-
Notifications
You must be signed in to change notification settings - Fork 1
✨ Add ad write operations: create, update, delete (Closes #35)#36
Merged
Merged
✨ Add ad write operations: create, update, delete (Closes #35) #36SamPetherbridge merged 1 commit into
SamPetherbridge merged 1 commit into
Conversation
Extend the ads group from read-only to full management: - asa ads create — create an ad (CUSTOM_PRODUCT_PAGE or DEFAULT_PRODUCT_PAGE) - asa ads update — change an ad's name and/or status - asa ads delete — delete an ad (confirmation, --yes to skip) Creative-type/product-page coupling is validated client-side before any API call: CUSTOM_PRODUCT_PAGE requires --product-page, DEFAULT_PRODUCT_PAGE rejects it, and CREATIVE_SET is rejected (asset selection unsupported by the AdCreate model). create supports --dry-run to preview the payload. Closes #35.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #35 — extends the
adsgroup from read-only (added in #32) to full management. The library already supported ad CRUD via basecreate/update/delete; this wires it into the CLI with the validation and safety the issue called for.New commands
asa ads create -c <campaign> -a <ad-group> -n <name> [-t <creative-type>] [-p <product-page>] [-s <status>] [--dry-run] [-y]asa ads update <ad-id> -c <campaign> -a <ad-group> [--name ...] [--status ...]asa ads delete <ad-id> -c <campaign> -a <ad-group> [-y]Design decisions (from #35)
CUSTOM_PRODUCT_PAGErequires--product-pageDEFAULT_PRODUCT_PAGErejects--product-pageCREATIVE_SETis rejected outright — theAdCreatemodel exposes no way to attach creative-set assets, so it can't be created through this command (documented in the error).deleteconfirms (default No) with--yesto skip;createconfirms (default Yes) and supports--dry-runto preview the payload.--product-pageids come fromasa product-pages list(cross-referenced in help/errors).Verification
Because validation and
--dry-runrun beforeget_client()/network, the decision logic is testable offline — and is tested:ruff check/ruff format --checkmypy --strict(19 files;AdCreate/AdUpdateusage checked against real models)pytest— 16 passed, including 5 new behavioral tests:CREATIVE_SETrejectedCUSTOM_PRODUCT_PAGEwithout--product-pagerejectedDEFAULT_PRODUCT_PAGEwith--product-pagerejected--dry-runpreviews payload and exits 0 (no API call)update(no--name/--status) rejectedLimitation (honest scope)
Live create/update/delete can't be exercised here (no credentials, and writing real ads would be inappropriate) — same constraint as every other command. What's verified is types, validation, payload construction, and the dry-run path. The first real run against an account is the remaining confidence step, and
--dry-runplus the delete confirmation are there to make that safe.