NativeRequest

public class NativeRequest : AdUnit

A class representing a native request for original type of integration.

  • The version of the native ad specification being used. Defaults to “1.2” if not set.

    Declaration

    Swift

    public var version: String { get set }
  • The context in which the ad appears. See ContextType for possible values.

    Declaration

    Swift

    public var context: ContextType? { get set }
  • A more detailed context in which the ad appears. See ContextSubType for possible values.

    Declaration

    Swift

    public var contextSubType: ContextSubType? { get set }
  • The design/format/layout of the ad unit being offered. See PlacementType for possible values.

    Declaration

    Swift

    public var placementType: PlacementType? { get set }
  • The number of identical placements in the ad layout. Defaults to 1 if not set.

    Declaration

    Swift

    public var placementCount: Int { get set }
  • The sequence number of the ad. Defaults to 0 if not set.

    Declaration

    Swift

    public var sequence: Int { get set }
  • An array of NativeAsset objects representing the assets required for the native ad request.

    Declaration

    Swift

    public var assets: [NativeAsset]? { get set }
  • Indicates whether the supply source/impression supports returning an assetsurl instead of an asset object. Defaults to 0 if not set.

    Declaration

    Swift

    public var asseturlsupport: Int { get set }
  • Indicates whether the supply source/impression supports returning a dco URL instead of an asset object. Defaults to 0 if not set.

    Declaration

    Swift

    public var durlsupport: Int { get set }
  • An array of NativeEventTracker objects specifying the event tracking settings for the native ad.

    Declaration

    Swift

    public var eventtrackers: [NativeEventTracker]? { get set }
  • Indicates whether the native ad supports a buyer-specific privacy notice. Defaults to 0 if not set.

    Declaration

    Swift

    public var privacy: Int { get set }
  • ext

    A placeholder for custom JSON agreed to by the parties to support flexibility beyond the standard specification.

    Declaration

    Swift

    public var ext: [String : Any]? { get set }
  • The configuration ID for the ad unit.

    Declaration

    Swift

    public var configId: String { get set }
  • Initializes a NativeRequest with a specified configuration ID.

    Declaration

    Swift

    public init(configId: String)

    Parameters

    configId

    The configuration ID for the ad unit.

  • Initializes a NativeRequest with a specified configuration ID, assets, and event trackers.

    Declaration

    Swift

    public convenience init(configId: String, assets: [NativeAsset]? = nil, eventTrackers: [NativeEventTracker]? = nil)

    Parameters

    configId

    The configuration ID for the ad unit.

    assets

    An optional array of NativeAsset objects.

    eventTrackers

    An optional array of NativeEventTracker objects.

  • Adds an array of native assets to the request. If assets already exist, they will be appended.

    Declaration

    Swift

    public func addNativeAssets(_ assets: [NativeAsset])

    Parameters

    assets

    An array of NativeAsset objects to add.

  • Adds an array of native event trackers to the request. If event trackers already exist, they will be appended.

    Declaration

    Swift

    public func addNativeEventTracker(_ eventTrackers: [NativeEventTracker])

    Parameters

    eventTrackers

    An array of NativeEventTracker objects to add.

  • Retrieves the native request object as a JSON dictionary.

    Declaration

    Swift

    public func getNativeRequestObject() -> [AnyHashable : Any]?

    Return Value

    A dictionary representation of the native request object, or nil if an error occurs.