Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
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. More...
 
 is_match ($action)
 Does the action match this mapping? More...
 
 request ($apiurl, $urlparam1, $urlparam2, $email, $password, $postparam, $backpackid)
 Make an api request and parse the response. More...
 

Static Public Member Functions

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

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.
 

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: