Class for communicating with backpacks.  
 More...
Class for communicating with backpacks. 
- Copyright
- 2012 onwards Totara Learning Solutions Ltd  
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | core_badges\backpack_api::__construct | ( |  | $sitebackpack, | 
        
          |  |  |  | $userbackpack = false ) | 
      
 
Create a wrapper to communicate with the backpack. 
The resulting class can only do either site backpack communication or user backpack communication.
- Parameters
- 
  
    | stdClass | $sitebackpack | The site backpack record |  | mixed | $userbackpack | Optional - if passed it represents the users backpack. |  
 
 
 
◆ authenticate()
      
        
          | core_badges\backpack_api::authenticate | ( |  | ) |  | 
      
 
Authenticate using the stored email and password and save the valid access tokens. 
- Return values
- 
  
    | mixed | The id of the authenticated user as returned by the backpack. Can have different formats - numeric, empty, object with 'error' property, etc. |  
 
 
 
◆ clear_system_user_session()
      
        
          | core_badges\backpack_api::clear_system_user_session | ( |  | ) |  | 
      
 
Delete any user access tokens in the session so we will attempt to get new ones. 
- Return values
- 
  
  
 
 
◆ disconnect_backpack()
      
        
          | core_badges\backpack_api::disconnect_backpack | ( |  | $userid, | 
        
          |  |  |  | $backpackid ) | 
      
 
Disconnect the backpack from this user. 
- Parameters
- 
  
    | integer | $userid | The user in Moodle |  | integer | $backpackid | The backpack to disconnect |  
 
- Return values
- 
  
  
 
 
◆ get_assertion()
      
        
          | core_badges\backpack_api::get_assertion | ( |  | $entityid | ) |  | 
      
 
Make an api request to get an assertion. 
- Parameters
- 
  
    | string | $entityid | The id of the assertion. |  
 
- Return values
- 
  
  
 
 
◆ get_authentication_error()
      
        
          | core_badges\backpack_api::get_authentication_error | ( |  | ) |  | 
      
 
Get the last error message returned during an authentication request. 
- Return values
- 
  
  
 
 
◆ get_badges()
      
        
          | core_badges\backpack_api::get_badges | ( |  | $collection, | 
        
          |  |  |  | $expanded = false ) | 
      
 
Get the list of badges in a collection. 
- Parameters
- 
  
    | stdClass | $collection | The collection to deal with. |  | boolean | $expanded | Fetch all the sub entities. |  
 
- Return values
- 
  
  
 
 
◆ get_collection_id_from_response()
      
        
          | core_badges\backpack_api::get_collection_id_from_response | ( |  | $data | ) |  | 
      
 
Handle the response from getting a collection to map to an id. 
- Parameters
- 
  
    | stdClass | $data | The response data. |  
 
- Return values
- 
  
  
 
 
◆ get_collection_record()
      
        
          | core_badges\backpack_api::get_collection_record | ( |  | $collectionid | ) |  | 
      
 
Get one collection by id. 
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ get_collections()
      
        
          | core_badges\backpack_api::get_collections | ( |  | ) |  | 
      
 
Get all collections in this backpack. 
- Return values
- 
  
    | stdClass[] | The collections. |  
 
 
 
◆ import_badge_assertion()
      
        
          | core_badges\backpack_api::import_badge_assertion | ( | string | $data | ) |  | 
      
 
Import a badge assertion into a backpack. 
This is used to handle cross domain backpacks.
- Parameters
- 
  
    | string | $data | The structure of the badge class assertion. |  
 
- Return values
- 
  
  
- Exceptions
- 
  
  
 
 
◆ put_badgeclass()
      
        
          | core_badges\backpack_api::put_badgeclass | ( |  | $entityid, | 
        
          |  |  |  | $data ) | 
      
 
Create a badgeclass. 
- Parameters
- 
  
    | string | $entityid | The id of the entity. |  | string | $data | The structure of the badge class. |  
 
- Return values
- 
  
  
 
 
◆ put_badgeclass_assertion()
      
        
          | core_badges\backpack_api::put_badgeclass_assertion | ( |  | $entityid, | 
        
          |  |  |  | $data ) | 
      
 
Create a badgeclass assertion. 
- Parameters
- 
  
    | string | $entityid | The id of the badge class. |  | string | $data | The structure of the badge class assertion. |  
 
- Return values
- 
  
  
 
 
◆ put_issuer()
      
        
          | core_badges\backpack_api::put_issuer | ( |  | $data | ) |  | 
      
 
Create an issuer. 
- Parameters
- 
  
    | string | $data | The structure of the issuer. |  
 
- Return values
- 
  
  
 
 
◆ set_backpack_collections()
      
        
          | core_badges\backpack_api::set_backpack_collections | ( |  | $backpackid, | 
        
          |  |  |  | $collections ) | 
      
 
Select collections from a backpack. 
- Parameters
- 
  
    | string | $backpackid | The id of the backpack |  | stdClass[] | $collections | List of collections with collectionid or entityid. |  
 
- Return values
- 
  
  
 
 
◆ update_assertion()
      
        
          | core_badges\backpack_api::update_assertion | ( | string | $entityid, | 
        
          |  |  | array | $data ) | 
      
 
Update a badgeclass assertion. 
- Parameters
- 
  
    | string | $entityid | The id of the badge class. |  | array | $data | The structure of the badge class assertion. |  
 
- Return values
- 
  
  
 
 
The documentation for this class was generated from the following file: