SDK

Version 1.3 - Updated on 10/20/2016

Contents

__construct

public function __construct($clientKey = null,$clientSecret = null,$callbackUrl = null)

Instantiates a new SDK super-class object.

  • Parameters:
    • $clientKey - Key
    • $clientSecret -Secret
    • $callbackUrl - Callback URL
  • Exceptions: Exception

get

public function get($service, $method, array $params = [], $accessToken = null )

Sends a GET request to SDK and returns the result.

  • Parameters:
    • $accessTokenAccessToken|string|null
  • Exceptions: SDKException

Authentication and Authorization

getAuthorize

public function getAuthorize()

Helper function to create authorization URL.

  • Returns: Authorize URL

getAuthorizeRedirection

public function getAuthorizeRedirection()

Redirects to the authorization URL.

getToken

public function getToken($code)

Retrieves new Access and Refresh tokens.

  • Returns: Access and refresh tokens

loggedIn

public function loggedIn()

  • Returns: boolean value - true if the user is logged on.

updateAccesToken

public function updateAccesToken($refreshtoken)

Updates expired access token with new access token.

  • Parameters:
    • $refreshtoken - Refresh token
  • Returns: access and refresh tokens
  • Exceptions: SDKException

Account Information

getAccount

public function getAccount()

Retrieves account information.

Contacts

getContactInfo

public function getContactInfo()

Retrieves contact information.

File and Folder Operations

copy

public function copy($source = null,$target = null ,$safe = null,$conflictsolve = null,$override = null)

Creates a copy files or folders.

  • Parameters:
    • $source - Source location of file or folder
    • $target - Destination location of file or folder
    • $safe - If false, overwrites any existing file or folder in the target location. If true, uses conflictSolve param to resolve target conflicts. Default is false.
    • $conflictsolve - If null, operation fails if the target file or folder already exists. If set to ConflictSolveType.copy, a non-conflicting target name is generated.
    • $override - Specifies what happens when a folder of the same name already exists at the specified path:
      • overwrite - overwrites the existing folder.
      • modify - treats the new folder as a modification of the existing folder.
      If the override parameter is not set, the following algorithm is applied:
      • If the existing folder’s deleted attribute is set to true, the folder is overwritten.
      • If the existing folder’s deleted attribute is set to false or not set, the existing folder is modified.
      .
  • Returns: Return API Response
  • Exceptions: SDKException

NOTE:
You cannot perform the copy operation on a virutal folder.

createFolder

public function createFolder($name = null,$path = null ,$override = null)

Creates a folder in the user’s Cloud Storage.

  • Parameters:
    • $name - Name of the folder
    • $path - Destination of the folder.
    • $override - Specifies what happens when a folder of the same name already exists at the specified path:
      • overwrite - overwrites the existing folder.
      • modify - treats the new folder as a modification of the existing folder.
      If the override parameter is not set, the following algorithm is applied:
      • If the existing folder’s deleted attribute is set to true, the folder is overwritten.
      • If the existing folder’s deleted attribute is set to false or not set, the existing folder is modified.
      .
  • Returns: Return API Response
  • Exceptions: SDKException

NOTE:
You cannot perform the createFolder operation on a virutal folder.

deleteData

public function deleteData($path = null ,$purge = null)

Deletes a file or a folder.

  • Parameters:
    • $path - Path to a file or folder to be deleted
    • $purge - boolean value
  • Returns: Return API Response
  • Exceptions: SDKException

NOTE:
You cannot perform the deleteData operation on a virutal folder.

deltaView

public function deltaView($virtualfolder= null,$xHeaderETag = null)

Retrieves a list of all files and folders changed after ETag.

  • Parameters:
    • $virtualfolder - Virtual Folder
    • $xHeaderETag - X Header ETag received from full view API call
  • Returns: Return API Response
  • Exceptions: SDKException

getFileContent

public function getFileContent($path = null)

Retrieves file content.

getFullview

public function getFullview()

Retrieves a list of all files and folders.

  • Parameters:
  • Returns: Return API Response
    • Returns metadata of all files and folders.
  • Exceptions: SDKException

getMetadata

public function getMetadata($path,$includeDeleted,$sort, $start, $count, $filter)

Retrieves file or folder metadata.

  • Parameters:
    • $path - Folder path
    • $includeDeleted - boolean
    • $sort - Sort order for folder response. Syntax is: {field}+{asc or desc}. Valid values are: name, type, versionCreated, size, extension, album, artist, captureDate, compilation, contentType, creationDate, favorite, genre, height, modificationDate, priority, source, tags, title, timelineDate.
    • $start - The starting page to return in a paginated response. Defaults to 1.
    • $count - The maximum items to return. Defaults to 20, maximum value is 100.
    • $filter - For folders, indicates if only file or folder children will be included in the response. Valid values are folder and file.
  • Returns: Return API Response
  • Exceptions: SDKException

getSearch

public function getSearch($queryString,$sort, $start, $count)

Retrieves search results matching a query.

  • Parameters:
    • $queryString
    • $sort - Sort order for folder response. Syntax is: {field}+{asc or desc}. Valid values are: name, type, versionCreated, size, extension, album, artist, captureDate, compilation, contentType, creationDate, favorite, genre, height, modificationDate, priority, source, tags, title, timelineDate.
    • $start - The starting page to return in a paginated response. Defaults to 1.
    • $count - The maximum items to return. Defaults to 20, maximum value is 100.
  • Returns: Return API Response
  • Exceptions: SDKException

getThumbnail

public function getThumbnail($contenttoken, $size= null, $th = null, $tw = null)

Retrieves thumbnail images of requested files.

  • Parameters:
    • $contenttoken - Content token
    • $size - Thumbnail size
    • $th - Thumbnail height
    • $tw - Thumbnail width
  • Returns: Return API Response
  • Exceptions: SDKException

move

public function move($source = null,$target = null ,$safe = null,$conflictsolve = null)

Moves files or folders.

  • Parameters:
    • $source - Source location of file or folder
    • $target - Destination location of file or folder
    • $safe - If false, overwrites any existing file or folder in the target location. If true, uses conflictSolve param to resolve target conflicts. Default is false.
    • $conflictsolve - If null, operation fails if the target file or folder already exists. If set to ConflictSolveType.copy, a non-conflicting target name is generated.
  • Returns: Return API Response
  • Exceptions: SDKException

NOTE:
You cannot perform the move operation on a virutal folder.

rename

public function rename($source = null,$target = null ,$safe = null,$conflictsolve = null)

Renames a file or a folder.

  • Parameters:
    • $source - Source location of file or folder
    • $target - Destination location of file or folder
    • $safe - If false, overwrites any existing file or folder in the target location. If true, uses conflictSolve param to resolve target conflicts. Default is false.
    • $conflictsolve - If null, operation fails if the target file or folder already exists. If set to ConflictSolveType.copy, a non-conflicting target name is generated.
  • Returns: Return API Response
  • Exceptions: SDKException

NOTE:
You cannot perform the rename operation on a virutal folder.

updateMetadata

public function updateMetadata($name = null, $value = null, $uri = null)

Updates metadata for a file or folder.

  • Parameters:
    • $name - Name of the metadata attribute
    • $value - Value to be updated
    • $uri - URI of the file path
  • Returns: Return API Response
  • Exceptions: SDKException

File Upload

NOTE:
You cannot perform the the file upload operation on a virutal folder.

commitUpload

public function commitUpload($commiturl = null)

Commits file upload when chunk is set to true in fileUploadIntent function.

  • Parameters:
    • $commiturl - Commit URL returned from fileUploadIntent function.
  • Returns: Return API Response
  • Exceptions: SDKException

fileUploadIntent

public function fileUploadIntent($path = null,$name = null,$size = null,$checksum = null,$chunk = false)

Initiates file upload.

  • Parameters:
    • $path - File path
    • $name - File name
    • $size - File size
    • $checksum -SHA-256 checksum for the file’s binary content.
    • $chunk - true indicates chunked upload.
  • Returns: Return API Response
  • Exceptions: SDKException

uploadChunkData

public function uploadChunkData($uploadurl,$offset,$filepath)

Completes file upload process if chunk is set to true.

  • Parameters:
    • $uploadurl - Upload URL returned from fileUploadIntent function.
    • $offset - File offset
    • $filepath - Full path of the file
  • Returns: Return API Response
  • Exceptions: SDKException

uploadCompleteData

public function uploadCompleteData($uploadurl,$checksum,$filepath)

Completes file upload process when chunk is set to false.

  • Parameters:
    • $uploadurl - Upload URL returned from fileUploadIntent function.
    • $checksum - SHA-256 checksum for the file’s binary content.
    • $filepath - Full path of the file
  • Returns: Return API Response
  • Exceptions: SDKException

Playlists

addPlaylistItems

public function addPlaylistItems($playlistuid = null, $playlistItems = null)

Adds items to a playlist.

  • Parameters:
    • $playlistuid - UID of the playlist
    • $playlistItems - Playlist items
  • Returns: Return API Response
  • Exceptions: SDKException

createPlaylist

public function createPlaylist($name = null, $paths= null, $type = null)

Creates a playlist.

  • Parameters:
    • $name - Name of the playlist
    • $paths - Path of the playlist
    • $type - Type of the playlist
  • Returns: Return API Response
  • Exceptions: SDKException

deletePlaylist

public function deletePlaylist($playlistuid = null)

Deletes a playlist.

  • Parameters:
    • $playlistuid - UID of the playlist
  • Returns: Return API Response
  • Exceptions: SDKException

deletePlaylistItem

public function deletePlaylistItem($playlistuid = null, $itemUid = null)

Deletes an item from the playlist.

  • Parameters:
    • $playlistuid - UID of the playlist
    • $itemUid - UID of the item to be deleted
  • Returns: Return API Response
  • Exceptions: SDKException

getPlaylistDefinition

public function getPlaylistDefinition($playlistUid = null)

Retrieves definition and type of a playlist.

  • Parameters:
    • $playlistUid - UID of the playlist
  • Returns: Return API Response
  • Exceptions: SDKException

getPlaylistItemContent

public function getPlaylistItemContent($playlistUid = null, $itemUid = null)

Retrieves information about an item in a play list.

  • Parameters:
    • $playlistUid - UID of the playlist
    • $itemUid - UID of the item
  • Returns: Return API Response
  • Exceptions: SDKException

getPlaylistItems

public function getPlaylistItems($playlistUid = null)

Retrieves items in a playlist.

  • Parameters:
    • $playlistUid - UID of the playlist
  • Returns: Return API Response
  • Exceptions: SDKException

getPlaylists

public function getPlaylists()

Retrieves a list of playlists.

updatePlaylist

public function updatePlaylist($playlistuid = null ,$name = null ,$type = null)

Sends a request to SDK and returns the result.

  • Parameters:
    • $playlistuid - UID of the playlist
    • `$name - Playlist name to be updated
    • $type - Playlist type to be updated
  • Returns: Return API Response
  • Exceptions: SDKException

updatePlaylistDefinition

public function updatePlaylistDefinition($playlistuid = null, $name = null, $paths = null, $type = null)

Updates playlist definition.

  • Parameters:
    • $playlistuid - UID of the playlist
    • $name - Playlist name to be updated
    • $paths - Path of the playlist to be updated
    • $type - Type of the playlist to be updated
  • Returns: Return API Response
  • Exceptions: SDKException

Shares

createShare

public function createShare($name = null, $rname= null, $type = null, $subType = null, $location = null, $size = 0, $expiresIn = 0)

Creates a share.

  • Parameters:

    • $name — Name of the share.
    • $rname — Name of the shared resource.
    • $type — Type of the shared resource.
    • $subType — Subtype of the shared resource.
    • $location — Location of the share.
    • $size — Size of the share.
    • $expiresIn — Expiration of the share.
  • Returns: mixed|Response Return API Response.

deleteShare

public function deleteShare($shareUid = null)

Deletes a share.

  • Parameters:

    • $shareUid — Uid of share.
    • $purge — (true/false).
  • Returns: mixed|Response Return API Response.

getShares

public function getShares($cursor = null,$filter = "outbound",$since = null,$until = null,$count = null)

Retrieves a list of shares.

  • Parameters:

    • $cursor — A cursor used in paginating the response.
    • $filter — Filters the returned shares.
    • $since — The date and time, expressed in the W3C date and time format.
    • $until — The date and time, expressed in the W3C date and time format.
    • $count — Maximum items to include in a paginated response.
  • Returns: mixed|Response Return API Response.

Tags

deleteTags

public function deleteTags($uri = null, $createVersion = false)

Deletes a tag.

  • Parameters:

    • $uri — uri of resource.
    • $createVersion — createVersion of Tag.
  • Returns: mixed|Response Return API Response.

getTags

public function getTags($path = null)

Retrieves a list of tags.

  • Parameters:

    • $path — The path to the file or folder for which the tags are to be retrieved.
  • Returns: mixed|Response Return API Response.

setTags

public function setTags($uri = null, $Tags= null, $createVersion = false)

Creates a tag.

  • Parameters:

    • $uri — Uri of resource.
    • $Tags — Tag for the resource.
    • $createVersion — createVersion of Tag.
  • Returns: mixed|Response Return API Response.

Trash Can

purgeTrash

public function purgeTrash($virtualfolder)

Deletes items from trash.

  • Parameters:
    • $virtualfolder - Name of the virtual folder
  • Returns: Return API Response
  • Exceptions: SDKException

restoreTrash

public function restoreTrash($path)

Restores items from trash.

  • Parameters:
    • $path - Path of the item to be restored.
  • Returns: Return API Response
  • Exceptions: SDKException

trash

public function trash($virtualfolder = null, $sort = null, $start = null, $count = null, $filter = null, $deep = null)

Deletes files and folders from user’s Cloud Storage Account.

  • Parameters:
    • $virtualfolder - Name of the virtual folder
    • $sort - Sort order for folder response. Syntax is: {field}+{asc or desc}. Valid values are: name, type, versionCreated, size, extension, album, artist, captureDate, compilation, contentType, creationDate, favorite, genre, height, modificationDate, priority, source, tags, title, timelineDate.
    • $start - The starting page to return in a paginated response. Defaults to 1.
    • $count - The maximum items to return. Defaults to 20, maximum value is 100.
    • $filter - For folders, indicates if only file or folder children will be included in the response. Valid values are folder and file.
    • $deep
  • Returns: Return API Response
  • Exceptions: SDKException

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.