api

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	// contains filtered or unexported fields
}

Api struct

func New

func New() *Api

NewApi creates a new Api application struct

func (*Api) DownloadImageToFile

func (a *Api) DownloadImageToFile(messageID string) error

DownloadImageToFile downloads an image from cache to the Downloads folder

func (*Api) DownloadMedia

func (a *Api) DownloadMedia(chatJID string, messageID string) (string, error)

func (*Api) FetchContacts

func (a *Api) FetchContacts() ([]Contact, error)

func (*Api) FetchGroups

func (a *Api) FetchGroups() ([]wa.Group, error)

func (*Api) FetchMessagesPaged

func (a *Api) FetchMessagesPaged(jid string, limit int, beforeTimestamp int64) ([]store.Message, error)

func (*Api) GetCachedAvatar

func (a *Api) GetCachedAvatar(jid string) (string, error)

GetCachedAvatar retrieves or downloads and caches an avatar for a JID

func (*Api) GetCachedImage

func (a *Api) GetCachedImage(messageID string) (string, error)

func (*Api) GetCachedImages

func (a *Api) GetCachedImages(messageIDs []string) (map[string]string, error)

GetCachedImages retrieves multiple cached images by message IDs (batch operation) Returns map of message IDs to data URLs

func (*Api) GetChatList

func (a *Api) GetChatList() ([]ChatElement, error)

func (*Api) GetContact

func (a *Api) GetContact(jid types.JID) (*Contact, error)

func (*Api) GetCustomCSS

func (a *Api) GetCustomCSS() string

func (*Api) GetCustomJS

func (a *Api) GetCustomJS() string

func (*Api) GetProfile

func (a *Api) GetProfile(jidStr string) (Contact, error)

func (*Api) GetSettings

func (a *Api) GetSettings() map[string]any

func (*Api) Login

func (a *Api) Login() error

func (*Api) OnSecondInstanceLaunch

func (a *Api) OnSecondInstanceLaunch(secondInstanceData options.SecondInstanceData)

func (*Api) Reinitialize

func (a *Api) Reinitialize() error

func (*Api) SaveSettings

func (a *Api) SaveSettings(s map[string]any)

func (*Api) SendChatPresence

func (a *Api) SendChatPresence(jid string, cp types.ChatPresence, cpm types.ChatPresenceMedia) error

func (*Api) SendMessage

func (a *Api) SendMessage(chatJID string, content MessageContent) (string, error)

func (*Api) SetCustomCSS

func (a *Api) SetCustomCSS(css string) error

func (*Api) SetCustomJS

func (a *Api) SetCustomJS(js string) error

func (*Api) Startup

func (a *Api) Startup(ctx context.Context)

startup is called when the app starts. The context is saved so we can call the runtime methods

type ChatElement

type ChatElement struct {
	LatestMessage string `json:"latest_message"`
	LatestTS      int64
	Contact
}

type Contact

type Contact struct {
	JID        string `json:"jid"`
	Short      string `json:"short"`
	FullName   string `json:"full_name"`
	PushName   string `json:"push_name"`
	IsBusiness bool   `json:"is_business"`
	AvatarURL  string `json:"avatar_url"`
}

type MessageContent

type MessageContent struct {
	Type            string `json:"type"`
	Text            string `json:"text,omitempty"`
	Base64Data      string `json:"base64Data,omitempty"`
	QuotedMessageID string `json:"quotedMessageId,omitempty"`
}

Jump to

Keyboard shortcuts

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