api

package module
v0.0.0-...-65e044a Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MPL-2.0 Imports: 11 Imported by: 0

README

go-matrix-api

Documentation

Index

Constants

View Source
const (
	AuthTypePassword  = "m.login.password"
	AuthTypeReCAPTCHA = "m.login.recaptcha"
	AuthTypeOAuth2    = "m.login.oauth2"
	AuthTypeSSO       = "m.login.sso"
	AuthTypeEmail     = "m.login.email.identity"
	AuthTypeMSISDN    = "m.login.msisdn"
	AuthTypeToken     = "m.login.token"
	AuthTypeDummy     = "m.login.dummy"

	AuthTypeAppservice = "uk.half-shot.msc2778.login.application_service"
)
View Source
const (
	IdentifierTypeUser       = "m.id.user"
	IdentifierTypeThirdParty = "m.id.thirdparty"
	IdentifierTypePhone      = "m.id.phone"
)
View Source
const DefaultContentType = "application/json"

Variables

View Source
var (
	// Forbidden access, e.g. joining a room without permission, failed login.
	MForbidden = RespError{ErrCode: "M_FORBIDDEN"}
	// The access token specified was not recognised.
	MUnknownToken = RespError{ErrCode: "M_UNKNOWN_TOKEN"}
	// No access token was specified for the request.
	MMissingToken = RespError{ErrCode: "M_MISSING_TOKEN"}
	// Request contained valid JSON, but it was malformed in some way, e.g. missing required keys, invalid values for keys.
	MBadJSON = RespError{ErrCode: "M_BAD_JSON"}
	// Request did not contain valid JSON.
	MNotJSON = RespError{ErrCode: "M_NOT_JSON"}
	// No resource was found for this request.
	MNotFound = RespError{ErrCode: "M_NOT_FOUND"}
	// Too many requests have been sent in a short period of time. Wait a while then try again.
	MLimitExceeded = RespError{ErrCode: "M_LIMIT_EXCEEDED"}
	// The user ID associated with the request has been deactivated.
	// Typically for endpoints that prove authentication, such as /login.
	MUserDeactivated = RespError{ErrCode: "M_USER_DEACTIVATED"}
	// Encountered when trying to register a user ID which has been taken.
	MUserInUse = RespError{ErrCode: "M_USER_IN_USE"}
	// Encountered when trying to register a user ID which is not valid.
	MInvalidUsername = RespError{ErrCode: "M_INVALID_USERNAME"}
	// Sent when the room alias given to the createRoom API is already in use.
	MRoomInUse = RespError{ErrCode: "M_ROOM_IN_USE"}
	// The state change requested cannot be performed, such as attempting to unban a user who is not banned.
	MBadState = RespError{ErrCode: "M_BAD_STATE"}
	// 	The request or entity was too large.
	MTooLarge = RespError{ErrCode: "M_TOO_LARGE"}
	// The resource being requested is reserved by an application service, or the application service making the request has not created the resource.
	MExclusive = RespError{ErrCode: "M_EXCLUSIVE"}
	// The client's request to create a room used a room version that the server does not support.
	MUnsupportedRoomVersion = RespError{ErrCode: "M_UNSUPPORTED_ROOM_VERSION"}
	// The client attempted to join a room that has a version the server does not support.
	// Inspect the room_version property of the error response for the room's version.
	MIncompatibleRoomVersion = RespError{ErrCode: "M_INCOMPATIBLE_ROOM_VERSION"}
)

Common error codes from https://matrix.org/docs/spec/client_server/latest#api-standards

Can be used with errors.Is() to check the response code without casting the error:

err := client.Sync()
if errors.Is(err, MUnknownToken) {
  // logout
}
View Source
var (
	ErrEmptyHomeserver = errors.New("empty homeserver url")
)

Functions

func NewApi

func NewApi(homeserverUrl *url.URL) (*api, error)

Types

type Api

type Api interface {
	Login(req *ReqLogin) (resp *RespLogin, err error)
}

type AuthType

type AuthType string

type BaseAuthData

type BaseAuthData struct {
	Type    AuthType `json:"type"`
	Session string   `json:"session"`
}

type CrossSigningKeys

type CrossSigningKeys struct {
	UserID     id.UserID                         `json:"user_id"`
	Usage      []id.CrossSigningUsage            `json:"usage"`
	Keys       map[id.KeyID]id.Ed25519           `json:"keys"`
	Signatures map[id.UserID]map[id.KeyID]string `json:"signatures,omitempty"`
}

func (*CrossSigningKeys) FirstKey

func (csk *CrossSigningKeys) FirstKey() id.Ed25519

type DeviceIDList

type DeviceIDList []id.DeviceID

type DeviceKeys

type DeviceKeys struct {
	UserID     id.UserID              `json:"user_id"`
	DeviceID   id.DeviceID            `json:"device_id"`
	Algorithms []id.Algorithm         `json:"algorithms"`
	Keys       KeyMap                 `json:"keys"`
	Signatures Signatures             `json:"signatures"`
	Unsigned   map[string]interface{} `json:"unsigned,omitempty"`
}

type DeviceKeysRequest

type DeviceKeysRequest map[id.UserID]DeviceIDList

type HTTPError

type HTTPError struct {
	Request      *fasthttp.Request
	Response     *fasthttp.Response
	ResponseBody string

	WrappedError error
	RespError    *RespError
	Message      string
}

HTTPError An HTTP Error response, which may wrap an underlying native Go Error.

func (HTTPError) Error

func (e HTTPError) Error() string

func (HTTPError) Is

func (e HTTPError) Is(err error) bool

func (HTTPError) IsStatus

func (e HTTPError) IsStatus(code int) bool

func (HTTPError) Unwrap

func (e HTTPError) Unwrap() error

type IdentifierType

type IdentifierType string

type KeyMap

type KeyMap map[id.DeviceKeyID]string

func (KeyMap) GetCurve25519

func (km KeyMap) GetCurve25519(deviceID id.DeviceID) id.Curve25519

func (KeyMap) GetEd25519

func (km KeyMap) GetEd25519(deviceID id.DeviceID) id.Ed25519

type LazyLoadSummary

type LazyLoadSummary struct {
	Heroes             []id.UserID `json:"m.heroes,omitempty"`
	JoinedMemberCount  *int        `json:"m.joined_member_count,omitempty"`
	InvitedMemberCount *int        `json:"m.invited_member_count,omitempty"`
}

type OneTimeKey

type OneTimeKey struct {
	Key        id.Curve25519          `json:"key"`
	IsSigned   bool                   `json:"-"`
	Signatures Signatures             `json:"signatures,omitempty"`
	Unsigned   map[string]interface{} `json:"unsigned,omitempty"`
}

func (*OneTimeKey) MarshalJSON

func (otk *OneTimeKey) MarshalJSON() ([]byte, error)

func (*OneTimeKey) UnmarshalJSON

func (otk *OneTimeKey) UnmarshalJSON(data []byte) (err error)

type OneTimeKeysCount

type OneTimeKeysCount struct {
	Curve25519       int `json:"curve25519"`
	SignedCurve25519 int `json:"signed_curve25519"`
}

type OneTimeKeysRequest

type OneTimeKeysRequest map[id.UserID]map[id.DeviceID]id.KeyAlgorithm

type ReqAliasCreate

type ReqAliasCreate struct {
	RoomID id.RoomID `json:"room_id"`
}

type ReqBanUser

type ReqBanUser struct {
	Reason string    `json:"reason,omitempty"`
	UserID id.UserID `json:"user_id"`
}

ReqBanUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban

type ReqClaimKeys

type ReqClaimKeys struct {
	OneTimeKeys OneTimeKeysRequest `json:"one_time_keys"`

	Timeout int64 `json:"timeout,omitempty"`
}

type ReqCreateRoom

type ReqCreateRoom struct {
	Visibility      string                 `json:"visibility,omitempty"`
	RoomAliasName   string                 `json:"room_alias_name,omitempty"`
	Name            string                 `json:"name,omitempty"`
	Topic           string                 `json:"topic,omitempty"`
	Invite          []id.UserID            `json:"invite,omitempty"`
	Invite3PID      []ReqInvite3PID        `json:"invite_3pid,omitempty"`
	CreationContent map[string]interface{} `json:"creation_content,omitempty"`
	InitialState    []*event.Event         `json:"initial_state,omitempty"`
	Preset          string                 `json:"preset,omitempty"`
	IsDirect        bool                   `json:"is_direct,omitempty"`
}

ReqCreateRoom is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom

type ReqDeleteDevice

type ReqDeleteDevice struct {
	Auth interface{} `json:"auth,omitempty"`
}

ReqDeleteDevice is the JSON request for https://matrix.org/docs/spec/client_server/r0.6.1#delete-matrix-client-r0-devices-deviceid

type ReqDeleteDevices

type ReqDeleteDevices struct {
	Devices []id.DeviceID `json:"devices"`
	Auth    interface{}   `json:"auth,omitempty"`
}

ReqDeleteDevices is the JSON request for https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-delete-devices

type ReqDeviceInfo

type ReqDeviceInfo struct {
	DisplayName string `json:"display_name,omitempty"`
}

ReqDeviceInfo is the JSON request for https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-devices-deviceid

type ReqInvite3PID

type ReqInvite3PID struct {
	IDServer string `json:"id_server"`
	Medium   string `json:"medium"`
	Address  string `json:"address"`
}

ReqInvite3PID is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#id57 It is also a JSON object used in https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom

type ReqInviteUser

type ReqInviteUser struct {
	UserID id.UserID `json:"user_id"`
}

ReqInviteUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite

type ReqKeysSignatures

type ReqKeysSignatures struct {
	UserID     id.UserID              `json:"user_id"`
	DeviceID   id.DeviceID            `json:"device_id,omitempty"`
	Algorithms []id.Algorithm         `json:"algorithms,omitempty"`
	Usage      []id.CrossSigningUsage `json:"usage,omitempty"`
	Keys       map[id.KeyID]string    `json:"keys"`
	Signatures Signatures             `json:"signatures"`
}

type ReqKickUser

type ReqKickUser struct {
	Reason string    `json:"reason,omitempty"`
	UserID id.UserID `json:"user_id"`
}

ReqKickUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick

type ReqLogin

type ReqLogin struct {
	Type                     AuthType       `json:"type"`
	Identifier               UserIdentifier `json:"identifier"`
	Password                 string         `json:"password,omitempty"`
	Token                    string         `json:"token,omitempty"`
	DeviceID                 id.DeviceID    `json:"device_id,omitempty"`
	InitialDeviceDisplayName string         `json:"initial_device_display_name,omitempty"`
}

ReqLogin is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-login

type ReqMembers

type ReqMembers struct {
	At            string           `json:"at"`
	Membership    event.Membership `json:"membership,omitempty"`
	NotMembership event.Membership `json:"not_membership,omitempty"`
}

type ReqPresence

type ReqPresence struct {
	Presence event.Presence `json:"presence"`
}

type ReqPutPushRule

type ReqPutPushRule struct {
	Before string `json:"-"`
	After  string `json:"-"`

	Actions    []pushrules.PushActionType `json:"actions"`
	Conditions []pushrules.PushCondition  `json:"conditions"`
	Pattern    string                     `json:"pattern"`
}

type ReqQueryKeys

type ReqQueryKeys struct {
	DeviceKeys DeviceKeysRequest `json:"device_keys"`

	Timeout int64  `json:"timeout,omitempty"`
	Token   string `json:"token,omitempty"`
}

type ReqRedact

type ReqRedact struct {
	Reason string `json:"reason,omitempty"`
	TxnID  string `json:"-"`
}

ReqRedact is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid

type ReqRegister

type ReqRegister struct {
	Username                 string      `json:"username,omitempty"`
	BindEmail                bool        `json:"bind_email,omitempty"`
	Password                 string      `json:"password,omitempty"`
	DeviceID                 id.DeviceID `json:"device_id,omitempty"`
	InitialDeviceDisplayName string      `json:"initial_device_display_name"`
	Auth                     interface{} `json:"auth,omitempty"`
}

ReqRegister is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register

type ReqSendToDevice

type ReqSendToDevice struct {
	Messages map[id.UserID]map[id.DeviceID]*event.Content `json:"messages"`
}

type ReqTyping

type ReqTyping struct {
	Typing  bool  `json:"typing"`
	Timeout int64 `json:"timeout,omitempty"`
}

ReqTyping is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid

type ReqUIAuthFallback

type ReqUIAuthFallback struct {
	Session string `json:"session"`
	User    string `json:"user"`
}

type ReqUIAuthLogin

type ReqUIAuthLogin struct {
	BaseAuthData
	User     string `json:"user"`
	Password string `json:"password"`
}

type ReqUnbanUser

type ReqUnbanUser struct {
	UserID id.UserID `json:"user_id"`
}

ReqUnbanUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban

type ReqUploadKeys

type ReqUploadKeys struct {
	DeviceKeys  *DeviceKeys             `json:"device_keys,omitempty"`
	OneTimeKeys map[id.KeyID]OneTimeKey `json:"one_time_keys"`
}

type ReqUploadSignatures

type ReqUploadSignatures map[id.UserID]map[string]ReqKeysSignatures

type RespAliasCreate

type RespAliasCreate struct{}

type RespAliasDelete

type RespAliasDelete struct{}

type RespAliasResolve

type RespAliasResolve struct {
	RoomID  id.RoomID `json:"room_id"`
	Servers []string  `json:"servers"`
}

type RespBanUser

type RespBanUser struct{}

RespBanUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban

type RespClaimKeys

type RespClaimKeys struct {
	Failures    map[string]interface{}                                `json:"failures"`
	OneTimeKeys map[id.UserID]map[id.DeviceID]map[id.KeyID]OneTimeKey `json:"one_time_keys"`
}

type RespCreateFilter

type RespCreateFilter struct {
	FilterID string `json:"filter_id"`
}

RespCreateFilter is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-user-userid-filter

type RespCreateRoom

type RespCreateRoom struct {
	RoomID id.RoomID `json:"room_id"`
}

RespCreateRoom is the JSON response for https://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-createroom

type RespDeviceInfo

type RespDeviceInfo struct {
	DeviceID    id.DeviceID `json:"device_id"`
	DisplayName string      `json:"display_name"`
	LastSeenIP  string      `json:"last_seen_ip"`
	LastSeenTS  int64       `json:"last_seen_ts"`
}

RespDeviceInfo is the JSON response for https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-devices-deviceid

type RespDevicesInfo

type RespDevicesInfo struct {
	Devices []RespDeviceInfo `json:"devices"`
}

RespDevicesInfo is the JSON response for https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-devices

type RespError

type RespError struct {
	ErrCode   string
	Err       string
	ExtraData map[string]interface{}
}

RespError is the standard JSON error response from Homeservers. It also implements the Golang "error" interface. See http://matrix.org/docs/spec/client_server/r0.6.1.html#api-standards

func (RespError) Error

func (e RespError) Error() string

Error returns the errcode and error message.

func (RespError) Is

func (e RespError) Is(err error) bool

func (*RespError) MarshalJSON

func (e *RespError) MarshalJSON() ([]byte, error)

func (*RespError) UnmarshalJSON

func (e *RespError) UnmarshalJSON(data []byte) error

type RespForgetRoom

type RespForgetRoom struct{}

RespForgetRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-forget

type RespInviteUser

type RespInviteUser struct{}

RespInviteUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite

type RespJoinRoom

type RespJoinRoom struct {
	RoomID id.RoomID `json:"room_id"`
}

RespJoinRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-join

type RespJoinedMembers

type RespJoinedMembers struct {
	Joined map[id.UserID]struct {
		DisplayName *string `json:"display_name"`
		AvatarURL   *string `json:"avatar_url"`
	} `json:"joined"`
}

RespJoinedMembers is the JSON response for https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-joined-rooms

type RespJoinedRooms

type RespJoinedRooms struct {
	JoinedRooms []id.RoomID `json:"joined_rooms"`
}

RespJoinedRooms is the JSON response for https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-joined-rooms

type RespKeyChanges

type RespKeyChanges struct {
	Changed []id.UserID `json:"changed"`
	Left    []id.UserID `json:"left"`
}

type RespKickUser

type RespKickUser struct{}

RespKickUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick

type RespLeaveRoom

type RespLeaveRoom struct{}

RespLeaveRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-leave

type RespLogin

type RespLogin struct {
	AccessToken string      `json:"access_token"`
	DeviceID    id.DeviceID `json:"device_id"`
	UserID      id.UserID   `json:"user_id"`
}

RespLogin is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-login

type RespLoginFlows

type RespLoginFlows struct {
	Flows []struct {
		Type AuthType `json:"type"`
	} `json:"flows"`
}

func (*RespLoginFlows) HasFlow

func (rlf *RespLoginFlows) HasFlow(flowType AuthType) bool

type RespLogout

type RespLogout struct{}

RespLogout is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-logout

type RespMediaUpload

type RespMediaUpload struct {
	ContentURI id.ContentURI `json:"content_uri"`
}

RespMediaUpload is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-media-r0-upload

type RespMembers

type RespMembers struct {
	Chunk []*event.Event `json:"chunk"`
}

type RespMessages

type RespMessages struct {
	Start string         `json:"start"`
	Chunk []*event.Event `json:"chunk"`
	State []*event.Event `json:"state"`
	End   string         `json:"end"`
}

RespMessages is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-messages

type RespQueryKeys

type RespQueryKeys struct {
	Failures        map[string]interface{}                   `json:"failures"`
	DeviceKeys      map[id.UserID]map[id.DeviceID]DeviceKeys `json:"device_keys"`
	MasterKeys      map[id.UserID]CrossSigningKeys           `json:"master_keys"`
	SelfSigningKeys map[id.UserID]CrossSigningKeys           `json:"self_signing_keys"`
	UserSigningKeys map[id.UserID]CrossSigningKeys           `json:"user_signing_keys"`
}

type RespRegister

type RespRegister struct {
	AccessToken  string      `json:"access_token"`
	DeviceID     id.DeviceID `json:"device_id"`
	HomeServer   string      `json:"home_server"`
	RefreshToken string      `json:"refresh_token"`
	UserID       id.UserID   `json:"user_id"`
}

RespRegister is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register

type RespSendEvent

type RespSendEvent struct {
	EventID id.EventID `json:"event_id"`
}

RespSendEvent is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid

type RespSendToDevice

type RespSendToDevice struct{}

type RespSync

type RespSync struct {
	NextBatch string `json:"next_batch"`

	AccountData struct {
		Events []*event.Event `json:"events"`
	} `json:"account_data"`
	Presence struct {
		Events []*event.Event `json:"events"`
	} `json:"presence"`
	ToDevice struct {
		Events []*event.Event `json:"events"`
	} `json:"to_device"`

	DeviceLists struct {
		Changed []id.UserID `json:"changed"`
		Left    []id.UserID `json:"left"`
	} `json:"device_lists"`
	DeviceOneTimeKeysCount OneTimeKeysCount `json:"device_one_time_keys_count"`

	Rooms struct {
		Leave  map[id.RoomID]SyncLeftRoom    `json:"leave"`
		Join   map[id.RoomID]SyncJoinedRoom  `json:"join"`
		Invite map[id.RoomID]SyncInvitedRoom `json:"invite"`
	} `json:"rooms"`
}

RespSync is the JSON response for http://matrix.org/docs/spec/client_server/r0.6.0.html#get-matrix-client-r0-sync

type RespTurnServer

type RespTurnServer struct {
	Username string   `json:"username"`
	Password string   `json:"password"`
	TTL      int      `json:"ttl"`
	URIs     []string `json:"uris"`
}

type RespUnbanUser

type RespUnbanUser struct{}

RespUnbanUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban

type RespUploadKeys

type RespUploadKeys struct {
	OneTimeKeyCounts OneTimeKeysCount `json:"one_time_key_counts"`
}

type RespUploadSignatures

type RespUploadSignatures struct {
	Failures map[string]interface{} `json:"failures"`
}

type RespUserDisplayName

type RespUserDisplayName struct {
	DisplayName string `json:"displayname"`
}

RespUserDisplayName is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname

type RespUserInteractive

type RespUserInteractive struct {
	Flows []struct {
		Stages []AuthType `json:"stages"`
	} `json:"flows"`
	Params    map[AuthType]interface{} `json:"params"`
	Session   string                   `json:"session"`
	Completed []string                 `json:"completed"`

	ErrCode string `json:"errcode"`
	Error   string `json:"error"`
}

RespUserInteractive is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#user-interactive-authentication-api

func (RespUserInteractive) HasSingleStageFlow

func (r RespUserInteractive) HasSingleStageFlow(stageName AuthType) bool

HasSingleStageFlow returns true if there exists at least 1 Flow with a single stage of stageName.

type RespVersions

type RespVersions struct {
	Versions         []string        `json:"versions"`
	UnstableFeatures map[string]bool `json:"unstable_features"`
}

RespVersions is the JSON response for http://matrix.org/docs/spec/client_server/r0.6.1.html#get-matrix-client-versions

type RespWhoami

type RespWhoami struct {
	UserID id.UserID `json:"user_id"`
	// N.B. This field is not in the spec yet, it's expected to land in r0.6.2 or r0.7.0
	DeviceID id.DeviceID `json:"device_id"`
}

RespWhoami is the JSON response for https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-account-whoami

type Signatures

type Signatures map[id.UserID]map[id.KeyID]string

type SyncInvitedRoom

type SyncInvitedRoom struct {
	Summary LazyLoadSummary `json:"summary"`
	State   struct {
		Events []*event.Event `json:"events"`
	} `json:"invite_state"`
}

type SyncJoinedRoom

type SyncJoinedRoom struct {
	Summary LazyLoadSummary `json:"summary"`
	State   struct {
		Events []*event.Event `json:"events"`
	} `json:"state"`
	Timeline struct {
		Events    []*event.Event `json:"events"`
		Limited   bool           `json:"limited"`
		PrevBatch string         `json:"prev_batch"`
	} `json:"timeline"`
	Ephemeral struct {
		Events []*event.Event `json:"events"`
	} `json:"ephemeral"`
	AccountData struct {
		Events []*event.Event `json:"events"`
	} `json:"account_data"`
}

type SyncLeftRoom

type SyncLeftRoom struct {
	Summary LazyLoadSummary `json:"summary"`
	State   struct {
		Events []*event.Event `json:"events"`
	} `json:"state"`
	Timeline struct {
		Events    []*event.Event `json:"events"`
		Limited   bool           `json:"limited"`
		PrevBatch string         `json:"prev_batch"`
	} `json:"timeline"`
}

type UploadCrossSigningKeysReq

type UploadCrossSigningKeysReq struct {
	Master      CrossSigningKeys `json:"master_key"`
	SelfSigning CrossSigningKeys `json:"self_signing_key"`
	UserSigning CrossSigningKeys `json:"user_signing_key"`
	Auth        interface{}      `json:"auth,omitempty"`
}

type UserIdentifier

type UserIdentifier struct {
	Type IdentifierType `json:"type"`

	User string `json:"user,omitempty"`

	Medium  string `json:"medium,omitempty"`
	Address string `json:"address,omitempty"`

	Country string `json:"country,omitempty"`
	Phone   string `json:"phone,omitempty"`
}

Jump to

Keyboard shortcuts

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