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 #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
e0ec42 31 /// The request parameters.
2e29a3 32 @property (nonatomic, copy) NSDictionary<NSString *, id> *parameters;
L 33
e0ec42 34 /// The access token string used by the request.
2e29a3 35 @property (nullable, nonatomic, readonly, copy) NSString *tokenString;
L 36
e0ec42 37 /// The Graph API endpoint to use for the request, for example "me".
2e29a3 38 @property (nonatomic, readonly, copy) NSString *graphPath;
L 39
e0ec42 40 /// The HTTPMethod to use for the request, for example "GET" or "POST".
2e29a3 41 @property (nonatomic, readonly, copy) FBSDKHTTPMethod HTTPMethod;
L 42
e0ec42 43 /// The Graph API version to use (e.g., "v2.0")
2e29a3 44 @property (nonatomic, readonly, copy) NSString *version;
L 45
e0ec42 46 /// The graph request flags to use
2e29a3 47 @property (nonatomic, readonly, assign) FBSDKGraphRequestFlags flags;
L 48
e0ec42 49 /// Convenience property to determine if graph error recover is disabled
2e29a3 50 @property (nonatomic, getter = isGraphErrorRecoveryDisabled) BOOL graphErrorRecoveryDisabled;
L 51
e0ec42 52 /// Convenience property to determine if the request has attachments
2e29a3 53 @property (nonatomic, readonly) BOOL hasAttachments;
L 54
97fc0a 55 @property (nonatomic, readonly, assign) BOOL forAppEvents;
L 56
57 @property (nonatomic, readonly, assign) BOOL useAlternativeDefaultDomainPrefix;
58
2e29a3 59 /**
e0ec42 60  Starts a connection to the Graph API.
2e29a3 61  @param completion The handler block to call when the request completes.
L 62  */
63 - (id<FBSDKGraphRequestConnecting>)startWithCompletion:(nullable FBSDKGraphRequestCompletion)completion;
64
e0ec42 65 /// A formatted description of the graph request
2e29a3 66 - (NSString *)formattedDescription;
L 67
68 @end
69
70 NS_ASSUME_NONNULL_END