-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMBJSONRequest.h
40 lines (33 loc) · 1.19 KB
/
MBJSONRequest.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
//
// MBJSONRequest.h
// MBRequest
//
// Created by Sebastian Celis on 3/4/12.
// Copyright (c) 2012 Mobiata, LLC. All rights reserved.
//
#import "MBHTTPRequest.h"
/**
A basic callback for a JSON request that passes back the JSON data and any error that may have
occurred.
@param responseJSON The JSON data downloaded from the request. Will be an instance of NSArray or
NSDictionary.
@param error Any error that occurred during the request.
*/
typedef void (^MBJSONRequestCompletionHandler)(id responseJSON, NSError *error);
@interface MBJSONRequest : MBHTTPRequest
/**
Performs a basic request and notifies the caller when the request finishes.
@param request The NSURLRequest to perform.
@param completionHandler A block to execute after the request finishes. This block will always run
on the main thread.
*/
- (void)performJSONRequest:(NSURLRequest *)request completionHandler:(MBJSONRequestCompletionHandler)completionHandler;
/**
The response data, parsed into a JSON object.
*/
@property (atomic, strong, readonly) id responseJSON;
/**
The reading options to use when parsing the responseJSON. Defaults to 0.
*/
@property (atomic, assign) NSJSONReadingOptions JSONReadingOptions;
@end