Version 1.9 - Updated on 05/04/2017
Superclass: NSObject
Declared In: PCAPISDK.h
This class acts as the interface between iOS SDK for Personal Cloud Storage APIs and a third party applications. Third party applications can invoke all Personal Cloud Storage APIs using public methods exposed in this class.
- (void)authenticateClient:(PCClientCredentials *)clientCredentials
fromViewController:(UIViewController *)viewController
withCompletionHandler:(void (^)(PCAuthenticationResponse *authenticationCredentials, PCOAuthLoginPageResponse *OAuthLoginPageResponse, PCAPIQueryResponse *response))completion;
Parameters
clientCredentials
ClientID
clientSecret
redirectURL
keychainID
viewController
viewController
- from OAuth 2.0 screen completion
This completion block is called once OAuth 2.0 process completes. If the user is successfully logged on, the authentication credentials are returned in this block.
Discussion
Call this method to present OAuth 2.0 login screen. Once authentication is complete or has failed, the completion handler is called. If the authentication is successful, the authentication credentials are passed in the completion handler. Access token received as a result of login is saved in keychain. This will remain in keychain until user forcefully logged off.
-(NSString *)fetchAccessToken;
- (BOOL)isUserLoggedIn;
- (BOOL)logout;
- (PCAPI *)refreshSessionWithCompletionHandler:(void (^)(PCAuthenticationResponse *authenticationCredentials, PCAPIQueryResponse *response))completion;
- (PCAPI *)fetchAccountInfoWithCompletionHandler:(void (^)(PCAccountInfo *accountInfo, PCAPIQueryResponse *response))completion;
fetchAccountInfo
process. An object of PCAccountInfo
which holds account information is returned in completion block.-(PCAPI *)createContact:(PCCreateContactAPIParams*)params
withCompletionHandler:(void(^)(PCContact *contact, PCAPIQueryResponse *response))completion;
Parameters
PCContact
object is returned in this block.Discussion
Call this method to create a new contact.
-(PCAPI *)deleteContact:(PCDeleteContactAPIParams*)params
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
Parameters
Discussion
Call this method to delete a specific contact.
- (PCAPI *)fetchContacts:(PCContactAPIParams *)params
WithCompletionHandler:(void (^)(NSArray *contacts, PCAPIQueryResponse *response))completion;
fetchContacts
process. An array of PCContact
objects is returned in completion.-(PCAPI *)updateContact:(PCUpdateContactAPIParams*)params
withCompletionHandler:(void(^)(PCContact *contact, PCAPIQueryResponse *response))completion;
Parameters
PCContact
object is returned in this block.Discussion
Call this method to update a specific contact.
-(PCAPI *)deleteFavorites:(PCDeleteFavoritesAPIParams*)params
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
Parameters
Discussion
Call this method to unmark file or folder as favorites.
- (void)getFavorites:(PCGetFavoritesAPIParams *)params
withCompletionHandler:(void (^)(NSArray *favoritesItems, PCAPIQueryResponse *response))completion;
Parameters
PCMetadata
objects is returned in the completion block.Discussion
Call this method to retrieve the list of favorite files and folders from the user account.
-(PCAPI *)setFavorites:(PCSetFavoritesAPIParams *)params
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
Parameters
Discussion
Call this method to mark the list of files or folders as favorites.
- (PCAPI *)copy:(PCFOPSAPIParams *)params
withCompletionHandler:(void (^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to perform copy operation.
completion
This block is called on the completion of a copy operation. Metadata of the target folder is returned in completion block.
Discussion
Call this method to copy a file or a folder.
NOTE:
You cannot perform the copy
operation on a virutal folder.
- (PCAPI *)createFolder:(PCCreateFolderAPIParams *)params
withCompletionHandler:(void (^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to create a folder.
completion
This block is called on the completion of a folder creation process. Created folder metadata is returned in completion block.
Discussion
Call this method to create a folder at a given path.
NOTE:
You cannot perform the createFolder
operation on a virutal folder.
- (PCAPI *)deletePath:(PCDeleteParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to perform delete operation.
completion
This block is called on the completion of a delete operation.
Discussion
Call this method to delete a file or a folder.
NOTE:
You cannot perform the deletePath
operation on a virutal folder.
- (PCAPI *)doFullSyncWithCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
Discussion
Call this method to refresh the local cache of files. This method first calls GET /fullview
API to get changes from the server, then merges the changes with the local database.
- (PCAPI *)downloadFile:(PCFilesAPIParams *)params progress:(void(^)(long long totalBytesDownloaded, long long totalBytesToBeDownloaded))progress
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
PCAPIQueryResponse
stores the location of the downloaded file.PCAPI
object which is downloading the file.- (PCAPI *)downloadThumbnail:(PCThumbnailAPIParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to fetch a thumbnail image
completion
This block is called on the completion of thumbnail fetch process. PCAPIQueryResponse stores the location of downloadThumbnail
.
Return Value
A PCAPI
object which is downloading the thumbnail image.
Discussion
Call this method to download a thumbnail image of any file.
- (PCAPI *)fetchMetadata:(PCMetaDataAPIParams *)params
withCompletionHandler:(void (^)(PCMetadata *metadata, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to retrieve metadata of a folder.
completion
This block gets called on the completion of metadata fetch process. A PCMetadata object with metadata details are returned in completion block.
Discussion
Call this method to retrieve metadata of a folder.
- (PCAPI *)move:(PCFOPSAPIParams *)params
withCompletionHandler:(void (^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
NOTE:
You cannot perform the move
operation on a virutal folder.
- (PCAPI *)rename:(PCFOPSAPIParams *)params
withCompletionHandler:(void (^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
NOTE:
You cannot perform the rename
operation on a virutal folder.
- (void)search:(PCSearchAPIParams *)params
withCompletionHandler:(void (^)(NSArray *results, PCAPIQueryResponse *response))completion;
NSManagedObjectID
is returned in the completion block.- (void)uploadFile:(PCUploadAPIParams *)params readFromPath:(NSString *)filePath
progress:(void(^)(PCUploadAPIState uploadState, long long totalBytesUploaded, long long totalBytesToBeUploaded))progress
withCompletionHandler:(void(^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
NOTE:
You cannot perform the uploadFile
operation on a virutal folder.
- (PCAPI *)addPlaylistItems:(PCAddPlaylistItemsAPIParams *)params
withCompletionHandler:(void (^)(NSArray *playlistItems, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to add items in a playlist.
completion
This block is called on the completion addPlaylistItems
operation. A NSArray
of PCResource
objects are returned in this block.
Discussion
Call this method to add items to a playlist.
- (PCAPI *)createPlaylist:(PCCreateplaylistAPIParams *)params
withCompletionHandler:(void (^)(PCPlaylist *playlist, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to create a playlist.
completion
This block is called on the completion of create playlist operation. A PCPlaylist
object is returned in this block.
Discussion
Call this method to create a playlist.
- (PCAPI *)deletePlaylist:(PCDeletePlaylistAPIParams *)params
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to delete a playlist.
completion
This block is called on the completion of a deletePlaylist
operation.
Discussion
Call this method to delete a playlist.
- (PCAPI *)editPlaylist:(PCEditPlaylistAPIParams *)params
withCompletionHandler:(void (^)(PCPlaylist *playlist, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to edit a playlist.
completion
This block is called on the completion of a rename playlist operation. Renamed PCPlaylist
object is returned in this block.
Discussion
Call this method to edit a playlist.
- (PCAPI *)deletePlaylistItem:(PCDeletePlaylistItemAPIParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to delete an item from a playlist.
completion
This block is called on the completion of deletePlaylistItem
operation.
Discussion
Call this method to delete an item from a playlist.
- (PCAPI *)editPlaylistDefinition:(PCEditPlaylistDefinitionAPIParams *)params
withCompletionHandler:(void (^)(PCPlaylist *playlist, PCAPIQueryResponse *response))completion;
Parameters
PCPlaylist
object is returned in this block.Discussion
Call this method to edit playlist definition.
- (PCAPI *)getPlaylist:(PCGetPlaylistAPIParams *)params
withCompletionHandler:(void (^)(NSArray *playlist, PCAPIQueryResponse *response))completion;
getPlaylist
operation. An array of PCPlaylist
objects is returned in this block.- (PCAPI *)getPlaylistContent:(PCGetPlaylistContentAPIParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
PCAPIQueryResponse
stores the location of the retrieved file.Discussion
Call this method to retrieve content of a playlist.
- (PCAPI *)getPlaylistDefinition:(PCGetPlaylistDefinitionAPIParams *)params
withCompletionHandler:(void (^)(PCPlaylist *playlist, PCAPIQueryResponse *response))completion;
PCPlaylist
object is returned in this block.- (PCAPI *)getPlaylistItems:(PCGetPlaylistItemsAPIParams *)params
withCompletionHandler:(void (^)(NSArray *playlistItems, PCAPIQueryResponse *response))completion;
PCResource
objects is returned in this block.- (PCAPI *)createShare:(PCCreateShareAPIParams *)params
withCompletionHandler:(void(^)(PCShareItem *shareItem, PCAPIQueryResponse *response))completion;
Parameters
PCShareItem
objects are returned in completion.Discussion
Call this method to create a share.
- (PCAPI *)deleteShare:(PCDeleteShareAPIParams *)params
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
Parameters
Discussion
Call this method to delete a specified share
- (PCAPI *)fetchShare:(PCGetShareAPIParams *)params
withCompletionHandler:(void (^)(PCShare *share, PCAPIQueryResponse *response))completion;
Parameters
PCShare
objects are returned in the completion.Discussion
Call this method retrieve shares.
+ (PCAPISDK *)sharedInstance;
PCAPISDK
class.-(PCAPI *)deleteTags:(PCDeleteTagsAPIParams*)params
withCompletionHandler:(void(^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to delete tags.
completion
This block is called on the completion of a deleteTags
operation.
Discussion
Call this method to delete tags for the specified file or folder.
-(PCAPI *)getTags:(PCGetTagsAPIParams*)params
withCompletionHandler:(void(^)(PCTags *tag, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to retrieve tags.
completion
This block is called on the completion of a getTags
operation. A PCTags
object is returned in completion.
Discussion
Call this method to retrieve tags for the specified file or folder.
-(PCAPI *)setTags:(PCSetTagsAPIParams *)params
withCompletionHandler:(void(^)(PCTags *tag, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to update a tag.
completion
This block is called on the completion of a setTags
operation. A PCTags
object is returned in completion.
Discussion
Call this method to update tags for the specified file or folder.
- (PCAPI *)deleteTrash:(PCDeleteTrashAPIParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to delete trash.
completion
This block is called on the completion of a deleteTrash
operation.
Discussion
Call this method to delete all files and folders that are in a deleted state in the user’s Personal Cloud Storage account.
- (PCAPI *)fetchTrash:(PCGetTrashAPIParams *)params
withCompletionHandler:(void (^)(PCMetadata *metadata, PCAPIQueryResponse *response))completion;
fetchTrash
process. A PCMetadata
object with metadata details is returned in completion block.###restore
- (PCAPI *)restore:(PCRestoreAPIParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to perform restore operation.
completion
This block is called on the completion of a restore operation.
Discussion
Call this method to restore files or folders that are marked as deleted. When called on a folder, the API creates a new version of the folder and any child folder, and restores all files in these folders.
- (PCAPI *)createVirtualFolder:(PCCreateVFolderAPIParams *)params
withCompletionHandler:(void (^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to create a virtual folder.
completion
This block is called on the completion of a virtual folder creation process. The metadata of a new virtual folder is returned in completion block
Discussion
Call this method to create a virtual folder.
- (PCAPI *)deleteVirtualFolder:(PCDeleteVFolderAPIParams *)params
withCompletionHandler:(void (^)(PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to delete a virtual folder.
completion
This block is called on the completion of a delete virtual folder operation.
Discussion
Call this method to delete a virtual folder.
- (PCAPI *)renameVirtualFolder:(PCRenameVFolderAPIParams *)params
withCompletionHandler:(void (^)(PCResource *metadata, PCAPIQueryResponse *response))completion;
Parameters
params
Parameters required to rename a virtual folder.
completion
This block is called on the completion of a rename virtual folder operation. The metadata of the renamed virtual folder is returned in completion block.
Discussion
Call this method to rename a virtual folder.
- (void)handleCompletionHandler:(void (^)())completionHandler
forSession:(NSString *)sessionIdentifier;
Parameters
application:handleEventsForBackgroundURLSession:completionHandler
method.completionHanlder
received in application:handleEventsForBackgroundURLSession:completionHandler
method.Discussion
This method is used when your application is enabled to do a background fetch. Implement application:handleEventsForBackgroundURLSession:completionHandler delegate method in your application delegate class and pass completion handler received on to the handleSessionCompletionHandler: method.
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.