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 #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
55 /**
56  Starts a connection to the Graph API.
57  @param completion The handler block to call when the request completes.
58  */
59 - (id<FBSDKGraphRequestConnecting>)startWithCompletion:(nullable FBSDKGraphRequestCompletion)completion;
60
61 /// A formatted description of the graph request
62 - (NSString *)formattedDescription;
63
64 @end
65
66 NS_ASSUME_NONNULL_END