Skip to content

Commit a1c2a06

Browse files
authored
Merge pull request #29 from justwatch/feature/upgrade_to_v19
Feature/upgrade to v19
2 parents 8d68eda + ecbfd01 commit a1c2a06

16 files changed

+3199
-0
lines changed

marketing/v19/ad_account.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package v19
2+
3+
import (
4+
"context"
5+
6+
"github.com/justwatch/facebook-marketing-api-golang-sdk/fb"
7+
)
8+
9+
// AdAccountService works with ad accounts.
10+
type AdAccountService struct {
11+
c *fb.Client
12+
}
13+
14+
// List lists all ad accounts that belong to this business.
15+
func (aas *AdAccountService) List(ctx context.Context, businessID string) ([]AdAccount, error) {
16+
res := []AdAccount{}
17+
rb := fb.NewRoute(Version, "/%s/owned_ad_accounts", businessID).Limit(1000).Fields("name", "currency", "account_id", "timezone_name")
18+
err := aas.c.GetList(ctx, rb.String(), &res)
19+
if err != nil {
20+
return nil, err
21+
}
22+
23+
return res, nil
24+
}
25+
26+
// AdAccount represents an ad account.
27+
type AdAccount struct {
28+
Name string `json:"name"`
29+
AccountID string `json:"account_id"`
30+
Currency string `json:"currency"`
31+
TimeZoneName string `json:"timezone_name"`
32+
}

0 commit comments

Comments
 (0)