Skip to content

✨ Add ad/creative write operations (create, update, delete ads) #35

Description

@SamPetherbridge

Summary

The ads command group added in #32 (PR #34) is read-only (list/get). The asa-api-client library actually supports full ad CRUD — this issue tracks adding the write operations.

Ad creation was deliberately deferred from #32 because, unlike the other v5 resources, it's a real feature with meaningful UX decisions (creative type selection, CPP linking), not just a surfacing pass.

Library surface (already available)

client.campaigns(c).ad_groups(a).ads inherits base CRUD:

  • create(AdCreate) -> Ad
  • update(ad_id, AdUpdate) -> Ad
  • delete(ad_id) -> None

Models:

AdCreate:  name: str
           creative_type: CreativeType        # CREATIVE_SET | CUSTOM_PRODUCT_PAGE | DEFAULT_PRODUCT_PAGE
           status: AdStatus = ENABLED
           product_page_id: str | None        # required for CUSTOM_PRODUCT_PAGE

AdUpdate:  name: str | None
           status: AdStatus | None

Proposed commands

  • asa ads create -c <campaign> -a <ad-group> --name <name> --creative-type <type> [--product-page <id>] [--status ENABLED|PAUSED]
  • asa ads update <ad-id> -c <campaign> -a <ad-group> [--name <name>] [--status ...]
  • asa ads delete <ad-id> -c <campaign> -a <ad-group> [--yes]

Design considerations

  1. Creative type ↔ product page coupling. CUSTOM_PRODUCT_PAGE requires --product-page <id>; DEFAULT_PRODUCT_PAGE/CREATIVE_SET must not take one. Validate this combination client-side with a clear error rather than letting the API 400.
  2. Discoverability. --product-page ids come from asa product-pages list (already shipped) — cross-reference in help text. Consider validating the CPP belongs to the campaign's app.
  3. Confirmation + dry-run. delete should confirm (reuse confirm_action, with --yes to skip); create could support --dry-run to preview the payload, consistent with optimize/translate.
  4. CREATIVE_SET scope. Creative sets involve asset/media selection beyond a single id — confirm what the API expects before supporting that type, or restrict the first cut to the product-page creative types.

Acceptance criteria

  • create, update, delete implemented following existing typer/utils conventions
  • Creative-type/product-page validation with friendly errors
  • delete confirmation + --yes; create --dry-run
  • mypy --strict, ruff, and tests green; help/registration tests added

Context

Follows #32 (read-only v5 surfacing) and #30 (asa-api-client 0.2.1 adoption).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions