ALAdService.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // ALAdService.h
  3. // AppLovinSDK
  4. //
  5. // Created by Basil on 2/27/12.
  6. // Copyright © 2020 AppLovin Corporation. All rights reserved.
  7. //
  8. #import <AppLovinSDK/ALAdDisplayDelegate.h>
  9. #import <AppLovinSDK/ALAdLoadDelegate.h>
  10. #import <AppLovinSDK/ALAdVideoPlaybackDelegate.h>
  11. @class ALAd;
  12. @class ALAdSize;
  13. NS_ASSUME_NONNULL_BEGIN
  14. /**
  15. * This class provides and displays ads.
  16. */
  17. @interface ALAdService : NSObject
  18. /**
  19. * @param bidToken The bid token that was collected.
  20. * @param errorMessage The reason for failure to collect the bid token.
  21. */
  22. typedef void (^ALBidTokenCollectionCompletionHandler)(NSString *_Nullable bidToken, NSString *_Nullable errorMessage);
  23. /**
  24. * Fetches a new ad, of a given size, and notifies a supplied delegate on completion.
  25. *
  26. * @param adSize Size of an ad to load.
  27. * @param delegate A callback that @c loadNextAd calls to notify of the fact that the ad is loaded.
  28. */
  29. - (void)loadNextAd:(ALAdSize *)adSize andNotify:(id<ALAdLoadDelegate>)delegate;
  30. /**
  31. * Fetches a new ad, for a given zone, and notifies a supplied delegate on completion.
  32. *
  33. * @param zoneIdentifier The identifier of the zone to load an ad for.
  34. * @param delegate A callback that @c loadNextAdForZoneIdentifier calls to notify of the fact that the ad is loaded.
  35. */
  36. - (void)loadNextAdForZoneIdentifier:(NSString *)zoneIdentifier andNotify:(id<ALAdLoadDelegate>)delegate;
  37. /**
  38. * A token used for advanced header bidding.
  39. */
  40. @property (nonatomic, copy, readonly) NSString *bidToken;
  41. /**
  42. * Asynchronously generates a token used for advanced header bidding.
  43. *
  44. * @param completion A completion handler to notify whether or not the bid token collection was successful.
  45. * This will be called on the main thread. Must not be null.
  46. */
  47. - (void)collectBidTokenWithCompletion:(ALBidTokenCollectionCompletionHandler)completion;
  48. /**
  49. * Fetches a new ad for the given ad token. The provided ad token must be one that was received from AppLovin S2S API.
  50. *
  51. * @warning This method is designed to be called by SDK mediation providers. Use @code -[ALAdService loadNextAdForZoneIdentifiers:andNotify:] @endcode for
  52. * regular integrations.
  53. *
  54. * @param adToken Ad token returned from AppLovin S2S API.
  55. * @param delegate A callback that @c loadNextAdForAdToken calls to notify that the ad has been loaded.
  56. */
  57. - (void)loadNextAdForAdToken:(NSString *)adToken andNotify:(id<ALAdLoadDelegate>)delegate;
  58. /**
  59. * Fetch a new ad for any of the provided zone identifiers.
  60. *
  61. * @warning This method is designed to be called by SDK mediation providers. Use @code -[ALAdService loadNextAdForZoneIdentifiers:andNotify:] @endcode for
  62. * regular integrations.
  63. *
  64. * @param zoneIdentifiers An array of zone identifiers for which an ad should be loaded.
  65. * @param delegate A callback that @c loadNextAdForZoneIdentifiers calls to notify that the ad has been loaded.
  66. */
  67. - (void)loadNextAdForZoneIdentifiers:(NSArray<NSString *> *)zoneIdentifiers andNotify:(id<ALAdLoadDelegate>)delegate;
  68. - (instancetype)init __attribute__((unavailable("Access ALAdService through ALSdk's adService property.")));
  69. + (instancetype)new NS_UNAVAILABLE;
  70. @end
  71. NS_ASSUME_NONNULL_END