Documentation
¶
Overview ¶
Package models defines the shared entity and API types used by the Uncord server and clients. Both Go and TypeScript implementations import these types as the single source of truth for API request and response shapes.
Package models defines the shared entity and API types used by the Uncord server and clients. Both Go and TypeScript implementations import these types as the single source of truth for API request and response shapes.
Index ¶
- Constants
- type AcceptOnboardingRequest
- type AckRequest
- type Attachment
- type AuditLogEntry
- type AuthResponse
- type Ban
- type BanMemberRequest
- type Category
- type Channel
- type ChannelDeleteData
- type CreateCategoryRequest
- type CreateChannelRequest
- type CreateDMMessageRequest
- type CreateEmojiRequest
- type CreateInviteRequest
- type CreateMessageRequest
- type CreateRoleRequest
- type CreateThreadRequest
- type DMMessageDeleteData
- type DeleteAccountRequest
- type Device
- type DeviceKeyBundleResponse
- type DocumentAcceptance
- type Emoji
- type EmojiUpdateData
- type EncryptedMessageKey
- type GatewayTicketResponse
- type HelloData
- type IdentifyData
- type IdentityKeyChangedData
- type Invite
- type InviteDeleteData
- type KeyBundleLowData
- type KeyCountResponse
- type LoginRequest
- type MFAConfirmRequest
- type MFAConfirmResponse
- type MFADisableRequest
- type MFAEnableRequest
- type MFARegenerateCodesRequest
- type MFARegenerateCodesResponse
- type MFARequiredResponse
- type MFASetupResponse
- type MFAVerifyRequest
- type Member
- type MemberRemoveData
- type MemberUser
- type Message
- type MessageAckData
- type MessageDeleteData
- type MessageResponse
- type OnboardingAcceptanceResponse
- type OnboardingConfig
- type OnboardingDocument
- type OnboardingStatusResponse
- type OnboardingStep
- type OneTimePreKeyUpload
- type PermissionOverride
- type PresenceState
- type PresenceUpdateData
- type PresenceUpdateRequest
- type PublicServerInfo
- type PutSyncedSettingsRequest
- type PutSyncedSettingsResponse
- type ReactionAddData
- type ReactionRemoveData
- type ReactionSummary
- type ReactionUser
- type ReadState
- type ReadyData
- type RefreshRequest
- type RegisterDeviceRequest
- type RegisterRequest
- type ResolvedPermissions
- type ResumeData
- type Role
- type RoleDeleteData
- type SearchMessageHit
- type SearchResponse
- type ServerConfig
- type SetOverrideRequest
- type SyncedSettingsBlob
- type Thread
- type ThreadDeleteData
- type TimeoutMemberRequest
- type TokenPairResponse
- type TypingStartData
- type TypingStopData
- type UpdateCategoryRequest
- type UpdateChannelRequest
- type UpdateEmojiRequest
- type UpdateIdentityKeyRequest
- type UpdateMemberRequest
- type UpdateMessageRequest
- type UpdateOnboardingConfigRequest
- type UpdateRoleRequest
- type UpdateServerConfigRequest
- type UpdateThreadRequest
- type UpdateUserRequest
- type UploadOneTimePreKeysRequest
- type UploadSignedPreKeyRequest
- type User
- type UserKeyBundleResponse
- type UserProfile
- type VerifyEmailRequest
- type VerifyPasswordRequest
Constants ¶
const ( ChannelTypeText = "text" ChannelTypeVoice = "voice" ChannelTypeAnnouncement = "announcement" ChannelTypeForum = "forum" ChannelTypeStage = "stage" )
Channel type constants matching the database CHECK constraint.
const ( MemberStatusPending = "pending" MemberStatusActive = "active" MemberStatusTimedOut = "timed_out" )
Member status constants matching the database CHECK constraint.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptOnboardingRequest ¶ added in v0.2.8
type AcceptOnboardingRequest struct {
AcceptedDocumentSlugs []string `json:"accepted_document_slugs"`
}
AcceptOnboardingRequest is the body for POST /api/v1/onboarding/accept.
type AckRequest ¶ added in v0.2.20
type AckRequest struct {
MessageID string `json:"message_id"`
}
AckRequest is the body for POST /api/v1/channels/:channelID/ack.
type Attachment ¶ added in v0.2.8
type Attachment struct {
ID string `json:"id"`
Filename string `json:"filename"`
URL string `json:"url"`
Size int64 `json:"size"`
ContentType string `json:"content_type"`
Width *int `json:"width,omitempty"`
Height *int `json:"height,omitempty"`
ThumbnailURL *string `json:"thumbnail_url,omitempty"`
}
Attachment represents a file attached to a message.
type AuditLogEntry ¶ added in v0.2.19
type AuditLogEntry struct {
ID string `json:"id"`
ActorID string `json:"actor_id"`
Action string `json:"action"`
TargetType *string `json:"target_type"`
TargetID *string `json:"target_id"`
Changes json.RawMessage `json:"changes"`
Reason *string `json:"reason"`
CreatedAt string `json:"created_at"`
}
AuditLogEntry represents a single entry in the server audit log returned by the API.
type AuthResponse ¶
type AuthResponse struct {
User User `json:"user"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
AuthResponse is the response body for register, login, MFA verify, and verify-email endpoints.
type Ban ¶ added in v0.2.7
type Ban struct {
User MemberUser `json:"user"`
Reason *string `json:"reason"`
BannedBy *string `json:"banned_by"`
ExpiresAt *string `json:"expires_at"`
CreatedAt string `json:"created_at"`
}
Ban represents a server ban in API responses.
type BanMemberRequest ¶ added in v0.2.7
type BanMemberRequest struct {
Reason *string `json:"reason"`
ExpiresAt *string `json:"expires_at"`
}
BanMemberRequest is the body for PUT /api/v1/server/bans/:userID.
type Category ¶ added in v0.2.3
type Category struct {
ID string `json:"id"`
Name string `json:"name"`
Position int `json:"position"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Category represents a channel category returned by the API.
type Channel ¶ added in v0.2.3
type Channel struct {
ID string `json:"id"`
CategoryID *string `json:"category_id"`
CreatedBy *string `json:"created_by"`
Name string `json:"name"`
Type string `json:"type"`
Topic string `json:"topic"`
Position int `json:"position"`
SlowmodeSeconds int `json:"slowmode_seconds"`
NSFW bool `json:"nsfw"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Channel represents a channel returned by the API.
type ChannelDeleteData ¶ added in v0.2.10
type ChannelDeleteData struct {
ID string `json:"id"`
}
ChannelDeleteData is the payload for the CHANNEL_DELETE dispatch event, identifying the deleted channel.
type CreateCategoryRequest ¶ added in v0.2.3
type CreateCategoryRequest struct {
Name string `json:"name"`
}
CreateCategoryRequest is the body for POST /api/v1/server/categories.
type CreateChannelRequest ¶ added in v0.2.3
type CreateChannelRequest struct {
Name string `json:"name"`
Type *string `json:"type"`
CategoryID *string `json:"category_id"`
Topic *string `json:"topic"`
SlowmodeSeconds *int `json:"slowmode_seconds"`
NSFW *bool `json:"nsfw"`
}
CreateChannelRequest is the body for POST /api/v1/server/channels.
type CreateDMMessageRequest ¶ added in v0.2.18
type CreateDMMessageRequest struct {
Content string `json:"content"`
ReplyToID *string `json:"reply_to_id,omitempty"`
MessageKeys []EncryptedMessageKey `json:"message_keys,omitempty"`
}
CreateDMMessageRequest is the body for POST /api/v1/dm/:channelID/messages. DM messages carry ciphertext and optionally carry per-device encrypted keys for group DMs or multi-device delivery.
type CreateEmojiRequest ¶ added in v0.2.16
type CreateEmojiRequest struct {
Name string `json:"name"`
}
CreateEmojiRequest is the non-file fields for POST /api/v1/server/emoji (multipart form).
type CreateInviteRequest ¶ added in v0.2.8
type CreateInviteRequest struct {
ChannelID string `json:"channel_id"`
MaxUses *int `json:"max_uses"`
MaxAgeSeconds *int `json:"max_age_seconds"`
}
CreateInviteRequest is the body for POST /api/v1/server/invites.
type CreateMessageRequest ¶ added in v0.2.8
type CreateMessageRequest struct {
Content string `json:"content"`
ReplyToID *string `json:"reply_to_id"`
AttachmentIDs []string `json:"attachment_ids"`
}
CreateMessageRequest is the body for POST /api/v1/channels/:channelID/messages.
type CreateRoleRequest ¶ added in v0.2.6
type CreateRoleRequest struct {
Name string `json:"name"`
Colour *int `json:"colour"`
Permissions *int64 `json:"permissions"`
Hoist *bool `json:"hoist"`
}
CreateRoleRequest is the body for POST /api/v1/server/roles.
type CreateThreadRequest ¶ added in v0.2.17
type CreateThreadRequest struct {
Name string `json:"name"`
}
CreateThreadRequest is the body for POST /api/v1/messages/:messageID/threads.
type DMMessageDeleteData ¶ added in v0.2.18
DMMessageDeleteData is the payload for the DM_MESSAGE_DELETE dispatch event, identifying the deleted message and the DM channel it belonged to.
type DeleteAccountRequest ¶ added in v0.2.5
type DeleteAccountRequest struct {
Password string `json:"password"`
}
DeleteAccountRequest is the JSON body for DELETE /api/v1/users/@me. The authenticated user's password is required to confirm the irreversible account deletion.
type Device ¶ added in v0.2.18
type Device struct {
ID string `json:"id"`
DeviceID string `json:"device_id"`
Label string `json:"label,omitempty"`
IdentityKey string `json:"identity_key"`
CreatedAt string `json:"created_at"`
}
Device represents a registered device returned by the API.
type DeviceKeyBundleResponse ¶ added in v0.2.18
type DeviceKeyBundleResponse struct {
DeviceID string `json:"device_id"`
IdentityKey string `json:"identity_key"`
SignedPreKeyID int `json:"signed_pre_key_id"`
SignedPreKey string `json:"signed_pre_key"`
Signature string `json:"signature"`
OneTimeKeyID *int `json:"one_time_key_id,omitempty"`
OneTimeKey *string `json:"one_time_key,omitempty"`
}
DeviceKeyBundleResponse holds the key material for a single device, returned during key bundle fetches. Clients consume this during X3DH session establishment. OneTimeKeyID and OneTimeKey are nil when the device's one-time pre-key supply is exhausted.
type DocumentAcceptance ¶ added in v0.2.22
DocumentAcceptance records a single document the user has accepted on this server.
type Emoji ¶ added in v0.2.16
type Emoji struct {
ID string `json:"id"`
Name string `json:"name"`
Animated bool `json:"animated"`
URL string `json:"url"`
UploaderID string `json:"uploader_id"`
CreatedAt string `json:"created_at"`
}
Emoji represents a custom emoji available on the server.
type EmojiUpdateData ¶ added in v0.2.16
type EmojiUpdateData struct {
Emoji []Emoji `json:"emoji"`
}
EmojiUpdateData is the payload for the EMOJI_UPDATE dispatch event, containing the full current emoji list.
type EncryptedMessageKey ¶ added in v0.2.18
type EncryptedMessageKey struct {
DeviceID string `json:"device_id"`
EncryptedKey string `json:"encrypted_key"`
}
EncryptedMessageKey holds a per-device encrypted message key for E2EE DM delivery.
type GatewayTicketResponse ¶ added in v0.2.21
type GatewayTicketResponse struct {
Ticket string `json:"ticket"`
}
GatewayTicketResponse is the response body for POST /api/v1/auth/gateway-ticket. The ticket is a single-use opaque token that can be presented in the WebSocket Identify frame instead of a JWT access token.
type HelloData ¶ added in v0.2.8
type HelloData struct {
HeartbeatInterval int `json:"heartbeat_interval"`
}
HelloData is the payload for opcode 10 (Hello), sent by the server immediately after a WebSocket connection is established. The client must begin sending heartbeats at the specified interval.
type IdentifyData ¶ added in v0.2.8
type IdentifyData struct {
Token string `json:"token"`
}
IdentifyData is the payload for opcode 2 (Identify), sent by the client to authenticate a new connection. The token is a valid JWT access token.
type IdentityKeyChangedData ¶ added in v0.2.18
type IdentityKeyChangedData struct {
UserID string `json:"user_id"`
DeviceID string `json:"device_id"`
IdentityKey string `json:"identity_key"`
}
IdentityKeyChangedData is the payload for the IDENTITY_KEY_CHANGED gateway event, notifying DM peers that a user has registered a new device or replaced an identity key.
type Invite ¶ added in v0.2.8
type Invite struct {
ID string `json:"id"`
Code string `json:"code"`
ChannelID string `json:"channel_id"`
CreatorID string `json:"creator_id"`
MaxUses *int `json:"max_uses"`
UseCount int `json:"use_count"`
MaxAgeSeconds *int `json:"max_age_seconds"`
ExpiresAt *string `json:"expires_at,omitempty"`
CreatedAt string `json:"created_at"`
}
Invite represents a server invite in API responses.
type InviteDeleteData ¶ added in v0.2.23
type InviteDeleteData struct {
Code string `json:"code"`
}
InviteDeleteData is the payload for the INVITE_DELETE dispatch event.
type KeyBundleLowData ¶ added in v0.2.18
type KeyBundleLowData struct {
DeviceID string `json:"device_id"`
Remaining int `json:"remaining"`
}
KeyBundleLowData is the payload for the KEY_BUNDLE_LOW gateway event, notifying a user that a device's one-time pre-key supply is running low.
type KeyCountResponse ¶ added in v0.2.18
type KeyCountResponse struct {
Count int `json:"count"`
}
KeyCountResponse is the response for GET /api/v1/users/@me/devices/:deviceID/one-time-pre-keys/count.
type LoginRequest ¶
LoginRequest is the JSON body for POST /api/v1/auth/login.
type MFAConfirmRequest ¶ added in v0.2.4
type MFAConfirmRequest struct {
Code string `json:"code"`
}
MFAConfirmRequest is the JSON body for POST /api/v1/users/@me/mfa/confirm. The code is a six-digit TOTP code from the user's authenticator app, proving they successfully saved the secret.
type MFAConfirmResponse ¶ added in v0.2.4
type MFAConfirmResponse struct {
RecoveryCodes []string `json:"recovery_codes"`
}
MFAConfirmResponse is the response for the MFA confirm endpoint, containing the one-time-use recovery codes that the user must store securely.
type MFADisableRequest ¶ added in v0.2.4
MFADisableRequest is the JSON body for POST /api/v1/users/@me/mfa/disable. Both password and a valid TOTP code are required to disable MFA.
type MFAEnableRequest ¶ added in v0.2.4
type MFAEnableRequest struct {
Password string `json:"password"`
}
MFAEnableRequest is the JSON body for POST /api/v1/users/@me/mfa/enable. The password field confirms the user's identity before generating TOTP credentials.
type MFARegenerateCodesRequest ¶ added in v0.2.4
type MFARegenerateCodesRequest struct {
Password string `json:"password"`
}
MFARegenerateCodesRequest is the JSON body for POST /api/v1/users/@me/mfa/recovery-codes.
type MFARegenerateCodesResponse ¶ added in v0.2.4
type MFARegenerateCodesResponse struct {
RecoveryCodes []string `json:"recovery_codes"`
}
MFARegenerateCodesResponse is the response for the recovery code regeneration endpoint.
type MFARequiredResponse ¶ added in v0.2.4
type MFARequiredResponse struct {
MFARequired bool `json:"mfa_required"`
Ticket string `json:"ticket"`
}
MFARequiredResponse is the response when login succeeds but MFA verification is needed. The ticket is a single-use opaque token that the client must present to the MFA verify endpoint.
type MFASetupResponse ¶ added in v0.2.4
MFASetupResponse is the response for the MFA enable endpoint, containing the TOTP secret and provisioning URI for authenticator app registration.
type MFAVerifyRequest ¶ added in v0.2.4
MFAVerifyRequest is the JSON body for POST /api/v1/auth/mfa/verify.
type Member ¶ added in v0.2.7
type Member struct {
User MemberUser `json:"user"`
Nickname *string `json:"nickname"`
JoinedAt string `json:"joined_at"`
Roles []string `json:"roles"`
Status string `json:"status"`
TimeoutUntil *string `json:"timeout_until"`
}
Member represents a server member in API responses.
type MemberRemoveData ¶ added in v0.2.10
type MemberRemoveData struct {
UserID string `json:"user_id"`
}
MemberRemoveData is the payload for the MEMBER_REMOVE dispatch event, identifying the removed member.
type MemberUser ¶ added in v0.2.7
type MemberUser struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName *string `json:"display_name"`
AvatarKey *string `json:"avatar_key"`
}
MemberUser is the subset of user fields exposed in member listings and gateway events.
type Message ¶ added in v0.2.8
type Message struct {
ID string `json:"id"`
ChannelID string `json:"channel_id"`
Author MemberUser `json:"author"`
Content string `json:"content"`
Attachments []Attachment `json:"attachments"`
Reactions []ReactionSummary `json:"reactions"`
ReplyToID *string `json:"reply_to_id"`
ThreadID *string `json:"thread_id,omitempty"`
Pinned bool `json:"pinned"`
Encrypted bool `json:"encrypted"`
MessageKeys []EncryptedMessageKey `json:"message_keys,omitempty"`
EditedAt *string `json:"edited_at"`
CreatedAt string `json:"created_at"`
}
Message represents a message in a channel returned by the API.
type MessageAckData ¶ added in v0.2.20
type MessageAckData struct {
ChannelID string `json:"channel_id"`
MessageID string `json:"message_id"`
}
MessageAckData is the payload for the MESSAGE_ACK dispatch event, confirming that a user's read position in a channel has been updated.
type MessageDeleteData ¶ added in v0.2.8
MessageDeleteData is the payload for the MESSAGE_DELETE dispatch event, identifying the deleted message and the channel it belonged to.
type MessageResponse ¶
type MessageResponse struct {
Message string `json:"message"`
}
MessageResponse is a generic response containing a status message.
type OnboardingAcceptanceResponse ¶ added in v0.2.22
type OnboardingAcceptanceResponse struct {
AcceptedDocuments []DocumentAcceptance `json:"accepted_documents"`
}
OnboardingAcceptanceResponse is the response for GET /api/v1/onboarding/acceptance.
type OnboardingConfig ¶ added in v0.2.11
type OnboardingConfig struct {
WelcomeChannelID *string `json:"welcome_channel_id"`
RequireEmailVerification bool `json:"require_email_verification"`
OpenJoin bool `json:"open_join"`
MinAccountAgeSeconds int `json:"min_account_age_seconds"`
AutoRoles []string `json:"auto_roles"`
Documents []OnboardingDocument `json:"documents"`
}
OnboardingConfig is the response for GET /api/v1/onboarding.
type OnboardingDocument ¶ added in v0.2.11
type OnboardingDocument struct {
Slug string `json:"slug"`
Title string `json:"title"`
Content string `json:"content"`
Position int `json:"position"`
Required bool `json:"required"`
}
OnboardingDocument represents a single onboarding document served to clients.
type OnboardingStatusResponse ¶ added in v0.2.12
type OnboardingStatusResponse struct {
Step OnboardingStep `json:"step"`
}
OnboardingStatusResponse is the response for GET /api/v1/onboarding/status.
type OnboardingStep ¶ added in v0.2.12
type OnboardingStep string
OnboardingStep identifies the next action a client must take to complete onboarding.
const ( OnboardingStepVerifyEmail OnboardingStep = "verify_email" OnboardingStepJoinServer OnboardingStep = "join_server" OnboardingStepAcceptDocuments OnboardingStep = "accept_documents" OnboardingStepComplete OnboardingStep = "complete" )
type OneTimePreKeyUpload ¶ added in v0.2.18
OneTimePreKeyUpload represents a single one-time pre-key in an upload batch.
type PermissionOverride ¶ added in v0.2.7
type PermissionOverride struct {
ID string `json:"id"`
Type string `json:"type"` // "role" or "user"
TargetID string `json:"target_id"` // the role or user ID
Allow int64 `json:"allow"`
Deny int64 `json:"deny"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
PermissionOverride represents a channel-level permission override returned by the API.
type PresenceState ¶ added in v0.2.10
PresenceState is a snapshot of a single user's presence, included in the READY payload.
type PresenceUpdateData ¶ added in v0.2.10
PresenceUpdateData is the payload for the PRESENCE_UPDATE dispatch event, broadcast when a user's presence changes.
type PresenceUpdateRequest ¶ added in v0.2.10
type PresenceUpdateRequest struct {
Status string `json:"status"`
}
PresenceUpdateRequest is the payload for opcode 3 (PresenceUpdate), sent by the client to set its own online status.
type PublicServerInfo ¶ added in v0.2.8
type PublicServerInfo struct {
Name string `json:"name"`
Description string `json:"description"`
IconKey *string `json:"icon_key"`
}
PublicServerInfo is the unauthenticated subset of server identity returned by GET /api/v1/server/info.
type PutSyncedSettingsRequest ¶ added in v0.2.23
type PutSyncedSettingsRequest struct {
EncryptedBlob string `json:"encrypted_blob"`
Salt string `json:"salt"`
Nonce string `json:"nonce"`
BlobVersion int `json:"blob_version"`
}
PutSyncedSettingsRequest is the body for PUT /api/v1/users/@me/synced-settings.
type PutSyncedSettingsResponse ¶ added in v0.2.23
type PutSyncedSettingsResponse struct {
BlobVersion int `json:"blob_version"`
UpdatedAt string `json:"updated_at"`
}
PutSyncedSettingsResponse is returned after a successful synced settings update.
type ReactionAddData ¶ added in v0.2.16
type ReactionAddData struct {
MessageID string `json:"message_id"`
ChannelID string `json:"channel_id"`
UserID string `json:"user_id"`
EmojiID *string `json:"emoji_id"`
EmojiUnicode *string `json:"emoji_unicode"`
}
ReactionAddData is the payload for the REACTION_ADD dispatch event.
type ReactionRemoveData ¶ added in v0.2.16
type ReactionRemoveData struct {
MessageID string `json:"message_id"`
ChannelID string `json:"channel_id"`
UserID string `json:"user_id"`
EmojiID *string `json:"emoji_id"`
EmojiUnicode *string `json:"emoji_unicode"`
}
ReactionRemoveData is the payload for the REACTION_REMOVE dispatch event.
type ReactionSummary ¶ added in v0.2.16
type ReactionSummary struct {
EmojiID *string `json:"emoji_id"`
EmojiUnicode *string `json:"emoji_unicode"`
Count int `json:"count"`
Me bool `json:"me"`
}
ReactionSummary is a grouped count of a single emoji on a message, used in message list responses.
type ReactionUser ¶ added in v0.2.16
ReactionUser identifies a user who reacted with a specific emoji.
type ReadState ¶ added in v0.2.20
type ReadState struct {
ChannelID string `json:"channel_id"`
LastMessageID *string `json:"last_message_id"`
MentionCount int `json:"mention_count"`
}
ReadState represents a per-user, per-channel read position returned by the API. The last_message_id is the most recent message the user has acknowledged in the channel; null means no messages have been read.
type ReadyData ¶ added in v0.2.8
type ReadyData struct {
SessionID string `json:"session_id"`
User User `json:"user"`
Server ServerConfig `json:"server"`
Channels []Channel `json:"channels"`
Roles []Role `json:"roles"`
Members []Member `json:"members"`
Presences []PresenceState `json:"presences"`
ReadStates []ReadState `json:"read_states"`
Onboarding *OnboardingConfig `json:"onboarding"`
}
ReadyData is the payload for the READY dispatch event (opcode 0, type "READY"), sent after a successful Identify. It contains the initial state the client needs to populate its local cache.
type RefreshRequest ¶
type RefreshRequest struct {
RefreshToken string `json:"refresh_token"`
}
RefreshRequest is the JSON body for POST /api/v1/auth/refresh.
type RegisterDeviceRequest ¶ added in v0.2.18
type RegisterDeviceRequest struct {
DeviceID string `json:"device_id"`
Label string `json:"label,omitempty"`
IdentityKey string `json:"identity_key"`
}
RegisterDeviceRequest is the body for POST /api/v1/users/@me/devices.
type RegisterRequest ¶
type RegisterRequest struct {
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"password"`
}
RegisterRequest is the JSON body for POST /api/v1/auth/register.
type ResolvedPermissions ¶ added in v0.2.7
type ResolvedPermissions struct {
Permissions int64 `json:"permissions"`
}
ResolvedPermissions is the response for GET /api/v1/channels/:channelID/permissions/@me.
type ResumeData ¶ added in v0.2.8
type ResumeData struct {
Token string `json:"token"`
SessionID string `json:"session_id"`
Seq int64 `json:"seq"`
}
ResumeData is the payload for opcode 6 (Resume), sent by the client to restore a previously disconnected session. The server replays any events with sequence numbers greater than seq.
type Role ¶ added in v0.2.6
type Role struct {
ID string `json:"id"`
Name string `json:"name"`
Colour int `json:"colour"`
Position int `json:"position"`
Hoist bool `json:"hoist"`
Permissions int64 `json:"permissions"`
IsEveryone bool `json:"is_everyone"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Role represents a server role returned by the API.
type RoleDeleteData ¶ added in v0.2.10
type RoleDeleteData struct {
ID string `json:"id"`
}
RoleDeleteData is the payload for the ROLE_DELETE dispatch event, identifying the deleted role.
type SearchMessageHit ¶ added in v0.2.8
type SearchMessageHit struct {
ID string `json:"id"`
ChannelID string `json:"channel_id"`
AuthorID string `json:"author_id"`
Content string `json:"content"`
CreatedAt int64 `json:"created_at"`
Highlights []string `json:"highlights,omitempty"`
}
SearchMessageHit is the API response shape for a single search result.
type SearchResponse ¶ added in v0.2.8
type SearchResponse struct {
TotalCount int `json:"total_count"`
Page int `json:"page"`
PerPage int `json:"per_page"`
Hits []SearchMessageHit `json:"hits"`
}
SearchResponse is the top-level search response returned inside the data envelope.
type ServerConfig ¶ added in v0.2.2
type ServerConfig struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
IconKey *string `json:"icon_key"`
BannerKey *string `json:"banner_key"`
OwnerID string `json:"owner_id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
ServerConfig represents the server configuration returned by the API.
type SetOverrideRequest ¶ added in v0.2.7
type SetOverrideRequest struct {
Type string `json:"type"` // "role" or "user"
Allow int64 `json:"allow"`
Deny int64 `json:"deny"`
}
SetOverrideRequest is the body for PUT /api/v1/channels/:channelID/overrides/:targetID.
type SyncedSettingsBlob ¶ added in v0.2.23
type SyncedSettingsBlob struct {
EncryptedBlob string `json:"encrypted_blob"`
Salt string `json:"salt"`
Nonce string `json:"nonce"`
BlobVersion int `json:"blob_version"`
UpdatedAt string `json:"updated_at"`
}
SyncedSettingsBlob represents the encrypted settings blob stored on behalf of a user. The server treats the blob as opaque bytes; all encryption and decryption is performed client-side.
type Thread ¶ added in v0.2.17
type Thread struct {
ID string `json:"id"`
ChannelID string `json:"channel_id"`
ParentMessageID string `json:"parent_message_id"`
Name string `json:"name"`
Archived bool `json:"archived"`
Locked bool `json:"locked"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Thread represents a thread attached to a message, returned by the API.
type ThreadDeleteData ¶ added in v0.2.17
ThreadDeleteData is the payload for the THREAD_DELETE dispatch event, identifying the deleted thread and the channel it belonged to.
type TimeoutMemberRequest ¶ added in v0.2.7
type TimeoutMemberRequest struct {
Until string `json:"until"`
}
TimeoutMemberRequest is the body for PUT /api/v1/server/members/:userID/timeout.
type TokenPairResponse ¶
type TokenPairResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
TokenPairResponse is the response body for the refresh endpoint.
type TypingStartData ¶ added in v0.2.10
type TypingStartData struct {
ChannelID string `json:"channel_id"`
UserID string `json:"user_id"`
Timestamp string `json:"timestamp"`
}
TypingStartData is the payload for the TYPING_START dispatch event.
type TypingStopData ¶ added in v0.2.13
TypingStopData is the payload for the TYPING_STOP dispatch event.
type UpdateCategoryRequest ¶ added in v0.2.3
UpdateCategoryRequest is the body for PATCH /api/v1/categories/:categoryID.
type UpdateChannelRequest ¶ added in v0.2.3
type UpdateChannelRequest struct {
Name *string `json:"name"`
CategoryID *string `json:"category_id"`
Topic *string `json:"topic"`
Position *int `json:"position"`
SlowmodeSeconds *int `json:"slowmode_seconds"`
NSFW *bool `json:"nsfw"`
}
UpdateChannelRequest is the body for PATCH /api/v1/channels/:channelID.
type UpdateEmojiRequest ¶ added in v0.2.16
type UpdateEmojiRequest struct {
Name string `json:"name"`
}
UpdateEmojiRequest is the body for PATCH /api/v1/server/emoji/:emojiID.
type UpdateIdentityKeyRequest ¶ added in v0.2.18
type UpdateIdentityKeyRequest struct {
IdentityKey string `json:"identity_key"`
}
UpdateIdentityKeyRequest is the body for PUT /api/v1/users/@me/devices/:deviceID/identity-key.
type UpdateMemberRequest ¶ added in v0.2.7
type UpdateMemberRequest struct {
Nickname *string `json:"nickname"`
}
UpdateMemberRequest is the body for PATCH /api/v1/server/members/:userID or /@me.
type UpdateMessageRequest ¶ added in v0.2.8
type UpdateMessageRequest struct {
Content string `json:"content"`
}
UpdateMessageRequest is the body for PATCH /api/v1/messages/:messageID.
type UpdateOnboardingConfigRequest ¶ added in v0.2.11
type UpdateOnboardingConfigRequest struct {
WelcomeChannelID *string `json:"welcome_channel_id,omitempty"`
RequireEmailVerification *bool `json:"require_email_verification,omitempty"`
OpenJoin *bool `json:"open_join,omitempty"`
MinAccountAgeSeconds *int `json:"min_account_age_seconds,omitempty"`
AutoRoles []string `json:"auto_roles,omitempty"`
}
UpdateOnboardingConfigRequest is the body for PATCH /api/v1/onboarding.
type UpdateRoleRequest ¶ added in v0.2.6
type UpdateRoleRequest struct {
Name *string `json:"name"`
Colour *int `json:"colour"`
Position *int `json:"position"`
Permissions *int64 `json:"permissions"`
Hoist *bool `json:"hoist"`
}
UpdateRoleRequest is the body for PATCH /api/v1/server/roles/:roleID.
type UpdateServerConfigRequest ¶ added in v0.2.2
type UpdateServerConfigRequest struct {
Name *string `json:"name"`
Description *string `json:"description"`
}
UpdateServerConfigRequest is the body for PATCH /api/v1/server. Image keys (icon, banner) are managed through dedicated upload/delete endpoints and are not part of the PATCH flow.
type UpdateThreadRequest ¶ added in v0.2.17
type UpdateThreadRequest struct {
Name *string `json:"name"`
Archived *bool `json:"archived"`
Locked *bool `json:"locked"`
}
UpdateThreadRequest is the body for PATCH /api/v1/threads/:threadID.
type UpdateUserRequest ¶ added in v0.2.2
type UpdateUserRequest struct {
DisplayName *string `json:"display_name"`
Pronouns *string `json:"pronouns"`
About *string `json:"about"`
ThemeColourPrimary *int `json:"theme_colour_primary"`
ThemeColourSecondary *int `json:"theme_colour_secondary"`
}
UpdateUserRequest is the body for PATCH /api/v1/users/@me. Image keys (avatar, banner) are managed through dedicated upload/delete endpoints and are not part of the PATCH flow.
type UploadOneTimePreKeysRequest ¶ added in v0.2.18
type UploadOneTimePreKeysRequest struct {
PreKeys []OneTimePreKeyUpload `json:"pre_keys"`
}
UploadOneTimePreKeysRequest is the body for POST /api/v1/users/@me/devices/:deviceID/one-time-pre-keys.
type UploadSignedPreKeyRequest ¶ added in v0.2.18
type UploadSignedPreKeyRequest struct {
KeyID int `json:"key_id"`
PublicKey string `json:"public_key"`
Signature string `json:"signature"`
}
UploadSignedPreKeyRequest is the body for PUT /api/v1/users/@me/devices/:deviceID/signed-pre-key.
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
DisplayName *string `json:"display_name"`
AvatarKey *string `json:"avatar_key"`
Pronouns *string `json:"pronouns"`
BannerKey *string `json:"banner_key"`
About *string `json:"about"`
ThemeColourPrimary *int `json:"theme_colour_primary"`
ThemeColourSecondary *int `json:"theme_colour_secondary"`
MFAEnabled bool `json:"mfa_enabled"`
EmailVerified bool `json:"email_verified"`
}
User represents the public user profile returned by the API.
type UserKeyBundleResponse ¶ added in v0.2.18
type UserKeyBundleResponse struct {
UserID string `json:"user_id"`
Devices []DeviceKeyBundleResponse `json:"devices"`
}
UserKeyBundleResponse holds key bundles for all ready devices of a user, returned by GET /api/v1/users/:userID/keys.
type UserProfile ¶ added in v0.2.14
type UserProfile struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName *string `json:"display_name"`
AvatarKey *string `json:"avatar_key"`
Pronouns *string `json:"pronouns"`
BannerKey *string `json:"banner_key"`
About *string `json:"about"`
ThemeColourPrimary *int `json:"theme_colour_primary"`
ThemeColourSecondary *int `json:"theme_colour_secondary"`
}
UserProfile represents the publicly visible subset of a user's profile, excluding private fields such as email and MFA status.
type VerifyEmailRequest ¶
type VerifyEmailRequest struct {
Token string `json:"token"`
}
VerifyEmailRequest is the JSON body for POST /api/v1/auth/verify-email.
type VerifyPasswordRequest ¶ added in v0.2.4
type VerifyPasswordRequest struct {
Password string `json:"password"`
}
VerifyPasswordRequest is the JSON body for POST /api/v1/auth/verify-password. The authenticated user's password is verified without performing any other action, allowing clients to gate sensitive workflows behind a password prompt.