-
Notifications
You must be signed in to change notification settings - Fork 75
/
ObjectiveResource.h
71 lines (59 loc) · 2.06 KB
/
ObjectiveResource.h
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
//
// ObjectiveResource.h
// medaxion
//
// Created by Ryan Daigle on 7/24/08.
// Copyright 2008 yFactorial, LLC. All rights reserved.
//
@interface ObjectiveResource : NSObject
// Response Formats
typedef enum {
XmlResponse = 0,
JSONResponse,
} ResponseFormat;
// Resource configuration
+ (NSString *)getSite;
+ (void)setSite:(NSString*)siteURL;
+ (NSString *)getUser;
+ (void)setUser:(NSString *)user;
+ (NSString *)getPassword;
+ (void)setPassword:(NSString *)password;
+ (SEL)getParseDataMethod;
+ (void)setParseDataMethod:(SEL)parseMethod;
+ (SEL) getSerializeMethod;
+ (void) setSerializeMethod:(SEL)serializeMethod;
+ (NSString *)protocolExtension;
+ (void)setProtocolExtension:(NSString *)protocolExtension;
+ (void)setResponseType:(ResponseFormat) format;
+ (ResponseFormat)getResponseType;
// Finders
+ (NSArray *)findAll;
+ (NSArray *)findAllWithResponse:(NSError **)aError;
+ (id)find:(NSString *)elementId;
+ (id)find:(NSString *)elementId withResponse:(NSError **)aError;
// URL construction accessors
+ (NSString *)elementName;
+ (NSString *)collectionName;
+ (NSString *)elementPath:(NSString *)elementId;
+ (NSString *)collectionPath;
+ (NSString *)collectionPathWithParameters:(NSDictionary *)parameters;
+ (NSString *)populatePath:(NSString *)path withParameters:(NSDictionary *)parameters;
// Instance-specific methods
- (id)getId;
- (NSString *)classIdName;
- (BOOL)create;
- (BOOL)createWithResponse:(NSError **)aError;
- (BOOL)createWithParameters:(NSDictionary *)parameters;
- (BOOL)createWithParameters:(NSDictionary *)parameters andResponse:(NSError **)aError;
- (BOOL)destroy;
- (BOOL)destroyWithResponse:(NSError **)aError;
- (BOOL)update;
- (BOOL)updateWithResponse:(NSError **)aError;
- (BOOL)save;
- (BOOL)saveWithResponse:(NSError **)aError;
- (BOOL)createAtPath:(NSString *)path withResponse:(NSError **)aError;
- (BOOL)updateAtPath:(NSString *)path withResponse:(NSError **)aError;
- (BOOL)destroyAtPath:(NSString *)path withResponse:(NSError **)aError;
// Instance helpers for getting at commonly used class-level values
- (NSString *)collectionPath;
@end