matrix

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

README

Go Reference

healthcheck

Client module for matrix.

This project is released under GNU Affero General Public License v3.0, see LICENCE file in this repo for more info.

Documentation

Overview

Package matrix allows interfacing with a matrix server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matrix

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

Matrix represents a matrix server.

func New

func New(homeserver, token string) *Matrix

New creates a new matrix server handle. It takes the homeserver url and the client token as an argument.

func (*Matrix) HTTP

func (m *Matrix) HTTP(ctx context.Context, method, path string, request, response interface{}) (int, error)

HTTP performs a http exchange with the matrix server. It takes the http method, the path including queries and pointers to request and response payload as arguments. It returns the http status and io errors.

func (*Matrix) TxID

func (m *Matrix) TxID() uint64

TxID generates a unique transaction ID for requests.

type Response

type Response struct {
	ErrCode string `json:"errcode"`
	ErrMsg  string `json:"error"`
}

Response is the base for all responses returned by the matrix server.

func (Response) AsError

func (r Response) AsError(httpStatus int) error

AsError returns a descriptive error if the matrix server has returned an error for the corresponding request of nil.

Directories

Path Synopsis
Package room interfaces with matrix rooms.
Package room interfaces with matrix rooms.

Jump to

Keyboard shortcuts

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