syncapitypes

package
v0.0.0-...-9835270 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientEvents

type ClientEvents []gomatrixserverlib.ClientEvent

func (ClientEvents) Len

func (es ClientEvents) Len() int

func (ClientEvents) Less

func (es ClientEvents) Less(i, j int) bool

func (ClientEvents) Swap

func (es ClientEvents) Swap(i, j int)

type ContextEventResp

type ContextEventResp struct {
	Start     string                           `json:"start"`
	End       string                           `json:"end"`
	EvsBefore []gomatrixserverlib.ClientEvent  `json:"events_before"`
	Event     gomatrixserverlib.ClientEvent    `json:"event"`
	EvsAfter  []gomatrixserverlib.ClientEvent  `json:"events_after"`
	State     []*gomatrixserverlib.ClientEvent `json:"state"`
}

func (*ContextEventResp) Decode

func (r *ContextEventResp) Decode(input []byte) error

func (*ContextEventResp) Encode

func (r *ContextEventResp) Encode() ([]byte, error)

type DeviceLists

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

type InviteResponse

type InviteResponse struct {
	InviteState struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"invite_state"`
}

InviteResponse represents a /sync response for a room which is under the 'invite' key.

func NewInviteResponse

func NewInviteResponse() *InviteResponse

NewInviteResponse creates an empty response with initialised arrays.

type JoinResponse

type JoinResponse struct {
	State struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"state"`
	Timeline struct {
		Events    []gomatrixserverlib.ClientEvent `json:"events"`
		Limited   bool                            `json:"limited"`
		PrevBatch string                          `json:"prev_batch"`
	} `json:"timeline"`
	Ephemeral struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"ephemeral"`
	AccountData struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"account_data"`
	Unread *UnreadNotifications `json:"unread_notifications,omitempty"`
}

JoinResponse represents a /sync response for a room which is under the 'join' key.

func NewJoinResponse

func NewJoinResponse() *JoinResponse

NewJoinResponse creates an empty response with initialised arrays.

type JoinedRoomsResp

type JoinedRoomsResp struct {
	JoinedRooms []string `json:"joined_rooms,omitempty"`
}

func (*JoinedRoomsResp) Decode

func (r *JoinedRoomsResp) Decode(input []byte) error

func (*JoinedRoomsResp) Encode

func (r *JoinedRoomsResp) Encode() ([]byte, error)

type KeyChanged

type KeyChanged struct {
	Changes []string `json:"changed"`
}

func (*KeyChanged) Decode

func (r *KeyChanged) Decode(input []byte) error

func (*KeyChanged) Encode

func (r *KeyChanged) Encode() ([]byte, error)

type LeaveResponse

type LeaveResponse struct {
	State struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"state"`
	Timeline struct {
		Events    []gomatrixserverlib.ClientEvent `json:"events"`
		Limited   bool                            `json:"limited"`
		PrevBatch string                          `json:"prev_batch"`
	} `json:"timeline"`
}

LeaveResponse represents a /sync response for a room which is under the 'leave' key.

func NewLeaveResponse

func NewLeaveResponse() *LeaveResponse

NewLeaveResponse creates an empty response with initialised arrays.

type MemberResponse

type MemberResponse struct {
	Chunk []gomatrixserverlib.ClientEvent `json:"chunk"`
}

func (*MemberResponse) Decode

func (r *MemberResponse) Decode(input []byte) error

func (*MemberResponse) Encode

func (r *MemberResponse) Encode() ([]byte, error)

type MessageEventResp

type MessageEventResp struct {
	Start string                          `json:"start,omitempty"`
	Chunk []gomatrixserverlib.ClientEvent `json:"chunk"`
	End   string                          `json:"end,omitempty"`
}

func (*MessageEventResp) Decode

func (r *MessageEventResp) Decode(input []byte) error

func (*MessageEventResp) Encode

func (r *MessageEventResp) Encode() ([]byte, error)

type PaginationChunk

type PaginationChunk struct {
	Start string                          `json:"start"`
	Chunk []gomatrixserverlib.ClientEvent `json:"chunk"`
	End   string                          `json:"end"`
}

func (*PaginationChunk) Decode

func (p *PaginationChunk) Decode(input []byte) error

func (*PaginationChunk) Encode

func (p *PaginationChunk) Encode() ([]byte, error)

type PrevEventRef

type PrevEventRef struct {
	PrevContent   jsonRaw.RawMessage `json:"prev_content"`
	ReplacesState string             `json:"replaces_state"`
	PrevSender    string             `json:"prev_sender"`
	PreOffset     int64              `json:"prev_offset"`
}

PrevEventRef represents a reference to a previous event in a state event upgrade

type ReceiptUpdate

type ReceiptUpdate struct {
	Users  []string `json:"users"`
	Offset int64    `json:"offset"`
	RoomID string   `json:"room_id"`
}

type Response

type Response struct {
	NextBatch   string `json:"next_batch"`
	AccountData struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"account_data"`
	Presence struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"presence"`
	Rooms struct {
		Join   map[string]JoinResponse   `json:"join"`
		Invite map[string]InviteResponse `json:"invite"`
		Leave  map[string]LeaveResponse  `json:"leave"`
	} `json:"rooms"`
	/* extensions */
	// ToDevice send to device extension
	ToDevice ToDevice `json:"to_device"`
	// DeviceList encryptoapi key management /keyChange extension
	DeviceList DeviceLists `json:"device_lists"`
	// compatibility with no definition todo: del it
	SignNum map[string]int `json:"device_one_time_keys_count"`
	Lock    *sync.Mutex    `json:"-"`
}

Response represents a /sync API response. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync

func NewResponse

func NewResponse(pos StreamPosition) *Response

NewResponse creates an empty response with initialised maps.

func (*Response) Decode

func (p *Response) Decode(input []byte) error

func (*Response) Encode

func (p *Response) Encode() ([]byte, error)

type RoomInfo

type RoomInfo struct {
	RoomID     string `json:"room_id"`
	Membership string `json:"membership"`
	//Invite      gomatrixserverlib.ClientEvent   `json:"invite"`
	Messages    PaginationChunk                 `json:"messages"`
	State       []gomatrixserverlib.ClientEvent `json:"state"`
	Visibility  string                          `json:"visibility", omitempty`
	AccountData []gomatrixserverlib.ClientEvent `json:"account_data"`
	Presence    struct {
		Events []gomatrixserverlib.ClientEvent `json:"events"`
	} `json:"presence"`
}

func (*RoomInfo) Decode

func (r *RoomInfo) Decode(input []byte) error

func (*RoomInfo) Encode

func (r *RoomInfo) Encode() ([]byte, error)

type StateEventInState

type StateEventInState struct {
	gomatrixserverlib.ClientEvent
	PrevContent   jsonRaw.RawMessage `json:"prev_content,omitempty"`
	ReplacesState string             `json:"replaces_state,omitempty"`
}

type StateEventInStateResp

type StateEventInStateResp []StateEventInState

func (StateEventInStateResp) Decode

func (r StateEventInStateResp) Decode(input []byte) error

func (StateEventInStateResp) Encode

func (r StateEventInStateResp) Encode() ([]byte, error)

type StdHolder

type StdHolder struct {
	StreamID int64  `json:"stream_id"`
	Sender   string `json:"sender"`
	EventTyp string `json:"event_type"`
	Event    []byte `json:"event"`
}

type StreamPosition

type StreamPosition int64

StreamPosition represents the offset in the sync stream a client is at.

func (StreamPosition) String

func (sp StreamPosition) String() string

String implements the Stringer interface.

type SyncRoom

type SyncRoom struct {
	RoomID    string `json:"room_id,omitempty"`
	RoomState string `json:"room_state,omitempty"`
	Start     int64  `json:"start,omitempty"`
	End       int64  `json:"end,omitempty"`
}

type SyncServerRequest

type SyncServerRequest struct {
	RequestType      string     `json:"request_type,omitempty"`
	InviteRooms      []SyncRoom `json:"invite_rooms,omitempty"`
	JoinRooms        []SyncRoom `json:"join_rooms,omitempty"`
	LeaveRooms       []SyncRoom `json:"leave_rooms,omitempty"`
	JoinedRooms      []string   `json:"joined_rooms,omitempty"`
	UserID           string     `json:"user_id,omitempty"`
	DeviceID         string     `json:"device_id,omitempty"`
	ReceiptOffset    int64      `json:"receipt_offset,omitempty"`
	MaxReceiptOffset int64      `json:"max_receipt_offset,omitempty"`
	IsHuman          bool       `json:"is_human,omitempty"`
	Limit            int        `json:"limit,omitempty"`
	LoadReady        bool       `json:"load_ready,omitempty"`
	SyncReady        bool       `json:"sync_ready,omitempty"`
	SyncInstance     uint32     `json:"sync_instance"`
	IsFullSync       bool       `json:"is_full_sync"`
	Reply            string
	TraceID          string `json:"trace_id"`
	Slot             uint32 `json:"slot"`
	RSlot            uint32 `json:"rslot"`
}

type SyncServerResponse

type SyncServerResponse struct {
	Rooms struct {
		Join   map[string]JoinResponse   `json:"join,omitempty"`
		Invite map[string]InviteResponse `json:"invite,omitempty"`
		Leave  map[string]LeaveResponse  `json:"leave,omitempty"`
	} `json:"rooms,omitempty"`
	MaxReceiptOffset int64            `json:"max_receipt_offset,omitempty"`
	AllLoaded        bool             `json:"all_loaded,omitempty"`
	NewUsers         []string         `json:"new_users,omitempty"`
	Ready            bool             `json:"ready,omitempty"`
	MaxRoomOffset    map[string]int64 `json:"max_room_offset,omitempty"`
}

type SyncUnreadRequest

type SyncUnreadRequest struct {
	JoinRooms    []string `json:"join_rooms,omitempty"`
	UserID       string   `json:"user_id,omitempty"`
	SyncInstance uint32   `json:"sync_instance"`
	Reply        string
}

type SyncUnreadResponse

type SyncUnreadResponse struct {
	Count int64 `json:"count,omitempty"`
}

type ToDevice

type ToDevice struct {
	StdEvent []types.StdEvent `json:"events"`
}

type TypingUpdate

type TypingUpdate struct {
	Type      string   `json:"type,omitempty"`
	RoomID    string   `json:"room_id,omitempty"`
	UserID    string   `json:"user_id,omitempty"`
	DeviceID  string   `json:"device_id,omitempty"`
	RoomUsers []string `json:"users"`
}

type UnreadNotifications

type UnreadNotifications struct {
	HighLightCount    int64 `json:"highlight_count"`
	NotificationCount int64 `json:"notification_count"`
}

type UserTimeLineStream

type UserTimeLineStream struct {
	Offset     int64  `json:"offset,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	RoomID     string `json:"room_id,omitempty"`
	RoomOffset int64  `json:"room_offset,omitempty"`
	RoomState  string `json:"room_state,omitempty"`
}

Jump to

Keyboard shortcuts

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