@adcp/client API Reference - v4.19.0
    Preparing search index...

    Function getFormatAssets

    • Get assets from a Format

      Returns the assets from the v3 assets field. For backward compatibility with v2 servers, this function also handles the deprecated assets_required field if present.

      Parameters

      • format: Format

        The Format object from list_creative_formats response

      Returns (
          | BaseIndividualAsset
          | {
              item_type: "repeatable_group";
              asset_group_id: string;
              required: boolean;
              min_count: number;
              max_count: number;
              selection_mode?: "sequential"
              | "optimize";
              assets: BaseGroupAsset[];
          }
      )[]

      Array of assets

      • BaseIndividualAsset
      • {
            item_type: "repeatable_group";
            asset_group_id: string;
            required: boolean;
            min_count: number;
            max_count: number;
            selection_mode?: "sequential" | "optimize";
            assets: BaseGroupAsset[];
        }
        • item_type: "repeatable_group"

          Discriminator indicating this is a repeatable asset group

        • asset_group_id: string

          Identifier for this asset group (e.g., 'product', 'slide', 'card')

        • required: boolean

          Whether this asset group is required. If true, at least min_count repetitions must be provided.

        • min_count: number

          Minimum number of repetitions required (if group is required) or allowed (if optional)

        • max_count: number

          Maximum number of repetitions allowed

        • Optionalselection_mode?: "sequential" | "optimize"

          How the platform uses repetitions of this group. 'sequential' means all items display in order (carousels, playlists). 'optimize' means the platform selects the best-performing combination from alternatives (asset group optimization like Meta Advantage+ or Google Pmax).

        • assets: BaseGroupAsset[]

          Assets within each repetition of this group

      const formats = await agent.listCreativeFormats({});
      for (const format of formats.formats) {
      const assets = getFormatAssets(format);
      console.log(`${format.name} has ${assets.length} assets`);
      }