lpw
2023-07-20 80f7cc0c18ce7e590a4c14cd1011a82b296770f5
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 NS_ASSUME_NONNULL_BEGIN
12
13 @protocol FBSDKGraphRequest;
14 @protocol FBSDKGraphRequestConnecting;
15 @protocol FBSDKGraphRequestConnectionDelegate;
16 @class FBSDKGraphRequestMetadata;
17
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
53
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
62 @end
63
64 NS_ASSUME_NONNULL_END