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

To process badges with backpack and control api request and this class using for Open Badge API v2.1 methods. More...

Public Member Functions

 __construct ($externalbackpack)
 backpack_api2p1 constructor.
 
 curl_request ($action, $postdata=null)
 Make an api request.
 
 disconnect_backpack ($backpack)
 Disconnect the backpack from this user.
 
 put_assertions ($hash)
 Export a badge to the backpack site.
 

Protected Member Functions

 get_api_base_url ()
 Gets the apiBase url associated to this backpack.
 
 get_issuer ()
 Initialises or returns the OAuth2 issuer associated to this backpack.
 
 get_stored_token ($externalbackpackid)
 Get token.
 

Protected Attributes

endpoint endpoint $apibase
 The apiBase endpoint.
 
null $backpackapiversion
 version api of the backpack.
 
issuer issuer $issuer
 The OAuth2 Issuer for this backpack.
 

Detailed Description

To process badges with backpack and control api request 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::__construct ( $externalbackpack)

backpack_api2p1 constructor.

Parameters
object$externalbackpackobject
Exceptions
coding_exceptionerror message

Member Function Documentation

◆ curl_request()

core_badges\backpack_api2p1::curl_request ( $action,
$postdata = null )

Make an api request.

Parameters
string$actionThe api function.
string$postdataThe body of the api request.
Return values
mixed

◆ disconnect_backpack()

core_badges\backpack_api2p1::disconnect_backpack ( $backpack)

Disconnect the backpack from this user.

Parameters
object$backpackto disconnect.
Return values
bool
Exceptions
dml_exception

◆ get_api_base_url()

core_badges\backpack_api2p1::get_api_base_url ( )
protected

Gets the apiBase url associated to this backpack.

Return values
string

◆ get_issuer()

core_badges\backpack_api2p1::get_issuer ( )
protected

Initialises or returns the OAuth2 issuer associated to this backpack.

Return values
issuer

◆ get_stored_token()

core_badges\backpack_api2p1::get_stored_token ( $externalbackpackid)
protected

Get token.

Parameters
int$externalbackpackidID of external backpack.
Return values
oauth2\badge_backpack_oauth2|false|stdClass|null

◆ put_assertions()

core_badges\backpack_api2p1::put_assertions ( $hash)

Export a badge to the backpack site.

Parameters
string$hashof badge issued.
Return values
array
Exceptions
moodle_exception
coding_exception

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