Documentation
¶
Index ¶
- Constants
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type Account
- type AccountContactListParams
- type AccountContactListParamsDirection
- type AccountContactSearchParams
- type AccountContactSearchResponse
- type AccountContactService
- func (r *AccountContactService) List(ctx context.Context, accountID string, query AccountContactListParams, ...) (res *pagination.CursorSearch[shared.User], err error)
- func (r *AccountContactService) ListAutoPaging(ctx context.Context, accountID string, query AccountContactListParams, ...) *pagination.CursorSearchAutoPager[shared.User]
- func (r *AccountContactService) Search(ctx context.Context, accountID string, query AccountContactSearchParams, ...) (res *AccountContactSearchResponse, err error)
- type AccountService
- type AssetDownloadParams
- type AssetDownloadResponse
- type AssetServeParams
- type AssetService
- func (r *AssetService) Download(ctx context.Context, body AssetDownloadParams, opts ...option.RequestOption) (res *AssetDownloadResponse, err error)
- func (r *AssetService) Serve(ctx context.Context, query AssetServeParams, opts ...option.RequestOption) (err error)
- func (r *AssetService) Upload(ctx context.Context, body AssetUploadParams, opts ...option.RequestOption) (res *AssetUploadResponse, err error)
- func (r *AssetService) UploadBase64(ctx context.Context, body AssetUploadBase64Params, ...) (res *AssetUploadBase64Response, err error)
- type AssetUploadBase64Params
- type AssetUploadBase64Response
- type AssetUploadParams
- type AssetUploadResponse
- type Attachment
- type AttachmentSize
- type AttachmentType
- type Chat
- type ChatArchiveParams
- type ChatGetParams
- type ChatListParams
- type ChatListParamsDirection
- type ChatListResponse
- type ChatMessageReactionAddParams
- type ChatMessageReactionAddResponse
- type ChatMessageReactionDeleteParams
- type ChatMessageReactionDeleteResponse
- type ChatMessageReactionService
- func (r *ChatMessageReactionService) Add(ctx context.Context, messageID string, params ChatMessageReactionAddParams, ...) (res *ChatMessageReactionAddResponse, err error)
- func (r *ChatMessageReactionService) Delete(ctx context.Context, messageID string, params ChatMessageReactionDeleteParams, ...) (res *ChatMessageReactionDeleteResponse, err error)
- type ChatMessageService
- type ChatNewParams
- type ChatNewParamsMode
- type ChatNewParamsType
- type ChatNewParamsUser
- type ChatNewResponse
- type ChatNewResponseStatus
- type ChatParticipants
- type ChatReminderNewParams
- type ChatReminderNewParamsReminder
- type ChatReminderService
- type ChatSearchParams
- type ChatSearchParamsDirection
- type ChatSearchParamsInbox
- type ChatSearchParamsScope
- type ChatSearchParamsType
- type ChatService
- func (r *ChatService) Archive(ctx context.Context, chatID string, body ChatArchiveParams, ...) (err error)
- func (r *ChatService) Get(ctx context.Context, chatID string, query ChatGetParams, ...) (res *Chat, err error)
- func (r *ChatService) List(ctx context.Context, query ChatListParams, opts ...option.RequestOption) (res *pagination.CursorNoLimit[ChatListResponse], err error)
- func (r *ChatService) ListAutoPaging(ctx context.Context, query ChatListParams, opts ...option.RequestOption) *pagination.CursorNoLimitAutoPager[ChatListResponse]
- func (r *ChatService) New(ctx context.Context, body ChatNewParams, opts ...option.RequestOption) (res *ChatNewResponse, err error)
- func (r *ChatService) Search(ctx context.Context, query ChatSearchParams, opts ...option.RequestOption) (res *pagination.CursorSearch[Chat], err error)
- func (r *ChatService) SearchAutoPaging(ctx context.Context, query ChatSearchParams, opts ...option.RequestOption) *pagination.CursorSearchAutoPager[Chat]
- type ChatType
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Focus(ctx context.Context, body FocusParams, opts ...option.RequestOption) (res *FocusResponse, err error)
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Search(ctx context.Context, query SearchParams, opts ...option.RequestOption) (res *SearchResponse, err error)
- type Error
- type FocusParams
- type FocusResponse
- type InfoGetResponse
- type InfoGetResponseApp
- type InfoGetResponseEndpoints
- type InfoGetResponseEndpointsOAuth
- type InfoGetResponsePlatform
- type InfoGetResponseServer
- type InfoService
- type Message
- type MessageListParams
- type MessageListParamsDirection
- type MessageSearchParams
- type MessageSearchParamsChatType
- type MessageSearchParamsDirection
- type MessageSendParams
- type MessageSendParamsAttachment
- type MessageSendParamsAttachmentSize
- type MessageSendResponse
- type MessageService
- func (r *MessageService) List(ctx context.Context, chatID string, query MessageListParams, ...) (res *pagination.CursorSortKey[shared.Message], err error)
- func (r *MessageService) ListAutoPaging(ctx context.Context, chatID string, query MessageListParams, ...) *pagination.CursorSortKeyAutoPager[shared.Message]
- func (r *MessageService) Search(ctx context.Context, query MessageSearchParams, opts ...option.RequestOption) (res *pagination.CursorSearch[shared.Message], err error)
- func (r *MessageService) SearchAutoPaging(ctx context.Context, query MessageSearchParams, opts ...option.RequestOption) *pagination.CursorSearchAutoPager[shared.Message]
- func (r *MessageService) Send(ctx context.Context, chatID string, body MessageSendParams, ...) (res *MessageSendResponse, err error)
- func (r *MessageService) Update(ctx context.Context, messageID string, params MessageUpdateParams, ...) (res *MessageUpdateResponse, err error)
- type MessageType
- type MessageUpdateParams
- type MessageUpdateResponse
- type Reaction
- type SearchParams
- type SearchResponse
- type SearchResponseResults
- type SearchResponseResultsMessages
- type User
Constants ¶
const AttachmentTypeAudio = shared.AttachmentTypeAudio
Equals "audio"
const AttachmentTypeImg = shared.AttachmentTypeImg
Equals "img"
const AttachmentTypeUnknown = shared.AttachmentTypeUnknown
Equals "unknown"
const AttachmentTypeVideo = shared.AttachmentTypeVideo
Equals "video"
const MessageTypeAudio = shared.MessageTypeAudio
Equals "AUDIO"
const MessageTypeFile = shared.MessageTypeFile
Equals "FILE"
const MessageTypeImage = shared.MessageTypeImage
Equals "IMAGE"
const MessageTypeLocation = shared.MessageTypeLocation
Equals "LOCATION"
const MessageTypeNotice = shared.MessageTypeNotice
Equals "NOTICE"
const MessageTypeReaction = shared.MessageTypeReaction
Equals "REACTION"
const MessageTypeSticker = shared.MessageTypeSticker
Equals "STICKER"
const MessageTypeText = shared.MessageTypeText
Equals "TEXT"
const MessageTypeVideo = shared.MessageTypeVideo
Equals "VIDEO"
const MessageTypeVoice = shared.MessageTypeVoice
Equals "VOICE"
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (BEEPER_ACCESS_TOKEN, BEEPER_DESKTOP_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type Account ¶
type Account struct {
// Chat account added to Beeper. Use this to route account-scoped actions.
AccountID string `json:"accountID,required"`
// User the account belongs to.
User shared.User `json:"user,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AccountID respjson.Field
User respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A chat account added to Beeper
func (*Account) UnmarshalJSON ¶
type AccountContactListParams ¶ added in v0.4.0
type AccountContactListParams struct {
// Opaque pagination cursor; do not inspect. Use together with 'direction'.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum contacts to return per page.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optional search query for blended contact lookup.
Query param.Opt[string] `query:"query,omitzero" json:"-"`
// Pagination direction used with 'cursor': 'before' fetches older results, 'after'
// fetches newer results. Defaults to 'before' when only 'cursor' is provided.
//
// Any of "after", "before".
Direction AccountContactListParamsDirection `query:"direction,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (AccountContactListParams) URLQuery ¶ added in v0.4.0
func (r AccountContactListParams) URLQuery() (v url.Values, err error)
URLQuery serializes AccountContactListParams's query parameters as `url.Values`.
type AccountContactListParamsDirection ¶ added in v0.4.0
type AccountContactListParamsDirection string
Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided.
const ( AccountContactListParamsDirectionAfter AccountContactListParamsDirection = "after" AccountContactListParamsDirectionBefore AccountContactListParamsDirection = "before" )
type AccountContactSearchParams ¶
type AccountContactSearchParams struct {
// Text to search users by. Network-specific behavior.
Query string `query:"query,required" json:"-"`
// contains filtered or unexported fields
}
func (AccountContactSearchParams) URLQuery ¶
func (r AccountContactSearchParams) URLQuery() (v url.Values, err error)
URLQuery serializes AccountContactSearchParams's query parameters as `url.Values`.
type AccountContactSearchResponse ¶
type AccountContactSearchResponse struct {
Items []shared.User `json:"items,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Items respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountContactSearchResponse) RawJSON ¶
func (r AccountContactSearchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountContactSearchResponse) UnmarshalJSON ¶
func (r *AccountContactSearchResponse) UnmarshalJSON(data []byte) error
type AccountContactService ¶
type AccountContactService struct {
Options []option.RequestOption
}
Manage contacts on a specific account
AccountContactService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountContactService method instead.
func NewAccountContactService ¶
func NewAccountContactService(opts ...option.RequestOption) (r AccountContactService)
NewAccountContactService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AccountContactService) List ¶ added in v0.4.0
func (r *AccountContactService) List(ctx context.Context, accountID string, query AccountContactListParams, opts ...option.RequestOption) (res *pagination.CursorSearch[shared.User], err error)
List merged contacts for a specific account with cursor-based pagination.
func (*AccountContactService) ListAutoPaging ¶ added in v0.4.0
func (r *AccountContactService) ListAutoPaging(ctx context.Context, accountID string, query AccountContactListParams, opts ...option.RequestOption) *pagination.CursorSearchAutoPager[shared.User]
List merged contacts for a specific account with cursor-based pagination.
func (*AccountContactService) Search ¶
func (r *AccountContactService) Search(ctx context.Context, accountID string, query AccountContactSearchParams, opts ...option.RequestOption) (res *AccountContactSearchResponse, err error)
Search contacts on a specific account using merged account contacts, network search, and exact identifier lookup.
type AccountService ¶
type AccountService struct {
Options []option.RequestOption
// Manage contacts on a specific account
Contacts AccountContactService
}
Manage connected chat accounts
AccountService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.
func NewAccountService ¶
func NewAccountService(opts ...option.RequestOption) (r AccountService)
NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AccountService) List ¶
func (r *AccountService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Account, err error)
Lists chat accounts across networks (WhatsApp, Telegram, Twitter/X, etc.) actively connected to this Beeper Desktop instance
type AssetDownloadParams ¶
type AssetDownloadParams struct {
// Matrix content URL (mxc:// or localmxc://) for the asset to download.
URL string `json:"url,required"`
// contains filtered or unexported fields
}
func (AssetDownloadParams) MarshalJSON ¶
func (r AssetDownloadParams) MarshalJSON() (data []byte, err error)
func (*AssetDownloadParams) UnmarshalJSON ¶
func (r *AssetDownloadParams) UnmarshalJSON(data []byte) error
type AssetDownloadResponse ¶
type AssetDownloadResponse struct {
// Error message if the download failed.
Error string `json:"error"`
// Local file URL to the downloaded asset.
SrcURL string `json:"srcURL"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Error respjson.Field
SrcURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AssetDownloadResponse) RawJSON ¶
func (r AssetDownloadResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssetDownloadResponse) UnmarshalJSON ¶
func (r *AssetDownloadResponse) UnmarshalJSON(data []byte) error
type AssetServeParams ¶ added in v0.2.0
type AssetServeParams struct {
// Asset URL to serve. Accepts mxc://, localmxc://, or file:// URLs.
URL string `query:"url,required" json:"-"`
// contains filtered or unexported fields
}
func (AssetServeParams) URLQuery ¶ added in v0.2.0
func (r AssetServeParams) URLQuery() (v url.Values, err error)
URLQuery serializes AssetServeParams's query parameters as `url.Values`.
type AssetService ¶
type AssetService struct {
Options []option.RequestOption
}
Manage assets in Beeper Desktop, like message attachments
AssetService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetService method instead.
func NewAssetService ¶
func NewAssetService(opts ...option.RequestOption) (r AssetService)
NewAssetService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AssetService) Download ¶
func (r *AssetService) Download(ctx context.Context, body AssetDownloadParams, opts ...option.RequestOption) (res *AssetDownloadResponse, err error)
Download a Matrix asset using its mxc:// or localmxc:// URL to the device running Beeper Desktop and return the local file URL.
func (*AssetService) Serve ¶ added in v0.2.0
func (r *AssetService) Serve(ctx context.Context, query AssetServeParams, opts ...option.RequestOption) (err error)
Stream a file given an mxc://, localmxc://, or file:// URL. Downloads first if not cached. Supports Range requests for seeking in large files.
func (*AssetService) Upload ¶ added in v0.2.0
func (r *AssetService) Upload(ctx context.Context, body AssetUploadParams, opts ...option.RequestOption) (res *AssetUploadResponse, err error)
Upload a file to a temporary location using multipart/form-data. Returns an uploadID that can be referenced when sending messages with attachments.
func (*AssetService) UploadBase64 ¶ added in v0.2.0
func (r *AssetService) UploadBase64(ctx context.Context, body AssetUploadBase64Params, opts ...option.RequestOption) (res *AssetUploadBase64Response, err error)
Upload a file using a JSON body with base64-encoded content. Returns an uploadID that can be referenced when sending messages with attachments. Alternative to the multipart upload endpoint.
type AssetUploadBase64Params ¶ added in v0.2.0
type AssetUploadBase64Params struct {
// Base64-encoded file content (max ~500MB decoded)
Content string `json:"content,required"`
// Original filename. Generated if omitted
FileName param.Opt[string] `json:"fileName,omitzero"`
// MIME type. Auto-detected from magic bytes if omitted
MimeType param.Opt[string] `json:"mimeType,omitzero"`
// contains filtered or unexported fields
}
func (AssetUploadBase64Params) MarshalJSON ¶ added in v0.2.0
func (r AssetUploadBase64Params) MarshalJSON() (data []byte, err error)
func (*AssetUploadBase64Params) UnmarshalJSON ¶ added in v0.2.0
func (r *AssetUploadBase64Params) UnmarshalJSON(data []byte) error
type AssetUploadBase64Response ¶ added in v0.2.0
type AssetUploadBase64Response struct {
// Duration in seconds (audio/videos)
Duration float64 `json:"duration"`
// Error message if upload failed
Error string `json:"error"`
// Resolved filename
FileName string `json:"fileName"`
// File size in bytes
FileSize float64 `json:"fileSize"`
// Height in pixels (images/videos)
Height float64 `json:"height"`
// Detected or provided MIME type
MimeType string `json:"mimeType"`
// Local file URL (file://) for the uploaded asset
SrcURL string `json:"srcURL"`
// Unique upload ID for this asset
UploadID string `json:"uploadID"`
// Width in pixels (images/videos)
Width float64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Duration respjson.Field
Error respjson.Field
FileName respjson.Field
FileSize respjson.Field
Height respjson.Field
MimeType respjson.Field
SrcURL respjson.Field
UploadID respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AssetUploadBase64Response) RawJSON ¶ added in v0.2.0
func (r AssetUploadBase64Response) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssetUploadBase64Response) UnmarshalJSON ¶ added in v0.2.0
func (r *AssetUploadBase64Response) UnmarshalJSON(data []byte) error
type AssetUploadParams ¶ added in v0.2.0
type AssetUploadParams struct {
// The file to upload (max 500 MB).
File io.Reader `json:"file,omitzero,required" format:"binary"`
// Original filename. Defaults to the uploaded file name if omitted
FileName param.Opt[string] `json:"fileName,omitzero"`
// MIME type. Auto-detected from magic bytes if omitted
MimeType param.Opt[string] `json:"mimeType,omitzero"`
// contains filtered or unexported fields
}
func (AssetUploadParams) MarshalMultipart ¶ added in v0.2.0
func (r AssetUploadParams) MarshalMultipart() (data []byte, contentType string, err error)
type AssetUploadResponse ¶ added in v0.2.0
type AssetUploadResponse struct {
// Duration in seconds (audio/videos)
Duration float64 `json:"duration"`
// Error message if upload failed
Error string `json:"error"`
// Resolved filename
FileName string `json:"fileName"`
// File size in bytes
FileSize float64 `json:"fileSize"`
// Height in pixels (images/videos)
Height float64 `json:"height"`
// Detected or provided MIME type
MimeType string `json:"mimeType"`
// Local file URL (file://) for the uploaded asset
SrcURL string `json:"srcURL"`
// Unique upload ID for this asset
UploadID string `json:"uploadID"`
// Width in pixels (images/videos)
Width float64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Duration respjson.Field
Error respjson.Field
FileName respjson.Field
FileSize respjson.Field
Height respjson.Field
MimeType respjson.Field
SrcURL respjson.Field
UploadID respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AssetUploadResponse) RawJSON ¶ added in v0.2.0
func (r AssetUploadResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssetUploadResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *AssetUploadResponse) UnmarshalJSON(data []byte) error
type AttachmentSize ¶
type AttachmentSize = shared.AttachmentSize
Pixel dimensions of the attachment: width/height in px.
This is an alias to an internal type.
type AttachmentType ¶
type AttachmentType = shared.AttachmentType
Attachment type.
This is an alias to an internal type.
type Chat ¶
type Chat struct {
// Unique identifier of the chat across Beeper.
ID string `json:"id,required"`
// Account ID this chat belongs to.
AccountID string `json:"accountID,required"`
// Chat participants information.
Participants ChatParticipants `json:"participants,required"`
// Display title of the chat as computed by the client/server.
Title string `json:"title,required"`
// Chat type: 'single' for direct messages, 'group' for group chats.
//
// Any of "single", "group".
Type ChatType `json:"type,required"`
// Number of unread messages.
UnreadCount int64 `json:"unreadCount,required"`
// True if chat is archived.
IsArchived bool `json:"isArchived"`
// True if chat notifications are muted.
IsMuted bool `json:"isMuted"`
// True if chat is pinned.
IsPinned bool `json:"isPinned"`
// Timestamp of last activity.
LastActivity time.Time `json:"lastActivity" format:"date-time"`
// Last read message sortKey.
LastReadMessageSortKey string `json:"lastReadMessageSortKey"`
// Local chat ID specific to this Beeper Desktop installation.
LocalChatID string `json:"localChatID,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
AccountID respjson.Field
Participants respjson.Field
Title respjson.Field
Type respjson.Field
UnreadCount respjson.Field
IsArchived respjson.Field
IsMuted respjson.Field
IsPinned respjson.Field
LastActivity respjson.Field
LastReadMessageSortKey respjson.Field
LocalChatID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Chat) UnmarshalJSON ¶
type ChatArchiveParams ¶
type ChatArchiveParams struct {
// True to archive, false to unarchive
Archived param.Opt[bool] `json:"archived,omitzero"`
// contains filtered or unexported fields
}
func (ChatArchiveParams) MarshalJSON ¶
func (r ChatArchiveParams) MarshalJSON() (data []byte, err error)
func (*ChatArchiveParams) UnmarshalJSON ¶
func (r *ChatArchiveParams) UnmarshalJSON(data []byte) error
type ChatGetParams ¶
type ChatGetParams struct {
// Maximum number of participants to return. Use -1 for all; otherwise 0–500.
// Defaults to all (-1).
MaxParticipantCount param.Opt[int64] `query:"maxParticipantCount,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ChatGetParams) URLQuery ¶
func (r ChatGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatGetParams's query parameters as `url.Values`.
type ChatListParams ¶
type ChatListParams struct {
// Opaque pagination cursor; do not inspect. Use together with 'direction'.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Limit to specific account IDs. If omitted, fetches from all accounts.
AccountIDs []string `query:"accountIDs,omitzero" json:"-"`
// Pagination direction used with 'cursor': 'before' fetches older results, 'after'
// fetches newer results. Defaults to 'before' when only 'cursor' is provided.
//
// Any of "after", "before".
Direction ChatListParamsDirection `query:"direction,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ChatListParams) URLQuery ¶
func (r ChatListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatListParams's query parameters as `url.Values`.
type ChatListParamsDirection ¶
type ChatListParamsDirection string
Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided.
const ( ChatListParamsDirectionAfter ChatListParamsDirection = "after" ChatListParamsDirectionBefore ChatListParamsDirection = "before" )
type ChatListResponse ¶
type ChatListResponse struct {
// Last message preview for this chat, if available.
Preview shared.Message `json:"preview"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Preview respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
Chat
}
func (ChatListResponse) RawJSON ¶
func (r ChatListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatListResponse) UnmarshalJSON ¶
func (r *ChatListResponse) UnmarshalJSON(data []byte) error
type ChatMessageReactionAddParams ¶ added in v0.4.0
type ChatMessageReactionAddParams struct {
// Unique identifier of the chat.
ChatID string `path:"chatID,required" json:"-"`
// Reaction key to add (emoji, shortcode, or custom emoji key)
ReactionKey string `json:"reactionKey,required"`
// Optional transaction ID for deduplication and local echo tracking
TransactionID param.Opt[string] `json:"transactionID,omitzero"`
// contains filtered or unexported fields
}
func (ChatMessageReactionAddParams) MarshalJSON ¶ added in v0.4.0
func (r ChatMessageReactionAddParams) MarshalJSON() (data []byte, err error)
func (*ChatMessageReactionAddParams) UnmarshalJSON ¶ added in v0.4.0
func (r *ChatMessageReactionAddParams) UnmarshalJSON(data []byte) error
type ChatMessageReactionAddResponse ¶ added in v0.4.0
type ChatMessageReactionAddResponse struct {
// Unique identifier of the chat.
ChatID string `json:"chatID,required"`
// Message ID.
MessageID string `json:"messageID,required"`
// Reaction key that was added
ReactionKey string `json:"reactionKey,required"`
// Whether the reaction was successfully added
Success bool `json:"success,required"`
// Transaction ID used for the reaction event
TransactionID string `json:"transactionID,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
MessageID respjson.Field
ReactionKey respjson.Field
Success respjson.Field
TransactionID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatMessageReactionAddResponse) RawJSON ¶ added in v0.4.0
func (r ChatMessageReactionAddResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatMessageReactionAddResponse) UnmarshalJSON ¶ added in v0.4.0
func (r *ChatMessageReactionAddResponse) UnmarshalJSON(data []byte) error
type ChatMessageReactionDeleteParams ¶ added in v0.4.0
type ChatMessageReactionDeleteParams struct {
// Unique identifier of the chat.
ChatID string `path:"chatID,required" json:"-"`
// Reaction key to remove
ReactionKey string `query:"reactionKey,required" json:"-"`
// contains filtered or unexported fields
}
func (ChatMessageReactionDeleteParams) URLQuery ¶ added in v0.4.0
func (r ChatMessageReactionDeleteParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatMessageReactionDeleteParams's query parameters as `url.Values`.
type ChatMessageReactionDeleteResponse ¶ added in v0.4.0
type ChatMessageReactionDeleteResponse struct {
// Unique identifier of the chat.
ChatID string `json:"chatID,required"`
// Message ID.
MessageID string `json:"messageID,required"`
// Reaction key that was removed
ReactionKey string `json:"reactionKey,required"`
// Whether the reaction was successfully removed
Success bool `json:"success,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
MessageID respjson.Field
ReactionKey respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatMessageReactionDeleteResponse) RawJSON ¶ added in v0.4.0
func (r ChatMessageReactionDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatMessageReactionDeleteResponse) UnmarshalJSON ¶ added in v0.4.0
func (r *ChatMessageReactionDeleteResponse) UnmarshalJSON(data []byte) error
type ChatMessageReactionService ¶ added in v0.4.0
type ChatMessageReactionService struct {
Options []option.RequestOption
}
Manage message reactions
ChatMessageReactionService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatMessageReactionService method instead.
func NewChatMessageReactionService ¶ added in v0.4.0
func NewChatMessageReactionService(opts ...option.RequestOption) (r ChatMessageReactionService)
NewChatMessageReactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatMessageReactionService) Add ¶ added in v0.4.0
func (r *ChatMessageReactionService) Add(ctx context.Context, messageID string, params ChatMessageReactionAddParams, opts ...option.RequestOption) (res *ChatMessageReactionAddResponse, err error)
Add a reaction to an existing message.
func (*ChatMessageReactionService) Delete ¶ added in v0.4.0
func (r *ChatMessageReactionService) Delete(ctx context.Context, messageID string, params ChatMessageReactionDeleteParams, opts ...option.RequestOption) (res *ChatMessageReactionDeleteResponse, err error)
Remove the authenticated user's reaction from an existing message.
type ChatMessageService ¶ added in v0.4.0
type ChatMessageService struct {
Options []option.RequestOption
// Manage message reactions
Reactions ChatMessageReactionService
}
Manage chat messages
ChatMessageService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatMessageService method instead.
func NewChatMessageService ¶ added in v0.4.0
func NewChatMessageService(opts ...option.RequestOption) (r ChatMessageService)
NewChatMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
type ChatNewParams ¶
type ChatNewParams struct {
// Account to create or start the chat on.
AccountID string `json:"accountID,required"`
// Whether invite-based DM creation is allowed when required by the platform. Used
// for mode='start'.
AllowInvite param.Opt[bool] `json:"allowInvite,omitzero"`
// Optional first message content if the platform requires it to create the chat.
MessageText param.Opt[string] `json:"messageText,omitzero"`
// Optional title for group chats when mode='create'; ignored for single chats on
// most platforms.
Title param.Opt[string] `json:"title,omitzero"`
// Operation mode. Defaults to 'create' when omitted.
//
// Any of "create", "start".
Mode ChatNewParamsMode `json:"mode,omitzero"`
// Required when mode='create'. User IDs to include in the new chat.
ParticipantIDs []string `json:"participantIDs,omitzero"`
// Required when mode='create'. 'single' requires exactly one participantID;
// 'group' supports multiple participants and optional title.
//
// Any of "single", "group".
Type ChatNewParamsType `json:"type,omitzero"`
// Required when mode='start'. Merged user-like contact payload used to resolve the
// best identifier.
User ChatNewParamsUser `json:"user,omitzero"`
// contains filtered or unexported fields
}
func (ChatNewParams) MarshalJSON ¶
func (r ChatNewParams) MarshalJSON() (data []byte, err error)
func (*ChatNewParams) UnmarshalJSON ¶
func (r *ChatNewParams) UnmarshalJSON(data []byte) error
type ChatNewParamsMode ¶ added in v0.4.0
type ChatNewParamsMode string
Operation mode. Defaults to 'create' when omitted.
const ( ChatNewParamsModeCreate ChatNewParamsMode = "create" ChatNewParamsModeStart ChatNewParamsMode = "start" )
type ChatNewParamsType ¶
type ChatNewParamsType string
Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title.
const ( ChatNewParamsTypeSingle ChatNewParamsType = "single" ChatNewParamsTypeGroup ChatNewParamsType = "group" )
type ChatNewParamsUser ¶ added in v0.4.0
type ChatNewParamsUser struct {
// Known user ID when available.
ID param.Opt[string] `json:"id,omitzero"`
// Email candidate.
Email param.Opt[string] `json:"email,omitzero"`
// Display name hint used for ranking only.
FullName param.Opt[string] `json:"fullName,omitzero"`
// Phone number candidate (E.164 preferred).
PhoneNumber param.Opt[string] `json:"phoneNumber,omitzero"`
// Username/handle candidate.
Username param.Opt[string] `json:"username,omitzero"`
// contains filtered or unexported fields
}
Required when mode='start'. Merged user-like contact payload used to resolve the best identifier.
func (ChatNewParamsUser) MarshalJSON ¶ added in v0.4.0
func (r ChatNewParamsUser) MarshalJSON() (data []byte, err error)
func (*ChatNewParamsUser) UnmarshalJSON ¶ added in v0.4.0
func (r *ChatNewParamsUser) UnmarshalJSON(data []byte) error
type ChatNewResponse ¶
type ChatNewResponse struct {
// Newly created chat ID.
ChatID string `json:"chatID,required"`
// Only returned in start mode. 'existing' means an existing chat was reused;
// 'created' means a new chat was created.
//
// Any of "existing", "created".
Status ChatNewResponseStatus `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChatNewResponse) RawJSON ¶
func (r ChatNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatNewResponse) UnmarshalJSON ¶
func (r *ChatNewResponse) UnmarshalJSON(data []byte) error
type ChatNewResponseStatus ¶ added in v0.3.0
type ChatNewResponseStatus string
Only returned in start mode. 'existing' means an existing chat was reused; 'created' means a new chat was created.
const ( ChatNewResponseStatusExisting ChatNewResponseStatus = "existing" ChatNewResponseStatusCreated ChatNewResponseStatus = "created" )
type ChatParticipants ¶
type ChatParticipants struct {
// True if there are more participants than included in items.
HasMore bool `json:"hasMore,required"`
// Participants returned for this chat (limited by the request; may be a subset).
Items []shared.User `json:"items,required"`
// Total number of participants in the chat.
Total int64 `json:"total,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
HasMore respjson.Field
Items respjson.Field
Total respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Chat participants information.
func (ChatParticipants) RawJSON ¶
func (r ChatParticipants) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatParticipants) UnmarshalJSON ¶
func (r *ChatParticipants) UnmarshalJSON(data []byte) error
type ChatReminderNewParams ¶
type ChatReminderNewParams struct {
// Reminder configuration
Reminder ChatReminderNewParamsReminder `json:"reminder,omitzero,required"`
// contains filtered or unexported fields
}
func (ChatReminderNewParams) MarshalJSON ¶
func (r ChatReminderNewParams) MarshalJSON() (data []byte, err error)
func (*ChatReminderNewParams) UnmarshalJSON ¶
func (r *ChatReminderNewParams) UnmarshalJSON(data []byte) error
type ChatReminderNewParamsReminder ¶
type ChatReminderNewParamsReminder struct {
// Unix timestamp in milliseconds when reminder should trigger
RemindAtMs float64 `json:"remindAtMs,required"`
// Cancel reminder if someone messages in the chat
DismissOnIncomingMessage param.Opt[bool] `json:"dismissOnIncomingMessage,omitzero"`
// contains filtered or unexported fields
}
Reminder configuration
The property RemindAtMs is required.
func (ChatReminderNewParamsReminder) MarshalJSON ¶
func (r ChatReminderNewParamsReminder) MarshalJSON() (data []byte, err error)
func (*ChatReminderNewParamsReminder) UnmarshalJSON ¶
func (r *ChatReminderNewParamsReminder) UnmarshalJSON(data []byte) error
type ChatReminderService ¶
type ChatReminderService struct {
Options []option.RequestOption
}
Manage reminders for chats
ChatReminderService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatReminderService method instead.
func NewChatReminderService ¶
func NewChatReminderService(opts ...option.RequestOption) (r ChatReminderService)
NewChatReminderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatReminderService) Delete ¶
func (r *ChatReminderService) Delete(ctx context.Context, chatID string, opts ...option.RequestOption) (err error)
Clear an existing reminder from a chat
func (*ChatReminderService) New ¶
func (r *ChatReminderService) New(ctx context.Context, chatID string, body ChatReminderNewParams, opts ...option.RequestOption) (err error)
Set a reminder for a chat at a specific time
type ChatSearchParams ¶
type ChatSearchParams struct {
// Include chats marked as Muted by the user, which are usually less important.
// Default: true. Set to false if the user wants a more refined search.
IncludeMuted param.Opt[bool] `query:"includeMuted,omitzero" json:"-"`
// Set to true to only retrieve chats that have unread messages
UnreadOnly param.Opt[bool] `query:"unreadOnly,omitzero" json:"-"`
// Opaque pagination cursor; do not inspect. Use together with 'direction'.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Provide an ISO datetime string to only retrieve chats with last activity after
// this time
LastActivityAfter param.Opt[time.Time] `query:"lastActivityAfter,omitzero" format:"date-time" json:"-"`
// Provide an ISO datetime string to only retrieve chats with last activity before
// this time
LastActivityBefore param.Opt[time.Time] `query:"lastActivityBefore,omitzero" format:"date-time" json:"-"`
// Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Literal token search (non-semantic). Use single words users type (e.g.,
// "dinner"). When multiple words provided, ALL must match. Case-insensitive.
Query param.Opt[string] `query:"query,omitzero" json:"-"`
// Provide an array of account IDs to filter chats from specific messaging accounts
// only
AccountIDs []string `query:"accountIDs,omitzero" json:"-"`
// Pagination direction used with 'cursor': 'before' fetches older results, 'after'
// fetches newer results. Defaults to 'before' when only 'cursor' is provided.
//
// Any of "after", "before".
Direction ChatSearchParamsDirection `query:"direction,omitzero" json:"-"`
// Filter by inbox type: "primary" (non-archived, non-low-priority),
// "low-priority", or "archive". If not specified, shows all chats.
//
// Any of "primary", "low-priority", "archive".
Inbox ChatSearchParamsInbox `query:"inbox,omitzero" json:"-"`
// Search scope: 'titles' matches title + network; 'participants' matches
// participant names.
//
// Any of "titles", "participants".
Scope ChatSearchParamsScope `query:"scope,omitzero" json:"-"`
// Specify the type of chats to retrieve: use "single" for direct messages, "group"
// for group chats, or "any" to get all types
//
// Any of "single", "group", "any".
Type ChatSearchParamsType `query:"type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ChatSearchParams) URLQuery ¶
func (r ChatSearchParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatSearchParams's query parameters as `url.Values`.
type ChatSearchParamsDirection ¶
type ChatSearchParamsDirection string
Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided.
const ( ChatSearchParamsDirectionAfter ChatSearchParamsDirection = "after" ChatSearchParamsDirectionBefore ChatSearchParamsDirection = "before" )
type ChatSearchParamsInbox ¶
type ChatSearchParamsInbox string
Filter by inbox type: "primary" (non-archived, non-low-priority), "low-priority", or "archive". If not specified, shows all chats.
const ( ChatSearchParamsInboxPrimary ChatSearchParamsInbox = "primary" ChatSearchParamsInboxLowPriority ChatSearchParamsInbox = "low-priority" ChatSearchParamsInboxArchive ChatSearchParamsInbox = "archive" )
type ChatSearchParamsScope ¶
type ChatSearchParamsScope string
Search scope: 'titles' matches title + network; 'participants' matches participant names.
const ( ChatSearchParamsScopeTitles ChatSearchParamsScope = "titles" ChatSearchParamsScopeParticipants ChatSearchParamsScope = "participants" )
type ChatSearchParamsType ¶
type ChatSearchParamsType string
Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types
const ( ChatSearchParamsTypeSingle ChatSearchParamsType = "single" ChatSearchParamsTypeGroup ChatSearchParamsType = "group" ChatSearchParamsTypeAny ChatSearchParamsType = "any" )
type ChatService ¶
type ChatService struct {
Options []option.RequestOption
// Manage reminders for chats
Reminders ChatReminderService
// Manage chat messages
Messages ChatMessageService
}
Manage chats
ChatService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatService method instead.
func NewChatService ¶
func NewChatService(opts ...option.RequestOption) (r ChatService)
NewChatService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChatService) Archive ¶
func (r *ChatService) Archive(ctx context.Context, chatID string, body ChatArchiveParams, opts ...option.RequestOption) (err error)
Archive or unarchive a chat. Set archived=true to move to archive, archived=false to move back to inbox
func (*ChatService) Get ¶
func (r *ChatService) Get(ctx context.Context, chatID string, query ChatGetParams, opts ...option.RequestOption) (res *Chat, err error)
Retrieve chat details including metadata, participants, and latest message
func (*ChatService) List ¶
func (r *ChatService) List(ctx context.Context, query ChatListParams, opts ...option.RequestOption) (res *pagination.CursorNoLimit[ChatListResponse], err error)
List all chats sorted by last activity (most recent first). Combines all accounts into a single paginated list.
func (*ChatService) ListAutoPaging ¶
func (r *ChatService) ListAutoPaging(ctx context.Context, query ChatListParams, opts ...option.RequestOption) *pagination.CursorNoLimitAutoPager[ChatListResponse]
List all chats sorted by last activity (most recent first). Combines all accounts into a single paginated list.
func (*ChatService) New ¶
func (r *ChatService) New(ctx context.Context, body ChatNewParams, opts ...option.RequestOption) (res *ChatNewResponse, err error)
Create a single/group chat (mode='create') or start a direct chat from merged user data (mode='start').
func (*ChatService) Search ¶
func (r *ChatService) Search(ctx context.Context, query ChatSearchParams, opts ...option.RequestOption) (res *pagination.CursorSearch[Chat], err error)
Search chats by title/network or participants using Beeper Desktop's renderer algorithm.
func (*ChatService) SearchAutoPaging ¶
func (r *ChatService) SearchAutoPaging(ctx context.Context, query ChatSearchParams, opts ...option.RequestOption) *pagination.CursorSearchAutoPager[Chat]
Search chats by title/network or participants using Beeper Desktop's renderer algorithm.
type ChatType ¶
type ChatType string
Chat type: 'single' for direct messages, 'group' for group chats.
type Client ¶
type Client struct {
Options []option.RequestOption
// Manage connected chat accounts
Accounts AccountService
// Manage chats
Chats ChatService
// Manage messages in chats
Messages MessageService
// Manage assets in Beeper Desktop, like message attachments
Assets AssetService
Info InfoService
}
Client creates a struct with services and top level methods that help with interacting with the beeperdesktop API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (BEEPER_ACCESS_TOKEN, BEEPER_DESKTOP_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Focus ¶
func (r *Client) Focus(ctx context.Context, body FocusParams, opts ...option.RequestOption) (res *FocusResponse, err error)
Focus Beeper Desktop and optionally navigate to a specific chat, message, or pre-fill draft text and attachment.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Post ¶
func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Put ¶
func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Search ¶
func (r *Client) Search(ctx context.Context, query SearchParams, opts ...option.RequestOption) (res *SearchResponse, err error)
Returns matching chats, participant name matches in groups, and the first page of messages in one call. Paginate messages via search-messages. Paginate chats via search-chats.
type FocusParams ¶
type FocusParams struct {
// Optional Beeper chat ID (or local chat ID) to focus after opening the app. If
// omitted, only opens/focuses the app.
ChatID param.Opt[string] `json:"chatID,omitzero"`
// Optional draft attachment path to populate in the message input field.
DraftAttachmentPath param.Opt[string] `json:"draftAttachmentPath,omitzero"`
// Optional draft text to populate in the message input field.
DraftText param.Opt[string] `json:"draftText,omitzero"`
// Optional message ID. Jumps to that message in the chat when opening.
MessageID param.Opt[string] `json:"messageID,omitzero"`
// contains filtered or unexported fields
}
func (FocusParams) MarshalJSON ¶
func (r FocusParams) MarshalJSON() (data []byte, err error)
func (*FocusParams) UnmarshalJSON ¶
func (r *FocusParams) UnmarshalJSON(data []byte) error
type FocusResponse ¶
type FocusResponse struct {
// Whether the app was successfully opened/focused.
Success bool `json:"success,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response indicating successful app focus action.
func (FocusResponse) RawJSON ¶
func (r FocusResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*FocusResponse) UnmarshalJSON ¶
func (r *FocusResponse) UnmarshalJSON(data []byte) error
type InfoGetResponse ¶ added in v0.4.0
type InfoGetResponse struct {
App InfoGetResponseApp `json:"app,required"`
Endpoints InfoGetResponseEndpoints `json:"endpoints,required"`
Platform InfoGetResponsePlatform `json:"platform,required"`
Server InfoGetResponseServer `json:"server,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
App respjson.Field
Endpoints respjson.Field
Platform respjson.Field
Server respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InfoGetResponse) RawJSON ¶ added in v0.4.0
func (r InfoGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*InfoGetResponse) UnmarshalJSON ¶ added in v0.4.0
func (r *InfoGetResponse) UnmarshalJSON(data []byte) error
type InfoGetResponseApp ¶ added in v0.4.0
type InfoGetResponseApp struct {
// App bundle identifier
BundleID string `json:"bundle_id,required"`
// App name
Name string `json:"name,required"`
// App version
Version string `json:"version,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BundleID respjson.Field
Name respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InfoGetResponseApp) RawJSON ¶ added in v0.4.0
func (r InfoGetResponseApp) RawJSON() string
Returns the unmodified JSON received from the API
func (*InfoGetResponseApp) UnmarshalJSON ¶ added in v0.4.0
func (r *InfoGetResponseApp) UnmarshalJSON(data []byte) error
type InfoGetResponseEndpoints ¶ added in v0.4.0
type InfoGetResponseEndpoints struct {
// MCP endpoint
Mcp string `json:"mcp,required"`
OAuth InfoGetResponseEndpointsOAuth `json:"oauth,required"`
// OpenAPI spec endpoint
Spec string `json:"spec,required"`
// WebSocket events endpoint
WsEvents string `json:"ws_events,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Mcp respjson.Field
OAuth respjson.Field
Spec respjson.Field
WsEvents respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InfoGetResponseEndpoints) RawJSON ¶ added in v0.4.0
func (r InfoGetResponseEndpoints) RawJSON() string
Returns the unmodified JSON received from the API
func (*InfoGetResponseEndpoints) UnmarshalJSON ¶ added in v0.4.0
func (r *InfoGetResponseEndpoints) UnmarshalJSON(data []byte) error
type InfoGetResponseEndpointsOAuth ¶ added in v0.4.0
type InfoGetResponseEndpointsOAuth struct {
// OAuth authorization endpoint
AuthorizationEndpoint string `json:"authorization_endpoint,required"`
// OAuth introspection endpoint
IntrospectionEndpoint string `json:"introspection_endpoint,required"`
// OAuth dynamic client registration endpoint
RegistrationEndpoint string `json:"registration_endpoint,required"`
// OAuth token revocation endpoint
RevocationEndpoint string `json:"revocation_endpoint,required"`
// OAuth token endpoint
TokenEndpoint string `json:"token_endpoint,required"`
// OAuth userinfo endpoint
UserinfoEndpoint string `json:"userinfo_endpoint,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AuthorizationEndpoint respjson.Field
IntrospectionEndpoint respjson.Field
RegistrationEndpoint respjson.Field
RevocationEndpoint respjson.Field
TokenEndpoint respjson.Field
UserinfoEndpoint respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InfoGetResponseEndpointsOAuth) RawJSON ¶ added in v0.4.0
func (r InfoGetResponseEndpointsOAuth) RawJSON() string
Returns the unmodified JSON received from the API
func (*InfoGetResponseEndpointsOAuth) UnmarshalJSON ¶ added in v0.4.0
func (r *InfoGetResponseEndpointsOAuth) UnmarshalJSON(data []byte) error
type InfoGetResponsePlatform ¶ added in v0.4.0
type InfoGetResponsePlatform struct {
// CPU architecture
Arch string `json:"arch,required"`
// Operating system identifier
Os string `json:"os,required"`
// Runtime release version
Release string `json:"release"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Arch respjson.Field
Os respjson.Field
Release respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InfoGetResponsePlatform) RawJSON ¶ added in v0.4.0
func (r InfoGetResponsePlatform) RawJSON() string
Returns the unmodified JSON received from the API
func (*InfoGetResponsePlatform) UnmarshalJSON ¶ added in v0.4.0
func (r *InfoGetResponsePlatform) UnmarshalJSON(data []byte) error
type InfoGetResponseServer ¶ added in v0.4.0
type InfoGetResponseServer struct {
// Base URL of the Connect server
BaseURL string `json:"base_url,required"`
// Listening host
Hostname string `json:"hostname,required"`
// Whether MCP endpoint is enabled
McpEnabled bool `json:"mcp_enabled,required"`
// Listening port
Port int64 `json:"port,required"`
// Whether remote access is enabled
RemoteAccess bool `json:"remote_access,required"`
// Server status
Status string `json:"status,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BaseURL respjson.Field
Hostname respjson.Field
McpEnabled respjson.Field
Port respjson.Field
RemoteAccess respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InfoGetResponseServer) RawJSON ¶ added in v0.4.0
func (r InfoGetResponseServer) RawJSON() string
Returns the unmodified JSON received from the API
func (*InfoGetResponseServer) UnmarshalJSON ¶ added in v0.4.0
func (r *InfoGetResponseServer) UnmarshalJSON(data []byte) error
type InfoService ¶ added in v0.4.0
type InfoService struct {
Options []option.RequestOption
}
InfoService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInfoService method instead.
func NewInfoService ¶ added in v0.4.0
func NewInfoService(opts ...option.RequestOption) (r InfoService)
NewInfoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*InfoService) Get ¶ added in v0.4.0
func (r *InfoService) Get(ctx context.Context, opts ...option.RequestOption) (res *InfoGetResponse, err error)
Returns app, platform, server, and endpoint discovery metadata for this Beeper Desktop instance.
type MessageListParams ¶
type MessageListParams struct {
// Opaque pagination cursor; do not inspect. Use together with 'direction'.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Pagination direction used with 'cursor': 'before' fetches older results, 'after'
// fetches newer results. Defaults to 'before' when only 'cursor' is provided.
//
// Any of "after", "before".
Direction MessageListParamsDirection `query:"direction,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MessageListParams) URLQuery ¶
func (r MessageListParams) URLQuery() (v url.Values, err error)
URLQuery serializes MessageListParams's query parameters as `url.Values`.
type MessageListParamsDirection ¶
type MessageListParamsDirection string
Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided.
const ( MessageListParamsDirectionAfter MessageListParamsDirection = "after" MessageListParamsDirectionBefore MessageListParamsDirection = "before" )
type MessageSearchParams ¶
type MessageSearchParams struct {
// Exclude messages marked Low Priority by the user. Default: true. Set to false to
// include all.
ExcludeLowPriority param.Opt[bool] `query:"excludeLowPriority,omitzero" json:"-"`
// Include messages in chats marked as Muted by the user, which are usually less
// important. Default: true. Set to false if the user wants a more refined search.
IncludeMuted param.Opt[bool] `query:"includeMuted,omitzero" json:"-"`
// Opaque pagination cursor; do not inspect. Use together with 'direction'.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Only include messages with timestamp strictly after this ISO 8601 datetime
// (e.g., '2024-07-01T00:00:00Z' or '2024-07-01T00:00:00+02:00').
DateAfter param.Opt[time.Time] `query:"dateAfter,omitzero" format:"date-time" json:"-"`
// Only include messages with timestamp strictly before this ISO 8601 datetime
// (e.g., '2024-07-31T23:59:59Z' or '2024-07-31T23:59:59+02:00').
DateBefore param.Opt[time.Time] `query:"dateBefore,omitzero" format:"date-time" json:"-"`
// Maximum number of messages to return.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Literal word search (non-semantic). Finds messages containing these EXACT words
// in any order. Use single words users actually type, not concepts or phrases.
// Example: use "dinner" not "dinner plans", use "sick" not "health issues". If
// omitted, returns results filtered only by other parameters.
Query param.Opt[string] `query:"query,omitzero" json:"-"`
// Filter by sender: 'me' (messages sent by the authenticated user), 'others'
// (messages sent by others), or a specific user ID string (user.id).
Sender param.Opt[string] `query:"sender,omitzero" json:"-"`
// Limit search to specific account IDs.
AccountIDs []string `query:"accountIDs,omitzero" json:"-"`
// Limit search to specific chat IDs.
ChatIDs []string `query:"chatIDs,omitzero" json:"-"`
// Filter by chat type: 'group' for group chats, 'single' for 1:1 chats.
//
// Any of "group", "single".
ChatType MessageSearchParamsChatType `query:"chatType,omitzero" json:"-"`
// Pagination direction used with 'cursor': 'before' fetches older results, 'after'
// fetches newer results. Defaults to 'before' when only 'cursor' is provided.
//
// Any of "after", "before".
Direction MessageSearchParamsDirection `query:"direction,omitzero" json:"-"`
// Filter messages by media types. Use ['any'] for any media type, or specify exact
// types like ['video', 'image']. Omit for no media filtering.
//
// Any of "any", "video", "image", "link", "file".
MediaTypes []string `query:"mediaTypes,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MessageSearchParams) URLQuery ¶
func (r MessageSearchParams) URLQuery() (v url.Values, err error)
URLQuery serializes MessageSearchParams's query parameters as `url.Values`.
type MessageSearchParamsChatType ¶
type MessageSearchParamsChatType string
Filter by chat type: 'group' for group chats, 'single' for 1:1 chats.
const ( MessageSearchParamsChatTypeGroup MessageSearchParamsChatType = "group" MessageSearchParamsChatTypeSingle MessageSearchParamsChatType = "single" )
type MessageSearchParamsDirection ¶
type MessageSearchParamsDirection string
Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided.
const ( MessageSearchParamsDirectionAfter MessageSearchParamsDirection = "after" MessageSearchParamsDirectionBefore MessageSearchParamsDirection = "before" )
type MessageSendParams ¶
type MessageSendParams struct {
// Provide a message ID to send this as a reply to an existing message
ReplyToMessageID param.Opt[string] `json:"replyToMessageID,omitzero"`
// Text content of the message you want to send. You may use markdown.
Text param.Opt[string] `json:"text,omitzero"`
// Single attachment to send with the message
Attachment MessageSendParamsAttachment `json:"attachment,omitzero"`
// contains filtered or unexported fields
}
func (MessageSendParams) MarshalJSON ¶
func (r MessageSendParams) MarshalJSON() (data []byte, err error)
func (*MessageSendParams) UnmarshalJSON ¶
func (r *MessageSendParams) UnmarshalJSON(data []byte) error
type MessageSendParamsAttachment ¶ added in v0.2.0
type MessageSendParamsAttachment struct {
// Upload ID from uploadAsset endpoint. Required to reference uploaded files.
UploadID string `json:"uploadID,required"`
// Duration in seconds (optional override of cached value)
Duration param.Opt[float64] `json:"duration,omitzero"`
// Filename (optional override of cached value)
FileName param.Opt[string] `json:"fileName,omitzero"`
// MIME type (optional override of cached value)
MimeType param.Opt[string] `json:"mimeType,omitzero"`
// Dimensions (optional override of cached value)
Size MessageSendParamsAttachmentSize `json:"size,omitzero"`
// Special attachment type (gif, voiceNote, sticker). If omitted, auto-detected
// from mimeType
//
// Any of "gif", "voiceNote", "sticker".
Type string `json:"type,omitzero"`
// contains filtered or unexported fields
}
Single attachment to send with the message
The property UploadID is required.
func (MessageSendParamsAttachment) MarshalJSON ¶ added in v0.2.0
func (r MessageSendParamsAttachment) MarshalJSON() (data []byte, err error)
func (*MessageSendParamsAttachment) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageSendParamsAttachment) UnmarshalJSON(data []byte) error
type MessageSendParamsAttachmentSize ¶ added in v0.2.0
type MessageSendParamsAttachmentSize struct {
Height float64 `json:"height,required"`
Width float64 `json:"width,required"`
// contains filtered or unexported fields
}
Dimensions (optional override of cached value)
The properties Height, Width are required.
func (MessageSendParamsAttachmentSize) MarshalJSON ¶ added in v0.2.0
func (r MessageSendParamsAttachmentSize) MarshalJSON() (data []byte, err error)
func (*MessageSendParamsAttachmentSize) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageSendParamsAttachmentSize) UnmarshalJSON(data []byte) error
type MessageSendResponse ¶
type MessageSendResponse struct {
// Unique identifier of the chat.
ChatID string `json:"chatID,required"`
// Pending message ID
PendingMessageID string `json:"pendingMessageID,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
PendingMessageID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageSendResponse) RawJSON ¶
func (r MessageSendResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageSendResponse) UnmarshalJSON ¶
func (r *MessageSendResponse) UnmarshalJSON(data []byte) error
type MessageService ¶
type MessageService struct {
Options []option.RequestOption
}
Manage messages in chats
MessageService contains methods and other services that help with interacting with the beeperdesktop API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMessageService method instead.
func NewMessageService ¶
func NewMessageService(opts ...option.RequestOption) (r MessageService)
NewMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*MessageService) List ¶
func (r *MessageService) List(ctx context.Context, chatID string, query MessageListParams, opts ...option.RequestOption) (res *pagination.CursorSortKey[shared.Message], err error)
List all messages in a chat with cursor-based pagination. Sorted by timestamp.
func (*MessageService) ListAutoPaging ¶
func (r *MessageService) ListAutoPaging(ctx context.Context, chatID string, query MessageListParams, opts ...option.RequestOption) *pagination.CursorSortKeyAutoPager[shared.Message]
List all messages in a chat with cursor-based pagination. Sorted by timestamp.
func (*MessageService) Search ¶
func (r *MessageService) Search(ctx context.Context, query MessageSearchParams, opts ...option.RequestOption) (res *pagination.CursorSearch[shared.Message], err error)
Search messages across chats using Beeper's message index
func (*MessageService) SearchAutoPaging ¶
func (r *MessageService) SearchAutoPaging(ctx context.Context, query MessageSearchParams, opts ...option.RequestOption) *pagination.CursorSearchAutoPager[shared.Message]
Search messages across chats using Beeper's message index
func (*MessageService) Send ¶
func (r *MessageService) Send(ctx context.Context, chatID string, body MessageSendParams, opts ...option.RequestOption) (res *MessageSendResponse, err error)
Send a text message to a specific chat. Supports replying to existing messages. Returns a pending message ID.
func (*MessageService) Update ¶ added in v0.2.0
func (r *MessageService) Update(ctx context.Context, messageID string, params MessageUpdateParams, opts ...option.RequestOption) (res *MessageUpdateResponse, err error)
Edit the text content of an existing message. Messages with attachments cannot be edited.
type MessageType ¶ added in v0.2.0
type MessageType = shared.MessageType
Message content type. Useful for distinguishing reactions, media messages, and state events from regular text messages.
This is an alias to an internal type.
type MessageUpdateParams ¶ added in v0.2.0
type MessageUpdateParams struct {
// Unique identifier of the chat.
ChatID string `path:"chatID,required" json:"-"`
// New text content for the message
Text string `json:"text,required"`
// contains filtered or unexported fields
}
func (MessageUpdateParams) MarshalJSON ¶ added in v0.2.0
func (r MessageUpdateParams) MarshalJSON() (data []byte, err error)
func (*MessageUpdateParams) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageUpdateParams) UnmarshalJSON(data []byte) error
type MessageUpdateResponse ¶ added in v0.2.0
type MessageUpdateResponse struct {
// Unique identifier of the chat.
ChatID string `json:"chatID,required"`
// Message ID.
MessageID string `json:"messageID,required"`
// Whether the message was successfully edited
Success bool `json:"success,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ChatID respjson.Field
MessageID respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageUpdateResponse) RawJSON ¶ added in v0.2.0
func (r MessageUpdateResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageUpdateResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *MessageUpdateResponse) UnmarshalJSON(data []byte) error
type SearchParams ¶
type SearchParams struct {
// User-typed search text. Literal word matching (non-semantic).
Query string `query:"query,required" json:"-"`
// contains filtered or unexported fields
}
func (SearchParams) URLQuery ¶
func (r SearchParams) URLQuery() (v url.Values, err error)
URLQuery serializes SearchParams's query parameters as `url.Values`.
type SearchResponse ¶
type SearchResponse struct {
Results SearchResponseResults `json:"results,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Results respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SearchResponse) RawJSON ¶
func (r SearchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SearchResponse) UnmarshalJSON ¶
func (r *SearchResponse) UnmarshalJSON(data []byte) error
type SearchResponseResults ¶
type SearchResponseResults struct {
// Top chat results.
Chats []Chat `json:"chats,required"`
// Top group results by participant matches.
InGroups []Chat `json:"in_groups,required"`
Messages SearchResponseResultsMessages `json:"messages,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Chats respjson.Field
InGroups respjson.Field
Messages respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SearchResponseResults) RawJSON ¶
func (r SearchResponseResults) RawJSON() string
Returns the unmodified JSON received from the API
func (*SearchResponseResults) UnmarshalJSON ¶
func (r *SearchResponseResults) UnmarshalJSON(data []byte) error
type SearchResponseResultsMessages ¶
type SearchResponseResultsMessages struct {
// Map of chatID -> chat details for chats referenced in items.
Chats map[string]Chat `json:"chats,required"`
// True if additional results can be fetched using the provided cursors.
HasMore bool `json:"hasMore,required"`
// Messages matching the query and filters.
Items []shared.Message `json:"items,required"`
// Cursor for fetching newer results (use with direction='after'). Opaque string;
// do not inspect.
NewestCursor string `json:"newestCursor,required"`
// Cursor for fetching older results (use with direction='before'). Opaque string;
// do not inspect.
OldestCursor string `json:"oldestCursor,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Chats respjson.Field
HasMore respjson.Field
Items respjson.Field
NewestCursor respjson.Field
OldestCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SearchResponseResultsMessages) RawJSON ¶
func (r SearchResponseResultsMessages) RawJSON() string
Returns the unmodified JSON received from the API
func (*SearchResponseResultsMessages) UnmarshalJSON ¶
func (r *SearchResponseResultsMessages) UnmarshalJSON(data []byte) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|