Documentation ¶
Overview ¶
A library/SDK for interfacing to the homeserver as a client.
Index ¶
Constants ¶
const ( DiscoveryPrompt = "PROMPT" DiscoveryIgnore = "IGNORE" DiscoveryFailPrompt = "FAIL_PROMPT" DiscoveryFailError = "FAIL_ERROR" )
refer spec: https://spec.matrix.org/v1.2/client-server-api/#server-discovery
const (
SpecVersionSupport = "v1.2"
)
Variables ¶
This section is empty.
Functions ¶
func DiscoverHSIdentityServer ¶
discovers the identity server for the homeserver via delegation the request for delegation information is likely not cached, so calling both DiscoverHSURL and DiscoverHSIdentityServer will call fetchDelegation in total 2 times fetching the resource twice.
func DiscoverHSURL ¶
discovers homeserver baseurl from just the homeserver name when it does not succeed, it will return one of the Discovery* variable contents included in the error, and nil as the url. if any other error occurs, that error will be returned.
identity_server_base_URL currently only returns nil as it is not yet implemented. however, it may be planned to be implemented in the future.
refer spec: https://spec.matrix.org/v1.2/client-server-api/#getwell-knownmatrixclient
Types ¶
type Homeserver ¶
func (*Homeserver) GetLoginFlows ¶
func (hs *Homeserver) GetLoginFlows() (loginTypes *loginTypes, err error)
func (Homeserver) SendRequest ¶
func (hs Homeserver) SendRequest(method string, path string, request_body *string) (*http.Response, error)
low level method: sends a request to the homeserver and returns the response
it is recommended to use net/url.Method* constants for the method `parameter`. if request_body parameter is `nil`, an empty request body will be sent.
returns error from net/http if error occurs from that TODO: creates error if HS responds with standard error response spec refer: https://spec.matrix.org/v1.2/client-server-api/#standard-error-response
func (Homeserver) Supported ¶
func (hs Homeserver) Supported() (bool, error)
checks if a homeserver has implemented the exact version the specification returns error if there's anything wrong (like http request failure or json failure) spec refer: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientversions