include/OFCloudStorage.h

Go to the documentation of this file.
00001 //  Copyright 2009-2010 Aurora Feint, Inc.
00002 // 
00003 //  Licensed under the Apache License, Version 2.0 (the "License");
00004 //  you may not use this file except in compliance with the License.
00005 //  You may obtain a copy of the License at
00006 //  
00007 //      http://www.apache.org/licenses/LICENSE-2.0
00008 //      
00009 //  Unless required by applicable law or agreed to in writing, software
00010 //  distributed under the License is distributed on an "AS IS" BASIS,
00011 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 //  See the License for the specific language governing permissions and
00013 //  limitations under the License.
00014 
00015 @class OFRequestHandle;
00016 
00017 @protocol OFCloudStorageDelegate;
00018 
00024 enum OFCloudStorageStatus_Code 
00025 {
00026     CSC_Unspecified         = 0,    
00027     CSC_Ok                  = 200,  
00028     CSC_NotAcceptable       = 406,  
00029     CSC_NotFound            = 404,  
00030     CSC_GatewayTimeout      = 504,  
00031     CSC_InsufficientStorage = 507,  
00032     
00033     // The following codes may be supported in the future.
00034     // CSC_BadRequest       = 400,  // The request is invalid.
00035     // CSC_Unauthorized     = 401,  //
00036     // CSC_RequestTimeout   = 408,  //
00037     
00038 };
00039 
00047 @interface OFCloudStorage : NSObject<OFCallbackable>
00048 
00055 + (void)setDelegate:(id<OFCloudStorageDelegate>)delegate;
00056 
00069 + (OFRequestHandle*)upload:(NSData*)data withKey:(NSString*)key;
00070 
00079 + (OFRequestHandle*)downloadKeysForCurrentUser;
00080 
00090 + (OFRequestHandle*)downloadDataWithKey:(NSString*)key;
00091 
00092 @end
00093 
00094 
00100 @protocol OFCloudStorageDelegate
00101 @optional
00102 
00107 - (void)didUpload;
00108 
00113 - (void)didFailUpload:(OFCloudStorageStatus_Code)statusCode;
00114 
00121 - (void)didDownloadData:(NSData*)data;
00122 
00127 - (void)didFailDownloadData:(OFCloudStorageStatus_Code)statusCode;
00128 
00132 - (void)didDownloadKeysForCurrentUser:(NSArray*)keys;
00133 
00137 - (void)didFailDownloadKeysForCurrentUser;
00138 
00139 @end
 All Classes Files Functions Variables Enumerations Enumerator Properties