Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
communication_matrix\local\spec\v1p1 Class Reference

Matrix API to support version v1.1 of the Matrix specification. More...

Inheritance diagram for communication_matrix\local\spec\v1p1:

Public Member Functions

 get_server_url ()
 Get the URL of the server.
 
 get_supported_features ()
 Get a list of the features supported by this client.
 
 get_token ()
 Get the current token in use.
 
 get_version ()
 Get the API version of the current instance.
 
 implements_feature (array|string $feature)
 Determine if the API supports a feature.
 
 meets_version (string $minversion)
 Check if the API version is at least the specified version.
 
 require_feature (array|string $feature)
 Require that the API supports a feature.
 
 require_features (array $features)
 Require that the API supports a list of features.
 
 requires_version (string $minversion)
 Assert that the API version is at least the specified version.
 

Static Public Member Functions

static get_supported_versions ()
 Get the list of supported versions based on the available classes.
 
static instance (string $serverurl, string $accesstoken,)
 Return the versioned instance of the API.
 

Protected Member Functions

 execute (command $command,)
 Execute the specified command.
 
 get_client ()
 Helper to fetch the HTTP Client for the instance.
 

Static Protected Member Functions

static get_http_client ()
 Helper to fetch the HTTP Client.
 
static get_version_from_classname (string $classname)
 Normalise an API version from a classname.
 
static query_server_supports (string $serverurl)
 Query the supported versions, and any unstable features, from the server.
 

Static Protected Attributes

string string static http_client null http_client null $client = null
 $serverurl The URL of the home server
 

Detailed Description

Matrix API to support version v1.1 of the Matrix specification.

https://spec.matrix.org/v1.1/client-server-api/

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ execute()

communication_matrix\matrix_client::execute ( command $command)
protectedinherited

Execute the specified command.

Parameters
command$command
Return values
Response

◆ get_client()

communication_matrix\matrix_client::get_client ( )
protectedinherited

Helper to fetch the HTTP Client for the instance.

Return values
core\http_client

◆ get_http_client()

static communication_matrix\matrix_client::get_http_client ( )
staticprotectedinherited

Helper to fetch the HTTP Client.

Return values
core\http_client

◆ get_server_url()

communication_matrix\matrix_client::get_server_url ( )
inherited

Get the URL of the server.

Return values
string

◆ get_supported_features()

communication_matrix\matrix_client::get_supported_features ( )
inherited

Get a list of the features supported by this client.

Return values
string[]

◆ get_supported_versions()

static communication_matrix\matrix_client::get_supported_versions ( )
staticinherited

Get the list of supported versions based on the available classes.

Return values
array

◆ get_token()

communication_matrix\matrix_client::get_token ( )
inherited

Get the current token in use.

Return values
string

◆ get_version()

communication_matrix\matrix_client::get_version ( )
inherited

Get the API version of the current instance.

Return values
string

◆ get_version_from_classname()

static communication_matrix\matrix_client::get_version_from_classname ( string $classname)
staticprotectedinherited

Normalise an API version from a classname.

Parameters
string$classnameThe short classname, omitting any namespace or file extension
Return values
stringThe normalised version

◆ implements_feature()

communication_matrix\matrix_client::implements_feature ( array|string $feature)
inherited

Determine if the API supports a feature.

If an Array is provided, this will return true if any of the specified features is implemented.

Parameters
string[] | string$featureThe feature to check. This is in the form of a namespaced class.
Return values
bool

◆ instance()

static communication_matrix\matrix_client::instance ( string $serverurl,
string $accesstoken )
staticinherited

Return the versioned instance of the API.

Parameters
string$serverurlThe URL of the API server
string$accesstokenThe admin access token to use
Return values
matrix_client|null

◆ meets_version()

communication_matrix\matrix_client::meets_version ( string $minversion)
inherited

Check if the API version is at least the specified version.

Parameters
string$minversionThe minimum API version required
Return values
bool

◆ query_server_supports()

static communication_matrix\matrix_client::query_server_supports ( string $serverurl)
staticprotectedinherited

Query the supported versions, and any unstable features, from the server.

Servers must implement the client versions API described here:

Parameters
string$serverurlThe server base
Return values
null|stdClassThe list of supported versions and a list of enabled unstable features

◆ require_feature()

communication_matrix\matrix_client::require_feature ( array|string $feature)
inherited

Require that the API supports a feature.

If an Array is provided, this is treated as a require any of the features.

Parameters
string[] | string$featureThe feature to test
Exceptions
moodle_exception

◆ require_features()

communication_matrix\matrix_client::require_features ( array $features)
inherited

Require that the API supports a list of features.

All features specified will be required.

If an array is provided as one of the features, any of the items in the nested array will be required.

Parameters
string[] | array[]$featuresThe list of features required

Here is an example usage: $matrixapi->require_features([

communication_matrix::local::spec::features::create_room::class,
[
    communication_matrix::local::spec::features::get_room_info_v1::class,
    communication_matrix::local::spec::features::get_room_info_v2::class,
]

])

◆ requires_version()

communication_matrix\matrix_client::requires_version ( string $minversion)
inherited

Assert that the API version is at least the specified version.

Parameters
string$minversionThe minimum API version required
Exceptions
Exception

Member Data Documentation

◆ $client

string string static http_client null http_client null communication_matrix\matrix_client::$client = null
staticprotectedinherited

$serverurl The URL of the home server

$accesstoken The access token of the matrix server The client to use


The documentation for this class was generated from the following file: