PHP Класс TijsVerkoyen\Dropbox\Dropbox

Автор: Tijs Verkoyen ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $applicationKey, string $applicationSecret ) Default constructor
__destruct ( ) Default destructor
accountInfo ( ) : array Retrieves information about the user's account.
copyRef ( string $path, bool[optional] $sandbox = false ) : array Creates and returns a copy_ref to a file. This reference string can be used to copy that file to another user's Dropbox by passing it in as the fromCopyRef parameter on fileopsCopy.
delta ( string[optional] $cursor = null, string[optional] $locale = null ) : array A way of letting you keep up with changes to files and folders in a user's Dropbox. You can periodically call /delta to get a list of "delta entries", which are instructions on how to update your local state to match the server's state.
fileopsCopy ( string[optional] $fromPath = null, string $toPath, string[optional] $fromCopyRef = null, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Copies a file or folder to a new location.
fileopsCreateFolder ( string $path, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Creates a folder.
fileopsDelete ( string $path, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Deletes a file or folder.
fileopsMove ( string $fromPath, string $toPath, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Moves a file or folder to a new location.
filesGet ( string $path, string[optional] $rev = null, bool[optional] $sandbox = false ) : array Downloads a file.
filesPost ( string $path, string $localFile, bool[optional] $overwrite = null, string[optional] $parentRev = null, $locale = null, bool[optional] $sandbox = false ) : array Uploads a file.
getTimeOut ( ) : integer Get the timeout
getUserAgent ( ) : string Get the useragent that will be used.
media ( string $path, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Returns a link directly to a file.
metadata ( string[optional] $path = '', int[optional] $fileLimit = 10000, string[optional] $hash = false, bool[optional] $list = true, bool[optional] $includeDeleted = false, string[optional] $rev = null, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Retrieves file and folder metadata.
oAuthAccessToken ( string $oauthToken ) : array Step 3 of authentication. After the /oauth/authorize step is complete, the application can call /oauth/access_token to acquire an access token.
oAuthAuthorize ( string $oauthToken, string[optional] $oauthCallback = null, string[optional] $locale = null ) Step 2 of authentication. Applications should direct the user to /oauth/authorize. This isn't an API call per se, but rather a web endpoint that lets the user sign in to Dropbox and choose whether to grant the application the ability to access files on their behalf. The page served by /oauth/authorize should be presented to the user through their web browser. Without the user's authorization in this step, it isn't possible for your application to obtain an access token from /oauth/access_token.
oAuthRequestToken ( ) : array Step 1 of authentication. Obtain an OAuth request token to be used for the rest of the authentication process.
restore ( string $path, string $rev, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Restores a file path to a previous revision.
revisions ( string $path, int[optional] $revLimit = 10, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Obtains metadata for the previous revisions of a file.
search ( string $path, string $query, int[optional] $fileLimit = 1000, bool[optional] $includeDeleted = null, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Returns metadata for all files and folders whose filename contains the given search string as a substring.
setOAuthToken ( string $token ) Set the oAuth-token
setOAuthTokenSecret ( string $secret ) Set the oAuth-secret
setTimeOut ( integer $seconds ) Set the timeout
setUserAgent ( string $userAgent ) Get the useragent that will be used.
shares ( string $path, boolean $shortUrl = true, string[optional] $locale = null, bool[optional] $sandbox = false ) : array Creates and returns a Dropbox link to files or folders users can use to view a preview of the file in a web browser.
thumbnails ( string[optional] $path, string[optional] $size = 'small', string[optional] $format = 'jpeg', bool[optional] $sandbox = false ) : string Gets a thumbnail for an image.

Приватные методы

Метод Описание
buildQuery ( array $parameters ) : string Format the parameters as a querystring
calculateHeader ( array $parameters, string $url ) : string Build the Authorization header
doCall ( string $url, array $parameters = null, string[optional] $method = 'GET', $filePath = null, $expectJSON = true, $isContent = false ) : string Make the call
doOAuthCall ( string $url, array $parameters = null, string[optional] $method = 'POST', bool[optional] $expectJSON = true ) : mixed Make an call to the oAuth
getApplicationKey ( ) : string Get the application key
getApplicationSecret ( ) : string Get the application secret
getOAuthToken ( ) : string Get the oAuth-token
getOAuthTokenSecret ( ) : string Get the oAuth-token-secret
setApplicationKey ( string $key ) Set the application key
setApplicationSecret ( string $secret ) Set the application secret
urlencode_rfc3986 ( mixed $value ) : string URL-encode method for internal use

Описание методов

__construct() публичный Метод

Default constructor
public __construct ( string $applicationKey, string $applicationSecret )
$applicationKey string The application key to use.
$applicationSecret string The application secret to use.

__destruct() публичный Метод

Default destructor
public __destruct ( )

accountInfo() публичный Метод

Retrieves information about the user's account.
public accountInfo ( ) : array
Результат array

copyRef() публичный Метод

Creates and returns a copy_ref to a file. This reference string can be used to copy that file to another user's Dropbox by passing it in as the fromCopyRef parameter on fileopsCopy.
public copyRef ( string $path, bool[optional] $sandbox = false ) : array
$path string The path to the file.
$sandbox bool[optional]
Результат array

delta() публичный Метод

A way of letting you keep up with changes to files and folders in a user's Dropbox. You can periodically call /delta to get a list of "delta entries", which are instructions on how to update your local state to match the server's state.
public delta ( string[optional] $cursor = null, string[optional] $locale = null ) : array
$cursor string[optional]
$locale string[optional]
Результат array

fileopsCopy() публичный Метод

Copies a file or folder to a new location.
public fileopsCopy ( string[optional] $fromPath = null, string $toPath, string[optional] $fromCopyRef = null, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$fromPath string[optional]
$toPath string Specifies the destination path, including the new name for the file or folder, relative to root.
$fromCopyRef string[optional]
$locale string[optional]
$sandbox bool[optional]
Результат array

fileopsCreateFolder() публичный Метод

Creates a folder.
public fileopsCreateFolder ( string $path, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the new folder to create relative to root.
$locale string[optional]
$sandbox bool[optional]
Результат array

fileopsDelete() публичный Метод

Deletes a file or folder.
public fileopsDelete ( string $path, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the file or folder to be deleted.
$locale string[optional]
$sandbox bool[optional]
Результат array

fileopsMove() публичный Метод

Moves a file or folder to a new location.
public fileopsMove ( string $fromPath, string $toPath, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$fromPath string Specifies the file or folder to be moved from relative to root.
$toPath string Specifies the destination path, including the new name for the file or folder, relative to root.
$locale string[optional]
$sandbox bool[optional]
Результат array

filesGet() публичный Метод

Downloads a file.
public filesGet ( string $path, string[optional] $rev = null, bool[optional] $sandbox = false ) : array
$path string The path to the file you want to retrieve.
$rev string[optional]
$sandbox bool[optional]
Результат array An array with the content-type and the data as a base64-encoded string.

filesPost() публичный Метод

Uploads a file.
public filesPost ( string $path, string $localFile, bool[optional] $overwrite = null, string[optional] $parentRev = null, $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the folder the file should be uploaded to. This parameter should not point to a file.
$localFile string The path to the local file.
$overwrite bool[optional]
$parentRev string[optional]
$sandbox bool[optional]
Результат array

getTimeOut() публичный Метод

Get the timeout
public getTimeOut ( ) : integer
Результат integer

getUserAgent() публичный Метод

Our version will be prepended to yours. It will look like: "PHP Dropbox/ "
public getUserAgent ( ) : string
Результат string

media() публичный Метод

Returns a link directly to a file.
public media ( string $path, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the file.
$locale string[optional]
$sandbox bool[optional]
Результат array

metadata() публичный Метод

Retrieves file and folder metadata.
public metadata ( string[optional] $path = '', int[optional] $fileLimit = 10000, string[optional] $hash = false, bool[optional] $list = true, bool[optional] $includeDeleted = false, string[optional] $rev = null, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string[optional]
$fileLimit int[optional]
$hash string[optional]
$list bool[optional]
$includeDeleted bool[optional]
$rev string[optional]
$locale string[optional]
$sandbox bool[optional]
Результат array

oAuthAccessToken() публичный Метод

This method corresponds to Obtaining an Access Token in the OAuth Core 1.0 specification.
public oAuthAccessToken ( string $oauthToken ) : array
$oauthToken string The token returned after authorizing.
Результат array

oAuthAuthorize() публичный Метод

This method corresponds to Obtaining User Authorization in the OAuth Core 1.0 specification.
public oAuthAuthorize ( string $oauthToken, string[optional] $oauthCallback = null, string[optional] $locale = null )
$oauthToken string The request token obtained via /oauth/request_token.
$oauthCallback string[optional]
$locale string[optional]

oAuthRequestToken() публичный Метод

This method corresponds to Obtaining an Unauthorized Request Token in the OAuth Core 1.0 specification. A request token and the corresponding request token secret, URL-encoded. This token/secret pair is meant to be used with /oauth/access_token to complete the authentication process and cannot be used for any other API calls. See Service Provider Issues an Unauthorized Request Token in the OAuth Core 1.0 specification for additional discussion of the values returned when fetching a request token.
public oAuthRequestToken ( ) : array
Результат array

restore() публичный Метод

Unlike downloading a file at a given revision and then re-uploading it, this call is atomic. It also saves a bunch of bandwidth.
public restore ( string $path, string $rev, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the file.
$rev string The revision of the file to restore.
$locale string[optional]
$sandbox bool[optional]
Результат array

revisions() публичный Метод

Only revisions up to thirty days old are available (or more if the Dropbox user has Pack-Rat). You can use the revision number in conjunction with the /restore call to revert the file to its previous state.
public revisions ( string $path, int[optional] $revLimit = 10, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the file.
$revLimit int[optional]
$locale string[optional]
$sandbox bool[optional]
Результат array

setOAuthToken() публичный Метод

Set the oAuth-token
public setOAuthToken ( string $token )
$token string The token to use.

setOAuthTokenSecret() публичный Метод

Set the oAuth-secret
public setOAuthTokenSecret ( string $secret )
$secret string The secret to use.

setTimeOut() публичный Метод

Set the timeout
public setTimeOut ( integer $seconds )
$seconds integer The timeout in seconds.

setUserAgent() публичный Метод

Our version will be prepended to yours. It will look like: "PHP Dropbox/ "
public setUserAgent ( string $userAgent )
$userAgent string The user-agent, it should look like /.

shares() публичный Метод

Creates and returns a Dropbox link to files or folders users can use to view a preview of the file in a web browser.
public shares ( string $path, boolean $shortUrl = true, string[optional] $locale = null, bool[optional] $sandbox = false ) : array
$path string The path to the file.
$shortUrl boolean When true (default), the url returned will be shortened using the Dropbox url shortener. If false, the url will link directly to the file's preview page.
$locale string[optional]
$sandbox bool[optional]
Результат array

thumbnails() публичный Метод

Gets a thumbnail for an image.
public thumbnails ( string[optional] $path, string[optional] $size = 'small', string[optional] $format = 'jpeg', bool[optional] $sandbox = false ) : string
$path string[optional]
$size string[optional]
$format string[optional]
$sandbox bool[optional]
Результат string An array with the content-type and the data as a base64-encoded string.