杨锴
2025-04-16 09a372bc45fde16fd42257ab6f78b8deeecf720b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
//
//  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;
- (void)addObserverForResetCurrentRetryCount;
@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;
 
/// Set whether to allow retry attempts when the app switches to the background
@property (nonatomic, assign) BOOL isAllowResetRetryCount;
 
/// Set whether to allow metric information
@property (nonatomic, assign) BOOL isAllowNetworkMetricInfo;
 
@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, nullable) OSSRange * range;
 
/**
 The local file path to download to.
 */
@property (nonatomic, strong, nullable) NSURL * downloadToFileURL;
 
/**
 Image processing configuration.
 */
@property (nonatomic, copy, nullable) NSString * xOssProcess;
 
/**
 Download progress callback.
 It runs at background thread.
 */
@property (nonatomic, copy, nullable) 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, nullable) OSSNetworkingOnRecieveDataBlock onRecieveData;
 
/**
 * set request headers
 */
@property (nonatomic, copy, nullable) 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, nullable) 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, nullable) NSData * uploadingData;
 
/**
 The local file path to upload.
 */
@property (nonatomic, strong, nullable) NSURL * uploadingFileURL;
 
/**
 The callback parameters.
 */
@property (nonatomic, copy, nullable) NSDictionary * callbackParam;
 
/**
 The callback variables.
 */
@property (nonatomic, copy, nullable) NSDictionary * callbackVar;
 
/**
 The content type.
 */
@property (nonatomic, copy, nullable) 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, nullable) NSString * contentMd5;
 
/**
 Specifies the download name of the object. Checks out RFC2616 for more details.
 */
@property (nonatomic, copy, nullable) NSString * contentDisposition;
 
/**
 Specifies the content encoding during the download. Checks out RFC2616 for more details.
 */
@property (nonatomic, copy, nullable) NSString * contentEncoding;
 
/**
 Specifies the cache behavior during the download. Checks out RFC2616 for more details.
 */
@property (nonatomic, copy, nullable) NSString * cacheControl;
 
/**
 Expiration time in milliseconds. Checks out RFC2616 for more details.
 */
@property (nonatomic, copy, nullable) 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, nullable) NSDictionary * objectMeta;
 
/**
 The upload progress callback.
 It runs in background thread (not UI thread).
 */
@property (nonatomic, copy, nullable) OSSNetworkingUploadProgressBlock uploadProgress;
 
/**
 The upload retry callback.
 It runs in background thread (not UI thread).
 */
@property (nonatomic, copy, nullable) OSSNetworkingRetryBlock uploadRetryCallback;
 
/**
 * the sha1 of content
 */
@property (nonatomic, copy, nullable) 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, nullable) NSString * eTag;
 
/**
 If the callback is specified, this is the callback response result.
 */
@property (nonatomic, copy, nullable) 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, nullable) NSData * uploadingData;
 
/**
 The local file path to upload from.
 */
@property (nonatomic, strong, nullable) NSURL * uploadingFileURL;
 
/**
 Sets the content type
 */
@property (nonatomic, copy, nullable) 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, nullable) NSString *contentMd5;
 
/**
 The object's name during the download according to RFC 2616.
 */
@property (nonatomic, copy, nullable) NSString * contentDisposition;
 
/**
 The content encoding during the object upload. Checks out RFC2616 for more detail.
 */
@property (nonatomic, copy, nullable) NSString * contentEncoding;
 
/**
 Specifies the cache control behavior when it's being downloaded.Checks out RFC 2616 for more details.
 */
@property (nonatomic, copy, nullable) NSString * cacheControl;
 
/**
 Expiration time. Checks out RFC2616 for more information.
 */
@property (nonatomic, copy, nullable) 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, nullable) NSDictionary * objectMeta;
 
/**
 Upload progress callback.
 It's called on the background thread.
 */
@property (nonatomic, copy, nullable) OSSNetworkingUploadProgressBlock uploadProgress;
 
/**
 * the sha1 of content
 */
@property (nonatomic, copy, nullable) 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, nullable) 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, nullable) 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, nullable) 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, nullable) NSDictionary * objectMeta;
 
/**
 * the sha1 of content
 */
@property (nonatomic, copy, nullable) NSString *contentSHA1;
 
 
@end
 
/**
 The result class of copying an object
 */
@interface OSSCopyObjectResult : OSSResult
 
/**
 The last modified time
 */
@property (nonatomic, copy, nullable) NSString * lastModifed;
 
/**
 The ETag of the new object.
 */
@property (nonatomic, copy, nullable) 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, nullable) NSString * contentType;
 
/**
 The object's download name. Checks out RFC 2616 for more details.
 */
@property (nonatomic, copy, nullable) NSString * contentDisposition;
 
/**
 The content encoding. Checks out RFC 2616.
 */
@property (nonatomic, copy, nullable) NSString * contentEncoding;
 
/**
 Specifies the cache control behavior when it's downloaded. Checks out RFC 2616 for more details.
 */
@property (nonatomic, copy, nullable) NSString * cacheControl;
 
/**
 Expiration time in milliseconds. Checks out RFC 2616 for more details.
 */
@property (nonatomic, copy, nullable) 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, nullable) 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, nullable) 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, nullable) NSString * contentMd5;
 
/**
 The in-memory data to upload from.
 */
@property (nonatomic, strong, nullable) NSData * uploadPartData;
 
/**
 The local file path to upload from
 */
@property (nonatomic, strong, nullable) NSURL * uploadPartFileURL;
 
/**
 The upload progress callback.
 It runs in background thread (not UI thread);
 */
@property (nonatomic, copy, nullable) OSSNetworkingUploadProgressBlock uploadPartProgress;
 
/**
 * the sha1 of content
 */
@property (nonatomic, copy, nullable) NSString *contentSHA1;
 
@end
 
/**
 The result class of uploading one part.
 */
@interface OSSUploadPartResult : OSSResult
@property (nonatomic, copy, nullable) 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, nullable) NSString * contentMd5;
 
/**
 All parts' information.
 */
@property (nonatomic, strong) NSArray * partInfos;
 
/**
 Server side callback parameter
 */
@property (nonatomic, copy, nullable) NSDictionary * callbackParam;
 
/**
 Callback variables 
 */
@property (nonatomic, copy, nullable) NSDictionary * callbackVar;
 
/**
 The metadata header
 */
@property (nonatomic, copy, nullable) NSDictionary * completeMetaHeader;
 
/**
 * the sha1 of content
 */
@property (nonatomic, copy, nullable) NSString *contentSHA1;
 
@end
 
/**
 The resutl class of completing a multipart upload.
 */
@interface OSSCompleteMultipartUploadResult : OSSResult
 
/**
 The object's URL
 */
@property (nonatomic, copy, nullable) NSString * location;
 
/**
 ETag (entity tag).
 It's generated when the object is created. 
 */
@property (nonatomic, copy, nullable) NSString * eTag;
 
/**
 The callback response if the callback is specified.
 The resutl class of initiating a multipart upload.
 */
@property (nonatomic, copy, nullable) 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, nullable) NSString * delimiter;
 
/**
 The prefix.
 */
@property (nonatomic, copy, nullable) NSString * prefix;
 
/**
 The max number of uploads.
 */
@property (nonatomic, assign) int32_t maxUploads;
 
/**
 The key marker filter.
 */
@property (nonatomic, copy, nullable) NSString * keyMarker;
 
/**
 The upload Id marker.
 */
@property (nonatomic, copy, nullable) NSString * uploadIdMarker;
 
/**
 The encoding type of the object in the response body.
 */
@property (nonatomic, copy, nullable) 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, nullable) 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, nullable) NSString * delimiter;
 
/**
 The prefix of the objects returned----the returned objects must have this prefix.
 */
@property (nonatomic, copy, nullable) NSString * prefix;
 
/**
 The upload Id marker.
 */
@property (nonatomic, copy, nullable) 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, nullable) 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, nullable) 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, nullable) 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, nullable) 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, nullable) OSSNetworkingUploadProgressBlock uploadProgress;
 
/**
 The callback parmeters
 */
@property (nonatomic, copy, nullable) NSDictionary * callbackParam;
 
/**
 The callback variables
 */
@property (nonatomic, copy, nullable) NSDictionary * callbackVar;
 
/**
 Content type
 */
@property (nonatomic, copy, nullable) NSString * contentType;
 
/**
 The metadata header
 */
@property (nonatomic, copy, nullable) NSDictionary * completeMetaHeader;
 
/**
 * the sha1 of content
 */
@property (nonatomic, copy, nullable) NSString *contentSHA1;
 
/**
 * the md5 of content
 */
@property (nonatomic, copy, nullable) NSString *md5String;
 
/// The concurrent number of shard uploads
@property (nonatomic, assign) uint32_t threadNum;
 
@property (nonatomic, assign) OSSTerminationMode terminationMode;
 
- (void)cancel;
@end
 
/**
 The request class of resumable upload.
 */
@interface OSSResumableUploadRequest : OSSMultipartUploadRequest
 
 
/**
 directory path about create record uploadId file 
 */
@property (nonatomic, copy, nullable) 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, nullable) 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