matrix

package
v0.0.0-...-536f513 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatrixSearchLimit = 100 // default matrix (!) search limit

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server server

func NewServer

func NewServer(cfg configService, data dataRepository, search searchService) (*Server, error)

NewServer creates new matrix server

func (*Server) Authorize

func (s *Server) Authorize(serverName, method, uri string, body any) ([]string, error)

Authorize request

func (*Server) GetClientDirectory

func (s *Server) GetClientDirectory(ctx context.Context, alias string) (int, []byte)

GetClientDirectory is /_matrix/client/v3/directory/room/{roomAlias}

func (*Server) GetClientMediaThumbnail

func (s *Server) GetClientMediaThumbnail(ctx context.Context, serverName, mediaID string, params url.Values) (io.Reader, string)

GetClientMediaThumbnail is /_matrix/media/v3/thumbnail/{serverName}/{mediaID}

func (*Server) GetClientRoomSummary

func (s *Server) GetClientRoomSummary(ctx context.Context, aliasOrID string) (int, []byte)

GetClientRoomSummary is /_matrix/client/unstable/is.nheko.summary/summary/{roomIdOrAlias}

func (*Server) GetClientRoomVisibility

func (s *Server) GetClientRoomVisibility(ctx context.Context, id string) (int, []byte)

GetClientRoomVisibility is /_matrix/client/v3/directory/list/room/{roomID}

func (*Server) GetClientVersion

func (s *Server) GetClientVersion() []byte

GetClientVersion returns json-eligible response for /_matrix/client/versions

func (*Server) GetClientWellKnown

func (s *Server) GetClientWellKnown() []byte

GetClientWellKnown returns json-eligible response for /.well-known/matrix/client

func (*Server) GetKeyServer

func (s *Server) GetKeyServer(ctx context.Context) []byte

GetKeyServer returns jsonblob-eligible response for /_matrix/key/v2/server

func (*Server) GetServerVersion

func (s *Server) GetServerVersion() []byte

GetServerVersion returns json-eligible response for /_matrix/federation/v1/version

func (*Server) GetServerWellKnown

func (s *Server) GetServerWellKnown() []byte

GetServerWellKnown returns json-eligible response for /.well-known/matrix/server

func (*Server) GetSupportWellKnown

func (s *Server) GetSupportWellKnown() []byte

GetSupportWellKnown returns json-eligible response for /.well-known/matrix/support

func (*Server) PublicRooms

func (s *Server) PublicRooms(ctx context.Context, req *http.Request, rdReq *model.RoomDirectoryRequest) (int, []byte)

PublicRooms returns /_matrix/federation/v1/publicRooms response

func (*Server) QueryCSURL

func (s *Server) QueryCSURL(ctx context.Context, serverName string) string

QueryCSURL returns URL of Matrix CS API server

func (*Server) QueryDirectory

func (s *Server) QueryDirectory(ctx context.Context, req *http.Request, alias string) (int, []byte)

QueryDirectory is /_matrix/federation/v1/query/directory?room_alias={roomAlias}

func (*Server) QueryPublicRooms

func (s *Server) QueryPublicRooms(ctx context.Context, serverName, limit, since string) (*model.RoomDirectoryResponse, error)

QueryPublicRooms over federation

func (*Server) QueryServerName

func (s *Server) QueryServerName(ctx context.Context, serverName string) (string, error)

QueryServerName finds server name on the /_matrix/key/v2/server page

func (*Server) QueryVersion

func (s *Server) QueryVersion(ctx context.Context, serverName string) (server, version string, err error)

QueryVersion from /_matrix/federation/v1/version

func (*Server) SetDiscover

func (s *Server) SetDiscover(discover func(context.Context, string) int)

SetDiscover func

func (*Server) ValidateAuth

func (s *Server) ValidateAuth(ctx context.Context, r *http.Request) (serverName string, err error)

ValidateAuth validates matrix auth

Jump to

Keyboard shortcuts

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