Skip to content

Commit

Permalink
implement update creative set api
Browse files Browse the repository at this point in the history
  • Loading branch information
gungoren committed Oct 8, 2021
1 parent f1f75fd commit 3bf8a08
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions asa/creative_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,21 @@ func (s *CreativeSetsService) AssignCreativeSetsToAdGroup(ctx context.Context, c

return res, resp, err
}

// CreativeSetUpdate is the details of an update to a Creative Set request
//
// https://developer.apple.com/documentation/apple_search_ads/creativesetupdate
type CreativeSetUpdate struct {
Name string `json:"name"`
}

// UpdateCreativeSets Updates a Creative Set name using an identifier
//
// https://developer.apple.com/documentation/apple_search_ads/update_creative_sets
func (s *CreativeSetsService) UpdateCreativeSets(ctx context.Context, creativeSetID int64, request *CreativeSetUpdate) (*CreativeSetResponse, *Response, error) {
url := fmt.Sprintf("creativesets/%d", creativeSetID)
res := new(CreativeSetResponse)
resp, err := s.client.put(ctx, url, request, res)

return res, resp, err
}
8 changes: 8 additions & 0 deletions asa/creative_sets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ func TestAssignCreativeSetsToAdGroup(t *testing.T) {
return client.CreativeSets.AssignCreativeSetsToAdGroup(ctx, 1, 99, &AssignAdGroupCreativeSetRequest{})
})
}

func TestUpdateCreativeSets(t *testing.T) {
t.Parallel()

testEndpointWithResponse(t, "{}", &CreativeSetResponse{}, func(ctx context.Context, client *Client) (interface{}, *Response, error) {
return client.CreativeSets.UpdateCreativeSets(ctx, 1001, &CreativeSetUpdate{})
})
}

0 comments on commit 3bf8a08

Please sign in to comment.