Skip to content

Commit 29b2c71

Browse files
authored
Merge pull request #38 from justwatch/feature/add-v22
add v22
2 parents 8e6a3f0 + 0dbff3d commit 29b2c71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4782
-690
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ require (
66
github.com/PuerkitoBio/goquery v1.5.0
77
github.com/cenk/backoff v2.1.1+incompatible
88
github.com/go-kit/kit v0.8.0
9+
github.com/go-kit/log v0.2.1
910
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff
1011
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6
1112
)
1213

1314
require (
1415
github.com/andybalholm/cascadia v1.0.0 // indirect
15-
github.com/go-logfmt/logfmt v0.4.0 // indirect
16+
github.com/go-logfmt/logfmt v0.5.1 // indirect
1617
github.com/go-stack/stack v1.8.0 // indirect
1718
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
1819
github.com/jtolds/gls v4.20.0+incompatible // indirect
19-
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect
2020
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
2121
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a // indirect
2222
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ github.com/cenk/backoff v2.1.1+incompatible h1:gaShhlJc32b7ht9cwld/ti0z7tJOf69oU
66
github.com/cenk/backoff v2.1.1+incompatible/go.mod h1:7FtoeaSnHoZnmZzz47cM35Y9nSW7tNyaidugnHTaFDE=
77
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
88
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
9-
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
10-
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
9+
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
10+
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
11+
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
12+
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
1113
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
1214
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
1315
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
1416
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
1517
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
1618
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
17-
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
18-
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
1919
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
2020
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
2121
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff h1:86HlEv0yBCry9syNuylzqznKXDK11p6D0DT596yNMys=

marketing/v22/ad_account.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package v22
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)