FBSDKShareOpenGraphValueContainer.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. @class FBSDKShareOpenGraphObject;
  20. @class FBSDKSharePhoto;
  21. /*!
  22. @abstract Protocol defining operations on open graph actions and objects.
  23. @discussion The property keys MUST have namespaces specified on them, such as `og:image`.
  24. */
  25. @protocol FBSDKShareOpenGraphValueContaining <NSObject, NSSecureCoding>
  26. /*!
  27. @abstract Gets an NSArray out of the receiver.
  28. @param key The key for the value
  29. @return The NSArray value or nil
  30. */
  31. - (NSArray *)arrayForKey:(NSString *)key;
  32. /*!
  33. @abstract Applies a given block object to the entries of the receiver.
  34. @param block A block object to operate on entries in the receiver
  35. */
  36. - (void)enumerateKeysAndObjectsUsingBlock:(void (^)(NSString *key, id object, BOOL *stop))block;
  37. /*!
  38. @abstract Returns an enumerator object that lets you access each key in the receiver.
  39. @return An enumerator object that lets you access each key in the receiver
  40. */
  41. - (NSEnumerator *)keyEnumerator;
  42. /*!
  43. @abstract Gets an NSNumber out of the receiver.
  44. @param key The key for the value
  45. @return The NSNumber value or nil
  46. */
  47. - (NSNumber *)numberForKey:(NSString *)key;
  48. /*!
  49. @abstract Returns an enumerator object that lets you access each value in the receiver.
  50. @return An enumerator object that lets you access each value in the receiver
  51. */
  52. - (NSEnumerator *)objectEnumerator;
  53. /*!
  54. @abstract Gets an FBSDKShareOpenGraphObject out of the receiver.
  55. @param key The key for the value
  56. @return The FBSDKShareOpenGraphObject value or nil
  57. */
  58. - (FBSDKShareOpenGraphObject *)objectForKey:(NSString *)key;
  59. /*!
  60. @abstract Enables subscript access to the values in the receiver.
  61. @param key The key for the value
  62. @return The value
  63. */
  64. - (id)objectForKeyedSubscript:(NSString *)key;
  65. /*!
  66. @abstract Parses properties out of a dictionary into the receiver.
  67. @param properties The properties to parse.
  68. */
  69. - (void)parseProperties:(NSDictionary *)properties;
  70. /*!
  71. @abstract Gets an FBSDKSharePhoto out of the receiver.
  72. @param key The key for the value
  73. @return The FBSDKSharePhoto value or nil
  74. */
  75. - (FBSDKSharePhoto *)photoForKey:(NSString *)key;
  76. /*!
  77. @abstract Removes a value from the receiver for the specified key.
  78. @param key The key for the value
  79. */
  80. - (void)removeObjectForKey:(NSString *)key;
  81. /*!
  82. @abstract Sets an NSArray on the receiver.
  83. @discussion This method will throw if the array contains any values that is not an NSNumber, NSString, NSURL,
  84. FBSDKSharePhoto or FBSDKShareOpenGraphObject.
  85. @param array The NSArray value
  86. @param key The key for the value
  87. */
  88. - (void)setArray:(NSArray *)array forKey:(NSString *)key;
  89. /*!
  90. @abstract Sets an NSNumber on the receiver.
  91. @param number The NSNumber value
  92. @param key The key for the value
  93. */
  94. - (void)setNumber:(NSNumber *)number forKey:(NSString *)key;
  95. /*!
  96. @abstract Sets an FBSDKShareOpenGraphObject on the receiver.
  97. @param object The FBSDKShareOpenGraphObject value
  98. @param key The key for the value
  99. */
  100. - (void)setObject:(FBSDKShareOpenGraphObject *)object forKey:(NSString *)key;
  101. /*!
  102. @abstract Sets an FBSDKSharePhoto on the receiver.
  103. @param photo The FBSDKSharePhoto value
  104. @param key The key for the value
  105. */
  106. - (void)setPhoto:(FBSDKSharePhoto *)photo forKey:(NSString *)key;
  107. /*!
  108. @abstract Sets an NSString on the receiver.
  109. @param string The NSString value
  110. @param key The key for the value
  111. */
  112. - (void)setString:(NSString *)string forKey:(NSString *)key;
  113. /*!
  114. @abstract Sets an NSURL on the receiver.
  115. @param URL The NSURL value
  116. @param key The key for the value
  117. */
  118. - (void)setURL:(NSURL *)URL forKey:(NSString *)key;
  119. /*!
  120. @abstract Gets an NSString out of the receiver.
  121. @param key The key for the value
  122. @return The NSString value or nil
  123. */
  124. - (NSString *)stringForKey:(NSString *)key;
  125. /*!
  126. @abstract Gets an NSURL out of the receiver.
  127. @param key The key for the value
  128. @return The NSURL value or nil
  129. */
  130. - (NSURL *)URLForKey:(NSString *)key;
  131. @end
  132. /*!
  133. @abstract A base class to container Open Graph values.
  134. */
  135. @interface FBSDKShareOpenGraphValueContainer : NSObject <FBSDKShareOpenGraphValueContaining>
  136. @end