Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_badges\backpack_api_mapping Class Reference

Represent a single method for the remote api. More...

Public Member Functions

 __construct ($action, $url, $postparams, $requestexporter, $responseexporter, $multiple, $method, $json, $authrequired, $isuserbackpack, $backpackapiversion)
 Create a mapping.
 
 is_match ($action)
 Does the action match this mapping?
 
 request ($apiurl, $urlparam1, $urlparam2, $email, $password, $postparam, $backpackid)
 Make an api request and parse the response.
 

Static Public Member Functions

static get_authentication_error ()
 Get the last authentication error in this request.
 
static set_authentication_error ($msg)
 Remember the error message in a static variable.
 

Public Attributes

string $action
 The action of this method.
 
boolean $authrequired
 Authentication is required for this request.
 
boolean $json
 json decode the response.
 
string $method
 get or post methods.
 
boolean $multiple
 This method returns an array of responses.
 
array $params
 List of parameters for this method.
 
string $requestexporter
 Name of a class to export parameters for this method.
 
string $responseexporter
 Name of a class to export response for this method.
 

Protected Attributes

int $backpackapiversion
 OpenBadges version 1 or 2.
 
mixed $postparams
 List of parameters for this method.
 

Detailed Description

Represent a single method for the remote api.

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

Constructor & Destructor Documentation

◆ __construct()

core_badges\backpack_api_mapping::__construct ( $action,
$url,
$postparams,
$requestexporter,
$responseexporter,
$multiple,
$method,
$json,
$authrequired,
$isuserbackpack,
$backpackapiversion )

Create a mapping.

Parameters
string$actionThe action of this method.
string$urlThe base url of this backpack.
mixed$postparamsList of parameters for this method.
string$requestexporterName of a class to export parameters for this method.
string$responseexporterName of a class to export response for this method.
boolean$multipleThis method returns an array of responses.
string$methodget or post methods.
boolean$jsonjson decode the response.
boolean$authrequiredAuthentication is required for this request.
boolean$isuserbackpackuser backpack or a site backpack.
integer$backpackapiversionOpenBadges version 1 or 2.

Member Function Documentation

◆ get_authentication_error()

static core_badges\backpack_api_mapping::get_authentication_error ( )
static

Get the last authentication error in this request.

Return values
string

◆ is_match()

core_badges\backpack_api_mapping::is_match ( $action)

Does the action match this mapping?

Parameters
string$actionThe action.
Return values
boolean

◆ request()

core_badges\backpack_api_mapping::request ( $apiurl,
$urlparam1,
$urlparam2,
$email,
$password,
$postparam,
$backpackid )

Make an api request and parse the response.

Parameters
string$apiurlRaw request url.
string$urlparam1Parameter for the request.
string$urlparam2Parameter for the request.
string$emailUser email for authentication.
string$passwordfor authentication.
mixed$postparamRaw data for the post body.
string$backpackidthe id of the backpack to use.
Return values
mixed

◆ set_authentication_error()

static core_badges\backpack_api_mapping::set_authentication_error ( $msg)
static

Remember the error message in a static variable.

Parameters
string$msgThe message.

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