api

package
v0.0.0-...-e41826d Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationServiceServer

type ApplicationServiceServer struct {
	Server *http.Server

	HSToken string

	Transaction func(ReqTransactions, string)
}

func (*ApplicationServiceServer) ListenAndServe

func (as *ApplicationServiceServer) ListenAndServe() error

type Auth

type Auth func(*http.Request)

type Client

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

func NewClient

func NewClient(client *http.Client, homeserver string) *Client

func (*Client) CreateRoom

func (cli *Client) CreateRoom(auth Auth, req CreateRoomReq) (CreateRoomResp, error)

func (*Client) ForgetRoom

func (cli *Client) ForgetRoom(auth Auth, roomID string) error

func (*Client) GetRoomAliasID

func (cli *Client) GetRoomAliasID(alias string) (GetRoomAliasIDResp, error)

func (*Client) GetRoomMessages

func (cli *Client) GetRoomMessages(auth Auth, roomID string, from, to, dir string, limit int, filter string) (GetRoomMessagesResp, error)

func (*Client) GetRoomVisibility

func (cli *Client) GetRoomVisibility(id string) (GetRoomVisibilityResp, error)

func (*Client) GetUserDisplayname

func (cli *Client) GetUserDisplayname(userID string) (resp GetUserDisplaynameResp, err error)

func (*Client) KeysClaim

func (cli *Client) KeysClaim(auth Auth, req KeysClaimReq) (KeysClaimResp, error)

func (*Client) KeysQuery

func (cli *Client) KeysQuery(auth Auth, req KeysQueryReq) (KeysQueryResp, error)

func (*Client) KeysUpload

func (cli *Client) KeysUpload(auth Auth, req KeysUploadReq) (KeysUploadResp, error)

func (*Client) LeaveRoom

func (cli *Client) LeaveRoom(auth Auth, roomID string) error

func (*Client) Login

func (cli *Client) Login(body LoginBody) (LoginResp, error)

func (*Client) Logout

func (cli *Client) Logout(auth Auth) error

5.4.3

func (*Client) LogoutAll

func (cli *Client) LogoutAll(auth Auth) error

5.4.4

func (*Client) MediaDownload

func (cli *Client) MediaDownload(serverName, mediaID string, filename string) (string, string, int64, io.ReadCloser, error)

func (*Client) MediaThumbnail

func (cli *Client) MediaThumbnail(serverName, mediaID, method string, width, height int) (string, int64, io.ReadCloser, error)

func (*Client) MediaUpload

func (cli *Client) MediaUpload(auth Auth, contentType, filename string, content io.Reader) (resp MediaUploadResp, err error)

func (*Client) PutRoomEvent

func (cli *Client) PutRoomEvent(auth Auth, roomID, eventType, txnID string, body PutRoomEventBody) (PutRoomEventResp, error)

func (*Client) PutStateEvent

func (cli *Client) PutStateEvent(auth Auth, roomID, eventType, stateKey string, body PutStateEventBody) (PutStateEventResp, error)

func (*Client) SendToDevice

func (cli *Client) SendToDevice(auth Auth, eventType string, txnID string, req SendToDeviceReq) error

func (*Client) Sync

func (cli *Client) Sync(auth Auth, filter, since string, fullState bool, setPresence string, timeout int64) (SyncResp, error)

func (*Client) Versions

func (cli *Client) Versions() (VersionsResp, error)

func (*Client) Whoami

func (cli *Client) Whoami(auth Auth) (WhoamiResp, error)

type CreateRoomReq

type CreateRoomReq struct {
	Visibility                string                    `json:"visibility,omitempty"`
	RoomAliasName             string                    `json:"room_alias_name,omitempty"`
	Name                      string                    `json:"name,omitempty"`
	Topic                     string                    `json:"topic,omitempty"`
	Invite                    []string                  `json:"invite,omitempty"`
	Invite3PID                []CreateRoomReqInvite3PID `json:"invite_3pid,omitempty"`
	RoomVersion               string                    `json:"room_version,omitempty"`
	CreationContent           map[string]interface{}    `json:"creation_content,omitempty"`
	InitialState              []interface{}             `json:"initial_state,omitempty"`
	Preset                    string                    `json:"preset,omitempty"`
	IsDirect                  bool                      `json:"is_direct,omitempty"`
	PowerLevelContentOverride map[string]interface{}    `json:"power_level_content_override,omitempty"`
}

type CreateRoomReqInvite3PID

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

type CreateRoomResp

type CreateRoomResp struct {
	RoomID string `json:"room_id"`
}

type GetRoomAliasIDResp

type GetRoomAliasIDResp struct {
	RoomID  string   `json:"room_id"`
	Servers []string `json:"servers"`
}

type GetRoomMessagesResp

type GetRoomMessagesResp struct {
	Start string            `json:"start,omitempty"`
	End   string            `json:"end,omitempty"`
	Chunk []json.RawMessage `json:"chunk,omitempty"`
	State []json.RawMessage `json:"state,omitempty"`
}

type GetRoomVisibilityResp

type GetRoomVisibilityResp struct {
	Visibility string `json:"visibility"`
}

type GetUserDisplaynameResp

type GetUserDisplaynameResp struct {
	Displayname string `json:"displayname"`
}

type Identifier

type Identifier map[string]interface{}

5.3.6

func New3rdpartyIdentifer

func New3rdpartyIdentifer(medium, address string) Identifier

func NewPhoneIdentifer

func NewPhoneIdentifer(country, phone string) Identifier

func NewUserIdentifer

func NewUserIdentifer(username string) Identifier

type KeysClaimReq

type KeysClaimReq struct {
	Timeout     int                          `json:"timeout,omitempty"`
	OneTimeKeys map[string]map[string]string `json:"one_time_keys"`
}

type KeysClaimResp

type KeysClaimResp struct {
	Failures    map[string]interface{}                       `json:"failures"`
	OneTimeKeys map[string]map[string]map[string]interface{} `json:"one_time_keys"`
}

type KeysQueryReq

type KeysQueryReq struct {
	Timeout    int                 `json:"timeout,omitempty"`
	DeviceKeys map[string][]string `json:"device_keys"`
	Token      string              `json:"token"`
}

type KeysQueryResp

type KeysQueryResp struct {
	Failures   map[string]interface{}
	DeviceKeys map[string]map[string]KeysQueryRespDeviceKeys `json:"device_keys"`
}

type KeysQueryRespDeviceKeys

type KeysQueryRespDeviceKeys struct {
	UserID     string                       `json:"user_id"`
	DeviceID   string                       `json:"device_id"`
	Algorithms []string                     `json:"algorithms"`
	Keys       map[string]string            `json:"keys"`
	Signatures map[string]map[string]string `json:"signatures"`
	Unsigned   struct {
		DeviceDisplayName string `json:"device_display_name"`
	} `json:"unsigned"`
}

type KeysUploadReq

type KeysUploadReq struct {
	DeviceKeys  *KeysUploadReqDeviceKeys `json:"device_keys,omitempty"`
	OneTimeKeys map[string]interface{}   `json:"one_time_keys,omitempty"`
}

type KeysUploadReqDeviceKeys

type KeysUploadReqDeviceKeys struct {
	UserID     string                       `json:"user_id"`
	DeviceID   string                       `json:"device_id"`
	Algorithms []string                     `json:"algorithms"`
	Keys       map[string]string            `json:"keys"`
	Signatures map[string]map[string]string `json:"signatures"`
}

type KeysUploadResp

type KeysUploadResp struct {
	OneTimeKeyCounts map[string]int `json:"one_time_key_counts"`
}

type LoginBody

type LoginBody struct {
	Type                     string     `json:"type"`
	Identifier               Identifier `json:"identifier,omitempty"`
	User                     string     `json:"user,omitempty"`
	Medium                   string     `json:"medium,omitempty"`
	Address                  string     `json:"address,omitempty"`
	Password                 string     `json:"password,omitempty"`
	Token                    string     `json:"token,omitempty"`
	DeviceID                 string     `json:"device_id,omitempty"`
	InitialDeviceDisplayName string     `json:"initial_device_display_name,omitempty"`
}

5.4.2

type LoginResp

type LoginResp struct {
	UserID      string `json:"user_id"`
	AccessToken string `json:"access_token"`
	HomeServer  string `json:"home_server"`
	DeviceID    string `json:"device_id"`
	WellKnown   struct {
		Homeserver struct {
			BaseURL string `json:"base_url"`
		} `json:"m.homeserver"`
		IdentityServer struct {
			BaseURL string `json:"base_url"`
		} `json:"m.identity_server"`
	} `json:"well_known"`
}

type MatrixError

type MatrixError struct {
	Code string `json:"errcode"`
	Err  string `json:"error"`
}

func (MatrixError) Error

func (m MatrixError) Error() string

type MediaUploadResp

type MediaUploadResp struct {
	ContentURI string `json:"content_uri"`
}

type PutRoomEventBody

type PutRoomEventBody map[string]interface{}

9.6.2

type PutRoomEventResp

type PutRoomEventResp struct {
	EventID string `json:"event_id"`
}

type PutStateEventBody

type PutStateEventBody map[string]interface{}

9.6.1

type PutStateEventResp

type PutStateEventResp struct {
	EventID string `json:"event_id"`
}

type ReqTransactions

type ReqTransactions struct {
	Events []json.RawMessage `json:"events"`
}

type SendToDeviceReq

type SendToDeviceReq struct {
	Messages map[string]map[string]map[string]interface{} `json:"messages"`
}

type SyncResp

type SyncResp struct {
	NextBatch              string              `json:"next_batch"`
	Rooms                  SyncRespRooms       `json:"rooms,omitempty"`
	Presence               SyncRespPresence    `json:"presence,omitempty"`
	AccountData            SyncRespAccountData `json:"account_data,omitempty"`
	ToDevice               SyncRespToDevice    `json:"to_device,omitempty"`
	DeviceLists            SyncRespDeviceLists `json:"device_lists,omitempty"`
	DeviceOneTimeKeysCount map[string]int64    `json:"device_one_time_keys_count,omitempty"`
}

9.4.1

type SyncRespAccountData

type SyncRespAccountData struct {
	Events []json.RawMessage `json:"events,omitempty"`
}

type SyncRespDeviceLists

type SyncRespDeviceLists struct {
	Changed []string `json:"changed"`
	Left    []string `json:"left"`
}

type SyncRespEphemeral

type SyncRespEphemeral struct {
	Events []json.RawMessage `json:"events,omitempty"`
}

type SyncRespInviteState

type SyncRespInviteState struct {
	Events []json.RawMessage `json:"events,omitempty"`
}

type SyncRespPresence

type SyncRespPresence struct {
	Events []json.RawMessage `json:"events,omitempty"`
}

type SyncRespRoomSummary

type SyncRespRoomSummary struct {
	Heroes              []string `json:"m.heroes,omitempty"`
	JoinedMembersCount  int      `json:"m.joined_members_count,omitempty"`
	InvitedMembersCOund int      `json:"m.invited_members_count,omitempty"`
}

type SyncRespRooms

type SyncRespRooms struct {
	Join   map[string]SyncRespRoomsJoin   `json:"join,omitempty"`
	Invite map[string]SyncRespRoomsInvite `json:"invite,omitempty"`
	Leave  map[string]SyncRespRoomsLeave  `json:"leave,omitempty"`
}

type SyncRespRoomsInvite

type SyncRespRoomsInvite struct {
	InviteState SyncRespInviteState `json:"invite_state,omitempty"`
}

type SyncRespRoomsJoin

type SyncRespRoomsJoin struct {
	Summary             SyncRespRoomSummary              `json:"summary,omitempty"`
	State               SyncRespState                    `json:"state,omitempty"`
	Timeline            SyncRespTimeline                 `json:"timeline,omitempty"`
	Ephemeral           SyncRespEphemeral                `json:"ephemeral,omitempty"`
	AccountData         SyncRespAccountData              `json:"account_data,omitempty"`
	UnreadNotifications SyncRespUnreadNotificationCounts `json:"unread_notifications,omitempty"`
}

type SyncRespRoomsLeave

type SyncRespRoomsLeave struct {
	State       SyncRespState       `json:"state,omitempty"`
	Timeline    SyncRespTimeline    `json:"timeline,omitempty"`
	AccountData SyncRespAccountData `json:"account_data,omitempty"`
}

type SyncRespState

type SyncRespState struct {
	Events []json.RawMessage `json:"events,omitempty"`
}

type SyncRespTimeline

type SyncRespTimeline struct {
	Events    []json.RawMessage `json:"events,omitempty"`
	Limited   bool              `json:"limited,omitempty"`
	PrevBatch string            `json:"prev_batch,omitempty"`
}

type SyncRespToDevice

type SyncRespToDevice struct {
	Events []json.RawMessage `json:"events"`
}

type SyncRespUnreadNotificationCounts

type SyncRespUnreadNotificationCounts struct {
	HighlightCount    int `json:"hightlight_count,omitempty"`
	NotificationCount int `json:"notification_count,omitempty"`
}

type SyncRespUnsignedData

type SyncRespUnsignedData struct {
	Age             int64           `json:"age,omitempty"`
	RedactedBecause json.RawMessage `json:"redacted_because,omitempty"`
	TransactionID   string          `json:"transaction_id,omitempty"`
}

type VersionsResp

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

2.1

type WhoamiResp

type WhoamiResp struct {
	UserID string `json:"user_Id"`
}

Jump to

Keyboard shortcuts

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