Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_badges\backpack_api2p1_mapping Class Reference

Represent a single method for the remote api and this class using for Open Badge API v2.1 methods. More...

Public Member Functions

 __construct ($action, $url, $postparams, $multiple, $method, $json, $authrequired, $isuserbackpack, $backpackapiversion)
 Create a mapping.
 
 is_match ($action)
 Does the action match this mapping?
 
 request ($apiurl, $tokenkey, $post=[])
 Make an api request and parse the response.
 

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.
 

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 and this class using for Open Badge API v2.1 methods.

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

Constructor & Destructor Documentation

◆ __construct()

core_badges\backpack_api2p1_mapping::__construct ( $action,
$url,
$postparams,
$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.
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

◆ is_match()

core_badges\backpack_api2p1_mapping::is_match ( $action)

Does the action match this mapping?

Parameters
string$actionThe action.
Return values
boolean

◆ request()

core_badges\backpack_api2p1_mapping::request ( $apiurl,
$tokenkey,
$post = [] )

Make an api request and parse the response.

Parameters
string$apiurlRaw request url.
string$tokenkeyto verify authorization.
array$postrequest method.
Return values
bool|mixed

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