Skip to content

Commit

Permalink
Merge pull request #10 from Headway-Dev/fix/rollback-api-v-for-adset-…
Browse files Browse the repository at this point in the history
…copy

Set AdSet copy API version to 21.0
  • Loading branch information
MaxDMT16 authored Jan 31, 2025
2 parents e6d8874 + 1f97347 commit 05c5790
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions marketing/v22/adset.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func (as *AdsetService) CopyAsync(ctx context.Context, id string) (*fb.CopiedAds
return nil, errors.New("cannot copy adset without id")
}

tempVersion := "v21.0"

res := &fb.AsyncBatchCreateResponse{}

req := &fb.AsyncBatchCreateRequest{
Expand All @@ -136,7 +138,7 @@ func (as *AdsetService) CopyAsync(ctx context.Context, id string) (*fb.CopiedAds
},
}

err := as.c.PostJSON(ctx, fb.NewRoute(Version, "/").String(), req, res)
err := as.c.PostJSON(ctx, fb.NewRoute(tempVersion, "/").String(), req, res)
if err != nil {
return nil, err
}
Expand All @@ -152,7 +154,7 @@ func (as *AdsetService) CopyAsync(ctx context.Context, id string) (*fb.CopiedAds
for {
asyncBatchStatus := &fb.AsyncBatch{}

err = as.c.GetJSON(ctx, fb.NewRoute(Version, "/%s", asyncSessionID).
err = as.c.GetJSON(ctx, fb.NewRoute(tempVersion, "/%s", asyncSessionID).
Fields("result", "status", "error_code", "exception").
String(), asyncBatchStatus)
if err != nil {
Expand Down

0 comments on commit 05c5790

Please sign in to comment.