Skip to content

Commit

Permalink
feat(api): updates
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Jan 15, 2024
1 parent 15eae05 commit 9d2dc3d
Show file tree
Hide file tree
Showing 1,391 changed files with 217,926 additions and 56,186 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1113
configured_endpoints: 1359
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ import (

func main() {
client := cloudflare.NewClient(
option.WithAPIKey("my-cloudflare-api-key"), // defaults to os.LookupEnv("CLOUDFLARE_API_KEY")
option.WithEmail("dev@cloudflare.com"), // defaults to os.LookupEnv("CLOUDFLARE_EMAIL")
option.WithAPIEmail("dev@cloudflare.com"), // defaults to os.LookupEnv("CLOUDFLARE_API_EMAIL")
option.WithAPIKey("my-cloudflare-api-key"), // defaults to os.LookupEnv("CLOUDFLARE_API_KEY")
option.WithAPIToken("my-cloudflare-api-token"), // defaults to os.LookupEnv("CLOUDFLARE_API_TOKEN")
option.WithUserServiceKey("my-cloudflare-user-service-key"), // defaults to os.LookupEnv("CLOUDFLARE_USER_SERVICE_KEY")
)
zoneNewResponse, err := client.Zones.New(context.TODO(), cloudflare.ZoneNewParams{
Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{
Expand Down
254 changes: 146 additions & 108 deletions account.go

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ func TestAccountGet(t *testing.T) {
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIEmail("dev@cloudflare.com"),
option.WithAPIKey("my-cloudflare-api-key"),
option.WithEmail("dev@cloudflare.com"),
option.WithAPIToken("my-cloudflare-api-token"),
option.WithUserServiceKey("my-cloudflare-user-service-key"),
)
_, err := client.Accounts.Get(context.TODO(), map[string]interface{}{})
if err != nil {
Expand All @@ -48,15 +50,18 @@ func TestAccountUpdateWithOptionalParams(t *testing.T) {
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIEmail("dev@cloudflare.com"),
option.WithAPIKey("my-cloudflare-api-key"),
option.WithEmail("dev@cloudflare.com"),
option.WithAPIToken("my-cloudflare-api-token"),
option.WithUserServiceKey("my-cloudflare-user-service-key"),
)
_, err := client.Accounts.Update(
context.TODO(),
map[string]interface{}{},
cloudflare.AccountUpdateParams{
Name: cloudflare.F("Demo Account"),
Settings: cloudflare.F(cloudflare.AccountUpdateParamsSettings{
DefaultNameservers: cloudflare.F(cloudflare.AccountUpdateParamsSettingsDefaultNameserversCloudflareStandard),
EnforceTwofactor: cloudflare.F(true),
UseAccountCustomNsByDefault: cloudflare.F(true),
}),
Expand All @@ -82,8 +87,10 @@ func TestAccountAccountsListAccountsWithOptionalParams(t *testing.T) {
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIEmail("dev@cloudflare.com"),
option.WithAPIKey("my-cloudflare-api-key"),
option.WithEmail("dev@cloudflare.com"),
option.WithAPIToken("my-cloudflare-api-token"),
option.WithUserServiceKey("my-cloudflare-user-service-key"),
)
_, err := client.Accounts.AccountsListAccounts(context.TODO(), cloudflare.AccountAccountsListAccountsParams{
Direction: cloudflare.F(cloudflare.AccountAccountsListAccountsParamsDirectionDesc),
Expand Down
4 changes: 4 additions & 0 deletions accountaccess.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ type AccountAccessService struct {
Options []option.RequestOption
Bookmarks *AccountAccessBookmarkService
Certificates *AccountAccessCertificateService
CustomPages *AccountAccessCustomPageService
Groups *AccountAccessGroupService
IdentityProviders *AccountAccessIdentityProviderService
Keys *AccountAccessKeyService
Logs *AccountAccessLogService
Organizations *AccountAccessOrganizationService
Seats *AccountAccessSeatService
ServiceTokens *AccountAccessServiceTokenService
Tags *AccountAccessTagService
Users *AccountAccessUserService
}

Expand All @@ -33,13 +35,15 @@ func NewAccountAccessService(opts ...option.RequestOption) (r *AccountAccessServ
r.Options = opts
r.Bookmarks = NewAccountAccessBookmarkService(opts...)
r.Certificates = NewAccountAccessCertificateService(opts...)
r.CustomPages = NewAccountAccessCustomPageService(opts...)
r.Groups = NewAccountAccessGroupService(opts...)
r.IdentityProviders = NewAccountAccessIdentityProviderService(opts...)
r.Keys = NewAccountAccessKeyService(opts...)
r.Logs = NewAccountAccessLogService(opts...)
r.Organizations = NewAccountAccessOrganizationService(opts...)
r.Seats = NewAccountAccessSeatService(opts...)
r.ServiceTokens = NewAccountAccessServiceTokenService(opts...)
r.Tags = NewAccountAccessTagService(opts...)
r.Users = NewAccountAccessUserService(opts...)
return
}
Loading

0 comments on commit 9d2dc3d

Please sign in to comment.