单军华
2018-07-31 21d3023a9b7b6aff68c1170e345951396b1c6cfd
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
//
//  ASIS3BucketRequest.h
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
//
//  Created by Ben Copsey on 16/03/2010.
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
//
//  Use this class to create buckets, fetch a list of their contents, and delete buckets
 
#import <Foundation/Foundation.h>
#import "ASIS3Request.h"
 
@class ASIS3BucketObject;
 
@interface ASIS3BucketRequest : ASIS3Request {
    
    // Name of the bucket to talk to
    NSString *bucket;
    
    // A parameter passed to S3 in the query string to tell it to return specialised information
    // Consult the S3 REST API documentation for more info
    NSString *subResource;
    
    // Options for filtering GET requests
    // See http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketGET.html
    NSString *prefix;
    NSString *marker;
    int maxResultCount;
    NSString *delimiter;
    
    // Internally used while parsing the response
    ASIS3BucketObject *currentObject;
    
    // Returns an array of ASIS3BucketObjects created from the XML response
    NSMutableArray *objects;    
    
    // Will be populated with a list of 'folders' when a delimiter is set
    NSMutableArray *commonPrefixes;
    
    // Will be true if this request did not return all the results matching the query (use maxResultCount to configure the number of results to return)
    BOOL isTruncated;
}
 
// Fetch a bucket
+ (id)requestWithBucket:(NSString *)bucket;
 
// Create a bucket request, passing a parameter in the query string
// You'll need to parse the response XML yourself
// Examples:
// Fetch ACL:
// ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:@"mybucket" parameter:@"acl"];
// Fetch Location:
// ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:@"mybucket" parameter:@"location"];
// See the S3 REST API docs for more information about the parameters you can pass
+ (id)requestWithBucket:(NSString *)bucket subResource:(NSString *)subResource;
 
// Use for creating new buckets
+ (id)PUTRequestWithBucket:(NSString *)bucket;
 
// Use for deleting buckets - they must be empty for this to succeed
+ (id)DELETERequestWithBucket:(NSString *)bucket;
 
@property (retain, nonatomic) NSString *bucket;
@property (retain, nonatomic) NSString *subResource;
@property (retain, nonatomic) NSString *prefix;
@property (retain, nonatomic) NSString *marker;
@property (assign, nonatomic) int maxResultCount;
@property (retain, nonatomic) NSString *delimiter;
@property (retain, readonly) NSMutableArray *objects;
@property (retain, readonly) NSMutableArray *commonPrefixes;
@property (assign, readonly) BOOL isTruncated;
@end