Skip to content

Commit 837c738

Browse files
feat(api): api update
1 parent 078a9f4 commit 837c738

33 files changed

+14530
-23671
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: 1781
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2bfb36c626416e47cb758ab9f6f03d7a4ad14f7b7d4ecfc43e204effec027213.yml
3-
openapi_spec_hash: 01656e36e266af66a86deb34e34d1821
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d12e5f29ee59534bcbd3655ccc82d3f9b721562ce32d6a74905e4f64ea963ff3.yml
3+
openapi_spec_hash: 816ab531b7373d57f9c701d5bb8dcd2a
44
config_hash: a433f3793b734bc6fcc9d9e0c27ff8c2

api.md

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

zero_trust/accessapplication.go

Lines changed: 14289 additions & 23581 deletions
Large diffs are not rendered by default.

zero_trust/accessapplication_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ func TestAccessApplicationListWithOptionalParams(t *testing.T) {
272272
Domain: cloudflare.F("domain"),
273273
Exact: cloudflare.F(true),
274274
Name: cloudflare.F("name"),
275+
Page: cloudflare.F(int64(0)),
276+
PerPage: cloudflare.F(int64(0)),
275277
Search: cloudflare.F("search"),
276278
})
277279
if err != nil {

zero_trust/accessapplicationca.go

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10+
"net/url"
1011

1112
"github.com/cloudflare/cloudflare-go/v5/internal/apijson"
13+
"github.com/cloudflare/cloudflare-go/v5/internal/apiquery"
1214
"github.com/cloudflare/cloudflare-go/v5/internal/param"
1315
"github.com/cloudflare/cloudflare-go/v5/internal/requestconfig"
1416
"github.com/cloudflare/cloudflare-go/v5/option"
@@ -70,30 +72,30 @@ func (r *AccessApplicationCAService) New(ctx context.Context, appID string, body
7072
}
7173

7274
// Lists short-lived certificate CAs and their public keys.
73-
func (r *AccessApplicationCAService) List(ctx context.Context, query AccessApplicationCAListParams, opts ...option.RequestOption) (res *pagination.SinglePage[CA], err error) {
75+
func (r *AccessApplicationCAService) List(ctx context.Context, params AccessApplicationCAListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[CA], err error) {
7476
var raw *http.Response
7577
opts = append(r.Options[:], opts...)
7678
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
7779
var accountOrZone string
7880
var accountOrZoneID param.Field[string]
79-
if query.AccountID.Value != "" && query.ZoneID.Value != "" {
81+
if params.AccountID.Value != "" && params.ZoneID.Value != "" {
8082
err = errors.New("account ID and zone ID are mutually exclusive")
8183
return
8284
}
83-
if query.AccountID.Value == "" && query.ZoneID.Value == "" {
85+
if params.AccountID.Value == "" && params.ZoneID.Value == "" {
8486
err = errors.New("either account ID or zone ID must be provided")
8587
return
8688
}
87-
if query.AccountID.Value != "" {
89+
if params.AccountID.Value != "" {
8890
accountOrZone = "accounts"
89-
accountOrZoneID = query.AccountID
91+
accountOrZoneID = params.AccountID
9092
}
91-
if query.ZoneID.Value != "" {
93+
if params.ZoneID.Value != "" {
9294
accountOrZone = "zones"
93-
accountOrZoneID = query.ZoneID
95+
accountOrZoneID = params.ZoneID
9496
}
9597
path := fmt.Sprintf("%s/%s/access/apps/ca", accountOrZone, accountOrZoneID)
96-
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
98+
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
9799
if err != nil {
98100
return nil, err
99101
}
@@ -106,8 +108,8 @@ func (r *AccessApplicationCAService) List(ctx context.Context, query AccessAppli
106108
}
107109

108110
// Lists short-lived certificate CAs and their public keys.
109-
func (r *AccessApplicationCAService) ListAutoPaging(ctx context.Context, query AccessApplicationCAListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[CA] {
110-
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
111+
func (r *AccessApplicationCAService) ListAutoPaging(ctx context.Context, params AccessApplicationCAListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[CA] {
112+
return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...))
111113
}
112114

113115
// Deletes a short-lived certificate CA.
@@ -381,6 +383,19 @@ type AccessApplicationCAListParams struct {
381383
AccountID param.Field[string] `path:"account_id"`
382384
// The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
383385
ZoneID param.Field[string] `path:"zone_id"`
386+
// Page number of results.
387+
Page param.Field[int64] `query:"page"`
388+
// Number of results per page.
389+
PerPage param.Field[int64] `query:"per_page"`
390+
}
391+
392+
// URLQuery serializes [AccessApplicationCAListParams]'s query parameters as
393+
// `url.Values`.
394+
func (r AccessApplicationCAListParams) URLQuery() (v url.Values) {
395+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
396+
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
397+
NestedFormat: apiquery.NestedQueryFormatDots,
398+
})
384399
}
385400

386401
type AccessApplicationCADeleteParams struct {

zero_trust/accessapplicationca_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ func TestAccessApplicationCAListWithOptionalParams(t *testing.T) {
6060
)
6161
_, err := client.ZeroTrust.Access.Applications.CAs.List(context.TODO(), zero_trust.AccessApplicationCAListParams{
6262
AccountID: cloudflare.F("account_id"),
63+
Page: cloudflare.F(int64(0)),
64+
PerPage: cloudflare.F(int64(0)),
6365
})
6466
if err != nil {
6567
var apierr *cloudflare.Error

zero_trust/accessapplicationpolicy.go

Lines changed: 25 additions & 10 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
"time"
1213

1314
"github.com/cloudflare/cloudflare-go/v5/internal/apijson"
15+
"github.com/cloudflare/cloudflare-go/v5/internal/apiquery"
1416
"github.com/cloudflare/cloudflare-go/v5/internal/param"
1517
"github.com/cloudflare/cloudflare-go/v5/internal/requestconfig"
1618
"github.com/cloudflare/cloudflare-go/v5/option"
@@ -117,34 +119,34 @@ func (r *AccessApplicationPolicyService) Update(ctx context.Context, appID strin
117119

118120
// Lists Access policies configured for an application. Returns both exclusively
119121
// scoped and reusable policies used by the application.
120-
func (r *AccessApplicationPolicyService) List(ctx context.Context, appID string, query AccessApplicationPolicyListParams, opts ...option.RequestOption) (res *pagination.SinglePage[AccessApplicationPolicyListResponse], err error) {
122+
func (r *AccessApplicationPolicyService) List(ctx context.Context, appID string, params AccessApplicationPolicyListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[AccessApplicationPolicyListResponse], err error) {
121123
var raw *http.Response
122124
opts = append(r.Options[:], opts...)
123125
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
124126
var accountOrZone string
125127
var accountOrZoneID param.Field[string]
126-
if query.AccountID.Value != "" && query.ZoneID.Value != "" {
128+
if params.AccountID.Value != "" && params.ZoneID.Value != "" {
127129
err = errors.New("account ID and zone ID are mutually exclusive")
128130
return
129131
}
130-
if query.AccountID.Value == "" && query.ZoneID.Value == "" {
132+
if params.AccountID.Value == "" && params.ZoneID.Value == "" {
131133
err = errors.New("either account ID or zone ID must be provided")
132134
return
133135
}
134-
if query.AccountID.Value != "" {
136+
if params.AccountID.Value != "" {
135137
accountOrZone = "accounts"
136-
accountOrZoneID = query.AccountID
138+
accountOrZoneID = params.AccountID
137139
}
138-
if query.ZoneID.Value != "" {
140+
if params.ZoneID.Value != "" {
139141
accountOrZone = "zones"
140-
accountOrZoneID = query.ZoneID
142+
accountOrZoneID = params.ZoneID
141143
}
142144
if appID == "" {
143145
err = errors.New("missing required app_id parameter")
144146
return
145147
}
146148
path := fmt.Sprintf("%s/%s/access/apps/%s/policies", accountOrZone, accountOrZoneID, appID)
147-
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
149+
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
148150
if err != nil {
149151
return nil, err
150152
}
@@ -158,8 +160,8 @@ func (r *AccessApplicationPolicyService) List(ctx context.Context, appID string,
158160

159161
// Lists Access policies configured for an application. Returns both exclusively
160162
// scoped and reusable policies used by the application.
161-
func (r *AccessApplicationPolicyService) ListAutoPaging(ctx context.Context, appID string, query AccessApplicationPolicyListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[AccessApplicationPolicyListResponse] {
162-
return pagination.NewSinglePageAutoPager(r.List(ctx, appID, query, opts...))
163+
func (r *AccessApplicationPolicyService) ListAutoPaging(ctx context.Context, appID string, params AccessApplicationPolicyListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[AccessApplicationPolicyListResponse] {
164+
return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, appID, params, opts...))
163165
}
164166

165167
// Deletes an Access policy specific to an application. To delete a reusable
@@ -2820,6 +2822,19 @@ type AccessApplicationPolicyListParams struct {
28202822
AccountID param.Field[string] `path:"account_id"`
28212823
// The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
28222824
ZoneID param.Field[string] `path:"zone_id"`
2825+
// Page number of results.
2826+
Page param.Field[int64] `query:"page"`
2827+
// Number of results per page.
2828+
PerPage param.Field[int64] `query:"per_page"`
2829+
}
2830+
2831+
// URLQuery serializes [AccessApplicationPolicyListParams]'s query parameters as
2832+
// `url.Values`.
2833+
func (r AccessApplicationPolicyListParams) URLQuery() (v url.Values) {
2834+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
2835+
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
2836+
NestedFormat: apiquery.NestedQueryFormatDots,
2837+
})
28232838
}
28242839

28252840
type AccessApplicationPolicyDeleteParams struct {

zero_trust/accessapplicationpolicy_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ func TestAccessApplicationPolicyListWithOptionalParams(t *testing.T) {
124124
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
125125
zero_trust.AccessApplicationPolicyListParams{
126126
AccountID: cloudflare.F("account_id"),
127+
Page: cloudflare.F(int64(0)),
128+
PerPage: cloudflare.F(int64(0)),
127129
},
128130
)
129131
if err != nil {

zero_trust/accessapplicationpolicytestuser.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ func (r AccessApplicationPolicyTestUserListResponseStatus) IsKnown() bool {
118118
type AccessApplicationPolicyTestUserListParams struct {
119119
// Identifier.
120120
AccountID param.Field[string] `path:"account_id,required"`
121-
Page param.Field[int64] `query:"page"`
122-
PerPage param.Field[int64] `query:"per_page"`
121+
// Page number of results.
122+
Page param.Field[int64] `query:"page"`
123+
PerPage param.Field[int64] `query:"per_page"`
123124
// Filter users by their policy evaluation status.
124125
Status param.Field[AccessApplicationPolicyTestUserListParamsStatus] `query:"status"`
125126
}

zero_trust/accesscertificate.go

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10+
"net/url"
1011
"time"
1112

1213
"github.com/cloudflare/cloudflare-go/v5/internal/apijson"
14+
"github.com/cloudflare/cloudflare-go/v5/internal/apiquery"
1315
"github.com/cloudflare/cloudflare-go/v5/internal/param"
1416
"github.com/cloudflare/cloudflare-go/v5/internal/requestconfig"
1517
"github.com/cloudflare/cloudflare-go/v5/option"
@@ -104,30 +106,30 @@ func (r *AccessCertificateService) Update(ctx context.Context, certificateID str
104106
}
105107

106108
// Lists all mTLS root certificates.
107-
func (r *AccessCertificateService) List(ctx context.Context, query AccessCertificateListParams, opts ...option.RequestOption) (res *pagination.SinglePage[Certificate], err error) {
109+
func (r *AccessCertificateService) List(ctx context.Context, params AccessCertificateListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[Certificate], err error) {
108110
var raw *http.Response
109111
opts = append(r.Options[:], opts...)
110112
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
111113
var accountOrZone string
112114
var accountOrZoneID param.Field[string]
113-
if query.AccountID.Value != "" && query.ZoneID.Value != "" {
115+
if params.AccountID.Value != "" && params.ZoneID.Value != "" {
114116
err = errors.New("account ID and zone ID are mutually exclusive")
115117
return
116118
}
117-
if query.AccountID.Value == "" && query.ZoneID.Value == "" {
119+
if params.AccountID.Value == "" && params.ZoneID.Value == "" {
118120
err = errors.New("either account ID or zone ID must be provided")
119121
return
120122
}
121-
if query.AccountID.Value != "" {
123+
if params.AccountID.Value != "" {
122124
accountOrZone = "accounts"
123-
accountOrZoneID = query.AccountID
125+
accountOrZoneID = params.AccountID
124126
}
125-
if query.ZoneID.Value != "" {
127+
if params.ZoneID.Value != "" {
126128
accountOrZone = "zones"
127-
accountOrZoneID = query.ZoneID
129+
accountOrZoneID = params.ZoneID
128130
}
129131
path := fmt.Sprintf("%s/%s/access/certificates", accountOrZone, accountOrZoneID)
130-
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
132+
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
131133
if err != nil {
132134
return nil, err
133135
}
@@ -140,8 +142,8 @@ func (r *AccessCertificateService) List(ctx context.Context, query AccessCertifi
140142
}
141143

142144
// Lists all mTLS root certificates.
143-
func (r *AccessCertificateService) ListAutoPaging(ctx context.Context, query AccessCertificateListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[Certificate] {
144-
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
145+
func (r *AccessCertificateService) ListAutoPaging(ctx context.Context, params AccessCertificateListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[Certificate] {
146+
return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...))
145147
}
146148

147149
// Deletes an mTLS certificate.
@@ -591,6 +593,19 @@ type AccessCertificateListParams struct {
591593
AccountID param.Field[string] `path:"account_id"`
592594
// The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
593595
ZoneID param.Field[string] `path:"zone_id"`
596+
// Page number of results.
597+
Page param.Field[int64] `query:"page"`
598+
// Number of results per page.
599+
PerPage param.Field[int64] `query:"per_page"`
600+
}
601+
602+
// URLQuery serializes [AccessCertificateListParams]'s query parameters as
603+
// `url.Values`.
604+
func (r AccessCertificateListParams) URLQuery() (v url.Values) {
605+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
606+
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
607+
NestedFormat: apiquery.NestedQueryFormatDots,
608+
})
594609
}
595610

596611
type AccessCertificateDeleteParams struct {

0 commit comments

Comments
 (0)