Skip to content

Commit

Permalink
feat(kv)!: move analytics under existing namespace (#3696)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Dec 4, 2024
1 parent 3d87e0b commit 28dc3f7
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 527 deletions.
26 changes: 12 additions & 14 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,18 @@ Methods:
- <code title="put /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk">client.KV.Namespaces.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceService.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/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceBulkUpdateParams">NamespaceBulkUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceBulkUpdateResponse">NamespaceBulkUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}">client.KV.Namespaces.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceService.Get">Get</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>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceGetParams">NamespaceGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#Namespace">Namespace</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### Analytics

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#Components">Components</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#Schema">Schema</a>

Methods:

- <code title="get /accounts/{account_id}/storage/analytics">client.KV.Namespaces.Analytics.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceAnalyticsService.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/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceAnalyticsListParams">NamespaceAnalyticsListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#Schema">Schema</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.KV.Namespaces.Analytics.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceAnalyticsService.Stored">Stored</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/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#NamespaceAnalyticsStoredParams">NamespaceAnalyticsStoredParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv">kv</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/kv#Components">Components</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### Keys

Response Types:
Expand Down Expand Up @@ -3912,20 +3924,6 @@ Methods:
- <code title="delete /accounts/{account_id}/rules/lists/{list_id}/items">client.Rules.Lists.Items.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules#ListItemService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, listID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules">rules</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules#ListItemDeleteParams">ListItemDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules">rules</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules#ListItemDeleteResponse">ListItemDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}">client.Rules.Lists.Items.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules#ListItemService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, listID <a href="https://pkg.go.dev/builtin#string">string</a>, itemID <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules">rules</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/rules#ListItemGetResponseUnion">ListItemGetResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Storage

## Analytics

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage">storage</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#Components">Components</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage">storage</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#Schema">Schema</a>

Methods:

- <code title="get /accounts/{account_id}/storage/analytics">client.Storage.Analytics.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#AnalyticsService.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/v3/storage">storage</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#AnalyticsListParams">AnalyticsListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage">storage</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#Schema">Schema</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.Storage.Analytics.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#AnalyticsService.Stored">Stored</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/v3/storage">storage</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#AnalyticsStoredParams">AnalyticsStoredParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage">storage</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/storage#Components">Components</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Stream

Params Types:
Expand Down
3 changes: 0 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import (
"github.com/cloudflare/cloudflare-go/v3/spectrum"
"github.com/cloudflare/cloudflare-go/v3/speed"
"github.com/cloudflare/cloudflare-go/v3/ssl"
"github.com/cloudflare/cloudflare-go/v3/storage"
"github.com/cloudflare/cloudflare-go/v3/stream"
"github.com/cloudflare/cloudflare-go/v3/turnstile"
"github.com/cloudflare/cloudflare-go/v3/url_normalization"
Expand Down Expand Up @@ -154,7 +153,6 @@ type Client struct {
Registrar *registrar.RegistrarService
RequestTracers *request_tracers.RequestTracerService
Rules *rules.RuleService
Storage *storage.StorageService
Stream *stream.StreamService
Alerting *alerting.AlertingService
D1 *d1.D1Service
Expand Down Expand Up @@ -263,7 +261,6 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
r.Registrar = registrar.NewRegistrarService(opts...)
r.RequestTracers = request_tracers.NewRequestTracerService(opts...)
r.Rules = rules.NewRuleService(opts...)
r.Storage = storage.NewStorageService(opts...)
r.Stream = stream.NewStreamService(opts...)
r.Alerting = alerting.NewAlertingService(opts...)
r.D1 = d1.NewD1Service(opts...)
Expand Down
10 changes: 6 additions & 4 deletions kv/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewNamespaceService] method instead.
type NamespaceService struct {
Options []option.RequestOption
Keys *NamespaceKeyService
Metadata *NamespaceMetadataService
Values *NamespaceValueService
Options []option.RequestOption
Analytics *NamespaceAnalyticsService
Keys *NamespaceKeyService
Metadata *NamespaceMetadataService
Values *NamespaceValueService
}

// NewNamespaceService generates a new service that applies the given options to
Expand All @@ -37,6 +38,7 @@ type NamespaceService struct {
func NewNamespaceService(opts ...option.RequestOption) (r *NamespaceService) {
r = &NamespaceService{}
r.Options = opts
r.Analytics = NewNamespaceAnalyticsService(opts...)
r.Keys = NewNamespaceKeyService(opts...)
r.Metadata = NewNamespaceMetadataService(opts...)
r.Values = NewNamespaceValueService(opts...)
Expand Down
Loading

0 comments on commit 28dc3f7

Please sign in to comment.