🌐 AI搜索 & 代理 主页
Skip to content

Commit f25f70f

Browse files
stainless-app[bot]meorphis
authored andcommitted
feat(kv)!: move analytics under existing namespace (#2212)
1 parent 0e7c5d2 commit f25f70f

File tree

9 files changed

+39
-57
lines changed

9 files changed

+39
-57
lines changed

api.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,18 @@ Methods:
22022202
- <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>
22032203
- <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>
22042204

2205+
### Analytics
2206+
2207+
Types:
2208+
2209+
- <code><a href="./src/resources/kv/namespaces/analytics.ts">Components</a></code>
2210+
- <code><a href="./src/resources/kv/namespaces/analytics.ts">Schema</a></code>
2211+
2212+
Methods:
2213+
2214+
- <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>
2215+
- <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>
2216+
22052217
### Keys
22062218

22072219
Types:
@@ -3645,20 +3657,6 @@ Methods:
36453657
- <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>
36463658
- <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>
36473659

3648-
# Storage
3649-
3650-
## Analytics
3651-
3652-
Types:
3653-
3654-
- <code><a href="./src/resources/storage/analytics.ts">Components</a></code>
3655-
- <code><a href="./src/resources/storage/analytics.ts">Schema</a></code>
3656-
3657-
Methods:
3658-
3659-
- <code title="get /accounts/{account_id}/storage/analytics">client.storage.analytics.<a href="./src/resources/storage/analytics.ts">list</a>({ ...params }) -> Schema</code>
3660-
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.storage.analytics.<a href="./src/resources/storage/analytics.ts">stored</a>({ ...params }) -> Components</code>
3661-
36623660
# Stream
36633661

36643662
Types:

src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ import { Snippets } from './resources/snippets/snippets';
9595
import { Spectrum } from './resources/spectrum/spectrum';
9696
import { Speed } from './resources/speed/speed';
9797
import { SSL } from './resources/ssl/ssl';
98-
import { Storage } from './resources/storage/storage';
9998
import { Stream } from './resources/stream/stream';
10099
import { Turnstile } from './resources/turnstile/turnstile';
101100
import { URLScanner } from './resources/url-scanner/url-scanner';
@@ -301,7 +300,6 @@ export class Cloudflare extends Core.APIClient {
301300
registrar: API.Registrar = new API.Registrar(this);
302301
requestTracers: API.RequestTracers = new API.RequestTracers(this);
303302
rules: API.Rules = new API.Rules(this);
304-
storage: API.Storage = new API.Storage(this);
305303
stream: API.Stream = new API.Stream(this);
306304
alerting: API.Alerting = new API.Alerting(this);
307305
d1: API.D1Resource = new API.D1Resource(this);
@@ -511,7 +509,6 @@ Cloudflare.Pages = Pages;
511509
Cloudflare.Registrar = Registrar;
512510
Cloudflare.RequestTracers = RequestTracers;
513511
Cloudflare.Rules = Rules;
514-
Cloudflare.Storage = Storage;
515512
Cloudflare.Stream = Stream;
516513
Cloudflare.Alerting = Alerting;
517514
Cloudflare.D1Resource = D1Resource;
@@ -680,8 +677,6 @@ export declare namespace Cloudflare {
680677

681678
export { Rules as Rules };
682679

683-
export { Storage as Storage };
684-
685680
export { Stream as Stream };
686681

687682
export { Alerting as Alerting };

src/resources/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export { SecurityTXT } from './security-txt';
7676
export { Snippets } from './snippets/snippets';
7777
export { Spectrum } from './spectrum/spectrum';
7878
export { Speed } from './speed/speed';
79-
export { Storage } from './storage/storage';
8079
export { Stream } from './stream/stream';
8180
export { Turnstile } from './turnstile/turnstile';
8281
export { URLNormalization } from './url-normalization';
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import { APIResource } from '../../resource';
4-
import * as Core from '../../core';
3+
import { APIResource } from '../../../resource';
4+
import * as Core from '../../../core';
55

66
export class Analytics extends APIResource {
77
/**

src/resources/kv/namespaces/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
export {
4+
Analytics,
5+
type Components,
6+
type Schema,
7+
type AnalyticsListParams,
8+
type AnalyticsStoredParams,
9+
} from './analytics';
310
export { KeysCursorLimitPagination, Keys, type Key, type KeyListParams } from './keys';
411
export { Metadata, type MetadataGetResponse, type MetadataGetParams } from './metadata';
512
export {

src/resources/kv/namespaces/namespaces.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

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

2022
export class Namespaces extends APIResource {
23+
analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client);
2124
keys: KeysAPI.Keys = new KeysAPI.Keys(this._client);
2225
metadata: MetadataAPI.Metadata = new MetadataAPI.Metadata(this._client);
2326
values: ValuesAPI.Values = new ValuesAPI.Values(this._client);
@@ -311,6 +314,7 @@ export interface NamespaceGetParams {
311314
}
312315

313316
Namespaces.NamespacesV4PagePaginationArray = NamespacesV4PagePaginationArray;
317+
Namespaces.Analytics = Analytics;
314318
Namespaces.Keys = Keys;
315319
Namespaces.KeysCursorLimitPagination = KeysCursorLimitPagination;
316320
Namespaces.Metadata = Metadata;
@@ -333,6 +337,14 @@ export declare namespace Namespaces {
333337
type NamespaceGetParams as NamespaceGetParams,
334338
};
335339

340+
export {
341+
Analytics as Analytics,
342+
type Components as Components,
343+
type Schema as Schema,
344+
type AnalyticsListParams as AnalyticsListParams,
345+
type AnalyticsStoredParams as AnalyticsStoredParams,
346+
};
347+
336348
export {
337349
Keys as Keys,
338350
type Key as Key,

src/resources/storage/index.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/resources/storage/storage.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/api-resources/storage/analytics.test.ts renamed to tests/api-resources/kv/namespaces/analytics.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const client = new Cloudflare({
1111

1212
describe('resource analytics', () => {
1313
test('list: only required params', async () => {
14-
const responsePromise = client.storage.analytics.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });
14+
const responsePromise = client.kv.namespaces.analytics.list({
15+
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
16+
});
1517
const rawResponse = await responsePromise.asResponse();
1618
expect(rawResponse).toBeInstanceOf(Response);
1719
const response = await responsePromise;
@@ -22,7 +24,7 @@ describe('resource analytics', () => {
2224
});
2325

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

3941
test('stored: only required params', async () => {
40-
const responsePromise = client.storage.analytics.stored({
42+
const responsePromise = client.kv.namespaces.analytics.stored({
4143
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
4244
});
4345
const rawResponse = await responsePromise.asResponse();
@@ -50,7 +52,7 @@ describe('resource analytics', () => {
5052
});
5153

5254
test('stored: required and optional params', async () => {
53-
const response = await client.storage.analytics.stored({
55+
const response = await client.kv.namespaces.analytics.stored({
5456
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
5557
query: {
5658
dimensions: ['namespaceId'],

0 commit comments

Comments
 (0)