lpw
2022-02-15 2e29a3a585524a054640bb6e7bdf26fe77ba1f17
commit | author | age
2e29a3 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 NS_ASSUME_NONNULL_BEGIN
12
13 @protocol FBSDKGraphRequest;
14 @protocol FBSDKGraphRequestConnecting;
15 @protocol FBSDKGraphRequestConnectionDelegate;
16
17 /**
18  FBSDKGraphRequestCompletion
19
20  A block that is passed to addRequest to register for a callback with the results of that
21  request once the connection completes.
22
23  Pass a block of this type when calling addRequest.  This will be called once
24  the request completes.  The call occurs on the UI thread.
25
26  @param connection The connection that sent the request.
27
28  @param result The result of the request.  This is a translation of
29  JSON data to `NSDictionary` and `NSArray` objects.  This
30  is nil if there was an error.
31
32  @param error The `NSError` representing any error that occurred.
33  */
34 NS_SWIFT_NAME(GraphRequestCompletion)
35 typedef void (^FBSDKGraphRequestCompletion)(id<FBSDKGraphRequestConnecting> _Nullable connection,
36                                             id _Nullable result,
37                                             NSError *_Nullable error);
38
39 /// A protocol to describe an object that can manage graph requests
40 NS_SWIFT_NAME(GraphRequestConnecting)
41 @protocol FBSDKGraphRequestConnecting
42
43 @property (nonatomic, assign) NSTimeInterval timeout;
44 @property (nullable, nonatomic, weak) id<FBSDKGraphRequestConnectionDelegate> delegate;
45
46 - (void)addRequest:(id<FBSDKGraphRequest>)request
47         completion:(FBSDKGraphRequestCompletion)handler;
48
49 - (void)start;
50 - (void)cancel;
51
52 @end
53
54 NS_ASSUME_NONNULL_END