Statistics
| Branch: | Revision:

root / asi-http-request-with-pithos / Classes / Pithos / ASIPithosContainerRequest.h @ 6b3a5e6a

History | View | Annotate | Download (8.2 kB)

1
//  ASIPithosContainerRequest.h
2
//  Based on ASICloudFilesContainerRequest.h
3
//
4
// Copyright 2011 GRNET S.A. All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or
7
// without modification, are permitted provided that the following
8
// conditions are met:
9
// 
10
//   1. Redistributions of source code must retain the above
11
//      copyright notice, this list of conditions and the following
12
//      disclaimer.
13
// 
14
//   2. Redistributions in binary form must reproduce the above
15
//      copyright notice, this list of conditions and the following
16
//      disclaimer in the documentation and/or other materials
17
//      provided with the distribution.
18
// 
19
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
20
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
23
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
// POSSIBILITY OF SUCH DAMAGE.
31
// 
32
// The views and conclusions contained in the software and
33
// documentation are those of the authors and should not be
34
// interpreted as representing official policies, either expressed
35
// or implied, of GRNET S.A.
36

    
37
#import "ASIPithosRequest.h"
38

    
39
#if !TARGET_OS_IPHONE || (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_4_0)
40
#import "ASINSXMLParserCompat.h"
41
#endif
42

    
43
@class ASIPithosContainer;
44
@class ASIPithosObject;
45

    
46
@interface ASIPithosContainerRequest : ASIPithosRequest <NSXMLParserDelegate> {
47
    NSString *containerName;
48
    
49
    NSMutableDictionary *policy;
50
    NSMutableDictionary *metadata;
51
    
52
    NSMutableArray *objects;
53

    
54
        // Internally used while parsing the response
55
        ASIPithosObject *currentObject;
56
}
57

    
58
@property (retain) NSString *containerName;
59
@property (retain) ASIPithosObject *currentObject;
60

    
61
// HEAD storageURL/container
62
+ (id)containerMetadataRequestWithContainerName:(NSString *)containerName;
63
// HEAD storageURL/container?[until=untilTimestamp]
64
+ (id)containerMetadataRequestWithContainerName:(NSString *)containerName until:(NSDate *)untilTimestamp;
65
// HEAD storageURL/container?[until=untilTimestamp] [If-Modified-Since]
66
+ (id)containerMetadataRequestWithContainerName:(NSString *)containerName 
67
                                          until:(NSDate *)untilTimestamp 
68
                                ifModifiedSince:(NSDate *)sinceTimestamp;
69
// HEAD storageURL/container?[until=untilTimestamp] [If-Unmodified-Since]
70
+ (id)containerMetadataRequestWithContainerName:(NSString *)containerName 
71
                                          until:(NSDate *)untilTimestamp 
72
                              ifUnmodifiedSince:(NSDate *)sinceTimestamp;
73

    
74
- (NSUInteger)objectCount;
75
- (NSUInteger)bytesUsed;
76
- (NSUInteger)blockSize;
77
- (NSString *)blockHash;
78
- (NSDate *)untilTimestamp;
79
- (NSArray *)objectMeta;
80
- (NSDictionary *)policy;
81
- (NSDictionary *)metadata;
82
- (NSDate *)lastModified;
83

    
84
- (ASIPithosContainer *)container;
85

    
86
// GET storageURL/container
87
+ (id)listObjectsRequestWithContainerName:(NSString *)containerName;
88
// GET storageURL?[limit=limit]&[marker=marker]&[prefix=prefix]&[delimiter=delimiter]&[path=path]&[meta=meta]&[shared=]&[until=untilTimestamp]
89
+ (id)listObjectsRequestWithContainerName:(NSString *)containerName
90
                                    limit:(NSUInteger)limit 
91
                                   marker:(NSString *)marker 
92
                                   prefix:(NSString *)prefix 
93
                                delimiter:(NSString *)delimiter 
94
                                     path:(NSString *)path 
95
                                     meta:(NSArray *)meta 
96
                                   shared:(BOOL)shared
97
                                    until:(NSDate *)untilTimestamp;
98
// GET storageURL?[limit=limit]&[marker=marker]&[prefix=prefix]&[delimiter=delimiter]&[path=path]&[meta=meta]&[shared=]&[until=untilTimestamp] [If-Modified-Since]
99
+ (id)listObjectsRequestWithContainerName:(NSString *)containerName
100
                                    limit:(NSUInteger)limit 
101
                                   marker:(NSString *)marker 
102
                                   prefix:(NSString *)prefix 
103
                                delimiter:(NSString *)delimiter 
104
                                     path:(NSString *)path 
105
                                     meta:(NSArray *)meta 
106
                                   shared:(BOOL)shared
107
                                    until:(NSDate *)untilTimestamp 
108
                          ifModifiedSince:(NSDate *)sinceTimestamp;
109
// GET storageURL?[limit=limit]&[marker=marker]&[prefix=prefix]&[delimiter=delimiter]&[path=path]&[meta=meta]&[shared=]&[until=untilTimestamp] [If-Unmodified-Since]
110
+ (id)listObjectsRequestWithContainerName:(NSString *)containerName
111
                                    limit:(NSUInteger)limit 
112
                                   marker:(NSString *)marker 
113
                                   prefix:(NSString *)prefix 
114
                                delimiter:(NSString *)delimiter 
115
                                     path:(NSString *)path 
116
                                     meta:(NSArray *)meta 
117
                                   shared:(BOOL)shared
118
                                    until:(NSDate *)untilTimestamp 
119
                        ifUnmodifiedSince:(NSDate *)sinceTimestamp;
120

    
121
- (NSArray *)objects;
122

    
123
// PUT storageURL/container
124
+ (id)createOrUpdateContainerRequestWithContainerName:(NSString *)containerName;
125
// PUT storageURL/container [X-Container-Policy-*] [X-Container-Meta-*]
126
+ (id)createOrUpdateContainerRequestWithContainerName:(NSString *)containerName 
127
                                               policy:(NSDictionary *)policy 
128
                                             metadata:(NSDictionary *)metadata;
129

    
130
// POST storageURL/container
131
+ (id)updateContainerMetadataRequestWithContainerName:(NSString *)containerName;
132
// POST storageURL/container?[update=] [X-Container-Policy-*] [X-Container-Meta-*]
133
+ (id)updateContainerMetadataRequestWithContainerName:(NSString *)containerName 
134
                                               policy:(NSDictionary *)policy 
135
                                             metadata:(NSDictionary *)metadata 
136
                                               update:(BOOL)update;
137
// POST storageURL/container?[update=] [X-Container-Policy-*] [X-Container-Meta-*] (update data from ASIPithosObject with data)
138
+ (id)updateContainerDataRequestWithContainerName:(NSString *)containerName 
139
                                           policy:(NSDictionary *)policy 
140
                                         metadata:(NSDictionary *)metadata 
141
                                           update:(BOOL)update
142
                                           object:(ASIPithosObject *)object;
143
// POST storageURL/container?[update=] [X-Container-Policy-*] [X-Container-Meta-*] (update data from NSData)
144
+ (id)updateContainerDataRequestWithContainerName:(NSString *)containerName 
145
                                           policy:(NSDictionary *)policy 
146
                                         metadata:(NSDictionary *)metadata 
147
                                           update:(BOOL)update
148
                                             data:(NSData *)data;
149
// POST storageURL/container?[update=] [X-Container-Policy-*] [X-Container-Meta-*] (update data from file)
150
+ (id)updateContainerDataRequestWithContainerName:(NSString *)containerName 
151
                                           policy:(NSDictionary *)policy 
152
                                         metadata:(NSDictionary *)metadata 
153
                                           update:(BOOL)update
154
                                             file:(NSString *)filePath;
155

    
156
// DELETE storageURL/container
157
+ (id)deleteContainerRequestWithContainerName:(NSString *)containerName;
158
// DELETE storageURL/container?[until=untilTimestamp]
159
+ (id)deleteContainerRequestWithContainerName:(NSString *)containerName until:(NSDate *)untilTimestamp;
160

    
161
@end