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