Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Mar 27, 2024
1 parent 80d2adb commit c31e0e5
Show file tree
Hide file tree
Showing 11 changed files with 531 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1290
configured_endpoints: 1292
41 changes: 29 additions & 12 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2582,33 +2582,50 @@ Types:
- <code><a href="./src/resources/queues/queues.ts">WorkersQueue</a></code>
- <code><a href="./src/resources/queues/queues.ts">WorkersQueueCreated</a></code>
- <code><a href="./src/resources/queues/queues.ts">WorkersQueueUpdated</a></code>
- <code><a href="./src/resources/queues/queues.ts">QueueCreateResponse</a></code>
- <code><a href="./src/resources/queues/queues.ts">QueueUpdateResponse</a></code>
- <code><a href="./src/resources/queues/queues.ts">QueueListResponse</a></code>
- <code><a href="./src/resources/queues/queues.ts">QueueDeleteResponse</a></code>
- <code><a href="./src/resources/queues/queues.ts">QueueGetResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/workers/queues">client.queues.<a href="./src/resources/queues/queues.ts">create</a>({ ...params }) -> WorkersQueueCreated | null</code>
- <code title="put /accounts/{account_id}/workers/queues/{name}">client.queues.<a href="./src/resources/queues/queues.ts">update</a>(name, { ...params }) -> WorkersQueueUpdated | null</code>
- <code title="get /accounts/{account_id}/workers/queues">client.queues.<a href="./src/resources/queues/queues.ts">list</a>({ ...params }) -> QueueListResponse | null</code>
- <code title="delete /accounts/{account_id}/workers/queues/{name}">client.queues.<a href="./src/resources/queues/queues.ts">delete</a>(name, { ...params }) -> QueueDeleteResponse | null</code>
- <code title="get /accounts/{account_id}/workers/queues/{name}">client.queues.<a href="./src/resources/queues/queues.ts">get</a>(name, { ...params }) -> WorkersQueue | null</code>
- <code title="post /accounts/{account_id}/queues">client.queues.<a href="./src/resources/queues/queues.ts">create</a>({ ...params }) -> QueueCreateResponse | null</code>
- <code title="put /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/resources/queues/queues.ts">update</a>(queueId, { ...params }) -> QueueUpdateResponse | null</code>
- <code title="get /accounts/{account_id}/queues">client.queues.<a href="./src/resources/queues/queues.ts">list</a>({ ...params }) -> QueueListResponse | null</code>
- <code title="delete /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/resources/queues/queues.ts">delete</a>(queueId, { ...params }) -> QueueDeleteResponse | null</code>
- <code title="get /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/resources/queues/queues.ts">get</a>(queueId, { ...params }) -> QueueGetResponse | null</code>

## Consumers

Types:

- <code><a href="./src/resources/queues/consumers.ts">WorkersConsumer</a></code>
- <code><a href="./src/resources/queues/consumers.ts">WorkersConsumerCreated</a></code>
- <code><a href="./src/resources/queues/consumers.ts">WorkersConsumerUpdated</a></code>
- <code><a href="./src/resources/queues/consumers.ts">ConsumerCreateResponse</a></code>
- <code><a href="./src/resources/queues/consumers.ts">ConsumerUpdateResponse</a></code>
- <code><a href="./src/resources/queues/consumers.ts">ConsumerDeleteResponse</a></code>
- <code><a href="./src/resources/queues/consumers.ts">ConsumerGetResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/workers/queues/{name}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">create</a>(name, { ...params }) -> WorkersConsumerCreated | null</code>
- <code title="put /accounts/{account_id}/workers/queues/{name}/consumers/{consumer_name}">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">update</a>(name, consumerName, { ...params }) -> WorkersConsumerUpdated | null</code>
- <code title="delete /accounts/{account_id}/workers/queues/{name}/consumers/{consumer_name}">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">delete</a>(name, consumerName, { ...params }) -> ConsumerDeleteResponse | null</code>
- <code title="get /accounts/{account_id}/workers/queues/{name}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">get</a>(name, { ...params }) -> ConsumerGetResponse | null</code>
- <code title="post /accounts/{account_id}/queues/{queue_id}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">create</a>(queueId, { ...params }) -> ConsumerCreateResponse | null</code>
- <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 }) -> ConsumerUpdateResponse | null</code>
- <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 | null</code>
- <code title="get /accounts/{account_id}/queues/{queue_id}/consumers">client.queues.consumers.<a href="./src/resources/queues/consumers.ts">get</a>(queueId, { ...params }) -> ConsumerGetResponse | null</code>

## Messages

Types:

- <code><a href="./src/resources/queues/messages.ts">WorkersConsumer</a></code>
- <code><a href="./src/resources/queues/messages.ts">WorkersConsumerCreated</a></code>
- <code><a href="./src/resources/queues/messages.ts">WorkersConsumerUpdated</a></code>
- <code><a href="./src/resources/queues/messages.ts">MessageAckResponse</a></code>
- <code><a href="./src/resources/queues/messages.ts">MessagePullResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/queues/{queue_id}/messages/ack">client.queues.messages.<a href="./src/resources/queues/messages.ts">ack</a>(queueId, { ...params }) -> MessageAckResponse | null</code>
- <code title="post /accounts/{account_id}/queues/{queue_id}/messages/pull">client.queues.messages.<a href="./src/resources/queues/messages.ts">pull</a>(queueId, { ...params }) -> MessagePullResponse | null</code>

# ManagedHeaders

Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,11 @@ export namespace Cloudflare {
export import WorkersQueue = API.WorkersQueue;
export import WorkersQueueCreated = API.WorkersQueueCreated;
export import WorkersQueueUpdated = API.WorkersQueueUpdated;
export import QueueCreateResponse = API.QueueCreateResponse;
export import QueueUpdateResponse = API.QueueUpdateResponse;
export import QueueListResponse = API.QueueListResponse;
export import QueueDeleteResponse = API.QueueDeleteResponse;
export import QueueGetResponse = API.QueueGetResponse;
export import QueueCreateParams = API.QueueCreateParams;
export import QueueUpdateParams = API.QueueUpdateParams;
export import QueueListParams = API.QueueListParams;
Expand Down
3 changes: 3 additions & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,11 @@ export {
WorkersQueue,
WorkersQueueCreated,
WorkersQueueUpdated,
QueueCreateResponse,
QueueUpdateResponse,
QueueListResponse,
QueueDeleteResponse,
QueueGetResponse,
QueueCreateParams,
QueueUpdateParams,
QueueListParams,
Expand Down
94 changes: 50 additions & 44 deletions src/resources/queues/consumers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,50 @@ export class Consumers extends APIResource {
* Creates a new consumer for a queue.
*/
create(
name: string,
queueId: string,
params: ConsumerCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise<WorkersConsumerCreated | null> {
): Core.APIPromise<ConsumerCreateResponse | null> {
const { account_id, body } = params;
return (
this._client.post(`/accounts/${account_id}/workers/queues/${name}/consumers`, {
this._client.post(`/accounts/${account_id}/queues/${queueId}/consumers`, {
body: body,
...options,
}) as Core.APIPromise<{ result: WorkersConsumerCreated | null }>
}) as Core.APIPromise<{ result: ConsumerCreateResponse | null }>
)._thenUnwrap((obj) => obj.result);
}

/**
* Updates the consumer for a queue, or creates one if it does not exist.
*/
update(
name: string,
consumerName: string,
queueId: string,
consumerId: string,
params: ConsumerUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<WorkersConsumerUpdated | null> {
): Core.APIPromise<ConsumerUpdateResponse | null> {
const { account_id, body } = params;
return (
this._client.put(`/accounts/${account_id}/workers/queues/${name}/consumers/${consumerName}`, {
this._client.put(`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`, {
body: body,
...options,
}) as Core.APIPromise<{ result: WorkersConsumerUpdated | null }>
}) as Core.APIPromise<{ result: ConsumerUpdateResponse | null }>
)._thenUnwrap((obj) => obj.result);
}

/**
* Deletes the consumer for a queue.
*/
delete(
name: string,
consumerName: string,
queueId: string,
consumerId: string,
params: ConsumerDeleteParams,
options?: Core.RequestOptions,
): Core.APIPromise<ConsumerDeleteResponse | null> {
const { account_id } = params;
return (
this._client.delete(
`/accounts/${account_id}/workers/queues/${name}/consumers/${consumerName}`,
`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`,
options,
) as Core.APIPromise<{ result: ConsumerDeleteResponse | null }>
)._thenUnwrap((obj) => obj.result);
Expand All @@ -62,34 +62,38 @@ export class Consumers extends APIResource {
* Returns the consumers for a queue.
*/
get(
name: string,
queueId: string,
params: ConsumerGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<ConsumerGetResponse | null> {
const { account_id } = params;
return (
this._client.get(
`/accounts/${account_id}/workers/queues/${name}/consumers`,
options,
) as Core.APIPromise<{ result: ConsumerGetResponse | null }>
this._client.get(`/accounts/${account_id}/queues/${queueId}/consumers`, options) as Core.APIPromise<{
result: ConsumerGetResponse | null;
}>
)._thenUnwrap((obj) => obj.result);
}
}

export interface WorkersConsumer {
export interface ConsumerCreateResponse {
created_on?: unknown;

dead_letter_queue?: string;

environment?: unknown;

queue_name?: unknown;

service?: unknown;
script_name?: unknown;

settings?: WorkersConsumer.Settings;
settings?: ConsumerCreateResponse.Settings;
}

export namespace WorkersConsumer {
export namespace ConsumerCreateResponse {
export interface Settings {
/**
* The maximum number of messages to include in a batch
*/
batch_size?: number;

max_retries?: number;
Expand All @@ -98,7 +102,7 @@ export namespace WorkersConsumer {
}
}

export interface WorkersConsumerCreated {
export interface ConsumerUpdateResponse {
created_on?: unknown;

dead_letter_queue?: string;
Expand All @@ -109,10 +113,10 @@ export interface WorkersConsumerCreated {

script_name?: unknown;

settings?: WorkersConsumerCreated.Settings;
settings?: ConsumerUpdateResponse.Settings;
}

export namespace WorkersConsumerCreated {
export namespace ConsumerUpdateResponse {
export interface Settings {
batch_size?: number;

Expand All @@ -122,34 +126,37 @@ export namespace WorkersConsumerCreated {
}
}

export interface WorkersConsumerUpdated {
created_on?: unknown;
export type ConsumerDeleteResponse = unknown | Array<unknown> | string;

dead_letter_queue?: string;
export type ConsumerGetResponse = Array<ConsumerGetResponse.ConsumerGetResponseItem>;

environment?: unknown;
export namespace ConsumerGetResponse {
export interface ConsumerGetResponseItem {
created_on?: unknown;

queue_name?: unknown;
environment?: unknown;

script_name?: unknown;
queue_name?: unknown;

settings?: WorkersConsumerUpdated.Settings;
}
service?: unknown;

export namespace WorkersConsumerUpdated {
export interface Settings {
batch_size?: number;
settings?: ConsumerGetResponseItem.Settings;
}

max_retries?: number;
export namespace ConsumerGetResponseItem {
export interface Settings {
/**
* The maximum number of messages to include in a batch
*/
batch_size?: number;

max_wait_time_ms?: number;
max_retries?: number;

max_wait_time_ms?: number;
}
}
}

export type ConsumerDeleteResponse = unknown | Array<unknown> | string;

export type ConsumerGetResponse = Array<WorkersConsumer>;

export interface ConsumerCreateParams {
/**
* Path param: Identifier
Expand Down Expand Up @@ -189,9 +196,8 @@ export interface ConsumerGetParams {
}

export namespace Consumers {
export import WorkersConsumer = ConsumersAPI.WorkersConsumer;
export import WorkersConsumerCreated = ConsumersAPI.WorkersConsumerCreated;
export import WorkersConsumerUpdated = ConsumersAPI.WorkersConsumerUpdated;
export import ConsumerCreateResponse = ConsumersAPI.ConsumerCreateResponse;
export import ConsumerUpdateResponse = ConsumersAPI.ConsumerUpdateResponse;
export import ConsumerDeleteResponse = ConsumersAPI.ConsumerDeleteResponse;
export import ConsumerGetResponse = ConsumersAPI.ConsumerGetResponse;
export import ConsumerCreateParams = ConsumersAPI.ConsumerCreateParams;
Expand Down
18 changes: 15 additions & 3 deletions src/resources/queues/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
WorkersConsumer,
WorkersConsumerCreated,
WorkersConsumerUpdated,
ConsumerCreateResponse,
ConsumerUpdateResponse,
ConsumerDeleteResponse,
ConsumerGetResponse,
ConsumerCreateParams,
Expand All @@ -12,12 +11,25 @@ export {
ConsumerGetParams,
Consumers,
} from './consumers';
export {
WorkersConsumer,
WorkersConsumerCreated,
WorkersConsumerUpdated,
MessageAckResponse,
MessagePullResponse,
MessageAckParams,
MessagePullParams,
Messages,
} from './messages';
export {
WorkersQueue,
WorkersQueueCreated,
WorkersQueueUpdated,
QueueCreateResponse,
QueueUpdateResponse,
QueueListResponse,
QueueDeleteResponse,
QueueGetResponse,
QueueCreateParams,
QueueUpdateParams,
QueueListParams,
Expand Down
Loading

0 comments on commit c31e0e5

Please sign in to comment.