Skip to content

Commit 91e5b48

Browse files
authored
feat: add --ad-account-id flag to debug meta-ads command (#7)
Allow explicit ad account ID for token resolution and include DELETE in the supported HTTP methods.
1 parent b0354b2 commit 91e5b48

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎cmd/debug.go‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ Examples:
3030
}
3131

3232
var (
33-
debugMetaPath string
34-
debugMetaMethod string
35-
debugMetaParams string
36-
debugMetaPageID string
33+
debugMetaPath string
34+
debugMetaMethod string
35+
debugMetaParams string
36+
debugMetaPageID string
37+
debugMetaAdAccountID string
3738
)
3839

3940
func init() {
4041
// Meta Ads debug
4142
debugMetaAdsCmd.Flags().StringVar(&debugMetaPath, "path", "", "Graph API path, e.g. me/adaccounts or act_123/campaigns (required)")
42-
debugMetaAdsCmd.Flags().StringVar(&debugMetaMethod, "method", "GET", "HTTP method: GET or POST")
43+
debugMetaAdsCmd.Flags().StringVar(&debugMetaMethod, "method", "GET", "HTTP method: GET, POST, or DELETE")
4344
debugMetaAdsCmd.Flags().StringVar(&debugMetaParams, "params", "", "JSON object of additional query/body params")
4445
debugMetaAdsCmd.Flags().StringVar(&debugMetaPageID, "page-id", "", "Use this page's access token instead of user token")
46+
debugMetaAdsCmd.Flags().StringVar(&debugMetaAdAccountID, "ad-account-id", "", "Explicit ad account ID for token resolution (e.g. act_123456)")
4547
debugMetaAdsCmd.MarkFlagRequired("path")
4648
debugCmd.AddCommand(debugMetaAdsCmd)
4749

@@ -126,6 +128,9 @@ func runDebugMetaAds(cmd *cobra.Command, args []string) error {
126128
if debugMetaPageID != "" {
127129
body["page_id"] = debugMetaPageID
128130
}
131+
if debugMetaAdAccountID != "" {
132+
body["ad_account_id"] = debugMetaAdAccountID
133+
}
129134

130135
c := client.NewREST(getWebAPIURL(), token)
131136
result, err := c.Post("/api/debug/meta-ads", body)

0 commit comments

Comments
 (0)