Documentation
¶
Overview ¶
Package beeper provides a supported Go client for the Beeper Desktop local API.
This package targets the local Desktop API exposed by a running Beeper Desktop instance, not the remote Beeper cloud APIs. The default base URL is http://localhost:23373 and requests are authenticated with a Desktop API token.
The package aims to keep the public surface small and typed: stable request and response models, raw HTTP helpers, and a focused set of chat/message methods. CLI-specific formatting, agent output, and TUI concerns are intentionally kept out of this package.
Index ¶
- Constants
- func IsNotFound(err error) bool
- func IsUnauthorized(err error) bool
- type APIError
- type Account
- type AccountUser
- type Attachment
- type AttachmentSize
- type Chat
- type Client
- func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) DeleteJSON(ctx context.Context, path string, body any) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) GetChat(ctx context.Context, chatID string) (Chat, error)
- func (c *Client) ListAccounts(ctx context.Context) ([]Account, error)
- func (c *Client) ListChats(ctx context.Context, opts ListChatsOptions) (ListChatsResponse, error)
- func (c *Client) ListMessages(ctx context.Context, chatID string, opts ListMessagesOptions) (ListMessagesResponse, error)
- func (c *Client) Post(ctx context.Context, path string, body any) (*http.Response, error)
- func (c *Client) PostMultipart(ctx context.Context, path, fieldName, fileName string, file io.Reader, ...) (*http.Response, error)
- func (c *Client) Put(ctx context.Context, path string, body any) (*http.Response, error)
- func (c *Client) SearchChats(ctx context.Context, opts SearchChatsOptions) (ListChatsResponse, error)
- func (c *Client) SearchMessages(ctx context.Context, opts SearchMessagesOptions) (SearchMessagesResponse, error)
- func (c *Client) SendMessage(ctx context.Context, chatID string, body SendMessageRequest) (SendMessageResponse, error)
- type ClientOption
- type FlexibleEmoji
- type FlexibleString
- type ListChatsOptions
- type ListChatsResponse
- type ListMessagesOptions
- type ListMessagesResponse
- type Message
- type MessagePreview
- type Participant
- type ParticipantList
- type Reaction
- type SearchChatsOptions
- type SearchMessagesOptions
- type SearchMessagesResponse
- type SendMessageAttachment
- type SendMessageRequest
- type SendMessageResponse
Constants ¶
const ( // DefaultBaseURL is the default Beeper Desktop local API base URL. DefaultBaseURL = api.DefaultBaseURL // DefaultHTTPTimeout is the default HTTP timeout applied to requests. DefaultHTTPTimeout = api.DefaultHTTPTimeout )
const ( DirectionNewer = "newer" DirectionOlder = "older" )
Direction constants for pagination.
const ( ChatTypeDM = "dm" ChatTypeGroup = "group" )
ChatType constants for filtering.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether the error is a 404 Not Found from the API.
func IsUnauthorized ¶
IsUnauthorized reports whether the error is a 401 Unauthorized from the API.
Types ¶
type AccountUser ¶
type AccountUser = api.AccountUser
type Attachment ¶
type Attachment = api.Attachment
type AttachmentSize ¶
type AttachmentSize = api.AttachmentSize
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to the Beeper Desktop local API.
func NewClient ¶
func NewClient(baseURL, token string, opts ...ClientOption) *Client
NewClient creates a new Beeper API client. If baseURL is empty, DefaultBaseURL ("http://localhost:23373") is used.
func (*Client) DeleteJSON ¶
DeleteJSON performs a DELETE request with a JSON body.
func (*Client) ListAccounts ¶
ListAccounts returns all connected chat network accounts.
func (*Client) ListChats ¶
func (c *Client) ListChats(ctx context.Context, opts ListChatsOptions) (ListChatsResponse, error)
ListChats returns conversations matching the given options.
func (*Client) ListMessages ¶
func (c *Client) ListMessages(ctx context.Context, chatID string, opts ListMessagesOptions) (ListMessagesResponse, error)
ListMessages returns messages from a conversation.
func (*Client) PostMultipart ¶
func (c *Client) PostMultipart(ctx context.Context, path, fieldName, fileName string, file io.Reader, fields map[string]string) (*http.Response, error)
PostMultipart performs a multipart file upload.
func (*Client) SearchChats ¶
func (c *Client) SearchChats(ctx context.Context, opts SearchChatsOptions) (ListChatsResponse, error)
SearchChats searches conversations by name or content.
func (*Client) SearchMessages ¶
func (c *Client) SearchMessages(ctx context.Context, opts SearchMessagesOptions) (SearchMessagesResponse, error)
SearchMessages searches messages across all conversations.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, chatID string, body SendMessageRequest) (SendMessageResponse, error)
SendMessage sends a text or media message to a conversation.
type ClientOption ¶
type ClientOption func(*clientOptions)
ClientOption configures a Client.
func WithDebug ¶
func WithDebug(debug bool) ClientOption
WithDebug enables HTTP request/response debug logging.
func WithDebugWriter ¶
func WithDebugWriter(w io.Writer) ClientOption
WithDebugWriter sets the writer for debug output (defaults to os.Stderr).
type FlexibleEmoji ¶
type FlexibleEmoji = api.FlexibleEmoji
type FlexibleString ¶
type FlexibleString = api.FlexibleString
type ListChatsOptions ¶
type ListChatsOptions struct {
AccountIDs []string
Cursor string
Direction string
Limit int
Type string
UnreadOnly bool
}
ListChatsOptions configures the ListChats request.
Direction: "newer" or "older" (default: server decides). Type: "dm" or "group" (default: all).
type ListChatsResponse ¶
type ListChatsResponse = api.ListChatsResponse
type ListMessagesOptions ¶
ListMessagesOptions configures the ListMessages request.
Direction: "newer" or "older" (default: "older").
type ListMessagesResponse ¶
type ListMessagesResponse = api.ListMessagesResponse
type MessagePreview ¶
type MessagePreview = api.MessagePreview
type Participant ¶
type Participant = api.Participant
type ParticipantList ¶
type ParticipantList = api.ParticipantList
type SearchChatsOptions ¶
type SearchChatsOptions struct {
AccountIDs []string
Cursor string
Direction string
Limit int
Query string
Type string
}
SearchChatsOptions configures the SearchChats request.
type SearchMessagesOptions ¶
type SearchMessagesOptions struct {
Query string
AccountIDs []string
ChatIDs []string
DateAfter *time.Time
DateBefore *time.Time
Sender string
ChatType string
IncludeLowPriority bool
ExcludeMuted bool
Cursor string
Limit int
}
SearchMessagesOptions configures the SearchMessages request.
IncludeLowPriority maps to excludeLowPriority=false on the API. ExcludeMuted maps to includeMuted=false on the API.
type SearchMessagesResponse ¶
type SearchMessagesResponse = api.SearchMessagesResponse
type SendMessageAttachment ¶
type SendMessageAttachment = api.SendMessageAttachment
type SendMessageRequest ¶
type SendMessageRequest = api.SendMessageRequest
type SendMessageResponse ¶
type SendMessageResponse = api.SendMessageResponse