Skip to content

Commit db79b6e

Browse files
feat(api): api update
1 parent 1efe99b commit db79b6e

File tree

13 files changed

+129
-40
lines changed

13 files changed

+129
-40
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 1782
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d2a66f62f007704db30b02dc6072a9c9a3363f229521fd5c8d1db94cdaddf682.yml
3-
openapi_spec_hash: 5439122fed13eb566c770576999e67fb
4-
config_hash: eda5b3d9487ce675d1fadf88153b457d
1+
configured_endpoints: 1783
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e408a7cdec2dae3d1a18842dcc59280c56050fb042569139aec3fe0f12e0d461.yml
3+
openapi_spec_hash: 7e210c76f5dd4c79b3e67204ad279b81
4+
config_hash: 9ecbb4ede8ef69ecffaf8e504d2cb25d

api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,7 +2297,7 @@ Types:
22972297

22982298
Methods:
22992299

2300-
- <code title="get /accounts/{account_id}/workers/durable_objects/namespaces">client.durableObjects.namespaces.<a href="./src/resources/durable-objects/namespaces/namespaces.ts">list</a>({ ...params }) -> NamespacesSinglePage</code>
2300+
- <code title="get /accounts/{account_id}/workers/durable_objects/namespaces">client.durableObjects.namespaces.<a href="./src/resources/durable-objects/namespaces/namespaces.ts">list</a>({ ...params }) -> NamespacesV4PagePaginationArray</code>
23012301

23022302
### Objects
23032303

@@ -2336,8 +2336,9 @@ Methods:
23362336

23372337
- <code title="post /accounts/{account_id}/queues/{queue_id}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">create</a>(queueId, { ...params }) -> Consumer</code>
23382338
- <code title="put /accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">update</a>(queueId, consumerId, { ...params }) -> Consumer</code>
2339+
- <code title="get /accounts/{account_id}/queues/{queue_id}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">list</a>(queueId, { ...params }) -> ConsumersSinglePage</code>
23392340
- <code title="delete /accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">delete</a>(queueId, consumerId, { ...params }) -> ConsumerDeleteResponse</code>
2340-
- <code title="get /accounts/{account_id}/queues/{queue_id}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">get</a>(queueId, { ...params }) -> ConsumersSinglePage</code>
2341+
- <code title="get /accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">get</a>(queueId, consumerId, { ...params }) -> Consumer</code>
23412342

23422343
## Messages
23432344

src/resources/durable-objects/durable-objects.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22

33
import { APIResource } from '../../resource';
44
import * as NamespacesAPI from './namespaces/namespaces';
5-
import { Namespace, NamespaceListParams, Namespaces, NamespacesSinglePage } from './namespaces/namespaces';
5+
import {
6+
Namespace,
7+
NamespaceListParams,
8+
Namespaces,
9+
NamespacesV4PagePaginationArray,
10+
} from './namespaces/namespaces';
611

712
export class DurableObjects extends APIResource {
813
namespaces: NamespacesAPI.Namespaces = new NamespacesAPI.Namespaces(this._client);
914
}
1015

1116
DurableObjects.Namespaces = Namespaces;
12-
DurableObjects.NamespacesSinglePage = NamespacesSinglePage;
17+
DurableObjects.NamespacesV4PagePaginationArray = NamespacesV4PagePaginationArray;
1318

1419
export declare namespace DurableObjects {
1520
export {
1621
Namespaces as Namespaces,
1722
type Namespace as Namespace,
18-
NamespacesSinglePage as NamespacesSinglePage,
23+
NamespacesV4PagePaginationArray as NamespacesV4PagePaginationArray,
1924
type NamespaceListParams as NamespaceListParams,
2025
};
2126
}

src/resources/durable-objects/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export { DurableObjects } from './durable-objects';
44
export {
5-
NamespacesSinglePage,
5+
NamespacesV4PagePaginationArray,
66
Namespaces,
77
type Namespace,
88
type NamespaceListParams,

src/resources/durable-objects/namespaces/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ export {
66
type DurableObject,
77
type ObjectListParams,
88
} from './objects';
9-
export { NamespacesSinglePage, Namespaces, type Namespace, type NamespaceListParams } from './namespaces';
9+
export {
10+
NamespacesV4PagePaginationArray,
11+
Namespaces,
12+
type Namespace,
13+
type NamespaceListParams,
14+
} from './namespaces';

src/resources/durable-objects/namespaces/namespaces.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { APIResource } from '../../../resource';
44
import * as Core from '../../../core';
55
import * as ObjectsAPI from './objects';
66
import { DurableObject, DurableObjectsCursorLimitPagination, ObjectListParams, Objects } from './objects';
7-
import { SinglePage } from '../../../pagination';
7+
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination';
88

99
export class Namespaces extends APIResource {
1010
objects: ObjectsAPI.Objects = new ObjectsAPI.Objects(this._client);
@@ -15,17 +15,17 @@ export class Namespaces extends APIResource {
1515
list(
1616
params: NamespaceListParams,
1717
options?: Core.RequestOptions,
18-
): Core.PagePromise<NamespacesSinglePage, Namespace> {
19-
const { account_id } = params;
18+
): Core.PagePromise<NamespacesV4PagePaginationArray, Namespace> {
19+
const { account_id, ...query } = params;
2020
return this._client.getAPIList(
2121
`/accounts/${account_id}/workers/durable_objects/namespaces`,
22-
NamespacesSinglePage,
23-
options,
22+
NamespacesV4PagePaginationArray,
23+
{ query, ...options },
2424
);
2525
}
2626
}
2727

28-
export class NamespacesSinglePage extends SinglePage<Namespace> {}
28+
export class NamespacesV4PagePaginationArray extends V4PagePaginationArray<Namespace> {}
2929

3030
export interface Namespace {
3131
id?: string;
@@ -39,21 +39,21 @@ export interface Namespace {
3939
use_sqlite?: boolean;
4040
}
4141

42-
export interface NamespaceListParams {
42+
export interface NamespaceListParams extends V4PagePaginationArrayParams {
4343
/**
44-
* Identifier.
44+
* Path param: Identifier.
4545
*/
4646
account_id: string;
4747
}
4848

49-
Namespaces.NamespacesSinglePage = NamespacesSinglePage;
49+
Namespaces.NamespacesV4PagePaginationArray = NamespacesV4PagePaginationArray;
5050
Namespaces.Objects = Objects;
5151
Namespaces.DurableObjectsCursorLimitPagination = DurableObjectsCursorLimitPagination;
5252

5353
export declare namespace Namespaces {
5454
export {
5555
type Namespace as Namespace,
56-
NamespacesSinglePage as NamespacesSinglePage,
56+
NamespacesV4PagePaginationArray as NamespacesV4PagePaginationArray,
5757
type NamespaceListParams as NamespaceListParams,
5858
};
5959

src/resources/queues/consumers.ts

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,33 @@ export class Consumers extends APIResource {
5858
)._thenUnwrap((obj) => obj.result);
5959
}
6060

61+
/**
62+
* Returns the consumers for a Queue
63+
*
64+
* @example
65+
* ```ts
66+
* // Automatically fetches more pages as needed.
67+
* for await (const consumer of client.queues.consumers.list(
68+
* '023e105f4ecef8ad9ca31a8372d0c353',
69+
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
70+
* )) {
71+
* // ...
72+
* }
73+
* ```
74+
*/
75+
list(
76+
queueId: string,
77+
params: ConsumerListParams,
78+
options?: Core.RequestOptions,
79+
): Core.PagePromise<ConsumersSinglePage, Consumer> {
80+
const { account_id } = params;
81+
return this._client.getAPIList(
82+
`/accounts/${account_id}/queues/${queueId}/consumers`,
83+
ConsumersSinglePage,
84+
options,
85+
);
86+
}
87+
6188
/**
6289
* Deletes the consumer for a queue.
6390
*
@@ -81,30 +108,30 @@ export class Consumers extends APIResource {
81108
}
82109

83110
/**
84-
* Returns the consumers for a Queue
111+
* Fetches the consumer for a queue by consumer id
85112
*
86113
* @example
87114
* ```ts
88-
* // Automatically fetches more pages as needed.
89-
* for await (const consumer of client.queues.consumers.get(
115+
* const consumer = await client.queues.consumers.get(
116+
* '023e105f4ecef8ad9ca31a8372d0c353',
90117
* '023e105f4ecef8ad9ca31a8372d0c353',
91118
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
92-
* )) {
93-
* // ...
94-
* }
119+
* );
95120
* ```
96121
*/
97122
get(
98123
queueId: string,
124+
consumerId: string,
99125
params: ConsumerGetParams,
100126
options?: Core.RequestOptions,
101-
): Core.PagePromise<ConsumersSinglePage, Consumer> {
127+
): Core.APIPromise<Consumer> {
102128
const { account_id } = params;
103-
return this._client.getAPIList(
104-
`/accounts/${account_id}/queues/${queueId}/consumers`,
105-
ConsumersSinglePage,
106-
options,
107-
);
129+
return (
130+
this._client.get(
131+
`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`,
132+
options,
133+
) as Core.APIPromise<{ result: Consumer }>
134+
)._thenUnwrap((obj) => obj.result);
108135
}
109136
}
110137

@@ -450,6 +477,13 @@ export declare namespace ConsumerUpdateParams {
450477
}
451478
}
452479

480+
export interface ConsumerListParams {
481+
/**
482+
* A Resource identifier.
483+
*/
484+
account_id: string;
485+
}
486+
453487
export interface ConsumerDeleteParams {
454488
/**
455489
* A Resource identifier.
@@ -473,6 +507,7 @@ export declare namespace Consumers {
473507
ConsumersSinglePage as ConsumersSinglePage,
474508
type ConsumerCreateParams as ConsumerCreateParams,
475509
type ConsumerUpdateParams as ConsumerUpdateParams,
510+
type ConsumerListParams as ConsumerListParams,
476511
type ConsumerDeleteParams as ConsumerDeleteParams,
477512
type ConsumerGetParams as ConsumerGetParams,
478513
};

src/resources/queues/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export {
77
type ConsumerDeleteResponse,
88
type ConsumerCreateParams,
99
type ConsumerUpdateParams,
10+
type ConsumerListParams,
1011
type ConsumerDeleteParams,
1112
type ConsumerGetParams,
1213
} from './consumers';

src/resources/queues/queues.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ConsumerDeleteParams,
1111
ConsumerDeleteResponse,
1212
ConsumerGetParams,
13+
ConsumerListParams,
1314
ConsumerUpdateParams,
1415
Consumers,
1516
ConsumersSinglePage,
@@ -352,6 +353,7 @@ export declare namespace Queues {
352353
ConsumersSinglePage as ConsumersSinglePage,
353354
type ConsumerCreateParams as ConsumerCreateParams,
354355
type ConsumerUpdateParams as ConsumerUpdateParams,
356+
type ConsumerListParams as ConsumerListParams,
355357
type ConsumerDeleteParams as ConsumerDeleteParams,
356358
type ConsumerGetParams as ConsumerGetParams,
357359
};

src/resources/workers/scripts/deployments.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ export namespace DeploymentCreateResponse {
155155
* Human-readable message about the deployment. Truncated to 100 bytes.
156156
*/
157157
'workers/message'?: string;
158+
159+
/**
160+
* Operation that triggered the creation of the deployment.
161+
*/
162+
'workers/triggered_by'?: string;
158163
}
159164
}
160165

@@ -191,6 +196,11 @@ export namespace DeploymentListResponse {
191196
* Human-readable message about the deployment. Truncated to 100 bytes.
192197
*/
193198
'workers/message'?: string;
199+
200+
/**
201+
* Operation that triggered the creation of the deployment.
202+
*/
203+
'workers/triggered_by'?: string;
194204
}
195205
}
196206
}
@@ -268,6 +278,11 @@ export namespace DeploymentGetResponse {
268278
* Human-readable message about the deployment. Truncated to 100 bytes.
269279
*/
270280
'workers/message'?: string;
281+
282+
/**
283+
* Operation that triggered the creation of the deployment.
284+
*/
285+
'workers/triggered_by'?: string;
271286
}
272287
}
273288

0 commit comments

Comments
 (0)