Differences Between: [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
Communicate with backpacks.
Author: | Yuliya Bozhko <yuliya.bozhko@totaralms.com> |
Copyright: | 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 727 lines (31 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
backpack_api:: (21 methods):
__construct()
define_mappings()
curl_request()
get_auth_user_id()
get_token_key()
check_status()
get_assertion()
put_badgeclass_assertion()
update_assertion()
import_badge_assertion()
set_backpack_collections()
put_badgeclass()
put_issuer()
clear_system_user_session()
authenticate()
get_collections()
get_collection_record()
disconnect_backpack()
get_collection_id_from_response()
get_authentication_error()
get_badges()
Class: backpack_api - X-Ref
Class for communicating with backpacks.__construct($sitebackpack, $userbackpack = false) X-Ref |
Create a wrapper to communicate with the backpack. The resulting class can only do either site backpack communication or user backpack communication. param: stdClass $sitebackpack The site backpack record param: mixed $userbackpack Optional - if passed it represents the users backpack. |
define_mappings() X-Ref |
Define the mappings supported by this usage and api version. |
curl_request($action, $collection = null, $entityid = null, $postdata = null) X-Ref |
Make an api request return: mixed param: string $action The api function. param: string $collection An api parameter param: string $entityid An api parameter param: string $postdata The body of the api request. |
get_auth_user_id() X-Ref |
Get the id to use for requests with this api. return: integer |
get_token_key($type) X-Ref |
Get the name of the key to store this access token type. return: string param: string $type |
check_status($status) X-Ref |
Normalise the return from a missing user request. return: mixed param: string $status |
get_assertion($entityid) X-Ref |
Make an api request to get an assertion return: mixed param: string $entityid The id of the assertion. |
put_badgeclass_assertion($entityid, $data) X-Ref |
Create a badgeclass assertion. return: mixed param: string $entityid The id of the badge class. param: string $data The structure of the badge class assertion. |
update_assertion(string $entityid, array $data) X-Ref |
Update a badgeclass assertion. return: mixed param: string $entityid The id of the badge class. param: array $data The structure of the badge class assertion. |
import_badge_assertion(string $data) X-Ref |
Import a badge assertion into a backpack. This is used to handle cross domain backpacks. return: mixed param: string $data The structure of the badge class assertion. |
set_backpack_collections($backpackid, $collections) X-Ref |
Select collections from a backpack. return: boolean param: string $backpackid The id of the backpack param: stdClass[] $collections List of collections with collectionid or entityid. |
put_badgeclass($entityid, $data) X-Ref |
Create a badgeclass return: mixed param: string $entityid The id of the entity. param: string $data The structure of the badge class. |
put_issuer($data) X-Ref |
Create an issuer return: mixed param: string $data The structure of the issuer. |
clear_system_user_session() X-Ref |
Delete any user access tokens in the session so we will attempt to get new ones. return: void |
authenticate() X-Ref |
Authenticate using the stored email and password and save the valid access tokens. return: integer The id of the authenticated user. |
get_collections() X-Ref |
Get all collections in this backpack. return: stdClass[] The collections. |
get_collection_record($collectionid) X-Ref |
Get one collection by id. return: stdClass The collection. param: integer $collectionid |
disconnect_backpack($userid, $backpackid) X-Ref |
Disconnect the backpack from this user. return: boolean param: integer $userid The user in Moodle param: integer $backpackid The backpack to disconnect |
get_collection_id_from_response($data) X-Ref |
Handle the response from getting a collection to map to an id. return: string The collection id. param: stdClass $data The response data. |
get_authentication_error() X-Ref |
Get the last error message returned during an authentication request. return: string |
get_badges($collection, $expanded = false) X-Ref |
Get the list of badges in a collection. return: stdClass[] param: stdClass $collection The collection to deal with. param: boolean $expanded Fetch all the sub entities. |