Skip to content

Commit

Permalink
Merge pull request #29 from justwatch/feature/upgrade_to_v19
Browse files Browse the repository at this point in the history
Feature/upgrade to v19
  • Loading branch information
HolkerDev authored Jul 15, 2024
2 parents 8d68eda + ecbfd01 commit a1c2a06
Show file tree
Hide file tree
Showing 16 changed files with 3,199 additions and 0 deletions.
32 changes: 32 additions & 0 deletions marketing/v19/ad_account.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package v19

import (
"context"

"github.com/justwatch/facebook-marketing-api-golang-sdk/fb"
)

// AdAccountService works with ad accounts.
type AdAccountService struct {
c *fb.Client
}

// List lists all ad accounts that belong to this business.
func (aas *AdAccountService) List(ctx context.Context, businessID string) ([]AdAccount, error) {
res := []AdAccount{}
rb := fb.NewRoute(Version, "/%s/owned_ad_accounts", businessID).Limit(1000).Fields("name", "currency", "account_id", "timezone_name")
err := aas.c.GetList(ctx, rb.String(), &res)
if err != nil {
return nil, err
}

return res, nil
}

// AdAccount represents an ad account.
type AdAccount struct {
Name string `json:"name"`
AccountID string `json:"account_id"`
Currency string `json:"currency"`
TimeZoneName string `json:"timezone_name"`
}
Loading

0 comments on commit a1c2a06

Please sign in to comment.