beeper

package
v0.2.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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
)
View Source
const (
	DirectionNewer = "newer"
	DirectionOlder = "older"
)

Direction constants for pagination.

View Source
const (
	ChatTypeDM    = "dm"
	ChatTypeGroup = "group"
)

ChatType constants for filtering.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether the error is a 404 Not Found from the API.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized reports whether the error is a 401 Unauthorized from the API.

Types

type APIError

type APIError = api.APIError

type Account

type Account = api.Account

type AccountUser

type AccountUser = api.AccountUser

type Attachment

type Attachment = api.Attachment

type AttachmentSize

type AttachmentSize = api.AttachmentSize

type Chat

type Chat = api.Chat

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) Delete

func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)

Delete performs a raw DELETE request.

func (*Client) DeleteJSON

func (c *Client) DeleteJSON(ctx context.Context, path string, body any) (*http.Response, error)

DeleteJSON performs a DELETE request with a JSON body.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string) (*http.Response, error)

Get performs a raw GET request. Prefer typed methods like ListChats.

func (*Client) GetChat

func (c *Client) GetChat(ctx context.Context, chatID string) (Chat, error)

GetChat returns a single conversation by ID.

func (*Client) ListAccounts

func (c *Client) ListAccounts(ctx context.Context) ([]Account, error)

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) Post

func (c *Client) Post(ctx context.Context, path string, body any) (*http.Response, error)

Post performs a raw POST request. Prefer typed methods like SendMessage.

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) Put

func (c *Client) Put(ctx context.Context, path string, body any) (*http.Response, error)

Put performs a raw PUT request.

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

type ListMessagesOptions struct {
	Cursor    string
	Direction string
	Limit     int
}

ListMessagesOptions configures the ListMessages request.

Direction: "newer" or "older" (default: "older").

type ListMessagesResponse

type ListMessagesResponse = api.ListMessagesResponse

type Message

type Message = api.Message

type MessagePreview

type MessagePreview = api.MessagePreview

type Participant

type Participant = api.Participant

type ParticipantList

type ParticipantList = api.ParticipantList

type Reaction

type Reaction = api.Reaction

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL