lpw
2024-04-15 97fc0a41111c5a929ee8be9d6511775697ffa760
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;
e0ec42 16 @class FBSDKGraphRequestMetadata;
2e29a3 17
L 18 /**
19  FBSDKGraphRequestCompletion
20
21  A block that is passed to addRequest to register for a callback with the results of that
22  request once the connection completes.
23
24  Pass a block of this type when calling addRequest.  This will be called once
25  the request completes.  The call occurs on the UI thread.
26
27  @param connection The connection that sent the request.
28
29  @param result The result of the request.  This is a translation of
30  JSON data to `NSDictionary` and `NSArray` objects.  This
31  is nil if there was an error.
32
33  @param error The `NSError` representing any error that occurred.
34  */
35 NS_SWIFT_NAME(GraphRequestCompletion)
36 typedef void (^FBSDKGraphRequestCompletion)(id<FBSDKGraphRequestConnecting> _Nullable connection,
37                                             id _Nullable result,
38                                             NSError *_Nullable error);
39
40 /// A protocol to describe an object that can manage graph requests
41 NS_SWIFT_NAME(GraphRequestConnecting)
42 @protocol FBSDKGraphRequestConnecting
43
44 @property (nonatomic, assign) NSTimeInterval timeout;
45 @property (nullable, nonatomic, weak) id<FBSDKGraphRequestConnectionDelegate> delegate;
46
47 - (void)addRequest:(id<FBSDKGraphRequest>)request
48         completion:(FBSDKGraphRequestCompletion)handler;
49
50 - (void)start;
51 - (void)cancel;
52
e0ec42 53
L 54 /**
55  Internal property exposed to facilitate transition to Swift.
56  API Subject to change or removal without warning. Do not use.
57
58  @warning INTERNAL - DO NOT USE
59  */
60 @property (nonatomic, readonly) NSMutableArray<FBSDKGraphRequestMetadata *> *requests;
61
2e29a3 62 @end
L 63
64 NS_ASSUME_NONNULL_END