Skip to content

Commit 177205f

Browse files
chore(api): update composite API spec
1 parent e482bcb commit 177205f

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1899
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-7e4d0f06a14e00e1fded122c6e363b955753c19f529887d691584630b9625544.yml
3-
openapi_spec_hash: f04905b36443a3e136496c9dc28ea51d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6d83cb5b55796ad6fb90e4941b68bf0814dee7735ce3a458dd249f5c5bcea2cb.yml
3+
openapi_spec_hash: 1c6947fbdbd925e0acbe688861673092
44
config_hash: f8ad41a1e87119e46c6452f8f1ea0440

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2710,7 +2710,7 @@ Response Types:
27102710
Methods:
27112711

27122712
- <code title="put /zones/{zone_id}/api_gateway/configuration">client.APIGateway.Configurations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#ConfigurationService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#ConfigurationUpdateParams">ConfigurationUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#Configuration">Configuration</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2713-
- <code title="get /zones/{zone_id}/api_gateway/configuration">client.APIGateway.Configurations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#ConfigurationService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#ConfigurationGetParams">ConfigurationGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#Configuration">Configuration</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2713+
- <code title="get /zones/{zone_id}/api_gateway/configuration">client.APIGateway.Configurations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#ConfigurationService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#ConfigurationGetParams">ConfigurationGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6/api_gateway#Configuration">Configuration</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
27142714

27152715
## Discovery
27162716

api_gateway/configuration.go

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10+
"net/url"
1011
"reflect"
1112
"slices"
1213

1314
"github.com/cloudflare/cloudflare-go/v6/internal/apijson"
15+
"github.com/cloudflare/cloudflare-go/v6/internal/apiquery"
1416
"github.com/cloudflare/cloudflare-go/v6/internal/param"
1517
"github.com/cloudflare/cloudflare-go/v6/internal/requestconfig"
1618
"github.com/cloudflare/cloudflare-go/v6/option"
@@ -54,15 +56,15 @@ func (r *ConfigurationService) Update(ctx context.Context, params ConfigurationU
5456
}
5557

5658
// Retrieve information about specific configuration properties
57-
func (r *ConfigurationService) Get(ctx context.Context, query ConfigurationGetParams, opts ...option.RequestOption) (res *Configuration, err error) {
59+
func (r *ConfigurationService) Get(ctx context.Context, params ConfigurationGetParams, opts ...option.RequestOption) (res *Configuration, err error) {
5860
var env ConfigurationGetResponseEnvelope
5961
opts = slices.Concat(r.Options, opts)
60-
if query.ZoneID.Value == "" {
62+
if params.ZoneID.Value == "" {
6163
err = errors.New("missing required zone_id parameter")
6264
return
6365
}
64-
path := fmt.Sprintf("zones/%s/api_gateway/configuration", query.ZoneID)
65-
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
66+
path := fmt.Sprintf("zones/%s/api_gateway/configuration", params.ZoneID)
67+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...)
6668
if err != nil {
6769
return
6870
}
@@ -343,12 +345,23 @@ type ConfigurationUpdateParams struct {
343345
// Identifier.
344346
ZoneID param.Field[string] `path:"zone_id,required"`
345347
Configuration ConfigurationParam `json:"configuration,required"`
348+
// Ensures that the configuration is written or retrieved in normalized fashion
349+
Normalize param.Field[bool] `query:"normalize"`
346350
}
347351

348352
func (r ConfigurationUpdateParams) MarshalJSON() (data []byte, err error) {
349353
return apijson.MarshalRoot(r.Configuration)
350354
}
351355

356+
// URLQuery serializes [ConfigurationUpdateParams]'s query parameters as
357+
// `url.Values`.
358+
func (r ConfigurationUpdateParams) URLQuery() (v url.Values) {
359+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
360+
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
361+
NestedFormat: apiquery.NestedQueryFormatDots,
362+
})
363+
}
364+
352365
type ConfigurationUpdateResponseEnvelope struct {
353366
Errors Message `json:"errors,required"`
354367
Messages Message `json:"messages,required"`
@@ -395,6 +408,16 @@ func (r ConfigurationUpdateResponseEnvelopeSuccess) IsKnown() bool {
395408
type ConfigurationGetParams struct {
396409
// Identifier.
397410
ZoneID param.Field[string] `path:"zone_id,required"`
411+
// Ensures that the configuration is written or retrieved in normalized fashion
412+
Normalize param.Field[bool] `query:"normalize"`
413+
}
414+
415+
// URLQuery serializes [ConfigurationGetParams]'s query parameters as `url.Values`.
416+
func (r ConfigurationGetParams) URLQuery() (v url.Values) {
417+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
418+
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
419+
NestedFormat: apiquery.NestedQueryFormatDots,
420+
})
398421
}
399422

400423
type ConfigurationGetResponseEnvelope struct {

api_gateway/configuration_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/cloudflare/cloudflare-go/v6/option"
1515
)
1616

17-
func TestConfigurationUpdate(t *testing.T) {
17+
func TestConfigurationUpdateWithOptionalParams(t *testing.T) {
1818
baseURL := "http://localhost:4010"
1919
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
2020
baseURL = envURL
@@ -35,6 +35,7 @@ func TestConfigurationUpdate(t *testing.T) {
3535
Type: cloudflare.F(api_gateway.ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicTypeHeader),
3636
}}),
3737
},
38+
Normalize: cloudflare.F(true),
3839
})
3940
if err != nil {
4041
var apierr *cloudflare.Error
@@ -45,7 +46,7 @@ func TestConfigurationUpdate(t *testing.T) {
4546
}
4647
}
4748

48-
func TestConfigurationGet(t *testing.T) {
49+
func TestConfigurationGetWithOptionalParams(t *testing.T) {
4950
baseURL := "http://localhost:4010"
5051
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
5152
baseURL = envURL
@@ -59,7 +60,8 @@ func TestConfigurationGet(t *testing.T) {
5960
option.WithAPIEmail("user@example.com"),
6061
)
6162
_, err := client.APIGateway.Configurations.Get(context.TODO(), api_gateway.ConfigurationGetParams{
62-
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
63+
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
64+
Normalize: cloudflare.F(true),
6365
})
6466
if err != nil {
6567
var apierr *cloudflare.Error

0 commit comments

Comments
 (0)