Statistics
| Branch: | Revision:

root / asi-http-request-with-pithos / Classes / S3 / ASIS3BucketRequest.h @ be116d22

History | View | Annotate | Download (2.5 kB)

1
//
2
//  ASIS3BucketRequest.h
3
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
4
//
5
//  Created by Ben Copsey on 16/03/2010.
6
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
7
//
8
//  Use this class to create buckets, fetch a list of their contents, and delete buckets
9

    
10
#import <Foundation/Foundation.h>
11
#import "ASIS3Request.h"
12

    
13
@class ASIS3BucketObject;
14

    
15
@interface ASIS3BucketRequest : ASIS3Request {
16
        
17
        // Name of the bucket to talk to
18
        NSString *bucket;
19
        
20
        // A parameter passed to S3 in the query string to tell it to return specialised information
21
        // Consult the S3 REST API documentation for more info
22
        NSString *subResource;
23
        
24
        // Options for filtering GET requests
25
        // See http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketGET.html
26
        NSString *prefix;
27
        NSString *marker;
28
        int maxResultCount;
29
        NSString *delimiter;
30
        
31
        // Internally used while parsing the response
32
        ASIS3BucketObject *currentObject;
33
        
34
        // Returns an array of ASIS3BucketObjects created from the XML response
35
        NSMutableArray *objects;        
36
        
37
        // Will be populated with a list of 'folders' when a delimiter is set
38
        NSMutableArray *commonPrefixes;
39
        
40
        // 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)
41
        BOOL isTruncated;
42
}
43

    
44
// Fetch a bucket
45
+ (id)requestWithBucket:(NSString *)bucket;
46

    
47
// Create a bucket request, passing a parameter in the query string
48
// You'll need to parse the response XML yourself
49
// Examples:
50
// Fetch ACL:
51
// ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:@"mybucket" parameter:@"acl"];
52
// Fetch Location:
53
// ASIS3BucketRequest *request = [ASIS3BucketRequest requestWithBucket:@"mybucket" parameter:@"location"];
54
// See the S3 REST API docs for more information about the parameters you can pass
55
+ (id)requestWithBucket:(NSString *)bucket subResource:(NSString *)subResource;
56

    
57
// Use for creating new buckets
58
+ (id)PUTRequestWithBucket:(NSString *)bucket;
59

    
60
// Use for deleting buckets - they must be empty for this to succeed
61
+ (id)DELETERequestWithBucket:(NSString *)bucket;
62

    
63
@property (retain, nonatomic) NSString *bucket;
64
@property (retain, nonatomic) NSString *subResource;
65
@property (retain, nonatomic) NSString *prefix;
66
@property (retain, nonatomic) NSString *marker;
67
@property (assign, nonatomic) int maxResultCount;
68
@property (retain, nonatomic) NSString *delimiter;
69
@property (retain, readonly) NSMutableArray *objects;
70
@property (retain, readonly) NSMutableArray *commonPrefixes;
71
@property (assign, readonly) BOOL isTruncated;
72
@end