Moodle PHP Documentation 4.4
Moodle 4.4.8+ (Build: 20250530) (000b0c27711)
repository_dropbox\dropbox Class Reference

Dropbox V2 API. More...

Inheritance diagram for repository_dropbox\dropbox:

Public Member Functions

 __construct (issuer $issuer, $callback)
 Create the DropBox API Client.
 
 callback ()
 Process the callback.
 
 get_file_share_info ($id)
 Fetch a valid public share link for the specified file.
 
 get_listing ($path='')
 Get file listing from dropbox.
 
 get_thumbnail ($path)
 Retrieves the thumbnail for the content, as supplied by dropbox.
 
 has_additional_results ($result)
 Whether the supplied result is paginated and not the final page.
 
 logout ()
 Revoke the current access token.
 
 search ($query='')
 Get file search results from dropbox.
 
 supports_thumbnail ($entry)
 Whether the entry is expected to have a thumbnail.
 

Protected Member Functions

 auth_url ()
 Returns the auth url for OAuth 2.0 request.
 
 check_and_handle_api_errors ($data)
 Check for an attempt to handle API errors.
 
 fetch_dropbox_content ($endpoint, $data=[])
 Fetch content from the specified endpoint with the supplied data.
 
 fetch_dropbox_data ($endpoint, $data=[], string $resultnode='entries')
 Make an API call against the specified endpoint with supplied data.
 
 get_api_endpoint ($endpoint)
 Return the constructed API endpoint URL.
 
 get_content_endpoint ($endpoint)
 Return the constructed content endpoint URL.
 
 get_endpoint_for_continue (string $endpoint)
 Get the continue endpoint for the provided endpoint.
 
 get_login_scopes ()
 Override - Return an empty string to override parent function.
 
 normalize_file_share_info ($entry)
 Normalize the file share info.
 
 token_url ()
 Returns the token url for OAuth 2.0 request.
 

Detailed Description

Dropbox V2 API.

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

Constructor & Destructor Documentation

◆ __construct()

repository_dropbox\dropbox::__construct ( issuer $issuer,
$callback )

Create the DropBox API Client.

Parameters
issuer$issuerThe dropbox issuer
string$callbackThe callback URL

Member Function Documentation

◆ auth_url()

repository_dropbox\dropbox::auth_url ( )
protected

Returns the auth url for OAuth 2.0 request.

Return values
stringthe auth url

◆ check_and_handle_api_errors()

repository_dropbox\dropbox::check_and_handle_api_errors ( $data)
protected

Check for an attempt to handle API errors.

This function attempts to deal with errors as per https://www.dropbox.com/developers/documentation/http/documentation#error-handling.

Parameters
mixed$dataThe returned content.
Exceptions
moodle_exception

◆ fetch_dropbox_content()

repository_dropbox\dropbox::fetch_dropbox_content ( $endpoint,
$data = [] )
protected

Fetch content from the specified endpoint with the supplied data.

Parameters
string$endpointThe endpoint to be contacted
array$dataAny data to pass to the endpoint
Return values
stringThe returned data

◆ fetch_dropbox_data()

repository_dropbox\dropbox::fetch_dropbox_data ( $endpoint,
$data = [],
string $resultnode = 'entries' )
protected

Make an API call against the specified endpoint with supplied data.

Parameters
string$endpointThe endpoint to be contacted
array$dataAny data to pass to the endpoint
string$resultnodeThe name of the node that contains the data
Return values
objectContent decoded from the endpoint

◆ get_api_endpoint()

repository_dropbox\dropbox::get_api_endpoint ( $endpoint)
protected

Return the constructed API endpoint URL.

Parameters
string$endpointThe endpoint to be contacted
Return values
moodle_urlThe constructed API URL

◆ get_content_endpoint()

repository_dropbox\dropbox::get_content_endpoint ( $endpoint)
protected

Return the constructed content endpoint URL.

Parameters
string$endpointThe endpoint to be contacted
Return values
moodle_urlThe constructed content URL

◆ get_endpoint_for_continue()

repository_dropbox\dropbox::get_endpoint_for_continue ( string $endpoint)
protected

Get the continue endpoint for the provided endpoint.

Parameters
string$endpointThe original endpoint
Return values
string#$endpointThe generated/mapped continue link

◆ get_file_share_info()

repository_dropbox\dropbox::get_file_share_info ( $id)

Fetch a valid public share link for the specified file.

Parameters
string$idThe file path or file id of the file to fetch information for.
Return values
objectAn object containing the id, path, size, and URL of the entry

◆ get_listing()

repository_dropbox\dropbox::get_listing ( $path = '')

Get file listing from dropbox.

Parameters
string$pathThe path to query
Return values
objectThe returned directory listing, or null on failure

◆ get_login_scopes()

repository_dropbox\dropbox::get_login_scopes ( )
protected

Override - Return an empty string to override parent function.

Dropbox does not require scopes to be provided and can function without them. Additional information MDL-70268

Return values
string

◆ get_thumbnail()

repository_dropbox\dropbox::get_thumbnail ( $path)

Retrieves the thumbnail for the content, as supplied by dropbox.

Parameters
string$pathThe path to fetch a thumbnail for
Return values
stringThumbnail image content

◆ has_additional_results()

repository_dropbox\dropbox::has_additional_results ( $result)

Whether the supplied result is paginated and not the final page.

Parameters
object$resultThe result of an operation
Return values
boolean

◆ logout()

repository_dropbox\dropbox::logout ( )

Revoke the current access token.

Return values
string

◆ normalize_file_share_info()

repository_dropbox\dropbox::normalize_file_share_info ( $entry)
protected

Normalize the file share info.

Parameters
object$entryInformation retrieved from share endpoints
Return values
objectNormalized entry information to store as repository information

◆ search()

repository_dropbox\dropbox::search ( $query = '')

Get file search results from dropbox.

Parameters
string$queryThe search query
Return values
objectThe returned directory listing, or null on failure

◆ supports_thumbnail()

repository_dropbox\dropbox::supports_thumbnail ( $entry)

Whether the entry is expected to have a thumbnail.

See docs at https://www.dropbox.com/developers/documentation/http/documentation#files-get_thumbnail.

Parameters
object$entryThe file entry received from the DropBox API
Return values
booleanWhether dropbox has a thumbnail available

◆ token_url()

repository_dropbox\dropbox::token_url ( )
protected

Returns the token url for OAuth 2.0 request.

Return values
stringthe auth url

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