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

A command to be sent to the Matrix server. More...

Inheritance diagram for communication_matrix\local\command:

Public Member Functions

 __construct (protected matrix_client $client, string $method, string $endpoint, protected array $params=[], protected array $query=[], protected bool $ignorehttperrors=false, protected bool $requireauthorization=true, protected bool $sendasjson=true,)
 Create a new Command.
 
 get_all_params ()
 Get all parameters, including those set in the URL.
 
 get_options ()
 Get the Guzzle options to pass into the request.
 
 get_remaining_params ()
 Get the parameters provided to the command which are not used in the URL.
 
 require_authorization ()
 Whether authorization is required.
 
 should_ignore_http_errors ()
 Whether to ignore http errors on the response.
 
 should_send_params_as_json ()
 Whether to send remaining parameters as JSON.
 

Protected Member Functions

 get_url (string $endpoint)
 Get the URL of the endpoint on the server.
 

Protected Attributes

array array null bool bool bool array array null array $remainingparams = []
 $command The raw command data
 

Detailed Description

A command to be sent to the Matrix server.

This class is a wrapper around the PSR-7 Request Interface implementation provided by Guzzle.

It takes a set of common parameters and configurations and turns them into a Request that can be called against a live server.

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

Constructor & Destructor Documentation

◆ __construct()

communication_matrix\local\command::__construct ( protected matrix_client $client,
string $method,
string $endpoint,
protected array $params = [],
protected array $query = [],
protected bool $ignorehttperrors = false,
protected bool $requireauthorization = true,
protected bool $sendasjson = true )

Create a new Command.

Parameters
matrix_client$clientThe URL for this method
string$method(GET|POST|PUT|DELETE)
string$endpointThe URL
array$paramsAny parameters to pass
array$queryAny query parameters to set on the URL
bool$ignorehttperrorsWhether to ignore HTTP Errors
bool$requireauthorizationWhether authorization is required for this request
bool$sendasjsonWhether to send params as JSON

Member Function Documentation

◆ get_all_params()

communication_matrix\local\command::get_all_params ( )

Get all parameters, including those set in the URL.

Return values
array

◆ get_options()

communication_matrix\local\command::get_options ( )

Get the Guzzle options to pass into the request.

Return values
array

◆ get_remaining_params()

communication_matrix\local\command::get_remaining_params ( )

Get the parameters provided to the command which are not used in the URL.

These are typically passed to the server as query or body parameters instead.

Return values
array

◆ get_url()

communication_matrix\local\command::get_url ( string $endpoint)
protected

Get the URL of the endpoint on the server.

Parameters
string$endpoint
Return values
string

◆ require_authorization()

communication_matrix\local\command::require_authorization ( )

Whether authorization is required.

Based on the 'authorization' attribute set in a raw command.

Return values
bool

◆ should_ignore_http_errors()

communication_matrix\local\command::should_ignore_http_errors ( )

Whether to ignore http errors on the response.

Based on the 'ignore_http_errors' attribute set in a raw command.

Return values
bool

◆ should_send_params_as_json()

communication_matrix\local\command::should_send_params_as_json ( )

Whether to send remaining parameters as JSON.

Return values
bool

Member Data Documentation

◆ $remainingparams

array array null bool bool bool array array null array communication_matrix\local\command::$remainingparams = []
protected

$command The raw command data

$params The parameters passed into the command $sendasjson Whether to send params as JSON $requireauthorization Whether authorization is required for this request $ignorehttperrors Whether to ignore HTTP Errors $query Any query parameters to set on the URL Any parameters not used in the URI which are to be passed to the server via body or query params


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