-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from justwatch/feature/upgrade_to_v19
Feature/upgrade to v19
- Loading branch information
Showing
16 changed files
with
3,199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
} |
Oops, something went wrong.