sync

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceLists

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

DeviceLists contains information about device changes.

type EventContainer

type EventContainer struct {
	Events []event.Opaque `json:"events"`
}

EventContainer represents map that just contains an event field.

There is a lot of those in Response...

type InvitedRoom

type InvitedRoom struct {
	State EventContainer `json:"invite_state"`
}

InvitedRoom is a room the client was invited to.

type JoinedRoom

type JoinedRoom struct {
	AccountData               EventContainer            `json:"account_data"`
	Ephemeral                 EventContainer            `json:"ephemeral"`
	State                     EventContainer            `json:"state"`
	Summary                   RoomSummary               `json:"summary"`
	Timeline                  Timeline                  `json:"timeline"`
	UnreadNotificationsCounts UnreadNotificationsCounts `json:"unread_notifications"`
}

JoinedRoom is a room the client has joined.

type KnockedRoom

type KnockedRoom struct {
	KnockState EventContainer `json:"knock_state"`
}

KnockedRoom is a room the client has knocked on.

type LeftRoom

type LeftRoom struct {
	AccountData EventContainer `json:"account_data"`
	State       EventContainer `json:"ephemeral"`
	Timeline    Timeline       `json:"timeline"`
}

LeftRoom is a room the client has left.

type Response

type Response struct {
	matrix.Response
	AccountData            EventContainer `json:"account_data"`
	DeviceLists            DeviceLists    `json:"device_lists"`
	DeviceOneTimeKeysCount map[string]int `json:"device_one_time_keys_count"`
	NextBatch              string         `json:"next_batch"`
	Presence               EventContainer `json:"presence"`
	Rooms                  Rooms          `json:"rooms"`
	ToDevice               EventContainer `json:"to_device"`
}

Response of a sync request.

func Sync

func Sync(ctx context.Context, cli matrix.Client, since, filter string, timeoutMilliSeconds int) (Response, error)

Sync state with the given client. Since indicate where to start the response, filter which filter to use and timeoutMilliSeconds tells the server how long to block if the return limit set by the filter is not reached yet. The sync request will time out 10 seconds after that limit.

type RoomSummary

type RoomSummary struct {
	Heros              []string `json:"m.heroes"`
	InvitedMemberCount int      `json:"m.invited_member_count"`
	JoinedMemeberCount int      `json:"m.joined_member_count"`
}

RoomSummary for joined rooms.

type Rooms

type Rooms struct {
	Invited map[string]InvitedRoom `json:"invite"`
	Joined  map[string]JoinedRoom  `json:"join"`
	Knocked map[string]KnockedRoom `json:"knock"`
	Left    map[string]LeftRoom    `json:"leave"`
}

Rooms contains information about rooms the client has interacted with, grouped by state.

type Timeline

type Timeline struct {
	Events        []event.Opaque `json:"events"`
	Limited       bool           `json:"limited"`
	PreviousBatch string         `json:"prev_batch"`
}

Timeline represents events of a room.

type UnreadNotificationsCounts

type UnreadNotificationsCounts struct {
	Highlighted int `json:"highlight_count"`
	Total       int `json:"total"`
}

UnreadNotificationsCounts contains notication counts of a joined room.

Jump to

Keyboard shortcuts

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