123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494 |
- //
- // OSSModel.h
- // oss_ios_sdk
- //
- // Created by zhouzhuo on 8/16/15.
- // Copyright (c) 2015 aliyun.com. All rights reserved.
- //
-
- #import <Foundation/Foundation.h>
- #import "OSSRequest.h"
- #import "OSSResult.h"
-
- @class OSSAllRequestNeededMessage;
- @class OSSFederationToken;
- @class OSSTask;
- @class OSSClientConfiguration;
-
- NS_ASSUME_NONNULL_BEGIN
-
- typedef OSSFederationToken * _Nullable (^OSSGetFederationTokenBlock) (void);
-
- /**
- Categories NSDictionary
- */
- @interface NSDictionary (OSS)
- - (NSString *)base64JsonString;
- @end
-
- /**
- Categories NSDate
- */
- @interface NSDate (OSS)
- + (void)oss_setClockSkew:(NSTimeInterval)clockSkew;
- + (NSDate *)oss_dateFromString:(NSString *)string;
- + (NSDate *)oss_clockSkewFixedDate;
- - (NSString *)oss_asStringValue;
- @end
-
- /**
- A thread-safe dictionary
- */
- @interface OSSSyncMutableDictionary : NSObject
- @property (nonatomic, strong) NSMutableDictionary *dictionary;
- @property (nonatomic, strong) dispatch_queue_t dispatchQueue;
-
- - (id)objectForKey:(id)aKey;
- - (NSArray *)allKeys;
- - (void)setObject:(id)anObject forKey:(id <NSCopying>)aKey;
- - (void)removeObjectForKey:(id)aKey;
- @end
-
- /**
- FederationToken class
- */
- @interface OSSFederationToken : NSObject
- @property (nonatomic, copy) NSString * tAccessKey;
- @property (nonatomic, copy) NSString * tSecretKey;
- @property (nonatomic, copy) NSString * tToken;
-
- /**
- Token's expiration time in milliseconds of the unix time.
- */
- @property (atomic, assign) int64_t expirationTimeInMilliSecond;
-
- /**
- Token's expiration time in GMT format string.
- */
- @property (atomic, strong, nullable) NSString *expirationTimeInGMTFormat;
- @end
-
- /**
- CredentialProvider protocol, needs to implement sign API.
- */
- @protocol OSSCredentialProvider <NSObject>
- @optional
- - (nullable NSString *)sign:(NSString *)content error:(NSError **)error;
- @end
-
- /**
- The plaint text AK/SK credential provider for test purposely.
- */
-
- __attribute__((deprecated("PLEASE DO NOT USE THIS CLASS AGAIN")))
- @interface OSSPlainTextAKSKPairCredentialProvider : NSObject <OSSCredentialProvider>
- @property (nonatomic, copy) NSString * accessKey;
- @property (nonatomic, copy) NSString * secretKey;
-
- - (instancetype)initWithPlainTextAccessKey:(NSString *)accessKey
- secretKey:(NSString *)secretKey __attribute__((deprecated("We recommend the STS authentication mode on mobile")));
- @end
-
- /**
- TODOTODO
- The custom signed credential provider
- */
- @interface OSSCustomSignerCredentialProvider : NSObject <OSSCredentialProvider>
- @property (nonatomic, copy, readonly,) NSString * _Nonnull (^ _Nonnull signContent)( NSString * _Nonnull , NSError * _Nullable *_Nullable);
-
- + (instancetype _Nullable)new NS_UNAVAILABLE;
- - (instancetype _Nullable)init NS_UNAVAILABLE;
-
- /**
- * During the task execution, this API is called for signing
- * It's executed at the background thread instead of UI thread.
- */
- - (instancetype _Nullable)initWithImplementedSigner:(OSSCustomSignContentBlock)signContent NS_DESIGNATED_INITIALIZER;
- @end
-
- /**
- TODOTODO
- User's custom federation credential provider.
- */
- @interface OSSFederationCredentialProvider : NSObject <OSSCredentialProvider>
- @property (nonatomic, strong) OSSFederationToken * cachedToken;
- @property (nonatomic, copy) OSSFederationToken * (^federationTokenGetter)(void);
-
- /**
- During the task execution, this method is called to get the new STS token.
- It runs in the background thread, not the UI thread.
- */
- - (instancetype)initWithFederationTokenGetter:(OSSGetFederationTokenBlock)federationTokenGetter;
- - (nullable OSSFederationToken *)getToken:(NSError **)error;
- @end
-
- /**
- The STS token's credential provider.
- */
- @interface OSSStsTokenCredentialProvider : NSObject <OSSCredentialProvider>
- @property (nonatomic, copy) NSString * accessKeyId;
- @property (nonatomic, copy) NSString * secretKeyId;
- @property (nonatomic, copy) NSString * securityToken;
-
- - (OSSFederationToken *)getToken;
- - (instancetype)initWithAccessKeyId:(NSString *)accessKeyId
- secretKeyId:(NSString *)secretKeyId
- securityToken:(NSString *)securityToken;
- @end
-
- /**
- auth credential provider.
- */
- @interface OSSAuthCredentialProvider : OSSFederationCredentialProvider
- @property (nonatomic, copy) NSString * authServerUrl;
- @property (nonatomic, copy) NSData * (^responseDecoder)(NSData *);
- - (instancetype)initWithAuthServerUrl:(NSString *)authServerUrl;
- - (instancetype)initWithAuthServerUrl:(NSString *)authServerUrl responseDecoder:(nullable OSSResponseDecoderBlock)decoder;
- @end
-
- /**
- OSSClient side configuration.
- */
- @interface OSSClientConfiguration : NSObject
-
- /**
- Max retry count
- */
- @property (nonatomic, assign) uint32_t maxRetryCount;
-
- /**
- Max concurrent requests
- */
- @property (nonatomic, assign) uint32_t maxConcurrentRequestCount;
-
- /**
- Flag of enabling background file transmit service.
- Note: it's only applicable for file upload.
- */
- @property (nonatomic, assign) BOOL enableBackgroundTransmitService;
-
- /**
- Flag of using Http request for DNS resolution.
- */
- @property (nonatomic, assign) BOOL isHttpdnsEnable;
-
- /**
- Sets the session Id for background file transmission
- */
- @property (nonatomic, copy) NSString * backgroundSesseionIdentifier;
-
- /**
- Sets request timeout
- */
- @property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest;
-
- /**
- Sets single object download's max time
- */
- @property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource;
-
- /**
- Sets proxy host and port.
- */
- @property (nonatomic, copy) NSString * proxyHost;
- @property (nonatomic, strong) NSNumber * proxyPort;
-
- /**
- Sets UA
- */
- @property (nonatomic, copy) NSString * userAgentMark;
-
- /**
- Sets CName excluded list.
- */
- @property (nonatomic, strong, setter=setCnameExcludeList:) NSArray * cnameExcludeList;
-
- /**
- 是否开启crc校验(当同时设置了此选项和请求中的checkCRC开关时,以请求中的checkCRC开关为准)
- */
- @property (nonatomic, assign) BOOL crc64Verifiable;
-
- @end
-
- @protocol OSSRequestInterceptor <NSObject>
- - (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)request;
- @end
-
- /**
- Signs the request when it's being created.
- */
- @interface OSSSignerInterceptor : NSObject <OSSRequestInterceptor>
- @property (nonatomic, strong) id<OSSCredentialProvider> credentialProvider;
-
- - (instancetype)initWithCredentialProvider:(id<OSSCredentialProvider>)credentialProvider;
- @end
-
- /**
- Updates the UA when creating the request.
- */
- @interface OSSUASettingInterceptor : NSObject <OSSRequestInterceptor>
- @property (nonatomic, weak) OSSClientConfiguration *clientConfiguration;
- - (instancetype)initWithClientConfiguration:(OSSClientConfiguration *) clientConfiguration;
- @end
-
- /**
- Fixes the time skew issue when creating the request.
- */
- @interface OSSTimeSkewedFixingInterceptor : NSObject <OSSRequestInterceptor>
- @end
-
- /**
- The download range of OSS object
- */
- @interface OSSRange : NSObject
- @property (nonatomic, assign) int64_t startPosition;
- @property (nonatomic, assign) int64_t endPosition;
-
- - (instancetype)initWithStart:(int64_t)start
- withEnd:(int64_t)end;
-
- /**
- * Converts the header to string: 'bytes=${start}-${end}'
- */
- - (NSString *)toHeaderString;
- @end
-
- #pragma mark RequestAndResultClass
-
- /**
- The request to list all buckets of current user.
- */
- @interface OSSGetServiceRequest : OSSRequest
-
- /**
- The prefix filter for listing buckets---optional.
- */
- @property (nonatomic, copy) NSString * prefix;
-
- /**
- The marker filter for listing buckets----optional.
- The marker filter is to ensure any returned bucket name must be greater than the marker in the lexicographic order.
- */
- @property (nonatomic, copy) NSString * marker;
-
- /**
- The max entries to return. By default it's 100 and max value of this property is 1000.
- */
- @property (nonatomic, assign) int32_t maxKeys;
-
-
- /**
- Gets the query parameters' dictionary according to the properties.
- */
- - (NSMutableDictionary *)getQueryDict;
- @end
-
- /**
- The result class of listing all buckets
- */
- @interface OSSGetServiceResult : OSSResult
-
- /**
- The owner Id
- */
- @property (nonatomic, copy) NSString * ownerId;
-
- /**
- Bucket owner name---currently it's same as owner Id.
- */
- @property (nonatomic, copy) NSString * ownerDispName;
-
- /**
- The prefix of this query. It's only set when there's remaining buckets to return.
- */
- @property (nonatomic, copy) NSString * prefix;
-
- /**
- The marker of this query. It's only set when there's remaining buckets to return.
- */
- @property (nonatomic, copy) NSString * marker;
-
- /**
- The max buckets to return. It's only set when there's remaining buckets to return.
- */
- @property (nonatomic, assign) int32_t maxKeys;
-
- /**
- Flag of the result is truncated. If it's truncated, it means there's remaining buckets to return.
- */
- @property (nonatomic, assign) BOOL isTruncated;
-
- /**
- The marker for the next ListBucket call. It's only set when there's remaining buckets to return.
- */
- @property (nonatomic, copy) NSString * nextMarker;
-
- /**
- The container of the buckets. It's a dictionary array, in which every element has keys "Name", "CreationDate" and "Location".
- */
- @property (nonatomic, strong, nullable) NSArray * buckets;
- @end
-
- /**
- The request to create bucket
- */
- @interface OSSCreateBucketRequest : OSSRequest
-
- /**
- * 存储空间,命名规范如下:(1)只能包括小写字母、数字和短横线(-);(2)必须以小写字母或者数字开头和结尾;(3)长度必须在3-63字节之间.
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- The bucket location
- For more information about OSS datacenter and endpoint, please check out <a>https://docs.aliyun.com/#/pub/oss/product-documentation/domain-region</a>
- */
- @property (nonatomic, copy) NSString * location __attribute__ ((deprecated));
-
- /**
- Sets Bucket access permission. For now there're three permissions:public-read-write,public-read and private. if this key is not set, the default value is private
- */
- @property (nonatomic, copy) NSString * xOssACL;
-
- @end
-
- /**
- Result class of bucket creation
- */
- @interface OSSCreateBucketResult : OSSResult
-
- /**
- Bucket datacenter
- */
- @property (nonatomic, copy) NSString * location;
- @end
-
- /**
- The request class of deleting bucket
- */
- @interface OSSDeleteBucketRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
- @end
-
- /**
- Result class of deleting bucket
- */
- @interface OSSDeleteBucketResult : OSSResult
- @end
-
- /**
- The request class of listing objects under a bucket
- */
- @interface OSSGetBucketRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- The delimiter is very important and it determines the behavior of common prefix.
- For most cases, use the default '/' as the delimiter.
- For example, if a bucket has folder 'prefix/' and a file 'abc'. And inside the folder it has file '123.txt'
- If the delimiter is '/', then the ListObject will return a common prefix 'prefix/' and a file 'abc'.
- If the delimiter is something else, then ListObject will return three files: prefix/, abc and prefix/123.txt. No common prefix!.
- */
- @property (nonatomic, copy) NSString * delimiter;
-
- /**
- The marker filter for listing objects----optional.
- The marker filter is to ensure any returned object name must be greater than the marker in the lexicographic order.
- */
- @property (nonatomic, copy) NSString * marker;
-
- /**
- The max entries count to return. By default it's 100 and it could be up to 1000.
- */
- @property (nonatomic, assign) int32_t maxKeys;
-
- /**
- The filter prefix of the objects to return----the returned objects' name must have the prefix.
- */
- @property (nonatomic, copy) NSString * prefix;
-
- /**
- Generates the query parameter dictionary according to the properties.
- */
- - (NSMutableDictionary *)getQueryDict;
- @end
-
- /**
- The result class of listing objects.
- */
- @interface OSSGetBucketResult : OSSResult
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- The prefix of the objects returned----the returned objects must have this prefix.
- */
- @property (nonatomic, copy) NSString * prefix;
-
- /**
- The marker filter of the objects returned---all objects returned are greater than this marker in lexicographic order.
- */
- @property (nonatomic, copy) NSString * marker;
-
- /**
- The max entries to return. By default it's 100 and it could be up to 1000.
- */
- @property (nonatomic, assign) int32_t maxKeys;
-
- /**
- The delimiter to differentiate the folder object and file object.
- For object whose name ends with the delimiter, then it's treated as folder or common prefixes.
- */
- @property (nonatomic, copy) NSString * delimiter;
-
- /**
- The maker for the next call. If no more entries to return, it's null.
- */
- @property (nonatomic, copy) NSString * nextMarker;
-
- /**
- Flag of truncated result. If it's truncated, it means there's more entries to return.
- */
- @property (nonatomic, assign) BOOL isTruncated;
-
- /**
- The dictionary arrary, in which each dictionary has keys of "Key", "LastModified", "ETag", "Type", "Size", "StorageClass" and "Owner".
- */
- @property (nonatomic, strong, nullable) NSArray * contents;
-
- /**
- The arrary of common prefixes. Each element is one common prefix.
- */
- @property (nonatomic, strong) NSArray * commentPrefixes;
- @end
-
- /**
- The request class to get the bucket ACL.
- */
- @interface OSSGetBucketACLRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
- @end
-
- /**
- The result class to get the bucket ACL.
- */
- @interface OSSGetBucketACLResult : OSSResult
-
- /**
- The bucket ACL. It could be one of the three values: private/public-read/public-read-write.
- */
- @property (nonatomic, copy) NSString * aclGranted;
- @end
-
- /**
- The request class to get object metadata
- */
- @interface OSSHeadObjectRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
- @end
-
- /**
- The result class of getting object metadata.
- */
- @interface OSSHeadObjectResult : OSSResult
-
- /**
- Object metadata
- */
- @property (nonatomic, copy) NSDictionary * objectMeta;
- @end
-
- /**
- The request class to get object
- */
- @interface OSSGetObjectRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- OSS Download Range: For example, bytes=0-9 means uploading the first to the tenth's character.
- */
- @property (nonatomic, strong) OSSRange * range;
-
- /**
- The local file path to download to.
- */
- @property (nonatomic, strong) NSURL * downloadToFileURL;
-
- /**
- Image processing configuration.
- */
- @property (nonatomic, copy) NSString * xOssProcess;
-
- /**
- Download progress callback.
- It runs at background thread.
- */
- @property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress;
-
- /**
- During the object download, the callback is called upon response is received.
- It runs under background thread (not UI thread)
- */
- @property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData;
- @end
-
- /**
- Result class of downloading an object.
- */
- @interface OSSGetObjectResult : OSSResult
-
- /**
- The in-memory content of the downloaded object, if the local file path is not specified.
- */
- @property (nonatomic, strong) NSData * downloadedData;
-
- /**
- The object metadata dictionary
- */
- @property (nonatomic, copy) NSDictionary * objectMeta;
- @end
-
-
- /**
- The response class to update the object ACL.
- */
- @interface OSSPutObjectACLResult : OSSResult
- @end
-
- /**
- The request class to upload an object.
- */
- @interface OSSPutObjectRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- The in-memory data to upload.
- */
- @property (nonatomic, strong) NSData * uploadingData;
-
- /**
- The local file path to upload.
- */
- @property (nonatomic, strong) NSURL * uploadingFileURL;
-
- /**
- The callback parameters.
- */
- @property (nonatomic, copy) NSDictionary * callbackParam;
-
- /**
- The callback variables.
- */
- @property (nonatomic, copy) NSDictionary * callbackVar;
-
- /**
- The content type.
- */
- @property (nonatomic, copy) NSString * contentType;
-
- /**
- The content's MD5 digest.
- It's calculated on the request body (not headers) according to RFC 1864 to get the 128 bit digest data.
- Then use base64 encoding on the 128bit result to get this MD5 value.
- This header is for integrity check on the data. And it's recommended to turn on for every body.
- */
- @property (nonatomic, copy) NSString * contentMd5;
-
- /**
- Specifies the download name of the object. Checks out RFC2616 for more details.
- */
- @property (nonatomic, copy) NSString * contentDisposition;
-
- /**
- Specifies the content encoding during the download. Checks out RFC2616 for more details.
- */
- @property (nonatomic, copy) NSString * contentEncoding;
-
- /**
- Specifies the cache behavior during the download. Checks out RFC2616 for more details.
- */
- @property (nonatomic, copy) NSString * cacheControl;
-
- /**
- Expiration time in milliseconds. Checks out RFC2616 for more details.
- */
- @property (nonatomic, copy) NSString * expires;
-
- /**
- The object's metadata.
- When the object is being uploaded, it could be specified with http headers prefixed with x-oss-meta for user metadata.
- The total size of all user metadata cannot be more than 8K.
- It also could include standard HTTP headers in this object.
- */
- @property (nonatomic, copy) NSDictionary * objectMeta;
-
- /**
- The upload progress callback.
- It runs in background thread (not UI thread).
- */
- @property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-
- /**
- The upload retry callback.
- It runs in background thread (not UI thread).
- */
- @property (nonatomic, copy) OSSNetworkingRetryBlock uploadRetryCallback;
-
- /**
- * the sha1 of content
- */
- @property (nonatomic, copy) NSString *contentSHA1;
-
- @end
-
- /**
- The request class to update the object ACL.
- */
- @interface OSSPutObjectACLRequest : OSSPutObjectRequest
-
- /**
- *@brief:指定oss创建object时的访问权限,合法值:public-read、private、public-read-write
- */
- @property (nonatomic, copy, nullable) NSString *acl;
-
- @end
-
- /**
- The result class to put an object
- */
- @interface OSSPutObjectResult : OSSResult
-
- /**
- ETag (entity tag) is the tag during the object creation in OSS server side.
- It's the MD5 value for put object request. If the object is created by other APIs, the ETag is the UUID of the content.
- ETag could be used to check if the object has been updated.
- */
- @property (nonatomic, copy) NSString * eTag;
-
- /**
- If the callback is specified, this is the callback response result.
- */
- @property (nonatomic, copy) NSString * serverReturnJsonString;
- @end
-
- /**
- * append object request
- */
- @interface OSSAppendObjectRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- Specifies which position to append. For a new file, the first append should start from 0. And the subsequential calls will start from the current length of the object.
- For example, if the first append's size is 65536, then the appendPosition value in the next call will be 65536.
- In its response, the header x-oss-next-append-position is included for next call.
- */
- @property (nonatomic, assign) int64_t appendPosition;
-
- /**
- The in-memory data to upload from.
- */
- @property (nonatomic, strong) NSData * uploadingData;
-
- /**
- The local file path to upload from.
- */
- @property (nonatomic, strong) NSURL * uploadingFileURL;
-
- /**
- Sets the content type
- */
- @property (nonatomic, copy) NSString * contentType;
-
- /**
- The content's MD5 digest value.
- It's calculated from the MD5 value of the request body according to RFC 1864 and then encoded by base64.
- */
- @property (nonatomic, copy) NSString *contentMd5;
-
- /**
- The object's name during the download according to RFC 2616.
- */
- @property (nonatomic, copy) NSString * contentDisposition;
-
- /**
- The content encoding during the object upload. Checks out RFC2616 for more detail.
- */
- @property (nonatomic, copy) NSString * contentEncoding;
-
- /**
- Specifies the cache control behavior when it's being downloaded.Checks out RFC 2616 for more details.
- */
- @property (nonatomic, copy) NSString * cacheControl;
-
- /**
- Expiration time. Checks out RFC2616 for more information.
- */
- @property (nonatomic, copy) NSString * expires;
-
- /**
- The object's metadata, which start with x-oss-meta-, such as x-oss-meta-location.
- Each request can have multiple metadata as long as the total size of all metadata is no bigger than 8KB.
- It could include standard headers as well.
- */
- @property (nonatomic, copy) NSDictionary * objectMeta;
-
- /**
- Upload progress callback.
- It's called on the background thread.
- */
- @property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-
- /**
- * the sha1 of content
- */
- @property (nonatomic, copy) NSString *contentSHA1;
-
-
- @end
-
- /**
- * append object result
- */
- @interface OSSAppendObjectResult : OSSResult
-
- /**
- TODOTODO
- ETag (entity tag). It's created for every object when it's created.
- For Objects created by PUT, ETag is the MD5 value of the content data. For others, ETag is the UUID of the content.
- ETag is used for checking data integrity.
- */
- @property (nonatomic, copy) NSString * eTag;
-
- /**
- Specifies the next starting position. It's essentially the current object size.
- This header is included in the successful response or the error response when the start position does not match the object size.
- */
- @property (nonatomic, assign, readwrite) int64_t xOssNextAppendPosition;
- @end
-
- /**
- The request of deleting an object.
- */
- @interface OSSDeleteObjectRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object object
- */
- @property (nonatomic, copy) NSString * objectKey;
- @end
-
- /**
- Result class of deleting an object
- */
- @interface OSSDeleteObjectResult : OSSResult
- @end
-
- /**
- Request class of copying an object in OSS.
- */
- @interface OSSCopyObjectRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- Source object's address (the caller needs the read permission on this object)
- */
- @property (nonatomic, copy) NSString * sourceCopyFrom;
-
- /**
- The content type
- */
- @property (nonatomic, copy) NSString * contentType;
-
- /**
- The content's MD5 digest.
- It's calculated according to RFC 1864 and encoded in base64.
- Though it's optional, it's recommended to turn it on for integrity check.
- */
- @property (nonatomic, copy) NSString * contentMd5;
-
- /**
- The user metadata dictionary, which starts with x-oss-meta-.
- The total size of user metadata can be no more than 8KB.
- It could include standard http headers as well.
- */
- @property (nonatomic, copy) NSDictionary * objectMeta;
-
- /**
- * the sha1 of content
- */
- @property (nonatomic, copy) NSString *contentSHA1;
-
-
- @end
-
- /**
- The result class of copying an object
- */
- @interface OSSCopyObjectResult : OSSResult
-
- /**
- The last modified time
- */
- @property (nonatomic, copy) NSString * lastModifed;
-
- /**
- The ETag of the new object.
- */
- @property (nonatomic, copy) NSString * eTag;
- @end
-
- /**
- Request class of initiating a multipart upload.
- */
- @interface OSSInitMultipartUploadRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- Content type
- */
- @property (nonatomic, copy) NSString * contentType;
-
- /**
- The object's download name. Checks out RFC 2616 for more details.
- */
- @property (nonatomic, copy) NSString * contentDisposition;
-
- /**
- The content encoding. Checks out RFC 2616.
- */
- @property (nonatomic, copy) NSString * contentEncoding;
-
- /**
- Specifies the cache control behavior when it's downloaded. Checks out RFC 2616 for more details.
- */
- @property (nonatomic, copy) NSString * cacheControl;
-
- /**
- Expiration time in milliseconds. Checks out RFC 2616 for more details.
- */
- @property (nonatomic, copy) NSString * expires;
-
- /**
- The dictionary of object's custom metadata, which starts with x-oss-meta-.
- The total size of user metadata is no more than 8KB.
- It could include other standard http headers.
- */
- @property (nonatomic, copy) NSDictionary * objectMeta;
-
- /**
- * When Setting this value to YES , parts will be uploaded in order. Default value is NO.
- */
- @property (nonatomic, assign) BOOL sequential;
-
- @end
-
- /**
- The resutl class of initiating a multipart upload.
- */
- @interface OSSInitMultipartUploadResult : OSSResult
-
- /**
- The upload Id of the multipart upload
- */
- @property (nonatomic, copy) NSString * uploadId;
- @end
-
- /**
- The request class of uploading one part.
- */
- @interface OSSUploadPartRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectkey;
-
- /**
- Multipart Upload id.
- */
- @property (nonatomic, copy) NSString * uploadId;
-
- /**
- The part number of this part.
- */
- @property (nonatomic, assign) int partNumber;
-
- /**
- The content MD5 value.
- It's calculated according to RFC 1864 and encoded in base64.
- Though it's optional, it's recommended to turn it on for integrity check.
- */
- @property (nonatomic, copy) NSString * contentMd5;
-
- /**
- The in-memory data to upload from.
- */
- @property (nonatomic, strong) NSData * uploadPartData;
-
- /**
- The local file path to upload from
- */
- @property (nonatomic, strong) NSURL * uploadPartFileURL;
-
- /**
- The upload progress callback.
- It runs in background thread (not UI thread);
- */
- @property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadPartProgress;
-
- /**
- * the sha1 of content
- */
- @property (nonatomic, copy) NSString *contentSHA1;
-
- @end
-
- /**
- The result class of uploading one part.
- */
- @interface OSSUploadPartResult : OSSResult
- @property (nonatomic, copy) NSString * eTag;
- @end
-
- /**
- The Part information. It's called by CompleteMultipartUpload().
- */
- @interface OSSPartInfo : NSObject<NSCopying>
-
- /**
- The part number in this part upload.
- */
- @property (nonatomic, assign) int32_t partNum;
-
- /**
- ETag value of this part returned by OSS.
- */
- @property (nonatomic, copy) NSString * eTag;
-
- /**
- The part size.
- */
- @property (nonatomic, assign) int64_t size;
-
- @property (nonatomic, assign) uint64_t crc64;
-
- + (instancetype)partInfoWithPartNum:(int32_t)partNum eTag:(NSString *)eTag size:(int64_t)size __attribute__((deprecated("Use partInfoWithPartNum:eTag:size:crc64: to instead!")));
- + (instancetype)partInfoWithPartNum:(int32_t)partNum eTag:(NSString *)eTag size:(int64_t)size crc64:(uint64_t)crc64;
-
- - (NSDictionary *)entityToDictionary;
-
- @end
-
- /**
- The request class of completing a multipart upload.
- */
- @interface OSSCompleteMultipartUploadRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- Multipart upload Id
- */
- @property (nonatomic, copy) NSString * uploadId;
-
- /**
- The content MD5 value.
- It's calculated according to RFC 1864 and encoded in base64.
- Though it's optional, it's recommended to turn it on for integrity check.
- */
- @property (nonatomic, copy) NSString * contentMd5;
-
- /**
- All parts' information.
- */
- @property (nonatomic, strong) NSArray * partInfos;
-
- /**
- Server side callback parameter
- */
- @property (nonatomic, copy) NSDictionary * callbackParam;
-
- /**
- Callback variables
- */
- @property (nonatomic, copy) NSDictionary * callbackVar;
-
- /**
- The metadata header
- */
- @property (nonatomic, copy) NSDictionary * completeMetaHeader;
-
- /**
- * the sha1 of content
- */
- @property (nonatomic, copy) NSString *contentSHA1;
-
- @end
-
- /**
- The resutl class of completing a multipart upload.
- */
- @interface OSSCompleteMultipartUploadResult : OSSResult
-
- /**
- The object's URL
- */
- @property (nonatomic, copy) NSString * location;
-
- /**
- ETag (entity tag).
- It's generated when the object is created.
- */
- @property (nonatomic, copy) NSString * eTag;
-
- /**
- The callback response if the callback is specified.
- The resutl class of initiating a multipart upload.
- */
- @property (nonatomic, copy) NSString * serverReturnJsonString;
- @end
-
- /**
- The request class of listing all parts that have been uploaded.
- */
- @interface OSSListPartsRequest : OSSRequest
-
- /**
- Bucket name
- The request class of uploading one part.*/
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- The multipart upload Id.
- */
- @property (nonatomic, copy) NSString * uploadId;
-
- /**
- The max part count to return
- */
- @property (nonatomic, assign) int maxParts;
-
- /**
- The part number marker filter---only parts whose part number is greater than this value will be returned.
- */
- @property (nonatomic, assign) int partNumberMarker;
- @end
-
- /**
- The result class of listing uploaded parts.
- */
- @interface OSSListPartsResult : OSSResult
-
- /**
- The next part number marker. If the response does not include all data, this header specifies what's the start point for the next list call.
- */
- @property (nonatomic, assign) int nextPartNumberMarker;
-
- /**
- The max parts count to return.
- */
- @property (nonatomic, assign) int maxParts;
-
- /**
- Flag of truncated data in the response. If it's true, it means there're more data to come.
- If it's false, it means all data have been returned.
- */
- @property (nonatomic, assign) BOOL isTruncated;
-
- /**
- The array of the part information.
- */
- @property (nonatomic, strong, nullable) NSArray * parts;
- @end
-
- /**
- The request class of listing all multipart uploads.
- */
- @interface OSSListMultipartUploadsRequest : OSSRequest
- /**
- Bucket name.
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- The delimiter.
- */
- @property (nonatomic, copy) NSString * delimiter;
-
- /**
- The prefix.
- */
- @property (nonatomic, copy) NSString * prefix;
-
- /**
- The max number of uploads.
- */
- @property (nonatomic, assign) int32_t maxUploads;
-
- /**
- The key marker filter.
- */
- @property (nonatomic, copy) NSString * keyMarker;
-
- /**
- The upload Id marker.
- */
- @property (nonatomic, copy) NSString * uploadIdMarker;
-
- /**
- The encoding type of the object in the response body.
- */
- @property (nonatomic, copy) NSString * encodingType;
-
- /**
- Generates the query parameter dictionary according to the properties.
- */
- - (NSMutableDictionary *)getQueryDict;
-
- @end
-
- /**
- The result class of listing multipart uploads.
- */
- @interface OSSListMultipartUploadsResult : OSSResult
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- The marker filter of the objects returned---all objects returned are greater than this marker in lexicographic order.
- */
- @property (nonatomic, copy) NSString * keyMarker;
-
- /**
- The delimiter to differentiate the folder object and file object.
- For object whose name ends with the delimiter, then it's treated as folder or common prefixes.
- */
- @property (nonatomic, copy) NSString * delimiter;
-
- /**
- The prefix of the objects returned----the returned objects must have this prefix.
- */
- @property (nonatomic, copy) NSString * prefix;
-
- /**
- The upload Id marker.
- */
- @property (nonatomic, copy) NSString * uploadIdMarker;
-
- /**
- The max entries to return. By default it's 100 and it could be up to 1000.
- */
- @property (nonatomic, assign) int32_t maxUploads;
-
- /**
- If not all results are returned this time, the response request includes the NextKeyMarker element to indicate the value of KeyMarker in the next request.
- */
- @property (nonatomic, copy) NSString * nextKeyMarker;
-
- /**
- If not all results are returned this time, the response request includes the NextUploadMarker element to indicate the value of UploadMarker in the next request.
- */
- @property (nonatomic, copy) NSString * nextUploadIdMarker;
-
- /**
- Flag of truncated result. If it's truncated, it means there's more entries to return.
- */
- @property (nonatomic, assign) BOOL isTruncated;
-
- @property (nonatomic, strong, nullable) NSArray * uploads;
-
- /**
- The arrary of common prefixes. Each element is one common prefix.
- */
- @property (nonatomic, strong) NSArray * commonPrefixes;
- @end
-
- /**
- Request to abort a multipart upload
- */
- @interface OSSAbortMultipartUploadRequest : OSSRequest
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object name
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- The multipart upload Id.
- */
- @property (nonatomic, copy) NSString * uploadId;
- @end
-
- /**
- The result class of aborting a multipart upload
- */
- @interface OSSAbortMultipartUploadResult : OSSResult
- @end
-
- /**
- The request class of multipart upload.
- */
- @interface OSSMultipartUploadRequest : OSSRequest
-
- /**
- The upload Id
- */
- @property (nonatomic, copy) NSString * uploadId;
-
- /**
- Bucket name
- */
- @property (nonatomic, copy) NSString * bucketName;
-
- /**
- Object object
- */
- @property (nonatomic, copy) NSString * objectKey;
-
- /**
- The local file path to upload from.
- */
- @property (nonatomic, strong) NSURL * uploadingFileURL;
-
- /**
- The part size, minimal value is 100KB.
- */
- @property (nonatomic, assign) NSUInteger partSize;
-
- /**
- Upload progress callback.
- It runs at the background thread (not UI thread).
- */
- @property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-
- /**
- The callback parmeters
- */
- @property (nonatomic, copy) NSDictionary * callbackParam;
-
- /**
- The callback variables
- */
- @property (nonatomic, copy) NSDictionary * callbackVar;
-
- /**
- Content type
- */
- @property (nonatomic, copy) NSString * contentType;
-
- /**
- The metadata header
- */
- @property (nonatomic, copy) NSDictionary * completeMetaHeader;
-
- /**
- * the sha1 of content
- */
- @property (nonatomic, copy) NSString *contentSHA1;
-
- /**
- * the md5 of content
- */
- @property (nonatomic, copy) NSString *md5String;
-
-
- - (void)cancel;
- @end
-
- /**
- The request class of resumable upload.
- */
- @interface OSSResumableUploadRequest : OSSMultipartUploadRequest
-
-
- /**
- directory path about create record uploadId file
- */
- @property (nonatomic, copy) NSString * recordDirectoryPath;
-
-
- /**
- need or not delete uploadId with cancel
- */
- @property (nonatomic, assign) BOOL deleteUploadIdOnCancelling;
-
- /**
- All running children requests
- */
- @property (atomic, weak) OSSRequest * runningChildrenRequest;
-
- @end
-
-
- /**
- The result class of resumable uploading
- */
- @interface OSSResumableUploadResult : OSSResult
-
- /**
- The callback response, if the callback is specified.
- */
- @property (nonatomic, copy) NSString * serverReturnJsonString;
-
- @end
-
-
- /**
- for more information,Please refer to the link https://help.aliyun.com/document_detail/31989.html
- */
- @interface OSSCallBackRequest : OSSRequest
-
- @property (nonatomic, copy) NSString *bucketName;
-
- @property (nonatomic, copy) NSString *objectName;
- /**
- The callback parameters.when you set this value,there are required params as below:
- {
- "callbackUrl": xxx
- "callbackBody": xxx
- }
- */
- @property (nonatomic, copy) NSDictionary *callbackParam;
- /**
- The callback variables.
- */
- @property (nonatomic, copy) NSDictionary *callbackVar;
-
- @end
-
-
-
- @interface OSSCallBackResult : OSSResult
-
- @property (nonatomic, copy) NSDictionary *serverReturnXML;
-
- /**
- If the callback is specified, this is the callback response result.
- */
- @property (nonatomic, copy) NSString *serverReturnJsonString;
-
- @end
-
-
- /**
- for more information,Please refer to the link https://help.aliyun.com/document_detail/55811.html
- */
- @interface OSSImagePersistRequest : OSSRequest
-
- @property (nonatomic, copy) NSString *fromBucket;
-
- @property (nonatomic, copy) NSString *fromObject;
-
- @property (nonatomic, copy) NSString *toBucket;
-
- @property (nonatomic, copy) NSString *toObject;
-
- @property (nonatomic, copy) NSString *action;
-
- @end
-
- @interface OSSImagePersistResult : OSSResult
-
- @end
-
- NS_ASSUME_NONNULL_END
|