Skip to content

Commit

Permalink
feat: update via SDK Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 20, 2024
1 parent b59b17f commit 023fc0a
Show file tree
Hide file tree
Showing 663 changed files with 84,245 additions and 102,240 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1147
configured_endpoints: 1111
31 changes: 7 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,14 @@ When the API returns a non-success status code, we return an error with type
To handle errors, we recommend that you use the `errors.As` pattern:

```go
_, err := client.Zones.New(context.TODO(), cloudflare.ZoneNewParams{
Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{
ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
}),
Name: cloudflare.F("example.com"),
Type: cloudflare.F(cloudflare.ZoneNewParamsTypeFull),
})
_, err := client.Zones.Get(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353")
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request
println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
}
panic(err.Error()) // GET "/zones": 400 Bad Request { ... }
panic(err.Error()) // GET "/zones/{zone_id}": 400 Bad Request { ... }
}
```

Expand All @@ -212,15 +206,10 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Zones.New(
client.Zones.Update(
ctx,
cloudflare.ZoneNewParams{
Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{
ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
}),
Name: cloudflare.F("example.com"),
Type: cloudflare.F(cloudflare.ZoneNewParamsTypeFull),
},
"023e105f4ecef8ad9ca31a8372d0c353",
cloudflare.ZoneUpdateParams{},
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
)
Expand All @@ -241,15 +230,9 @@ client := cloudflare.NewClient(
)

// Override per-request:
client.Zones.New(
client.Zones.Get(
context.TODO(),
cloudflare.ZoneNewParams{
Account: cloudflare.F(cloudflare.ZoneNewParamsAccount{
ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
}),
Name: cloudflare.F("example.com"),
Type: cloudflare.F(cloudflare.ZoneNewParamsTypeFull),
},
"023e105f4ecef8ad9ca31a8372d0c353",
option.WithMaxRetries(5),
)
```
Expand Down
4 changes: 2 additions & 2 deletions access.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// service directly, and instead use the [NewAccessService] method instead.
type AccessService struct {
Options []option.RequestOption
Apps *AccessAppService
Applications *AccessApplicationService
Certificates *AccessCertificateService
Groups *AccessGroupService
IdentityProviders *AccessIdentityProviderService
Expand All @@ -33,7 +33,7 @@ type AccessService struct {
func NewAccessService(opts ...option.RequestOption) (r *AccessService) {
r = &AccessService{}
r.Options = opts
r.Apps = NewAccessAppService(opts...)
r.Applications = NewAccessApplicationService(opts...)
r.Certificates = NewAccessCertificateService(opts...)
r.Groups = NewAccessGroupService(opts...)
r.IdentityProviders = NewAccessIdentityProviderService(opts...)
Expand Down
Loading

0 comments on commit 023fc0a

Please sign in to comment.