commit | author | age
|
e0ec42
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
#import <FBSDKCoreKit/FBSDKGraphRequestConnecting.h> |
|
12 |
#import <FBSDKCoreKit/FBSDKGraphRequestConnectionDelegate.h> |
|
13 |
|
|
14 |
@protocol FBSDKURLSessionProxyProviding; |
|
15 |
@protocol FBSDKErrorConfigurationProviding; |
|
16 |
@protocol FBSDKGraphRequestPiggybackManaging; |
|
17 |
@protocol FBSDKSettings; |
|
18 |
@protocol FBSDKGraphRequestConnectionFactory; |
|
19 |
@protocol FBSDKEventLogging; |
|
20 |
@protocol FBSDKOperatingSystemVersionComparing; |
|
21 |
@protocol FBSDKMacCatalystDetermining; |
|
22 |
@protocol FBSDKAccessTokenProviding; |
|
23 |
@protocol FBSDKErrorCreating; |
|
24 |
@protocol FBSDKAuthenticationTokenProviding; |
|
25 |
|
|
26 |
NS_ASSUME_NONNULL_BEGIN |
|
27 |
|
|
28 |
/** |
|
29 |
The key in the result dictionary for requests to old versions of the Graph API |
|
30 |
whose response is not a JSON object. |
|
31 |
|
|
32 |
When a request returns a non-JSON response (such as a "true" literal), that response |
|
33 |
will be wrapped into a dictionary using this const as the key. This only applies for very few Graph API |
|
34 |
prior to v2.1. |
|
35 |
*/ |
|
36 |
FOUNDATION_EXPORT NSString *const FBSDKNonJSONResponseProperty |
|
37 |
NS_SWIFT_NAME(NonJSONResponseProperty); |
|
38 |
|
|
39 |
@protocol FBSDKGraphRequest; |
|
40 |
|
|
41 |
/** |
|
42 |
The `FBSDKGraphRequestConnection` represents a single connection to Facebook to service a request. |
|
43 |
|
|
44 |
The request settings are encapsulated in a reusable <FBSDKGraphRequest> object. The |
|
45 |
`FBSDKGraphRequestConnection` object encapsulates the concerns of a single communication |
|
46 |
e.g. starting a connection, canceling a connection, or batching requests. |
|
47 |
*/ |
|
48 |
NS_SWIFT_NAME(GraphRequestConnection) |
|
49 |
@interface FBSDKGraphRequestConnection : NSObject <FBSDKGraphRequestConnecting> |
|
50 |
|
|
51 |
/// The default timeout on all FBSDKGraphRequestConnection instances. Defaults to 60 seconds. |
|
52 |
@property (class, nonatomic, assign) NSTimeInterval defaultConnectionTimeout; |
|
53 |
|
|
54 |
/// The delegate object that receives updates. |
|
55 |
@property (nullable, nonatomic, weak) id<FBSDKGraphRequestConnectionDelegate> delegate; |
|
56 |
|
|
57 |
/// Gets or sets the timeout interval to wait for a response before giving up. |
|
58 |
@property (nonatomic, assign) NSTimeInterval timeout; |
|
59 |
|
|
60 |
/** |
|
61 |
The raw response that was returned from the server. (readonly) |
|
62 |
|
|
63 |
This property can be used to inspect HTTP headers that were returned from |
|
64 |
the server. |
|
65 |
|
|
66 |
The property is nil until the request completes. If there was a response |
|
67 |
then this property will be non-nil during the FBSDKGraphRequestBlock callback. |
|
68 |
*/ |
|
69 |
@property (nullable, nonatomic, readonly, retain) NSHTTPURLResponse *urlResponse; |
|
70 |
|
|
71 |
/** |
|
72 |
Determines the operation queue that is used to call methods on the connection's delegate. |
|
73 |
|
|
74 |
By default, a connection is scheduled on the current thread in the default mode when it is created. |
|
75 |
You cannot reschedule a connection after it has started. |
|
76 |
*/ |
|
77 |
@property (nullable, nonatomic) NSOperationQueue *delegateQueue; |
|
78 |
|
|
79 |
/// @methodgroup Class methods |
|
80 |
|
|
81 |
/// @methodgroup Adding requests |
|
82 |
|
|
83 |
/** |
|
84 |
@method |
|
85 |
|
|
86 |
This method adds an <FBSDKGraphRequest> object to this connection. |
|
87 |
|
|
88 |
@param request A request to be included in the round-trip when start is called. |
|
89 |
@param completion A handler to call back when the round-trip completes or times out. |
|
90 |
|
|
91 |
The completion handler is retained until the block is called upon the |
|
92 |
completion or cancellation of the connection. |
|
93 |
*/ |
|
94 |
- (void)addRequest:(id<FBSDKGraphRequest>)request |
|
95 |
completion:(FBSDKGraphRequestCompletion)completion; |
|
96 |
|
|
97 |
/** |
|
98 |
@method |
|
99 |
|
|
100 |
This method adds an <FBSDKGraphRequest> object to this connection. |
|
101 |
|
|
102 |
@param request A request to be included in the round-trip when start is called. |
|
103 |
|
|
104 |
@param completion A handler to call back when the round-trip completes or times out. |
|
105 |
The handler will be invoked on the main thread. |
|
106 |
|
|
107 |
@param name A name for this request. This can be used to feed |
|
108 |
the results of one request to the input of another <FBSDKGraphRequest> in the same |
|
109 |
`FBSDKGraphRequestConnection` as described in |
|
110 |
[Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). |
|
111 |
|
|
112 |
The completion handler is retained until the block is called upon the |
|
113 |
completion or cancellation of the connection. This request can be named |
|
114 |
to allow for using the request's response in a subsequent request. |
|
115 |
*/ |
|
116 |
- (void)addRequest:(id<FBSDKGraphRequest>)request |
|
117 |
name:(NSString *)name |
|
118 |
completion:(FBSDKGraphRequestCompletion)completion; |
|
119 |
|
|
120 |
/** |
|
121 |
@method |
|
122 |
|
|
123 |
This method adds an <FBSDKGraphRequest> object to this connection. |
|
124 |
|
|
125 |
@param request A request to be included in the round-trip when start is called. |
|
126 |
|
|
127 |
@param completion A handler to call back when the round-trip completes or times out. |
|
128 |
|
|
129 |
@param parameters The dictionary of parameters to include for this request |
|
130 |
as described in [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). |
|
131 |
Examples include "depends_on", "name", or "omit_response_on_success". |
|
132 |
|
|
133 |
The completion handler is retained until the block is called upon the |
|
134 |
completion or cancellation of the connection. This request can be named |
|
135 |
to allow for using the request's response in a subsequent request. |
|
136 |
*/ |
|
137 |
- (void)addRequest:(id<FBSDKGraphRequest>)request |
|
138 |
parameters:(nullable NSDictionary<NSString *, id> *)parameters |
|
139 |
completion:(FBSDKGraphRequestCompletion)completion; |
|
140 |
|
|
141 |
/// @methodgroup Instance methods |
|
142 |
|
|
143 |
/** |
|
144 |
@method |
|
145 |
|
|
146 |
Signals that a connection should be logically terminated as the |
|
147 |
application is no longer interested in a response. |
|
148 |
|
|
149 |
Synchronously calls any handlers indicating the request was cancelled. Cancel |
|
150 |
does not guarantee that the request-related processing will cease. It |
|
151 |
does promise that all handlers will complete before the cancel returns. A call to |
|
152 |
cancel prior to a start implies a cancellation of all requests associated |
|
153 |
with the connection. |
|
154 |
*/ |
|
155 |
- (void)cancel; |
|
156 |
|
|
157 |
/** |
|
158 |
@method |
|
159 |
|
|
160 |
This method starts a connection with the server and is capable of handling all of the |
|
161 |
requests that were added to the connection. |
|
162 |
|
|
163 |
By default, a connection is scheduled on the current thread in the default mode when it is created. |
|
164 |
See `setDelegateQueue:` for other options. |
|
165 |
|
|
166 |
This method cannot be called twice for an `FBSDKGraphRequestConnection` instance. |
|
167 |
*/ |
|
168 |
- (void)start; |
|
169 |
|
|
170 |
/** |
|
171 |
@method |
|
172 |
|
|
173 |
Overrides the default version for a batch request |
|
174 |
|
|
175 |
The SDK automatically prepends a version part, such as "v2.0" to API paths in order to simplify API versioning |
|
176 |
for applications. If you want to override the version part while using batch requests on the connection, call |
|
177 |
this method to set the version for the batch request. |
|
178 |
|
|
179 |
@param version This is a string in the form @"v2.0" which will be used for the version part of an API path |
|
180 |
*/ |
|
181 |
- (void)overrideGraphAPIVersion:(NSString *)version; |
|
182 |
|
|
183 |
/** |
|
184 |
Internal method exposed to facilitate transition to Swift. |
|
185 |
API Subject to change or removal without warning. Do not use. |
|
186 |
|
|
187 |
@warning INTERNAL - DO NOT USE |
|
188 |
*/ |
|
189 |
+ (void)setCanMakeRequests; |
|
190 |
|
|
191 |
/** |
|
192 |
Internal method exposed to facilitate transition to Swift. |
|
193 |
API Subject to change or removal without warning. Do not use. |
|
194 |
|
|
195 |
@warning INTERNAL - DO NOT USE |
|
196 |
*/ |
|
197 |
+ (void)configureWithURLSessionProxyFactory:(nonnull id<FBSDKURLSessionProxyProviding>)proxyFactory |
|
198 |
errorConfigurationProvider:(nonnull id<FBSDKErrorConfigurationProviding>)errorConfigurationProvider |
|
199 |
piggybackManager:(nonnull id<FBSDKGraphRequestPiggybackManaging>)piggybackManager |
|
200 |
settings:(nonnull id<FBSDKSettings>)settings |
|
201 |
graphRequestConnectionFactory:(nonnull id<FBSDKGraphRequestConnectionFactory>)factory |
|
202 |
eventLogger:(nonnull id<FBSDKEventLogging>)eventLogger |
|
203 |
operatingSystemVersionComparer:(nonnull id<FBSDKOperatingSystemVersionComparing>)operatingSystemVersionComparer |
|
204 |
macCatalystDeterminator:(nonnull id<FBSDKMacCatalystDetermining>)macCatalystDeterminator |
|
205 |
accessTokenProvider:(nonnull Class<FBSDKAccessTokenProviding>)accessTokenProvider |
|
206 |
errorFactory:(nonnull id<FBSDKErrorCreating>)errorFactory |
|
207 |
authenticationTokenProvider:(nonnull Class<FBSDKAuthenticationTokenProviding>)authenticationTokenProvider |
|
208 |
NS_SWIFT_NAME(configure(urlSessionProxyFactory:errorConfigurationProvider:piggybackManager:settings:graphRequestConnectionFactory:eventLogger:operatingSystemVersionComparer:macCatalystDeterminator:accessTokenProvider:errorFactory:authenticationTokenProvider:)); |
|
209 |
|
|
210 |
@end |
|
211 |
|
|
212 |
NS_ASSUME_NONNULL_END |