The iOS SDK allows you to create, rename, and delete virtual folders. The following examples provide detailed steps that describe how to use supported methods and include code samples to help you get started with virtual folders.
This example illustrates a call to createVirtualFolder:withCompletionHandler:
API. This API is used create virtual folders.
#import <VerizonCloudAPI/VerizonCloudAPI.h>
PCAPISDK
object and call the createVirtualFolder:withCompletionHandler:
method.createVirtualFolder:withCompletionHandler:
API call using the code sample in this example.logout
API which the removes the access token stored in the keychain.authenticate:fromViewController:withCompletionHandler:
API to get a new access token.Code Sample
@try {
PCCreateVFolderAPIParams *params = [[PCCreateVFolderAPIParams alloc] init];
params.folderName = @"Test Virtual Folder"; //folderName is required to create a virtual folder. (required)
[[PCAPISDK sharedInstance] createVirtualFolder:params withCompletionHandler:^(PCResource *metadata, PCAPIQueryResponse *response){
switch (response.urlResponse.statusCode){
case PCAPIResponseCodeResourceCreated:
NSLog(@"Virtual folder is created");
break;
case PCAPIResponseCodeUnauthorized:
NSLog(@"Session is no longer valid.");
break;
case PCAPIResponseCodeServiceUnavailable:
NSLog(@"Server Unavailable");
break;
default:
NSLog(@"failed. Please try again!");
break;
}
}];
}
@catch (NSException * e) {
NSLog(@"catching %@ reason %@", [e name], [e reason]);
}
This example illustrates a call to deleteVirtualFolder:withCompletionHandler:
API. This API call is used to delete a specified virtual folder.
#import <VerizonCloudAPI/VerizonCloudAPI.h>
PCAPISDK
object and call the deleteVirtualFolder:withCompletionHandler:
method.deleteVirtualFolder:withCompletionHandler:
API call using the code sample in this example.logout
API which the removes the access token stored in the keychain.authenticate:fromViewController:withCompletionHandler:
API to get a new access token.Code Sample
@try {
PCDeleteVFolderAPIParams *params = [[PCDeleteVFolderAPIParams alloc] init];
params.folderName = @"Virtual_Folder_Name"; //Name of the virtual folder. (required)
[[PCAPISDK sharedInstance] deleteVirtualFolder:params withCompletionHandler:^(PCAPIQueryResponse *response) {
switch (response.urlResponse.statusCode){
case PCAPIResponseCodeNoContent:
NSLog(@"Virtual folder is deleted");
break;
case PCAPIResponseCodeUnauthorized:
NSLog(@"Session is no longer valid.");
break;
case PCAPIResponseCodeServiceUnavailable:
NSLog(@"Server Unavailable");
break;
default:
NSLog(@"failed. Please try again!");
break;
}
}];
}
@catch (NSException * e) {
NSLog(@"catching %@ reason %@", [e name], [e reason]);
}
This example illustrates a call to renameVirtualFolder:withCompletionHandler:
API. This API call is used rename a specified virtual folder.
#import <VerizonCloudAPI/VerizonCloudAPI.h>
PCAPISDK
object and call the renameVirtualFolder:withCompletionHandler:
method.renameVirtualFolder:withCompletionHandler:
API call using the code sample in this example.logout
API which the removes the access token stored in the keychain.authenticate:fromViewController:withCompletionHandler:
API to get a new access token.Code Sample
@try {
PCRenameVFolderAPIParams *params = [[PCRenameVFolderAPIParams alloc] init];
params.src = @"old_name"; //src is required to rename a virtual folder. (required)
params.target = @"new_name"; //target is required to rename a virtual folder. (required)
[[PCAPISDK sharedInstance] renameVirtualFolder:params withCompletionHandler:^(PCResource *metadata, PCAPIQueryResponse *response) {
switch (response.urlResponse.statusCode){
case PCAPIResponseCodeOK:
NSLog(@"Virtual folder renamed");
break;
case PCAPIResponseCodeUnauthorized:
NSLog(@"Session is no longer valid.");
break;
case PCAPIResponseCodeServiceUnavailable:
NSLog(@"Server Unavailable");
break;
default:
NSLog(@"failed. Please try again!");
break;
}
}];
}
@catch (NSException * e) {
NSLog(@"catching %@ reason %@", [e name], [e reason]);
}
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.