Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (8 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
+ (id)createOrUpdateContainerRequestWithContainerName:(NSString *)containerName 
126
                                               policy:(NSDictionary *)policy 
127
                                             metadata:(NSDictionary *)metadata;
128

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

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

    
160
@end