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
|
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
|
-
+
-
-
+
+
|
OF_ASSUME_NONNULL_BEGIN
/**
* @brief A response to a request.
*
* This is a typedef for `OFDictionary<OFString *, id> *`.
*/
typedef OFDictionary<OFString *, id> *mtx_response_t;
typedef OFDictionary<OFString *, id> *MTXResponse;
/**
* @brief A block called with the response for an MTXRequest.
*
* @param response The response to the request, as a dictionary parsed from JSON
* @param statusCode The HTTP status code returned for the request
* @param exception The first exception that occurred during the request,
* or `nil` on success
*/
typedef void (^mtx_request_block_t)(mtx_response_t _Nullable response,
int statusCode, id _Nullable exception);
typedef void (^MTXRequestBlock)(MTXResponse _Nullable response, int statusCode,
id _Nullable exception);
/**
* @brief An internal class for performing a request on the Matrix server.
*/
@interface MTXRequest: OFObject <OFHTTPClientDelegate>
/**
* @brief The access token to use.
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
-
+
|
@property (readonly, nonatomic) OFURL *homeserver;
/**
* @brief The HTTP request method.
*
* Defaults to `OF_HTTP_REQUEST_METHOD_GET`.
*/
@property (nonatomic) of_http_request_method_t method;
@property (nonatomic) OFHTTPRequestMethod method;
/**
* @brief The path of the request.
*/
@property (copy, nonatomic) OFString *path;
/**
|
108
109
110
111
112
113
114
115
116
117
118
|
108
109
110
111
112
113
114
115
116
117
118
|
-
+
|
/**
* @brief Performs the request and calls the specified block once the request
* succeeded or failed.
*
* @param block The block to call once the request succeeded or failed
*/
- (void)performWithBlock: (mtx_request_block_t)block;
- (void)performWithBlock: (MTXRequestBlock)block;
@end
OF_ASSUME_NONNULL_END
|