Documentation ¶
Overview ¶
package extensions contains the interface and concrete implementations for all sliding sync extensions
Index ¶
- func ExtensionEnabled(r GenericRequest) bool
- type AccountDataRequest
- type AccountDataResponse
- type Context
- type E2EEDeviceList
- type E2EEFetcher
- type E2EERequest
- type E2EEResponse
- type Enableable
- type GenericRequest
- type GenericResponse
- type Handler
- type HandlerInterface
- type ReceiptsRequest
- type ReceiptsResponse
- type Request
- type Response
- type ToDeviceRequest
- type ToDeviceResponse
- type TypingRequest
- type TypingResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtensionEnabled ¶ added in v0.99.1
func ExtensionEnabled(r GenericRequest) bool
Types ¶
type AccountDataRequest ¶
type AccountDataRequest struct {
Enableable
}
Client created request params
func (*AccountDataRequest) AppendLive ¶ added in v0.99.1
func (*AccountDataRequest) Name ¶ added in v0.99.1
func (r *AccountDataRequest) Name() string
func (*AccountDataRequest) ProcessInitial ¶ added in v0.99.1
func (r *AccountDataRequest) ProcessInitial(ctx context.Context, res *Response, extCtx Context)
type AccountDataResponse ¶
type AccountDataResponse struct { Global []json.RawMessage `json:"global,omitempty"` Rooms map[string][]json.RawMessage `json:"rooms,omitempty"` }
Server response
func (*AccountDataResponse) HasData ¶
func (r *AccountDataResponse) HasData(isInitial bool) bool
type E2EEDeviceList ¶
type E2EEFetcher ¶ added in v0.99.0
type E2EEFetcher interface {
DeviceData(userID, deviceID string, isInitial bool) *internal.DeviceData
}
Fetcher used by the E2EE extension
type E2EERequest ¶
type E2EERequest struct {
Enableable
}
Client created request params
func (*E2EERequest) AppendLive ¶ added in v0.99.1
func (*E2EERequest) Name ¶ added in v0.99.1
func (r *E2EERequest) Name() string
func (*E2EERequest) ProcessInitial ¶ added in v0.99.1
func (r *E2EERequest) ProcessInitial(ctx context.Context, res *Response, extCtx Context)
type E2EEResponse ¶
type E2EEResponse struct { OTKCounts map[string]int `json:"device_one_time_keys_count,omitempty"` DeviceLists *E2EEDeviceList `json:"device_lists,omitempty"` FallbackKeyTypes []string `json:"device_unused_fallback_key_types,omitempty"` }
Server response
func (*E2EEResponse) HasData ¶
func (r *E2EEResponse) HasData(isInitial bool) bool
type Enableable ¶ added in v0.99.1
type Enableable struct {
Enabled *bool `json:"enabled"`
}
mixin for managing the enabled flag
func (*Enableable) ApplyDelta ¶ added in v0.99.1
func (r *Enableable) ApplyDelta(gnext GenericRequest)
func (*Enableable) IsEnabled ¶ added in v0.99.1
func (r *Enableable) IsEnabled() *bool
func (*Enableable) Name ¶ added in v0.99.1
func (r *Enableable) Name() string
type GenericRequest ¶ added in v0.99.1
type GenericRequest interface { Name() string // Returns the value of the `enabled` JSON key. nil for "not specified". IsEnabled() *bool // Overwrite fields in the request by side-effecting on this struct. ApplyDelta(next GenericRequest) // Process this request and put the response into *Response. This is called for every request // before going into a live stream loop. ProcessInitial(ctx context.Context, res *Response, extCtx Context) // Process a live event, /aggregating/ the response in *Response. This function can be called // multiple times per sync loop as the conn buffer is consumed. AppendLive(ctx context.Context, res *Response, extCtx Context, up caches.Update) }
type GenericResponse ¶ added in v0.99.1
type Handler ¶
type Handler struct { Store *state.Storage E2EEFetcher E2EEFetcher GlobalCache *caches.GlobalCache }
type HandlerInterface ¶
type ReceiptsRequest ¶
type ReceiptsRequest struct {
Enableable
}
Client created request params
func (*ReceiptsRequest) AppendLive ¶ added in v0.99.1
func (*ReceiptsRequest) Name ¶ added in v0.99.1
func (r *ReceiptsRequest) Name() string
func (*ReceiptsRequest) ProcessInitial ¶ added in v0.99.1
func (r *ReceiptsRequest) ProcessInitial(ctx context.Context, res *Response, extCtx Context)
type ReceiptsResponse ¶
type ReceiptsResponse struct { // room_id -> m.receipt ephemeral event Rooms map[string]json.RawMessage `json:"rooms,omitempty"` }
Server response
func (*ReceiptsResponse) HasData ¶
func (r *ReceiptsResponse) HasData(isInitial bool) bool
type Request ¶
type Request struct { ToDevice *ToDeviceRequest `json:"to_device"` E2EE *E2EERequest `json:"e2ee"` AccountData *AccountDataRequest `json:"account_data"` Typing *TypingRequest `json:"typing"` Receipts *ReceiptsRequest `json:"receipts"` }
Request is the JSON request body under 'extensions'.
To add new extensions, add a field here and return it in fields() whilst setting it correctly in setFields().
func (Request) ApplyDelta ¶
func (Request) EnabledExtensions ¶ added in v0.99.1
func (r Request) EnabledExtensions() (exts []GenericRequest)
type Response ¶
type Response struct { ToDevice *ToDeviceResponse `json:"to_device,omitempty"` E2EE *E2EEResponse `json:"e2ee,omitempty"` AccountData *AccountDataResponse `json:"account_data,omitempty"` Typing *TypingResponse `json:"typing,omitempty"` Receipts *ReceiptsResponse `json:"receipts,omitempty"` }
Response represents the top-level `extensions` key in the JSON response.
To add a new extension, add a field here and in fields().
type ToDeviceRequest ¶
type ToDeviceRequest struct { Enableable Limit int `json:"limit"` // max number of to-device messages per response Since string `json:"since"` // since token }
Client created request params
func (*ToDeviceRequest) AppendLive ¶ added in v0.99.1
func (*ToDeviceRequest) ApplyDelta ¶
func (r *ToDeviceRequest) ApplyDelta(gnext GenericRequest)
func (*ToDeviceRequest) Name ¶ added in v0.99.1
func (r *ToDeviceRequest) Name() string
func (*ToDeviceRequest) ProcessInitial ¶ added in v0.99.1
func (r *ToDeviceRequest) ProcessInitial(ctx context.Context, res *Response, extCtx Context)
type ToDeviceResponse ¶
type ToDeviceResponse struct { NextBatch string `json:"next_batch"` Events []json.RawMessage `json:"events,omitempty"` }
Server response
func (*ToDeviceResponse) HasData ¶
func (r *ToDeviceResponse) HasData(isInitial bool) bool
type TypingRequest ¶
type TypingRequest struct {
Enableable
}
Client created request params
func (*TypingRequest) AppendLive ¶ added in v0.99.1
func (*TypingRequest) Name ¶ added in v0.99.1
func (r *TypingRequest) Name() string
func (*TypingRequest) ProcessInitial ¶ added in v0.99.1
func (r *TypingRequest) ProcessInitial(ctx context.Context, res *Response, extCtx Context)
type TypingResponse ¶
type TypingResponse struct {
Rooms map[string]json.RawMessage `json:"rooms,omitempty"`
}
Server response
func (*TypingResponse) HasData ¶
func (r *TypingResponse) HasData(isInitial bool) bool