FBSDKGraphRequestProtocol.h 2.4 KB

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