Skip to content

Commit

Permalink
chore(internal): codegen related update (#3024)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Sep 4, 2024
1 parent 581f621 commit e41904d
Show file tree
Hide file tree
Showing 1,138 changed files with 201,338 additions and 206,060 deletions.
634 changes: 317 additions & 317 deletions accounts/account.go

Large diffs are not rendered by default.

268 changes: 134 additions & 134 deletions accounts/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,154 +3,154 @@
package accounts_test

import (
"context"
"errors"
"os"
"testing"
"context"
"errors"
"os"
"testing"

"github.com/cloudflare/cloudflare-go/v2"
"github.com/cloudflare/cloudflare-go/v2/accounts"
"github.com/cloudflare/cloudflare-go/v2/internal/testutil"
"github.com/cloudflare/cloudflare-go/v2/option"
"github.com/cloudflare/cloudflare-go/v2"
"github.com/cloudflare/cloudflare-go/v2/accounts"
"github.com/cloudflare/cloudflare-go/v2/internal/testutil"
"github.com/cloudflare/cloudflare-go/v2/option"
)

func TestAccountNewWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.New(context.TODO(), accounts.AccountNewParams{
Name: cloudflare.F("name"),
Type: cloudflare.F(accounts.AccountNewParamsTypeStandard),
Unit: cloudflare.F(accounts.AccountNewParamsUnit{
ID: cloudflare.F("f267e341f3dd4697bd3b9f71dd96247f"),
}),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.New(context.TODO(), accounts.AccountNewParams{
Name: cloudflare.F("name"),
Type: cloudflare.F(accounts.AccountNewParamsTypeStandard),
Unit: cloudflare.F(accounts.AccountNewParamsUnit{
ID: cloudflare.F("f267e341f3dd4697bd3b9f71dd96247f"),
}),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccountUpdateWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.Update(context.TODO(), accounts.AccountUpdateParams{
AccountID: cloudflare.F("eb78d65290b24279ba6f44721b3ea3c4"),
Account: accounts.AccountParam{
Name: cloudflare.F("Demo Account"),
Settings: cloudflare.F(accounts.AccountSettingsParam{
AbuseContactEmail: cloudflare.F("abuse_contact_email"),
DefaultNameservers: cloudflare.F(accounts.AccountSettingsDefaultNameserversCloudflareStandard),
EnforceTwofactor: cloudflare.F(true),
UseAccountCustomNSByDefault: cloudflare.F(true),
}),
},
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.Update(context.TODO(), accounts.AccountUpdateParams{
AccountID: cloudflare.F("eb78d65290b24279ba6f44721b3ea3c4"),
Account: accounts.AccountParam{
Name: cloudflare.F("Demo Account"),
Settings: cloudflare.F(accounts.AccountSettingsParam{
AbuseContactEmail: cloudflare.F("abuse_contact_email"),
DefaultNameservers: cloudflare.F(accounts.AccountSettingsDefaultNameserversCloudflareStandard),
EnforceTwofactor: cloudflare.F(true),
UseAccountCustomNSByDefault: cloudflare.F(true),
}),
},
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccountListWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.List(context.TODO(), accounts.AccountListParams{
Direction: cloudflare.F(accounts.AccountListParamsDirectionAsc),
Name: cloudflare.F("example.com"),
Page: cloudflare.F(1.000000),
PerPage: cloudflare.F(5.000000),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.List(context.TODO(), accounts.AccountListParams{
Direction: cloudflare.F(accounts.AccountListParamsDirectionAsc),
Name: cloudflare.F("example.com"),
Page: cloudflare.F(1.000000),
PerPage: cloudflare.F(5.000000),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccountDelete(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.Delete(context.TODO(), accounts.AccountDeleteParams{
AccountID: cloudflare.F("account_id"),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.Delete(context.TODO(), accounts.AccountDeleteParams{
AccountID: cloudflare.F("account_id"),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccountGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.Get(context.TODO(), accounts.AccountGetParams{
AccountID: cloudflare.F("eb78d65290b24279ba6f44721b3ea3c4"),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
option.WithAPIEmail("[email protected]"),
)
_, err := client.Accounts.Get(context.TODO(), accounts.AccountGetParams{
AccountID: cloudflare.F("eb78d65290b24279ba6f44721b3ea3c4"),
})
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}
Loading

0 comments on commit e41904d

Please sign in to comment.