service

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveChat

func ArchiveChat(ctx context.Context, client requestClient, chatID string, archived bool) error

func ClearReminder

func ClearReminder(ctx context.Context, client *api.Client, chatID string) error

func CreateChat added in v0.2.14

func CreateChat(ctx context.Context, client requestClient, body api.CreateChatRequest) (api.CreateChatResponse, error)

func DeleteMessage

func DeleteMessage(ctx context.Context, client requestClient, chatID, messageID string) error

func DownloadAsset added in v0.2.14

func DownloadAsset(ctx context.Context, client *api.Client, body api.DownloadAssetRequest) (api.DownloadAssetResponse, error)

func EditMessage added in v0.2.14

func EditMessage(ctx context.Context, client requestClient, chatID, messageID string, body api.EditMessageRequest) (api.EditMessageResponse, error)

func FetchAllChats

func FetchAllChats(ctx context.Context, client requestClient, params url.Values, direction string, limit int) ([]api.Chat, error)

func Focus

func Focus(ctx context.Context, client *api.Client, body api.FocusRequest) error

func GetChat

func GetChat(ctx context.Context, client requestClient, chatID string) (api.Chat, error)

func ListAccounts

func ListAccounts(ctx context.Context, client requestClient) ([]api.Account, error)

func ListChats

func ListChats(ctx context.Context, client requestClient, params url.Values) (api.ListChatsResponse, error)

func ListMessages

func ListMessages(ctx context.Context, client requestClient, chatID string, params url.Values) (api.ListMessagesResponse, error)

func ListMessagesByCursor

func ListMessagesByCursor(ctx context.Context, client requestClient, chatID, cursor, direction string) (api.ListMessagesResponse, error)

func MarkChatRead

func MarkChatRead(ctx context.Context, client requestClient, chatID string) error

func NextChatCursor

func NextChatCursor(result api.ListChatsResponse, direction string) string

func ReactToMessage

func ReactToMessage(ctx context.Context, client requestClient, chatID, messageID string, body api.ReactionRequest) error

func SearchAccountContacts added in v0.2.14

func SearchAccountContacts(ctx context.Context, client *api.Client, accountID, query string) (api.SearchContactsResponse, error)

func SearchChats

func SearchChats(ctx context.Context, client requestClient, params url.Values) (api.ListChatsResponse, error)

func SearchMessages

func SearchMessages(ctx context.Context, client requestClient, params url.Values) (api.SearchMessagesResponse, error)

func SendMessage

func SendMessage(ctx context.Context, client requestClient, chatID string, body api.SendMessageRequest) (api.SendMessageResponse, error)

func ServeAsset added in v0.2.18

func ServeAsset(ctx context.Context, client *api.Client, rawURL string, headers http.Header) (*http.Response, error)

func SetReminder

func SetReminder(ctx context.Context, client *api.Client, chatID string, body api.ReminderRequest) error

func TryGetChat

func TryGetChat(ctx context.Context, client requestClient, chatID string) (api.Chat, error)

TryGetChat fetches chat details, returning an empty chat if not found (404). Server errors (5xx) are propagated as errors. This is useful for optional context where chat info is non-critical but server issues should be reported.

func UnreactToMessage added in v0.2.18

func UnreactToMessage(ctx context.Context, client requestClient, chatID, messageID, reactionKey string) error

func UploadAsset added in v0.2.14

func UploadAsset(ctx context.Context, client *api.Client, fileName string, file io.Reader, fields map[string]string) (api.UploadAssetResponse, error)

func UploadAssetBase64 added in v0.2.14

func UploadAssetBase64(ctx context.Context, client *api.Client, body api.UploadAssetBase64Request) (api.UploadAssetResponse, error)

func ValidateToken

func ValidateToken(ctx context.Context, baseURL, token string) error

ValidateToken checks that a token can authenticate against the API.

Types

type Event added in v0.2.18

type Event struct {
	Type      string            `json:"type"`
	Seq       int64             `json:"seq,omitempty"`
	Timestamp time.Time         `json:"timestamp,omitempty"`
	ChatID    string            `json:"chatID,omitempty"`
	IDs       []string          `json:"ids,omitempty"`
	Entries   []json.RawMessage `json:"entries,omitempty"`
	// contains filtered or unexported fields
}

func (Event) MessagePreview added in v0.2.18

func (e Event) MessagePreview() string

func (Event) RawEnvelope added in v0.2.18

func (e Event) RawEnvelope() api.EventEnvelope

type EventFilter added in v0.2.18

type EventFilter struct {
	ChatIDs        []string
	Types          []string
	IncludeControl bool
}

type EventStream added in v0.2.18

type EventStream interface {
	Next(context.Context) (Event, error)
	Close() error
}

func OpenEventStream added in v0.2.18

func OpenEventStream(ctx context.Context, client *api.Client, filter EventFilter) (EventStream, error)

func StreamEvents added in v0.2.18

func StreamEvents(ctx context.Context, raw RawEventStream, filter EventFilter) (EventStream, error)

type RawEventStream added in v0.2.18

type RawEventStream interface {
	Next(context.Context) (api.EventEnvelope, error)
	SetSubscriptions(context.Context, []string, string) error
	Close() error
}

Jump to

Keyboard shortcuts

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