FBSDKGameRequestContent.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. #import <FBSDKShareKit/FBSDKSharingValidation.h>
  21. /**
  22. NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
  23. Additional context about the nature of the request.
  24. */
  25. typedef NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
  26. {
  27. /** No action type */
  28. FBSDKGameRequestActionTypeNone = 0,
  29. /** Send action type: The user is sending an object to the friends. */
  30. FBSDKGameRequestActionTypeSend,
  31. /** Ask For action type: The user is asking for an object from friends. */
  32. FBSDKGameRequestActionTypeAskFor,
  33. /** Turn action type: It is the turn of the friends to play against the user in a match. (no object) */
  34. FBSDKGameRequestActionTypeTurn,
  35. };
  36. /**
  37. NS_ENUM(NSUInteger, FBSDKGameRequestFilters)
  38. Filter for who can be displayed in the multi-friend selector.
  39. */
  40. typedef NS_ENUM(NSUInteger, FBSDKGameRequestFilter)
  41. {
  42. /** No filter, all friends can be displayed. */
  43. FBSDKGameRequestFilterNone = 0,
  44. /** Friends using the app can be displayed. */
  45. FBSDKGameRequestFilterAppUsers,
  46. /** Friends not using the app can be displayed. */
  47. FBSDKGameRequestFilterAppNonUsers,
  48. };
  49. /**
  50. A model for a game request.
  51. */
  52. @interface FBSDKGameRequestContent : NSObject <FBSDKCopying, FBSDKSharingValidation, NSSecureCoding>
  53. /**
  54. Used when defining additional context about the nature of the request.
  55. The parameter 'objectID' is required if the action type is either
  56. 'FBSDKGameRequestSendActionType' or 'FBSDKGameRequestAskForActionType'.
  57. - SeeAlso:objectID
  58. */
  59. @property (nonatomic, assign) FBSDKGameRequestActionType actionType;
  60. /**
  61. Compares the receiver to another game request content.
  62. @param content The other content
  63. @return YES if the receiver's values are equal to the other content's values; otherwise NO
  64. */
  65. - (BOOL)isEqualToGameRequestContent:(FBSDKGameRequestContent *)content;
  66. /**
  67. Additional freeform data you may pass for tracking. This will be stored as part of
  68. the request objects created. The maximum length is 255 characters.
  69. */
  70. @property (nonatomic, copy) NSString *data;
  71. /**
  72. This controls the set of friends someone sees if a multi-friend selector is shown.
  73. It is FBSDKGameRequestNoFilter by default, meaning that all friends can be shown.
  74. If specify as FBSDKGameRequestAppUsersFilter, only friends who use the app will be shown.
  75. On the other hands, use FBSDKGameRequestAppNonUsersFilter to filter only friends who do not use the app.
  76. The parameter name is preserved to be consistent with the counter part on desktop.
  77. */
  78. @property (nonatomic, assign) FBSDKGameRequestFilter filters;
  79. /**
  80. A plain-text message to be sent as part of the request. This text will surface in the App Center view
  81. of the request, but not on the notification jewel. Required parameter.
  82. */
  83. @property (nonatomic, copy) NSString *message;
  84. /**
  85. The Open Graph object ID of the object being sent.
  86. - SeeAlso:actionType
  87. */
  88. @property (nonatomic, copy) NSString *objectID;
  89. /**
  90. An array of user IDs, usernames or invite tokens (NSString) of people to send request.
  91. These may or may not be a friend of the sender. If this is specified by the app,
  92. the sender will not have a choice of recipients. If not, the sender will see a multi-friend selector
  93. This is equivalent to the "to" parameter when using the web game request dialog.
  94. */
  95. @property (nonatomic, copy) NSArray *recipients;
  96. /**
  97. An array of user IDs that will be included in the dialog as the first suggested friends.
  98. Cannot be used together with filters.
  99. This is equivalent to the "suggestions" parameter when using the web game request dialog.
  100. */
  101. @property (nonatomic, copy) NSArray *recipientSuggestions;
  102. /**
  103. @warning Use `recipientSuggestions` instead.
  104. */
  105. @property (nonatomic, copy) NSArray *suggestions
  106. DEPRECATED_MSG_ATTRIBUTE("use recipientSuggestions instead");
  107. /**
  108. The title for the dialog.
  109. */
  110. @property (nonatomic, copy) NSString *title;
  111. /**
  112. @warning Use `recipients` instead.
  113. */
  114. @property (nonatomic, copy) NSArray *to
  115. DEPRECATED_MSG_ATTRIBUTE("use recipients instead");
  116. @end