msc2946

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package msc2946 'Spaces Summary' implements https://github.com/matrix-org/matrix-doc/pull/2946

Index

Constants

View Source
const (
	ConstCreateEventContentKey = "org.matrix.msc1772.type"
	ConstSpaceChildEventType   = "org.matrix.msc1772.space.child"
	ConstSpaceParentEventType  = "org.matrix.msc1772.space.parent"
)

Variables

This section is empty.

Functions

func Enable

Enable this MSC

func SpaceTarget

func SpaceTarget(he *gomatrixserverlib.HeaderedEvent) string

SpaceTarget returns the destination room ID for the space event. This is either a child or a parent depending on the event type.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func (*DB) References

func (d *DB) References(ctx context.Context, roomID string) ([]*gomatrixserverlib.HeaderedEvent, error)

func (*DB) StoreReference

func (d *DB) StoreReference(ctx context.Context, he *gomatrixserverlib.HeaderedEvent) error

type Database

type Database interface {
	// StoreReference persists a child or parent space mapping.
	StoreReference(ctx context.Context, he *gomatrixserverlib.HeaderedEvent) error
	// References returns all events which have the given roomID as a parent or child space.
	References(ctx context.Context, roomID string) ([]*gomatrixserverlib.HeaderedEvent, error)
}

func NewDatabase

func NewDatabase(dbOpts *config.DatabaseOptions) (Database, error)

NewDatabase loads the database for msc2836

type Room

type Room struct {
	gomatrixserverlib.PublicRoom
	NumRefs  int    `json:"num_refs"`
	RoomType string `json:"room_type"`
}

Room is a node on the space graph

type SpacesRequest

type SpacesRequest struct {
	MaxRoomsPerSpace int    `json:"max_rooms_per_space"`
	Limit            int    `json:"limit"`
	Batch            string `json:"batch"`
}

SpacesRequest is the request body to POST /_matrix/client/r0/rooms/{roomID}/spaces

func (*SpacesRequest) Defaults

func (r *SpacesRequest) Defaults()

Defaults sets the request defaults

type SpacesResponse

type SpacesResponse struct {
	NextBatch string `json:"next_batch"`
	// Rooms are nodes on the space graph.
	Rooms []Room `json:"rooms"`
	// Events are edges on the space graph, exclusively m.space.child or m.space.parent events
	Events []gomatrixserverlib.ClientEvent `json:"events"`
}

SpacesResponse is the response body to POST /_matrix/client/r0/rooms/{roomID}/spaces

Jump to

Keyboard shortcuts

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