|
19 | 19 | //
|
20 | 20 |
|
21 | 21 | #import <Foundation/Foundation.h>
|
| 22 | +#import "RKHTTPUtilities.h" |
22 | 23 |
|
23 | 24 | @class RKMapping;
|
24 | 25 |
|
25 | 26 | /**
|
26 | 27 | An `RKRequestDescriptor` object describes an object mapping configuration that is used to construct the parameters of an HTTP request for an object. Request descriptors are defined by specifying the `RKMapping` object (whose `objectClass` must be `NSMutableDictionary`) that is to be used when object mapping an object into an `NSDictionary` of parameters, the class of the type of object for which the mapping is to be applied, and an optional root key path under which the paramters are to be nested. Response descriptors are only utilized when construct parameters for an `NSURLRequest` with an HTTP method of `POST`, `PUT`, or `PATCH`.
|
27 |
| - |
| 28 | +
|
28 | 29 | @see RKObjectParameterization
|
29 | 30 | @see [RKObjectMapping requestMapping]
|
30 | 31 | @see [RKObjectManager requestWithObject:method:path:parameters:]
|
|
37 | 38 |
|
38 | 39 | /**
|
39 | 40 | Creates and returns a new `RKRequestDescriptor` object.
|
40 |
| - |
| 41 | +
|
41 | 42 | @param mapping The mapping to be used when parameterizing an object using the request descriptor. Cannot be nil and must have an objectClass equal to `[NSMutableDictionary class]`.
|
42 | 43 | @param objectClass The class of objects for which the request descriptor should be used. Cannot be nil.
|
43 | 44 | @param rootKeyPath The root key path under which paramters constructed using the response descriptor will be nested. If nil, the parameters will not be nested and returned as a flat dictionary object.
|
44 | 45 | @return A new `RKRequestDescriptor` object.
|
45 |
| - |
| 46 | +
|
46 | 47 | @see [RKObjectMapping requestMapping]
|
47 | 48 | @warning An exception will be raised if the objectClass of the given mapping is not `[NSMutableDictionary class]`.
|
48 | 49 | */
|
49 | 50 | + (instancetype)requestDescriptorWithMapping:(RKMapping *)mapping
|
50 | 51 | objectClass:(Class)objectClass
|
51 | 52 | rootKeyPath:(NSString *)rootKeyPath;
|
52 | 53 |
|
| 54 | ++ (instancetype)requestDescriptorWithMapping:(RKMapping *)mapping |
| 55 | + objectClass:(Class)objectClass |
| 56 | + rootKeyPath:(NSString *)rootKeyPath |
| 57 | + requestMethod:(RKRequestMethod)requestMethod; |
| 58 | + |
53 | 59 | ///-----------------------------------------------------
|
54 | 60 | /// @name Getting Information About a Request Descriptor
|
55 | 61 | ///-----------------------------------------------------
|
|
69 | 75 | */
|
70 | 76 | @property (nonatomic, copy, readonly) NSString *rootKeyPath;
|
71 | 77 |
|
| 78 | +@property (nonatomic, assign, readonly) RKRequestMethod requestMethod; |
| 79 | + |
72 | 80 | ///--------------------------------
|
73 | 81 | /// @name Using Request Descriptors
|
74 | 82 | ///--------------------------------
|
75 | 83 |
|
76 | 84 | /**
|
77 | 85 | Returns `YES` if the given object is instance of objectClass or any class that inherits from objectClass, else `NO`.
|
78 |
| - |
| 86 | +
|
79 | 87 | @param object The object to be matched against the receiver.
|
80 | 88 | @return `YES` if the given object matches objectClass, else `NO`.
|
81 | 89 | */
|
82 |
| -- (BOOL)matchesObject:(id)object; |
| 90 | +- (BOOL)matchesObject:(id)object requestMethod:(RKRequestMethod)requestMethod exactMatch:(BOOL)exact; |
83 | 91 |
|
84 | 92 | @end
|
0 commit comments