NimbusRequest
class NimbusRequest
extension NimbusRequest : Decodable, Encodable, Equatable, Hashable, NimbusRequestExtensible
The top-level bid request object. Attributes in this top-level object establish rules and restrictions that apply to all impressions being offered. There are also several subordinate objects that provide detailed data to potential buyers. OpenRTB Section 3.2.1
-
Default request for a hybrid interstitial ad
position: Position / identifier of the ad
Declaration
Swift
static func forInterstitialAd(position: String) -> NimbusRequest
Parameters
position
Position / identifier of the ad
Return Value
NimbusRequest set up for an interstitial ad
-
Default request for a banner ad
- position: Position / identifier of the ad
- format: Ad format for the banner ad. Defaults to
NimbusAdFormat.banner320x50
adPosition: Ad position. Defaults to
NimbusPosition.unknown
Declaration
Swift
static func forBannerAd(position: String, format: NimbusAdFormat = .banner320x50, adPosition: NimbusPosition = .unknown) -> NimbusRequest
Parameters
position
Position / identifier of the ad
format
Ad format for the banner ad. Defaults to
NimbusAdFormat.banner320x50
adPosition
Ad position. Defaults to
NimbusPosition.unknown
Return Value
NimbusRequest set up for a banner ad
-
Default request for a interstitial video ad
- position: Position / identifier of the ad
adPosition: Ad position for the ad. Default:
NimbusPosition.unknown
Declaration
Swift
static func forVideoAd(position: String, adPosition: NimbusPosition = .unknown) -> NimbusRequest
Parameters
position
Position / identifier of the ad
adPosition
Ad position for the ad. Default:
NimbusPosition.unknown
Return Value
NimbusRequest set up for a rewarded video unit
-
Default request for a rewarded video ad
position: Position / identifier of the ad
Declaration
Swift
static func forRewardedVideo(position: String) -> NimbusRequest
Parameters
position
Position / identifier of the ad
Return Value
NimbusRequest set up for a rewarded video unit
-
forNativeAd(position:size:includeVideo:adContext:adContextSubType:placementType:blockedCreativeAttributes:)
Default request for a native ad
- position: Position / identifier of the ad
- size: Ad size for the native ad. Defaults to
NimbusNativeSize.medium
- includeVideo: Whether Nimbus should also request a native video ad
- adContext: Ad context. Defaults to nil
- adContextSubType: Ad context subtype. Defaults to nil
- placementType: Ad placement type. Defaults to nil
blockedCreativeAttributes: Blocked attributes, i.e. [.provocativeOrSuggestiveImagery]. Defaults to nil
Declaration
Swift
static func forNativeAd(position: String, size: NimbusNativeSize = .medium, includeVideo: Bool = false, adContext: Native.Context? = nil, adContextSubType: Native.ContextSubType? = nil, placementType: Native.PlacementType? = nil, blockedCreativeAttributes: Set<NimbusCreativeAttribute>? = nil) -> NimbusRequest
Parameters
position
Position / identifier of the ad
size
Ad size for the native ad. Defaults to
NimbusNativeSize.medium
includeVideo
Whether Nimbus should also request a native video ad
adContext
Ad context. Defaults to nil
adContextSubType
Ad context subtype. Defaults to nil
placementType
Ad placement type. Defaults to nil
blockedCreativeAttributes
Blocked attributes, i.e. [.provocativeOrSuggestiveImagery]. Defaults to nil
Return Value
NimbusRequest set up for a native banner ad
-
Add a native ad to an existing NimbusRequest. Pass a NimbusNative object created using one of the public helpers (NimbusNative.banner, NimbusNative.video, or NimbusNative.hybrid).
Example: request.addNativeAd(NimbusNative.hybrid(format: .banner300x50))
- size: Ad size for the native ad. Defaults to
NimbusNativeSize.medium
- includeVideo: Whether Nimbus should also request a native video ad
- adContext: Ad context. Defaults to nil
- adContextSubType: Ad context subtype. Defaults to nil
- placementType: Ad placement type. Defaults to nil
blockedCreativeAttributes: Blocked attributes, i.e. [.provocativeOrSuggestiveImagery]. Defaults to nil
Declaration
Swift
@discardableResult func addNativeAd(size: NimbusNativeSize = .medium, includeVideo: Bool = false, adContext: Native.Context? = nil, adContextSubType: Native.ContextSubType? = nil, placementType: Native.PlacementType? = nil, blockedCreativeAttributes: Set<NimbusCreativeAttribute>? = nil) -> Self
Parameters
size
Ad size for the native ad. Defaults to
NimbusNativeSize.medium
includeVideo
Whether Nimbus should also request a native video ad
adContext
Ad context. Defaults to nil
adContextSubType
Ad context subtype. Defaults to nil
placementType
Ad placement type. Defaults to nil
blockedCreativeAttributes
Blocked attributes, i.e. [.provocativeOrSuggestiveImagery]. Defaults to nil
Return Value
NimbusRequest with a native ad
- size: Ad size for the native ad. Defaults to
-
Represents the impressions offered. Only one
NimbusImpression
object is currently supported.Declaration
Swift
var impressions: [NimbusImpression]
-
Details about the publisher’s app (i.e., non-browser applications). Only applicable and recommended for apps.
Declaration
Swift
var app: NimbusApp?
-
Details about the user’s device to which the impression will be delivered.
Declaration
Swift
var device: NimbusDevice
-
This is not part of the OpenRTB spec, adding this here for convenience allows height and width to be passed without the video/banner object to backwards support the GET
Declaration
Swift
var format: NimbusAdFormat
-
Details about the human user of the device; the advertising audience
Declaration
Swift
var user: NimbusUser?
-
Indicator of test mode in which auctions are not billable
Declaration
Swift
var isTest: Bool?
-
White list of buyer seats (e.g., advertisers, agencies) allowed to bid on this impression
Declaration
Swift
var whitelistBuyers: Set<String>?
-
Black list of buyer seats (e.g., advertisers, agencies) restricted from bidding on this impression
Declaration
Swift
var blocklistBuyers: Set<String>?
-
White list of languages for creatives using ISO-639-1-alpha-2
Declaration
Swift
var whitelistLanguages: Set<String>?
-
Blocked advertiser categories
Declaration
Swift
var blockedCategories: Set<String>?
-
Block list of advertisers by their domains (e.g., “ford.com”)
Declaration
Swift
var blockedAdvertisingDomains: Set<URL>?
-
Block list of applications by their platform-specific exchange-independent application identifiers (numeric IDs)
Declaration
Swift
var blockedApps: Set<String>?
-
Provides data about the inventory source and which entity makes the final decision
Declaration
Swift
var source: NimbusSource?
-
Specifies any industry, legal, or governmental regulations in force for this request
Declaration
Swift
var regs: NimbusRegs?
-
Maximum time in milliseconds the exchange allows for bids to be received including Internet latency to avoid timeout. This value supersedes any a priori guidance from the exchange
Declaration
Swift
var auctionTimeout: Int?
-
Placeholder for exchange-specific extensions to OpenRTB
Declaration
Swift
var extensions: [String : NimbusCodable]?
-
init(impressions:app:device:format:user:isTest:whitelistBuyers:blacklistBuyers:whitelistLanguages:blockedCategories:blockedAdvertisingDomains:blockedApps:source:regs:auctionTimeout:)
Initializes a
NimbusRequest
object- impressions: Represents the impressions offered. Only one
NimbusImpression
object is currently supported. - app: Details about the publisher’s app (i.e., non-browser applications). Only applicable and recommended for apps.
- device: Details about the user’s device to which the impression will be delivered
- format: This is not part of the OpenRTB spec, adding this here for convenience allows height and width to be passed without the video/banner object to backwards support the GET
- user: Details about the human user of the device; the advertising audience
- isTest: Indicator of test mode in which auctions are not billable
- whitelistBuyers: White list of buyer seats (e.g., advertisers, agencies) allowed to bid on this impression
- blacklistBuyers: Block list of buyer seats (e.g., advertisers, agencies) restricted from bidding on this impression
- whitelistLanguages: White list of languages for creatives using ISO-639-1-alpha-2
- blockedCategories: Blocked advertiser categories
- blockedAdvertisingDomains: Block list of advertisers by their domains (e.g., “ford.com”)
- blockedApps: Block list of applications by their platform-specific exchange-independent application identifiers (numeric IDs)
- source: Provides data about the inventory source and which entity makes the final decision
- regs: Specifies any industry, legal, or governmental regulations in force for this request
- auctionTimeout: Maximum time in milliseconds the exchange allows for bids to be received including Internet latency to avoid timeout. This value supersedes any a priori guidance from the exchange.
Declaration
Swift
init(impressions: [NimbusImpression], app: NimbusApp? = nil, device: NimbusDevice, format: NimbusAdFormat, user: NimbusUser? = nil, isTest: Bool? = nil, whitelistBuyers: Set<String>? = nil, blacklistBuyers: Set<String>? = nil, whitelistLanguages: Set<String>? = nil, blockedCategories: Set<String>? = nil, blockedAdvertisingDomains: Set<URL>? = nil, blockedApps: Set<String>? = nil, source: NimbusSource? = nil, regs: NimbusRegs? = nil, auctionTimeout: Int? = nil)
Parameters
impressions
Represents the impressions offered. Only one
NimbusImpression
object is currently supported.app
Details about the publisher’s app (i.e., non-browser applications). Only applicable and recommended for apps.
device
Details about the user’s device to which the impression will be delivered
format
This is not part of the OpenRTB spec, adding this here for convenience allows height and width to be passed without the video/banner object to backwards support the GET
user
Details about the human user of the device; the advertising audience
isTest
Indicator of test mode in which auctions are not billable
whitelistBuyers
White list of buyer seats (e.g., advertisers, agencies) allowed to bid on this impression
blacklistBuyers
Block list of buyer seats (e.g., advertisers, agencies) restricted from bidding on this impression
whitelistLanguages
White list of languages for creatives using ISO-639-1-alpha-2
blockedCategories
Blocked advertiser categories
blockedAdvertisingDomains
Block list of advertisers by their domains (e.g., “ford.com”)
blockedApps
Block list of applications by their platform-specific exchange-independent application identifiers (numeric IDs)
source
Provides data about the inventory source and which entity makes the final decision
regs
Specifies any industry, legal, or governmental regulations in force for this request
auctionTimeout
Maximum time in milliseconds the exchange allows for bids to be received including Internet latency to avoid timeout. This value supersedes any a priori guidance from the exchange.
- impressions: Represents the impressions offered. Only one
-
Unique session id for the current app session
Declaration
Swift
var sessionId: String? { get }
-
Configure publisher-specific details
- sessionId: Any unique identifier for this session
Declaration
Swift
func configure(sessionId: String)
Parameters
sessionId
Any unique identifier for this session
-
Add extended ID
- eid: Extended ID
Declaration
Swift
func addExtendedId(_ eid: NimbusExtendedId)
Parameters
eid
Extended ID
-
Configure viewability for Open Measurement
- partnerName: Name of the IAB-certified Open Measurement partner
- partnerVersion: Partner’s current app or SDK version
Declaration
Swift
func configureViewability(partnerName: String, partnerVersion: String)
Parameters
partnerName
Name of the IAB-certified Open Measurement partner
partnerVersion
Partner’s current app or SDK version
-
Returns a Boolean value indicating whether two values are not equal.
Inequality is the inverse of equality. For any values
a
andb
,a != b
implies thata == b
isfalse
.This is the default implementation of the not-equal-to operator (
!=
) for any type that conforms toEquatable
.Declaration
Swift
static func != (lhs: Self, rhs: Self) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
-
Declaration
Swift
func addAPSResponse(_ response: DTBAdResponse)
-
Declaration
Swift
func addAPSLoader(_ loader: DTBAdLoader)
-
Include AdMob bidding in the current Banner request.
Example including AdMob in a banner request:
NimbusRequest.forBannerAd("position").withAdMobBanner(adUnitId: "adUnit")
Declaration
Swift
@discardableResult func withAdMobBanner(adUnitId: String) -> NimbusRequest
Parameters
adUnitId
AdMob ad unit id
Return Value
NimbusRequest
-
Include AdMob bidding in the current Native request.
Example including AdMob in a native request:
NimbusRequest.forNativeAd("position").withAdMobNative(adUnitId: "adUnit")
Declaration
Swift
@discardableResult func withAdMobNative(adUnitId: String, nativeAdOptions: NimbusAdMobNativeAdOptions? = nil) -> NimbusRequest
Parameters
adUnitId
AdMob ad unit id
Return Value
NimbusRequest
-
Include AdMob bidding in the current Interstitial request.
Example including AdMob in an interstitial request:
NimbusRequest.forInterstitialAd("position").withAdMobInterstitial(adUnitId: "adUnit")
Declaration
Swift
@discardableResult func withAdMobInterstitial(adUnitId: String) -> NimbusRequest
Parameters
adUnitId
AdMob ad unit id
Return Value
NimbusRequest
-
Include AdMob bidding in the current Rewarded request.
Example including AdMob in a rewarded request:
NimbusRequest.forRewardedVideo("position").withAdMobRewarded(adUnitId: "adUnit")
Declaration
Swift
@discardableResult func withAdMobRewarded(adUnitId: String) -> NimbusRequest
Parameters
adUnitId
AdMob ad unit id
Return Value
NimbusRequest
-
Include Mintegral bidding in the current request.
Example including Mintegral in a banner request:
NimbusRequest.forBannerAd("position").withMintegral(adUnitId: "adUnit", placementId: "placement")
- adUnitId: Mintegral ad unit id
placementId: Mintegral placement id
Declaration
Swift
@discardableResult func withMintegral(adUnitId: String, placementId: String? = nil) -> NimbusRequest
Parameters
adUnitId
Mintegral ad unit id
placementId
Mintegral placement id
Return Value
NimbusRequest