Skip to content

Commit a69833c

Browse files
chore(api): upload stainless config from cloudflare-config
1 parent c3712db commit a69833c

File tree

6 files changed

+159
-13
lines changed

6 files changed

+159
-13
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1783
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e408a7cdec2dae3d1a18842dcc59280c56050fb042569139aec3fe0f12e0d461.yml
33
openapi_spec_hash: 7e210c76f5dd4c79b3e67204ad279b81
4-
config_hash: a433f3793b734bc6fcc9d9e0c27ff8c2
4+
config_hash: 2d45ef3f487fb8c17ee578789175de57

accounts/logaudit.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewLogAuditService(opts ...option.RequestOption) (r *LogAuditService) {
4242
// missing entries in the available audit logs. Be aware of the following
4343
// limitations. <br /> <ul> <li>Audit logs are available only for the past 30 days.
4444
// <br /></li> <li>Error handling is not yet implemented. <br /> </li> </ul>
45-
func (r *LogAuditService) List(ctx context.Context, params LogAuditListParams, opts ...option.RequestOption) (res *pagination.CursorLimitPagination[LogAuditListResponse], err error) {
45+
func (r *LogAuditService) List(ctx context.Context, params LogAuditListParams, opts ...option.RequestOption) (res *pagination.CursorPaginationAfter[LogAuditListResponse], err error) {
4646
var raw *http.Response
4747
opts = append(r.Options[:], opts...)
4848
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -68,8 +68,8 @@ func (r *LogAuditService) List(ctx context.Context, params LogAuditListParams, o
6868
// missing entries in the available audit logs. Be aware of the following
6969
// limitations. <br /> <ul> <li>Audit logs are available only for the past 30 days.
7070
// <br /></li> <li>Error handling is not yet implemented. <br /> </li> </ul>
71-
func (r *LogAuditService) ListAutoPaging(ctx context.Context, params LogAuditListParams, opts ...option.RequestOption) *pagination.CursorLimitPaginationAutoPager[LogAuditListResponse] {
72-
return pagination.NewCursorLimitPaginationAutoPager(r.List(ctx, params, opts...))
71+
func (r *LogAuditService) ListAutoPaging(ctx context.Context, params LogAuditListParams, opts ...option.RequestOption) *pagination.CursorPaginationAfterAutoPager[LogAuditListResponse] {
72+
return pagination.NewCursorPaginationAfterAutoPager(r.List(ctx, params, opts...))
7373
}
7474

7575
type LogAuditListResponse struct {

api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Response Types:
131131

132132
Methods:
133133

134-
- <code title="get /accounts/{account_id}/logs/audit">client.Accounts.Logs.Audit.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts#LogAuditService.List">List</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/v5/accounts">accounts</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts#LogAuditListParams">LogAuditListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination#CursorLimitPagination">CursorLimitPagination</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts">accounts</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts#LogAuditListResponse">LogAuditListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
134+
- <code title="get /accounts/{account_id}/logs/audit">client.Accounts.Logs.Audit.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts#LogAuditService.List">List</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/v5/accounts">accounts</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts#LogAuditListParams">LogAuditListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination#CursorPaginationAfter">CursorPaginationAfter</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts">accounts</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/accounts#LogAuditListResponse">LogAuditListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
135135

136136
# OriginCACertificates
137137

@@ -2419,7 +2419,7 @@ Response Types:
24192419

24202420
Methods:
24212421

2422-
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys">client.KV.Namespaces.Keys.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, namespaceID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyListParams">NamespaceKeyListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination#CursorLimitPagination">CursorLimitPagination</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#Key">Key</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2422+
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys">client.KV.Namespaces.Keys.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, namespaceID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyListParams">NamespaceKeyListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination#CursorPaginationAfter">CursorPaginationAfter</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#Key">Key</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
24232423
- <code title="post /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete">client.KV.Namespaces.Keys.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyService.BulkDelete">BulkDelete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, namespaceID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyBulkDeleteParams">NamespaceKeyBulkDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyBulkDeleteResponse">NamespaceKeyBulkDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
24242424
- <code title="post /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get">client.KV.Namespaces.Keys.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyService.BulkGet">BulkGet</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, namespaceID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyBulkGetParams">NamespaceKeyBulkGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyBulkGetResponse">NamespaceKeyBulkGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
24252425
- <code title="put /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk">client.KV.Namespaces.Keys.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyService.BulkUpdate">BulkUpdate</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, namespaceID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyBulkUpdateParams">NamespaceKeyBulkUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/kv#NamespaceKeyBulkUpdateResponse">NamespaceKeyBulkUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
@@ -2467,7 +2467,7 @@ Response Types:
24672467

24682468
Methods:
24692469

2470-
- <code title="get /accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects">client.DurableObjects.Namespaces.Objects.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects#NamespaceObjectService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects">durable_objects</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects#NamespaceObjectListParams">NamespaceObjectListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination#CursorLimitPagination">CursorLimitPagination</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects">durable_objects</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects#DurableObject">DurableObject</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2470+
- <code title="get /accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects">client.DurableObjects.Namespaces.Objects.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects#NamespaceObjectService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects">durable_objects</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects#NamespaceObjectListParams">NamespaceObjectListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/packages/pagination#CursorPaginationAfter">CursorPaginationAfter</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects">durable_objects</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/durable_objects#DurableObject">DurableObject</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
24712471

24722472
# Queues
24732473

durable_objects/namespaceobject.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewNamespaceObjectService(opts ...option.RequestOption) (r *NamespaceObject
3737
}
3838

3939
// Returns the Durable Objects in a given namespace.
40-
func (r *NamespaceObjectService) List(ctx context.Context, id string, params NamespaceObjectListParams, opts ...option.RequestOption) (res *pagination.CursorLimitPagination[DurableObject], err error) {
40+
func (r *NamespaceObjectService) List(ctx context.Context, id string, params NamespaceObjectListParams, opts ...option.RequestOption) (res *pagination.CursorPaginationAfter[DurableObject], err error) {
4141
var raw *http.Response
4242
opts = append(r.Options[:], opts...)
4343
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -63,8 +63,8 @@ func (r *NamespaceObjectService) List(ctx context.Context, id string, params Nam
6363
}
6464

6565
// Returns the Durable Objects in a given namespace.
66-
func (r *NamespaceObjectService) ListAutoPaging(ctx context.Context, id string, params NamespaceObjectListParams, opts ...option.RequestOption) *pagination.CursorLimitPaginationAutoPager[DurableObject] {
67-
return pagination.NewCursorLimitPaginationAutoPager(r.List(ctx, id, params, opts...))
66+
func (r *NamespaceObjectService) ListAutoPaging(ctx context.Context, id string, params NamespaceObjectListParams, opts ...option.RequestOption) *pagination.CursorPaginationAfterAutoPager[DurableObject] {
67+
return pagination.NewCursorPaginationAfterAutoPager(r.List(ctx, id, params, opts...))
6868
}
6969

7070
type DurableObject struct {

kv/namespacekey.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func NewNamespaceKeyService(opts ...option.RequestOption) (r *NamespaceKeyServic
4040
}
4141

4242
// Lists a namespace's keys.
43-
func (r *NamespaceKeyService) List(ctx context.Context, namespaceID string, params NamespaceKeyListParams, opts ...option.RequestOption) (res *pagination.CursorLimitPagination[Key], err error) {
43+
func (r *NamespaceKeyService) List(ctx context.Context, namespaceID string, params NamespaceKeyListParams, opts ...option.RequestOption) (res *pagination.CursorPaginationAfter[Key], err error) {
4444
var raw *http.Response
4545
opts = append(r.Options[:], opts...)
4646
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -66,8 +66,8 @@ func (r *NamespaceKeyService) List(ctx context.Context, namespaceID string, para
6666
}
6767

6868
// Lists a namespace's keys.
69-
func (r *NamespaceKeyService) ListAutoPaging(ctx context.Context, namespaceID string, params NamespaceKeyListParams, opts ...option.RequestOption) *pagination.CursorLimitPaginationAutoPager[Key] {
70-
return pagination.NewCursorLimitPaginationAutoPager(r.List(ctx, namespaceID, params, opts...))
69+
func (r *NamespaceKeyService) ListAutoPaging(ctx context.Context, namespaceID string, params NamespaceKeyListParams, opts ...option.RequestOption) *pagination.CursorPaginationAfterAutoPager[Key] {
70+
return pagination.NewCursorPaginationAfterAutoPager(r.List(ctx, namespaceID, params, opts...))
7171
}
7272

7373
// Remove multiple KV pairs from the namespace. Body should be an array of up to

packages/pagination/pagination.go

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,152 @@ func (r *CursorPaginationAutoPager[T]) Index() int {
417417
return r.run
418418
}
419419

420+
type CursorPaginationAfterResultInfo struct {
421+
Cursors CursorPaginationAfterResultInfoCursors `json:"cursors"`
422+
JSON cursorPaginationAfterResultInfoJSON `json:"-"`
423+
}
424+
425+
// cursorPaginationAfterResultInfoJSON contains the JSON metadata for the struct
426+
// [CursorPaginationAfterResultInfo]
427+
type cursorPaginationAfterResultInfoJSON struct {
428+
Cursors apijson.Field
429+
raw string
430+
ExtraFields map[string]apijson.Field
431+
}
432+
433+
func (r *CursorPaginationAfterResultInfo) UnmarshalJSON(data []byte) (err error) {
434+
return apijson.UnmarshalRoot(data, r)
435+
}
436+
437+
func (r cursorPaginationAfterResultInfoJSON) RawJSON() string {
438+
return r.raw
439+
}
440+
441+
type CursorPaginationAfterResultInfoCursors struct {
442+
After string `json:"after"`
443+
JSON cursorPaginationAfterResultInfoCursorsJSON `json:"-"`
444+
}
445+
446+
// cursorPaginationAfterResultInfoCursorsJSON contains the JSON metadata for the
447+
// struct [CursorPaginationAfterResultInfoCursors]
448+
type cursorPaginationAfterResultInfoCursorsJSON struct {
449+
After apijson.Field
450+
raw string
451+
ExtraFields map[string]apijson.Field
452+
}
453+
454+
func (r *CursorPaginationAfterResultInfoCursors) UnmarshalJSON(data []byte) (err error) {
455+
return apijson.UnmarshalRoot(data, r)
456+
}
457+
458+
func (r cursorPaginationAfterResultInfoCursorsJSON) RawJSON() string {
459+
return r.raw
460+
}
461+
462+
type CursorPaginationAfter[T any] struct {
463+
Result []T `json:"result"`
464+
ResultInfo CursorPaginationAfterResultInfo `json:"result_info"`
465+
JSON cursorPaginationAfterJSON `json:"-"`
466+
cfg *requestconfig.RequestConfig
467+
res *http.Response
468+
}
469+
470+
// cursorPaginationAfterJSON contains the JSON metadata for the struct
471+
// [CursorPaginationAfter[T]]
472+
type cursorPaginationAfterJSON struct {
473+
Result apijson.Field
474+
ResultInfo apijson.Field
475+
raw string
476+
ExtraFields map[string]apijson.Field
477+
}
478+
479+
func (r *CursorPaginationAfter[T]) UnmarshalJSON(data []byte) (err error) {
480+
return apijson.UnmarshalRoot(data, r)
481+
}
482+
483+
func (r cursorPaginationAfterJSON) RawJSON() string {
484+
return r.raw
485+
}
486+
487+
// GetNextPage returns the next page as defined by this pagination style. When
488+
// there is no next page, this function will return a 'nil' for the page value, but
489+
// will not return an error
490+
func (r *CursorPaginationAfter[T]) GetNextPage() (res *CursorPaginationAfter[T], err error) {
491+
if len(r.Result) == 0 {
492+
return nil, nil
493+
}
494+
next := r.ResultInfo.Cursors.After
495+
if len(next) == 0 {
496+
return nil, nil
497+
}
498+
cfg := r.cfg.Clone(r.cfg.Context)
499+
err = cfg.Apply(option.WithQuery("cursor", next))
500+
if err != nil {
501+
return nil, err
502+
}
503+
var raw *http.Response
504+
cfg.ResponseInto = &raw
505+
cfg.ResponseBodyInto = &res
506+
err = cfg.Execute()
507+
if err != nil {
508+
return nil, err
509+
}
510+
res.SetPageConfig(cfg, raw)
511+
return res, nil
512+
}
513+
514+
func (r *CursorPaginationAfter[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
515+
if r == nil {
516+
r = &CursorPaginationAfter[T]{}
517+
}
518+
r.cfg = cfg
519+
r.res = res
520+
}
521+
522+
type CursorPaginationAfterAutoPager[T any] struct {
523+
page *CursorPaginationAfter[T]
524+
cur T
525+
idx int
526+
run int
527+
err error
528+
}
529+
530+
func NewCursorPaginationAfterAutoPager[T any](page *CursorPaginationAfter[T], err error) *CursorPaginationAfterAutoPager[T] {
531+
return &CursorPaginationAfterAutoPager[T]{
532+
page: page,
533+
err: err,
534+
}
535+
}
536+
537+
func (r *CursorPaginationAfterAutoPager[T]) Next() bool {
538+
if r.page == nil || len(r.page.Result) == 0 {
539+
return false
540+
}
541+
if r.idx >= len(r.page.Result) {
542+
r.idx = 0
543+
r.page, r.err = r.page.GetNextPage()
544+
if r.err != nil || r.page == nil || len(r.page.Result) == 0 {
545+
return false
546+
}
547+
}
548+
r.cur = r.page.Result[r.idx]
549+
r.run += 1
550+
r.idx += 1
551+
return true
552+
}
553+
554+
func (r *CursorPaginationAfterAutoPager[T]) Current() T {
555+
return r.cur
556+
}
557+
558+
func (r *CursorPaginationAfterAutoPager[T]) Err() error {
559+
return r.err
560+
}
561+
562+
func (r *CursorPaginationAfterAutoPager[T]) Index() int {
563+
return r.run
564+
}
565+
420566
type CursorLimitPaginationResultInfo struct {
421567
Count int64 `json:"count"`
422568
Cursor string `json:"cursor"`

0 commit comments

Comments
 (0)