api

package
v0.0.0-...-ae88a1b Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

The API package is a the transport independent logic to perform the Matrix API functionalities from the specification. Any exported function in the module is intended to be used by any of the implemented transport protocols and only takes and produces json-serializable objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRoom

func CreateRoom(user *s.User, req io.Reader, vars Vars, query Query) (interface{}, error)

func GetAvatarURL

func GetAvatarURL(req_user *s.User, request io.Reader, vars Vars, q Query) (interface{}, error)

func GetDisplayName

func GetDisplayName(req_user *s.User, request io.Reader, vars Vars, q Query) (interface{}, error)

func GetEvents

func GetEvents(user *s.User, request io.Reader, vars Vars, query Query) (interface{}, error)

func GetInitialSync

func GetInitialSync(user *s.User, request io.Reader, vars Vars, query Query) (interface{}, error)

func GetLoginFlows

func GetLoginFlows(request io.Reader, v Vars, q Query) (interface{}, error)

func GetPresence

func GetPresence(cur_user *s.User, request io.Reader, vars Vars, query Query) (interface{}, error)

func JoinRoom

func JoinRoom(user *s.User, req io.Reader, vars Vars, query Query) (interface{}, error)

func ListPublicRooms

func ListPublicRooms(user *s.User, req io.Reader, vars Vars, query Query) (interface{}, error)

func LoginRequest

func LoginRequest(request io.Reader, v Vars, q Query) (interface{}, error)

Request login authentication for a user, an api.Error will be returned if the authentication did not succeed. Otherwise a proper response according to chosen login type should be returned.

func RegistrationRequest

func RegistrationRequest(request io.Reader, v Vars, q Query) (interface{}, error)

Request registration of a new user, an api.Error will be returned if the registration did not succeed. Otherwise a proper response according to chosen registration type should be returned.

func UpdateAvatarURL

func UpdateAvatarURL(user *s.User, request io.Reader, vars Vars, q Query) (interface{}, error)

func UpdateDisplayName

func UpdateDisplayName(user *s.User, request io.Reader, vars Vars, q Query) (interface{}, error)

func UpdatePresence

func UpdatePresence(user *s.User, request io.Reader, vars Vars, query Query) (interface{}, error)

Types

type AuthEndpoint

type AuthEndpoint func(*s.User, io.Reader, Vars, Query) (interface{}, error)

type Error

type Error struct {
	ErrorCode string `json:"errcode"`
	ErrorMsg  string `json:"error"`
}

func EBadJSON

func EBadJSON(msg string) Error

func EForbidden

func EForbidden(msg string) Error

func ENotFound

func ENotFound(msg string) Error

func ENotJSON

func ENotJSON(msg string) Error

func EUnknownToken

func EUnknownToken(msg string) Error

func EUserInUse

func EUserInUse(msg string) Error

func NewError

func NewError(code, msg string) Error

Create a new JSON-serializable matrix-formatted error message. The intention for having this in the api package is that it should be extendable for any future transport protocol that is added later on.

func (Error) Error

func (e Error) Error() string

func (Error) WriteTo

func (e Error) WriteTo(w io.Writer)

WriteTo should really be able to implement the io.WriterTo interface but can't since the json.Encode does not return the correct values.

type Query

type Query map[string][]string

func (Query) GetOne

func (q Query) GetOne(key, defval string) (string, bool)

type SimpleEndpoint

type SimpleEndpoint func(io.Reader, Vars, Query) (interface{}, error)

type Vars

type Vars map[string]string

Jump to

Keyboard shortcuts

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