Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
repository_googledocs\helper Class Reference

Static Public Member Functions

static build_node_path (string $id, string $name='', string $root='')
 Generates a safe path to a node.
 
static explode_node_path (string $node)
 Returns information about a node in a path.
 
static get_browser (rest $service, string $path)
 Returns the relevant googledocs content browser class based on the given path.
 
static get_node (\stdClass $gdcontent, string $path)
 Returns the relevant repository content node class based on the Google Drive file's mimetype.
 
static request (rest $service, string $api, array $params)
 Wrapper function to perform an API call and also catch and handle potential exceptions.
 

Member Function Documentation

◆ build_node_path()

static repository_googledocs\helper::build_node_path ( string $id,
string $name = '',
string $root = '' )
static

Generates a safe path to a node.

Typically, a node will be id|name of the node.

Parameters
string$idThe ID of the node
string$nameThe name of the node, will be URL encoded
string$rootThe path to append the node on (must be a result of this function)
Return values
stringThe path to the node

◆ explode_node_path()

static repository_googledocs\helper::explode_node_path ( string $node)
static

Returns information about a node in a path.

Parameters
string$nodeThe node string to extract information from
Return values
arrayThe array containing the information about the node
See also
self\build_node_path()

◆ get_browser()

static repository_googledocs\helper::get_browser ( rest $service,
string $path )
static

Returns the relevant googledocs content browser class based on the given path.

Parameters
rest$serviceThe rest API object
string$pathThe current path
Return values
googledocs_contentThe googledocs repository content browser

◆ get_node()

static repository_googledocs\helper::get_node ( \stdClass $gdcontent,
string $path )
static

Returns the relevant repository content node class based on the Google Drive file's mimetype.

Parameters
stdClass$gdcontentThe Google Drive content (file/folder) object
string$pathThe current path
Return values
nodeThe content node object

◆ request()

static repository_googledocs\helper::request ( rest $service,
string $api,
array $params )
static

Wrapper function to perform an API call and also catch and handle potential exceptions.

Parameters
rest$serviceThe rest API object
string$apiThe name of the API call
array$paramsThe parameters required by the API call
Return values
stdClassThe response object
Exceptions
repository_exception

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