FBSDKGameRequestContent.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2. //
  3. // You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
  4. // copy, modify, and distribute this software in source code or binary form for use
  5. // in connection with the web services and APIs provided by Facebook.
  6. //
  7. // As with any software that integrates with the Facebook platform, your use of
  8. // this software is subject to the Facebook Developer Principles and Policies
  9. // [http://developers.facebook.com/policy/]. This copyright notice shall be
  10. // included in all copies or substantial portions of the software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  14. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  15. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. #import <Foundation/Foundation.h>
  19. #import <FBSDKCoreKit/FBSDKCopying.h>
  20. /*!
  21. @typedef NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
  22. @abstract Additional context about the nature of the request.
  23. */
  24. typedef NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
  25. {
  26. /*! No action type */
  27. FBSDKGameRequestActionTypeNone = 0,
  28. /*! Send action type: The user is sending an object to the friends. */
  29. FBSDKGameRequestActionTypeSend,
  30. /*! Ask For action type: The user is asking for an object from friends. */
  31. FBSDKGameRequestActionTypeAskFor,
  32. /*! Turn action type: It is the turn of the friends to play against the user in a match. (no object) */
  33. FBSDKGameRequestActionTypeTurn,
  34. };
  35. /*!
  36. @typedef NS_ENUM(NSUInteger, FBSDKGameRequestFilters)
  37. @abstract Filter for who can be displayed in the multi-friend selector.
  38. */
  39. typedef NS_ENUM(NSUInteger, FBSDKGameRequestFilter)
  40. {
  41. /*! No filter, all friends can be displayed. */
  42. FBSDKGameRequestFilterNone = 0,
  43. /*! Friends using the app can be displayed. */
  44. FBSDKGameRequestFilterAppUsers,
  45. /*! Friends not using the app can be displayed. */
  46. FBSDKGameRequestFilterAppNonUsers,
  47. };
  48. /*!
  49. @abstract A model for a game request.
  50. */
  51. @interface FBSDKGameRequestContent : NSObject <FBSDKCopying, NSSecureCoding>
  52. /*!
  53. @abstract Used when defining additional context about the nature of the request.
  54. @discussion The parameter 'objectID' is required if the action type is either
  55. 'FBSDKGameRequestSendActionType' or 'FBSDKGameRequestAskForActionType'.
  56. @seealso objectID
  57. */
  58. @property (nonatomic, assign) FBSDKGameRequestActionType actionType;
  59. /*!
  60. @abstract Compares the receiver to another game request content.
  61. @param content The other content
  62. @return YES if the receiver's values are equal to the other content's values; otherwise NO
  63. */
  64. - (BOOL)isEqualToGameRequestContent:(FBSDKGameRequestContent *)content;
  65. /*!
  66. @abstract Additional freeform data you may pass for tracking. This will be stored as part of
  67. the request objects created. The maximum length is 255 characters.
  68. */
  69. @property (nonatomic, copy) NSString *data;
  70. /*!
  71. @abstract This controls the set of friends someone sees if a multi-friend selector is shown.
  72. It is FBSDKGameRequestNoFilter by default, meaning that all friends can be shown.
  73. If specify as FBSDKGameRequestAppUsersFilter, only friends who use the app will be shown.
  74. On the other hands, use FBSDKGameRequestAppNonUsersFilter to filter only friends who do not use the app.
  75. @discussion The parameter name is preserved to be consistent with the counter part on desktop.
  76. */
  77. @property (nonatomic, assign) FBSDKGameRequestFilter filters;
  78. /*!
  79. @abstract A plain-text message to be sent as part of the request. This text will surface in the App Center view
  80. of the request, but not on the notification jewel. Required parameter.
  81. */
  82. @property (nonatomic, copy) NSString *message;
  83. /*!
  84. @abstract The Open Graph object ID of the object being sent.
  85. @seealso actionType
  86. */
  87. @property (nonatomic, copy) NSString *objectID;
  88. /*!
  89. @abstract An array of user IDs, usernames or invite tokens (NSString) of people to send request.
  90. @discussion These may or may not be a friend of the sender. If this is specified by the app,
  91. the sender will not have a choice of recipients. If not, the sender will see a multi-friend selector
  92. This is equivalent to the "to" parameter when using the web game request dialog.
  93. */
  94. @property (nonatomic, copy) NSArray *recipients;
  95. /*!
  96. @abstract An array of user IDs that will be included in the dialog as the first suggested friends.
  97. Cannot be used together with filters.
  98. @discussion This is equivalent to the "suggestions" parameter when using the web game request dialog.
  99. */
  100. @property (nonatomic, copy) NSArray *recipientSuggestions;
  101. /*!
  102. @deprecated Use `recipientSuggestions` instead.
  103. */
  104. @property (nonatomic, copy) NSArray *suggestions __attribute__ ((deprecated("use recipientSuggestions instead")));
  105. /*!
  106. @abstract The title for the dialog.
  107. */
  108. @property (nonatomic, copy) NSString *title;
  109. /*!
  110. @deprecated Use `recipients` instead.
  111. */
  112. @property (nonatomic, copy) NSArray *to __attribute__ ((deprecated("use recipients instead")));
  113. @end