Skip to content

Commit

Permalink
feat(kv)!: move analytics under existing namespace (#2212)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Dec 4, 2024
1 parent 71f387c commit 4f5b6c9
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 57 deletions.
26 changes: 12 additions & 14 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,18 @@ Methods:
- <code title="put /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk">client.kv.namespaces.<a href="./src/resources/kv/namespaces/namespaces.ts">bulkUpdate</a>(namespaceId, [ ...body ]) -> NamespaceBulkUpdateResponse | null</code>
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}">client.kv.namespaces.<a href="./src/resources/kv/namespaces/namespaces.ts">get</a>(namespaceId, { ...params }) -> Namespace</code>

### Analytics

Types:

- <code><a href="./src/resources/kv/namespaces/analytics.ts">Components</a></code>
- <code><a href="./src/resources/kv/namespaces/analytics.ts">Schema</a></code>

Methods:

- <code title="get /accounts/{account_id}/storage/analytics">client.kv.namespaces.analytics.<a href="./src/resources/kv/namespaces/analytics.ts">list</a>({ ...params }) -> Schema</code>
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.kv.namespaces.analytics.<a href="./src/resources/kv/namespaces/analytics.ts">stored</a>({ ...params }) -> Components</code>

### Keys

Types:
Expand Down Expand Up @@ -3645,20 +3657,6 @@ Methods:
- <code title="delete /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/resources/rules/lists/items.ts">delete</a>(listId, { ...params }) -> ItemDeleteResponse</code>
- <code title="get /accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}">client.rules.lists.items.<a href="./src/resources/rules/lists/items.ts">get</a>(accountIdentifier, listId, itemId) -> ItemGetResponse</code>

# Storage

## Analytics

Types:

- <code><a href="./src/resources/storage/analytics.ts">Components</a></code>
- <code><a href="./src/resources/storage/analytics.ts">Schema</a></code>

Methods:

- <code title="get /accounts/{account_id}/storage/analytics">client.storage.analytics.<a href="./src/resources/storage/analytics.ts">list</a>({ ...params }) -> Schema</code>
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.storage.analytics.<a href="./src/resources/storage/analytics.ts">stored</a>({ ...params }) -> Components</code>

# Stream

Types:
Expand Down
5 changes: 0 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ import { Snippets } from './resources/snippets/snippets';
import { Spectrum } from './resources/spectrum/spectrum';
import { Speed } from './resources/speed/speed';
import { SSL } from './resources/ssl/ssl';
import { Storage } from './resources/storage/storage';
import { Stream } from './resources/stream/stream';
import { Turnstile } from './resources/turnstile/turnstile';
import { URLScanner } from './resources/url-scanner/url-scanner';
Expand Down Expand Up @@ -301,7 +300,6 @@ export class Cloudflare extends Core.APIClient {
registrar: API.Registrar = new API.Registrar(this);
requestTracers: API.RequestTracers = new API.RequestTracers(this);
rules: API.Rules = new API.Rules(this);
storage: API.Storage = new API.Storage(this);
stream: API.Stream = new API.Stream(this);
alerting: API.Alerting = new API.Alerting(this);
d1: API.D1Resource = new API.D1Resource(this);
Expand Down Expand Up @@ -511,7 +509,6 @@ Cloudflare.Pages = Pages;
Cloudflare.Registrar = Registrar;
Cloudflare.RequestTracers = RequestTracers;
Cloudflare.Rules = Rules;
Cloudflare.Storage = Storage;
Cloudflare.Stream = Stream;
Cloudflare.Alerting = Alerting;
Cloudflare.D1Resource = D1Resource;
Expand Down Expand Up @@ -680,8 +677,6 @@ export declare namespace Cloudflare {

export { Rules as Rules };

export { Storage as Storage };

export { Stream as Stream };

export { Alerting as Alerting };
Expand Down
1 change: 0 additions & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export { SecurityTXT } from './security-txt';
export { Snippets } from './snippets/snippets';
export { Spectrum } from './spectrum/spectrum';
export { Speed } from './speed/speed';
export { Storage } from './storage/storage';
export { Stream } from './stream/stream';
export { Turnstile } from './turnstile/turnstile';
export { URLNormalization } from './url-normalization';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';
import { APIResource } from '../../../resource';
import * as Core from '../../../core';

export class Analytics extends APIResource {
/**
Expand Down
7 changes: 7 additions & 0 deletions src/resources/kv/namespaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
Analytics,
type Components,
type Schema,
type AnalyticsListParams,
type AnalyticsStoredParams,
} from './analytics';
export { KeysCursorLimitPagination, Keys, type Key, type KeyListParams } from './keys';
export { Metadata, type MetadataGetResponse, type MetadataGetParams } from './metadata';
export {
Expand Down
12 changes: 12 additions & 0 deletions src/resources/kv/namespaces/namespaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import { APIResource } from '../../../resource';
import * as Core from '../../../core';
import * as AnalyticsAPI from './analytics';
import { Analytics, AnalyticsListParams, AnalyticsStoredParams, Components, Schema } from './analytics';
import * as KeysAPI from './keys';
import { Key, KeyListParams, Keys, KeysCursorLimitPagination } from './keys';
import * as MetadataAPI from './metadata';
Expand All @@ -18,6 +20,7 @@ import {
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination';

export class Namespaces extends APIResource {
analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client);
keys: KeysAPI.Keys = new KeysAPI.Keys(this._client);
metadata: MetadataAPI.Metadata = new MetadataAPI.Metadata(this._client);
values: ValuesAPI.Values = new ValuesAPI.Values(this._client);
Expand Down Expand Up @@ -311,6 +314,7 @@ export interface NamespaceGetParams {
}

Namespaces.NamespacesV4PagePaginationArray = NamespacesV4PagePaginationArray;
Namespaces.Analytics = Analytics;
Namespaces.Keys = Keys;
Namespaces.KeysCursorLimitPagination = KeysCursorLimitPagination;
Namespaces.Metadata = Metadata;
Expand All @@ -333,6 +337,14 @@ export declare namespace Namespaces {
type NamespaceGetParams as NamespaceGetParams,
};

export {
Analytics as Analytics,
type Components as Components,
type Schema as Schema,
type AnalyticsListParams as AnalyticsListParams,
type AnalyticsStoredParams as AnalyticsStoredParams,
};

export {
Keys as Keys,
type Key as Key,
Expand Down
10 changes: 0 additions & 10 deletions src/resources/storage/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/resources/storage/storage.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const client = new Cloudflare({

describe('resource analytics', () => {
test('list: only required params', async () => {
const responsePromise = client.storage.analytics.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });
const responsePromise = client.kv.namespaces.analytics.list({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -22,7 +24,7 @@ describe('resource analytics', () => {
});

test('list: required and optional params', async () => {
const response = await client.storage.analytics.list({
const response = await client.kv.namespaces.analytics.list({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
query: {
dimensions: ['accountId'],
Expand All @@ -37,7 +39,7 @@ describe('resource analytics', () => {
});

test('stored: only required params', async () => {
const responsePromise = client.storage.analytics.stored({
const responsePromise = client.kv.namespaces.analytics.stored({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});
const rawResponse = await responsePromise.asResponse();
Expand All @@ -50,7 +52,7 @@ describe('resource analytics', () => {
});

test('stored: required and optional params', async () => {
const response = await client.storage.analytics.stored({
const response = await client.kv.namespaces.analytics.stored({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
query: {
dimensions: ['namespaceId'],
Expand Down

0 comments on commit 4f5b6c9

Please sign in to comment.