FBSDKGraphRequestConnecting.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. NS_ASSUME_NONNULL_BEGIN
  10. @protocol FBSDKGraphRequest;
  11. @protocol FBSDKGraphRequestConnecting;
  12. @protocol FBSDKGraphRequestConnectionDelegate;
  13. @class FBSDKGraphRequestMetadata;
  14. /**
  15. FBSDKGraphRequestCompletion
  16. A block that is passed to addRequest to register for a callback with the results of that
  17. request once the connection completes.
  18. Pass a block of this type when calling addRequest. This will be called once
  19. the request completes. The call occurs on the UI thread.
  20. @param connection The connection that sent the request.
  21. @param result The result of the request. This is a translation of
  22. JSON data to `NSDictionary` and `NSArray` objects. This
  23. is nil if there was an error.
  24. @param error The `NSError` representing any error that occurred.
  25. */
  26. NS_SWIFT_NAME(GraphRequestCompletion)
  27. typedef void (^FBSDKGraphRequestCompletion)(id<FBSDKGraphRequestConnecting> _Nullable connection,
  28. id _Nullable result,
  29. NSError *_Nullable error);
  30. /// A protocol to describe an object that can manage graph requests
  31. NS_SWIFT_NAME(GraphRequestConnecting)
  32. @protocol FBSDKGraphRequestConnecting
  33. @property (nonatomic, assign) NSTimeInterval timeout;
  34. @property (nullable, nonatomic, weak) id<FBSDKGraphRequestConnectionDelegate> delegate;
  35. - (void)addRequest:(id<FBSDKGraphRequest>)request
  36. completion:(FBSDKGraphRequestCompletion)handler;
  37. - (void)start;
  38. - (void)cancel;
  39. /**
  40. Internal property exposed to facilitate transition to Swift.
  41. API Subject to change or removal without warning. Do not use.
  42. @warning INTERNAL - DO NOT USE
  43. */
  44. @property (nonatomic, readonly) NSMutableArray<FBSDKGraphRequestMetadata *> *requests;
  45. @end
  46. NS_ASSUME_NONNULL_END