api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 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 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
}

EDUServerInputAPI is used to write events to the typing server.

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 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 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