api

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package api provides the types that are used to communicate with the typing server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendReceipt added in v0.3.0

func SendReceipt(
	ctx context.Context,
	eduAPI EDUServerInputAPI, userID, roomID, eventID, receiptType string,
	timestamp gomatrixserverlib.Timestamp,
) error

SendReceipt sends a receipt event to EDU Server

func SendToDevice

func SendToDevice(
	ctx context.Context, eduAPI EDUServerInputAPI, sender, userID, deviceID, eventType string,
	message interface{},
) error

SendToDevice sends a typing event to EDU server

func SendTyping

func SendTyping(
	ctx context.Context, eduAPI EDUServerInputAPI, userID, roomID string,
	typing bool, timeoutMS int64,
) error

SendTyping sends a typing event to EDU server

Types

type EDUServerInputAPI

type EDUServerInputAPI interface {
	InputTypingEvent(
		ctx context.Context,
		request *InputTypingEventRequest,
		response *InputTypingEventResponse,
	) error

	InputSendToDeviceEvent(
		ctx context.Context,
		request *InputSendToDeviceEventRequest,
		response *InputSendToDeviceEventResponse,
	) error

	InputReceiptEvent(
		ctx context.Context,
		request *InputReceiptEventRequest,
		response *InputReceiptEventResponse,
	) error
}

EDUServerInputAPI is used to write events to the typing server.

type FederationReceiptData added in v0.3.0

type FederationReceiptData struct {
	Data     ReceiptTS `json:"data"`
	EventIDs []string  `json:"event_ids"`
}

type FederationReceiptMRead added in v0.3.0

type FederationReceiptMRead struct {
	User map[string]FederationReceiptData `json:"m.read"`
}

FederationSender output

type InputReceiptEvent added in v0.3.0

type InputReceiptEvent struct {
	UserID    string                      `json:"user_id"`
	RoomID    string                      `json:"room_id"`
	EventID   string                      `json:"event_id"`
	Type      string                      `json:"type"`
	Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
}

type InputReceiptEventRequest added in v0.3.0

type InputReceiptEventRequest struct {
	InputReceiptEvent InputReceiptEvent `json:"input_receipt_event"`
}

InputReceiptEventRequest is a request to EDUServerInputAPI

type InputReceiptEventResponse added in v0.3.0

type InputReceiptEventResponse struct{}

InputReceiptEventResponse is a response to InputReceiptEventRequest

type InputSendToDeviceEvent

type InputSendToDeviceEvent struct {
	UserID   string `json:"user_id"`
	DeviceID string `json:"device_id"`
	gomatrixserverlib.SendToDeviceEvent
}

type InputSendToDeviceEventRequest

type InputSendToDeviceEventRequest struct {
	InputSendToDeviceEvent InputSendToDeviceEvent `json:"input_send_to_device_event"`
}

InputSendToDeviceEventRequest is a request to EDUServerInputAPI

type InputSendToDeviceEventResponse

type InputSendToDeviceEventResponse struct{}

InputSendToDeviceEventResponse is a response to InputSendToDeviceEventRequest

type InputTypingEvent

type InputTypingEvent struct {
	// UserID of the user to update typing status.
	UserID string `json:"user_id"`
	// RoomID of the room the user is typing (or has stopped).
	RoomID string `json:"room_id"`
	// Typing is true if the user is typing, false if they have stopped.
	Typing bool `json:"typing"`
	// Timeout is the interval in milliseconds for which the user should be marked as typing.
	TimeoutMS int64 `json:"timeout"`
	// OriginServerTS when the server received the update.
	OriginServerTS gomatrixserverlib.Timestamp `json:"origin_server_ts"`
}

InputTypingEvent is an event for notifying the typing server about typing updates.

type InputTypingEventRequest

type InputTypingEventRequest struct {
	InputTypingEvent InputTypingEvent `json:"input_typing_event"`
}

InputTypingEventRequest is a request to EDUServerInputAPI

type InputTypingEventResponse

type InputTypingEventResponse struct{}

InputTypingEventResponse is a response to InputTypingEvents

type OutputReceiptEvent added in v0.3.0

type OutputReceiptEvent struct {
	UserID    string                      `json:"user_id"`
	RoomID    string                      `json:"room_id"`
	EventID   string                      `json:"event_id"`
	Type      string                      `json:"type"`
	Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
}

OutputReceiptEvent is an entry in the receipt output kafka log

type OutputSendToDeviceEvent

type OutputSendToDeviceEvent struct {
	UserID   string `json:"user_id"`
	DeviceID string `json:"device_id"`
	gomatrixserverlib.SendToDeviceEvent
}

OutputSendToDeviceEvent is an entry in the send-to-device output kafka log. This contains the full event content, along with the user ID and device ID to which it is destined.

type OutputTypingEvent

type OutputTypingEvent struct {
	// The Event for the typing edu event.
	Event TypingEvent `json:"event"`
	// ExpireTime is the interval after which the user should no longer be
	// considered typing. Only available if Event.Typing is true.
	ExpireTime *time.Time
}

OutputTypingEvent is an entry in typing server output kafka log. This contains the event with extra fields used to create 'm.typing' event in clientapi & federation.

type ReceiptEvent added in v0.3.0

type ReceiptEvent struct {
	UserID    string                      `json:"user_id"`
	RoomID    string                      `json:"room_id"`
	EventID   string                      `json:"event_id"`
	Type      string                      `json:"type"`
	Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
}

type ReceiptMRead added in v0.3.0

type ReceiptMRead struct {
	User map[string]ReceiptTS `json:"m.read"`
}

Helper structs for receipts json creation

type ReceiptTS added in v0.3.0

type ReceiptTS struct {
	TS gomatrixserverlib.Timestamp `json:"ts"`
}

type TypingEvent

type TypingEvent struct {
	Type   string `json:"type"`
	RoomID string `json:"room_id"`
	UserID string `json:"user_id"`
	Typing bool   `json:"typing"`
}

TypingEvent represents a matrix edu event of type 'm.typing'.

Jump to

Keyboard shortcuts

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