## List `client.Messages.List(ctx, chatID, query) (*CursorSortKey[Message], error)` **get** `/v1/chats/{chatID}/messages` List all messages in a chat with cursor-based pagination. Sorted by timestamp. ### Parameters - `chatID string` Unique identifier of the chat. - `query MessageListParams` - `Cursor param.Field[string]` Opaque pagination cursor; do not inspect. Use together with 'direction'. - `Direction param.Field[MessageListParamsDirection]` 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"` - `const MessageListParamsDirectionBefore MessageListParamsDirection = "before"` ### Returns - `type Message struct{…}` - `ID string` Message ID. - `AccountID string` Beeper account ID the message belongs to. - `ChatID string` Unique identifier of the chat. - `SenderID string` Sender user ID. - `SortKey string` A unique, sortable key used to sort messages. - `Timestamp Time` Message timestamp. - `Attachments []Attachment` Attachments included with this message, if any. - `Type AttachmentType` Attachment type. - `const AttachmentTypeUnknown AttachmentType = "unknown"` - `const AttachmentTypeImg AttachmentType = "img"` - `const AttachmentTypeVideo AttachmentType = "video"` - `const AttachmentTypeAudio AttachmentType = "audio"` - `ID string` Attachment identifier (typically an mxc:// URL). Use with /v1/assets/download to get a local file path. - `Duration float64` Duration in seconds (audio/video). - `FileName string` Original filename if available. - `FileSize float64` File size in bytes if known. - `IsGif bool` True if the attachment is a GIF. - `IsSticker bool` True if the attachment is a sticker. - `IsVoiceNote bool` True if the attachment is a voice note. - `MimeType string` MIME type if known (e.g., 'image/png'). - `PosterImg string` Preview image URL for video attachments (poster frame). May be temporary or local-only to this device; download promptly if durable access is needed. - `Size AttachmentSize` Pixel dimensions of the attachment: width/height in px. - `Height float64` - `Width float64` - `SrcURL string` Public URL or local file path to fetch the asset. May be temporary or local-only to this device; download promptly if durable access is needed. - `IsSender bool` True if the authenticated user sent the message. - `IsUnread bool` True if the message is unread for the authenticated user. May be omitted. - `LinkedMessageID string` ID of the message this is a reply to, if any. - `Reactions []Reaction` Reactions to the message, if any. - `ID string` Reaction ID, typically ${participantID}${reactionKey} if multiple reactions allowed, or just participantID otherwise. - `ParticipantID string` User ID of the participant who reacted. - `ReactionKey string` The reaction key: an emoji (😄), a network-specific key, or a shortcode like "smiling-face". - `Emoji bool` True if the reactionKey is an emoji. - `ImgURL string` URL to the reaction's image. May be temporary or local-only to this device; download promptly if durable access is needed. - `SenderName string` Resolved sender display name (impersonator/full name/username/participant name). - `Text string` Plain-text body if present. May include a JSON fallback with text entities for rich messages. - `Type MessageType` Message content type. Useful for distinguishing reactions, media messages, and state events from regular text messages. - `const MessageTypeText MessageType = "TEXT"` - `const MessageTypeNotice MessageType = "NOTICE"` - `const MessageTypeImage MessageType = "IMAGE"` - `const MessageTypeVideo MessageType = "VIDEO"` - `const MessageTypeVoice MessageType = "VOICE"` - `const MessageTypeAudio MessageType = "AUDIO"` - `const MessageTypeFile MessageType = "FILE"` - `const MessageTypeSticker MessageType = "STICKER"` - `const MessageTypeLocation MessageType = "LOCATION"` - `const MessageTypeReaction MessageType = "REACTION"` ### Example ```go package main import ( "context" "fmt" "github.com/beeper/desktop-api-go" ) func main() { client := beeperdesktopapi.NewClient( ) page, err := client.Messages.List( context.TODO(), "!NCdzlIaMjZUmvmvyHU:beeper.com", beeperdesktopapi.MessageListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ```