lpw
2024-06-24 14dac3416fa64cec3ca6523835297bf7a4d7d9bd
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/FBSDKGraphRequestFlags.h>
12 #import <FBSDKCoreKit/FBSDKGraphRequestHTTPMethod.h>
13
14 NS_ASSUME_NONNULL_BEGIN
15
16 @class FBSDKGraphRequestConnection;
17 @protocol FBSDKGraphRequestConnecting;
18
19 typedef void (^FBSDKGraphRequestCompletion)(id<FBSDKGraphRequestConnecting> _Nullable connection,
20                                             id _Nullable result,
21                                             NSError *_Nullable error);
22
23 typedef void (^FBSDKGraphRequestBlock)(FBSDKGraphRequestConnection *_Nullable connection,
24                                        id _Nullable result,
25                                        NSError *_Nullable error);
26
27 /// A protocol to describe anything that represents a graph request
28 NS_SWIFT_NAME(GraphRequestProtocol)
29 @protocol FBSDKGraphRequest
30
31 /// The request parameters.
32 @property (nonatomic, copy) NSDictionary<NSString *, id> *parameters;
33
34 /// The access token string used by the request.
35 @property (nullable, nonatomic, readonly, copy) NSString *tokenString;
36
37 /// The Graph API endpoint to use for the request, for example "me".
38 @property (nonatomic, readonly, copy) NSString *graphPath;
39
40 /// The HTTPMethod to use for the request, for example "GET" or "POST".
41 @property (nonatomic, readonly, copy) FBSDKHTTPMethod HTTPMethod;
42
43 /// The Graph API version to use (e.g., "v2.0")
44 @property (nonatomic, readonly, copy) NSString *version;
45
46 /// The graph request flags to use
47 @property (nonatomic, readonly, assign) FBSDKGraphRequestFlags flags;
48
49 /// Convenience property to determine if graph error recover is disabled
50 @property (nonatomic, getter = isGraphErrorRecoveryDisabled) BOOL graphErrorRecoveryDisabled;
51
52 /// Convenience property to determine if the request has attachments
53 @property (nonatomic, readonly) BOOL hasAttachments;
54
97fc0a 55 @property (nonatomic, readonly, assign) BOOL forAppEvents;
L 56
57 @property (nonatomic, readonly, assign) BOOL useAlternativeDefaultDomainPrefix;
58
e0ec42 59 /**
L 60  Starts a connection to the Graph API.
61  @param completion The handler block to call when the request completes.
62  */
63 - (id<FBSDKGraphRequestConnecting>)startWithCompletion:(nullable FBSDKGraphRequestCompletion)completion;
64
65 /// A formatted description of the graph request
66 - (NSString *)formattedDescription;
67
68 @end
69
70 NS_ASSUME_NONNULL_END