12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520 |
- //
- // 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
- /**
- 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 require a STS INFO Server URL,also you can customize a decoder block which returns json data.
-
-
- OSSAuthCredentialProvider *acp = [[OSSAuthCredentialProvider alloc] initWithAuthServerUrl:@"sts_server_url" responseDecoder:^NSData * (NSData * data) {
- // 1.hanle response from server.
-
- // 2.initialize json object from step 1. json object require message like {AccessKeyId:@"xxx",AccessKeySecret:@"xxx",SecurityToken:@"xxx",Expiration:@"xxx"}
-
- // 3.generate jsonData from step 2 and return it.
- }];
-
- */
- @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 the flag of using Second Level Domain style to access the endpoint. By default it's false.
- */
- @property (nonatomic, assign) BOOL isPathStyleAccessEnable;
- /**
- Sets the flag of using custom path prefix to access the endpoint. By default it's false.
- */
- @property (nonatomic, assign) BOOL isCustomPathPrefixEnable;
- /**
- Sets CName excluded list.
- */
- @property (nonatomic, strong, setter=setCnameExcludeList:) NSArray * cnameExcludeList;
- /**
- 是否开启crc校验(当同时设置了此选项和请求中的checkCRC开关时,以请求中的checkCRC开关为准)
- */
- @property (nonatomic, assign) BOOL crc64Verifiable;
- /// Set whether to allow UA to carry system information
- @property (nonatomic, assign) BOOL isAllowUACarrySystemInfo;
- /// Set whether to allow the redirection with a modified request
- @property (nonatomic, assign) BOOL isFollowRedirectsEnable;
- /// The maximum number of simultaneous persistent connections per host.
- /// The default value is NSURLSessionConfiguration's default value
- /// https://developer.apple.com/documentation/foundation/urlsessionconfiguration/1407597-httpmaximumconnectionsperhost
- @property (nonatomic, assign) uint32_t HTTPMaximumConnectionsPerHost;
- @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;
- @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;
- @property (nonatomic, assign) OSSBucketStorageClass storageClass;
- - (NSString *)storageClassAsString;
- @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;
- @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;
- /**
- * set request headers
- */
- @property (nonatomic, copy) NSDictionary *headerFields;
- @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 DEPRECATED_MSG_ATTRIBUTE("please use sourceBucketName & sourceObjectKey instead!it will be removed in next version.");
- @property (nonatomic, copy) NSString * sourceBucketName;
- @property (nonatomic, copy) NSString * sourceObjectKey;
- /**
- 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;
- @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;
- /// The concurrent number of shard uploads
- @property (nonatomic, assign) uint32_t threadNum;
- - (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
|