Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #469

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2268,39 +2268,11 @@ Types:

Types:

- <code><a href="./src/resources/workers/ai/ai.ts">AIRunResponse</a></code>
- <code><a href="./src/resources/workers/ai.ts">AIRunResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/ai/run/{model_name}">client.workers.ai.<a href="./src/resources/workers/ai/ai.ts">run</a>(modelName, { ...params }) -> AIRunResponse</code>

### Gateways

Types:

- <code><a href="./src/resources/workers/ai/gateways/gateways.ts">GatewayCreateResponse</a></code>
- <code><a href="./src/resources/workers/ai/gateways/gateways.ts">GatewayUpdateResponse</a></code>
- <code><a href="./src/resources/workers/ai/gateways/gateways.ts">GatewayListResponse</a></code>
- <code><a href="./src/resources/workers/ai/gateways/gateways.ts">GatewayDeleteResponse</a></code>
- <code><a href="./src/resources/workers/ai/gateways/gateways.ts">GatewayGetResponse</a></code>

Methods:

- <code title="post /accounts/{account_tag}/ai-gateway/gateways">client.workers.ai.gateways.<a href="./src/resources/workers/ai/gateways/gateways.ts">create</a>(accountTag, { ...params }) -> GatewayCreateResponse</code>
- <code title="put /accounts/{account_tag}/ai-gateway/gateways/{id}">client.workers.ai.gateways.<a href="./src/resources/workers/ai/gateways/gateways.ts">update</a>(accountTag, id, { ...params }) -> GatewayUpdateResponse</code>
- <code title="get /accounts/{account_tag}/ai-gateway/gateways">client.workers.ai.gateways.<a href="./src/resources/workers/ai/gateways/gateways.ts">list</a>(accountTag, { ...params }) -> GatewayListResponsesV4PagePaginationArray</code>
- <code title="delete /accounts/{account_tag}/ai-gateway/gateways/{id}">client.workers.ai.gateways.<a href="./src/resources/workers/ai/gateways/gateways.ts">delete</a>(accountTag, id) -> GatewayDeleteResponse</code>
- <code title="get /accounts/{account_tag}/ai-gateway/gateways/{id}">client.workers.ai.gateways.<a href="./src/resources/workers/ai/gateways/gateways.ts">get</a>(accountTag, id) -> GatewayGetResponse</code>

#### Logs

Types:

- <code><a href="./src/resources/workers/ai/gateways/logs.ts">LogGetResponse</a></code>

Methods:

- <code title="get /accounts/{account_tag}/ai-gateway/gateways/{id}/logs">client.workers.ai.gateways.logs.<a href="./src/resources/workers/ai/gateways/logs.ts">get</a>(accountTag, id, { ...params }) -> LogGetResponse</code>
- <code title="post /accounts/{account_id}/ai/run/{model_name}">client.workers.ai.<a href="./src/resources/workers/ai.ts">run</a>(modelName, { ...params }) -> AIRunResponse</code>

## Scripts

Expand Down Expand Up @@ -6451,3 +6423,31 @@ Methods:

- <code title="put /accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}">client.eventNotifications.r2.configuration.queues.<a href="./src/resources/event-notifications/r2/configuration/queues.ts">update</a>(bucketName, queueId, { ...params }) -> QueueUpdateResponse</code>
- <code title="delete /accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}">client.eventNotifications.r2.configuration.queues.<a href="./src/resources/event-notifications/r2/configuration/queues.ts">delete</a>(bucketName, queueId, { ...params }) -> QueueDeleteResponse</code>

# AIGateway

Types:

- <code><a href="./src/resources/ai-gateway/ai-gateway.ts">AIGatewayCreateResponse</a></code>
- <code><a href="./src/resources/ai-gateway/ai-gateway.ts">AIGatewayUpdateResponse</a></code>
- <code><a href="./src/resources/ai-gateway/ai-gateway.ts">AIGatewayListResponse</a></code>
- <code><a href="./src/resources/ai-gateway/ai-gateway.ts">AIGatewayDeleteResponse</a></code>
- <code><a href="./src/resources/ai-gateway/ai-gateway.ts">AIGatewayGetResponse</a></code>

Methods:

- <code title="post /accounts/{account_tag}/ai-gateway/gateways">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">create</a>(accountTag, { ...params }) -> AIGatewayCreateResponse</code>
- <code title="put /accounts/{account_tag}/ai-gateway/gateways/{id}">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">update</a>(accountTag, id, { ...params }) -> AIGatewayUpdateResponse</code>
- <code title="get /accounts/{account_tag}/ai-gateway/gateways">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">list</a>(accountTag, { ...params }) -> AIGatewayListResponsesV4PagePaginationArray</code>
- <code title="delete /accounts/{account_tag}/ai-gateway/gateways/{id}">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">delete</a>(accountTag, id) -> AIGatewayDeleteResponse</code>
- <code title="get /accounts/{account_tag}/ai-gateway/gateways/{id}">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">get</a>(accountTag, id) -> AIGatewayGetResponse</code>

## Logs

Types:

- <code><a href="./src/resources/ai-gateway/logs.ts">LogGetResponse</a></code>

Methods:

- <code title="get /accounts/{account_tag}/ai-gateway/gateways/{id}/logs">client.aiGateway.logs.<a href="./src/resources/ai-gateway/logs.ts">get</a>(accountTag, id, { ...params }) -> LogGetResponse</code>
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export class Cloudflare extends Core.APIClient {
calls: API.Calls = new API.Calls(this);
cloudforceOne: API.CloudforceOne = new API.CloudforceOne(this);
eventNotifications: API.EventNotifications = new API.EventNotifications(this);
aiGateway: API.AIGateway = new API.AIGateway(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return this._options.defaultQuery;
Expand Down Expand Up @@ -551,6 +552,8 @@ export namespace Cloudflare {

export import EventNotifications = API.EventNotifications;

export import AIGateway = API.AIGateway;

export import ASN = API.ASN;
export import AuditLog = API.AuditLog;
export import CloudflareTunnel = API.CloudflareTunnel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as GatewaysAPI from 'cloudflare/resources/workers/ai/gateways/gateways';
import * as LogsAPI from 'cloudflare/resources/workers/ai/gateways/logs';
import * as LogsAPI from 'cloudflare/resources/ai-gateway/logs';
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination';

export class Gateways extends APIResource {
export class AIGateway extends APIResource {
logs: LogsAPI.Logs = new LogsAPI.Logs(this._client);

/**
* Create a new Gateway
*/
create(
accountTag: string,
body: GatewayCreateParams,
body: AIGatewayCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise<GatewayCreateResponse> {
): Core.APIPromise<AIGatewayCreateResponse> {
return (
this._client.post(`/accounts/${accountTag}/ai-gateway/gateways`, {
body,
...options,
}) as Core.APIPromise<{ result: GatewayCreateResponse }>
}) as Core.APIPromise<{ result: AIGatewayCreateResponse }>
)._thenUnwrap((obj) => obj.result);
}

Expand All @@ -32,14 +31,14 @@ export class Gateways extends APIResource {
update(
accountTag: string,
id: string,
body: GatewayUpdateParams,
body: AIGatewayUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<GatewayUpdateResponse> {
): Core.APIPromise<AIGatewayUpdateResponse> {
return (
this._client.put(`/accounts/${accountTag}/ai-gateway/gateways/${id}`, {
body,
...options,
}) as Core.APIPromise<{ result: GatewayUpdateResponse }>
}) as Core.APIPromise<{ result: AIGatewayUpdateResponse }>
)._thenUnwrap((obj) => obj.result);
}

Expand All @@ -48,24 +47,24 @@ export class Gateways extends APIResource {
*/
list(
accountTag: string,
query?: GatewayListParams,
query?: AIGatewayListParams,
options?: Core.RequestOptions,
): Core.PagePromise<GatewayListResponsesV4PagePaginationArray, GatewayListResponse>;
): Core.PagePromise<AIGatewayListResponsesV4PagePaginationArray, AIGatewayListResponse>;
list(
accountTag: string,
options?: Core.RequestOptions,
): Core.PagePromise<GatewayListResponsesV4PagePaginationArray, GatewayListResponse>;
): Core.PagePromise<AIGatewayListResponsesV4PagePaginationArray, AIGatewayListResponse>;
list(
accountTag: string,
query: GatewayListParams | Core.RequestOptions = {},
query: AIGatewayListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<GatewayListResponsesV4PagePaginationArray, GatewayListResponse> {
): Core.PagePromise<AIGatewayListResponsesV4PagePaginationArray, AIGatewayListResponse> {
if (isRequestOptions(query)) {
return this.list(accountTag, {}, query);
}
return this._client.getAPIList(
`/accounts/${accountTag}/ai-gateway/gateways`,
GatewayListResponsesV4PagePaginationArray,
AIGatewayListResponsesV4PagePaginationArray,
{ query, ...options },
);
}
Expand All @@ -77,33 +76,33 @@ export class Gateways extends APIResource {
accountTag: string,
id: string,
options?: Core.RequestOptions,
): Core.APIPromise<GatewayDeleteResponse> {
): Core.APIPromise<AIGatewayDeleteResponse> {
return (
this._client.delete(`/accounts/${accountTag}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{
result: GatewayDeleteResponse;
result: AIGatewayDeleteResponse;
}>
)._thenUnwrap((obj) => obj.result);
}

/**
* Fetch a Gateway
*/
get(accountTag: string, id: string, options?: Core.RequestOptions): Core.APIPromise<GatewayGetResponse> {
get(accountTag: string, id: string, options?: Core.RequestOptions): Core.APIPromise<AIGatewayGetResponse> {
return (
this._client.get(`/accounts/${accountTag}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{
result: GatewayGetResponse;
result: AIGatewayGetResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
}

export class GatewayListResponsesV4PagePaginationArray extends V4PagePaginationArray<GatewayListResponse> {}
export class AIGatewayListResponsesV4PagePaginationArray extends V4PagePaginationArray<AIGatewayListResponse> {}

export interface GatewayCreateResponse {
task: GatewayCreateResponse.Task;
export interface AIGatewayCreateResponse {
task: AIGatewayCreateResponse.Task;
}

export namespace GatewayCreateResponse {
export namespace AIGatewayCreateResponse {
export interface Task {
id: string;

Expand All @@ -129,7 +128,7 @@ export namespace GatewayCreateResponse {
}
}

export interface GatewayUpdateResponse {
export interface AIGatewayUpdateResponse {
id: string;

cache_invalidate_on_update: boolean;
Expand All @@ -153,7 +152,7 @@ export interface GatewayUpdateResponse {
rate_limiting_technique?: string;
}

export interface GatewayListResponse {
export interface AIGatewayListResponse {
id: string;

cache_invalidate_on_update: boolean;
Expand All @@ -177,7 +176,7 @@ export interface GatewayListResponse {
rate_limiting_technique?: string;
}

export interface GatewayDeleteResponse {
export interface AIGatewayDeleteResponse {
id: string;

cache_invalidate_on_update: boolean;
Expand All @@ -201,7 +200,7 @@ export interface GatewayDeleteResponse {
rate_limiting_technique?: string;
}

export interface GatewayGetResponse {
export interface AIGatewayGetResponse {
id: string;

cache_invalidate_on_update: boolean;
Expand All @@ -225,7 +224,7 @@ export interface GatewayGetResponse {
rate_limiting_technique?: string;
}

export interface GatewayCreateParams {
export interface AIGatewayCreateParams {
cache_invalidate_on_update: boolean;

cache_ttl: number;
Expand All @@ -243,7 +242,7 @@ export interface GatewayCreateParams {
rate_limiting_technique?: string;
}

export interface GatewayUpdateParams {
export interface AIGatewayUpdateParams {
cache_invalidate_on_update: boolean;

cache_ttl: number;
Expand All @@ -261,7 +260,7 @@ export interface GatewayUpdateParams {
rate_limiting_technique?: string;
}

export interface GatewayListParams extends V4PagePaginationArrayParams {
export interface AIGatewayListParams extends V4PagePaginationArrayParams {
id?: string;

/**
Expand All @@ -270,16 +269,7 @@ export interface GatewayListParams extends V4PagePaginationArrayParams {
order_by?: string;
}

export namespace Gateways {
export import GatewayCreateResponse = GatewaysAPI.GatewayCreateResponse;
export import GatewayUpdateResponse = GatewaysAPI.GatewayUpdateResponse;
export import GatewayListResponse = GatewaysAPI.GatewayListResponse;
export import GatewayDeleteResponse = GatewaysAPI.GatewayDeleteResponse;
export import GatewayGetResponse = GatewaysAPI.GatewayGetResponse;
export import GatewayListResponsesV4PagePaginationArray = GatewaysAPI.GatewayListResponsesV4PagePaginationArray;
export import GatewayCreateParams = GatewaysAPI.GatewayCreateParams;
export import GatewayUpdateParams = GatewaysAPI.GatewayUpdateParams;
export import GatewayListParams = GatewaysAPI.GatewayListParams;
export namespace AIGateway {
export import Logs = LogsAPI.Logs;
export import LogGetResponse = LogsAPI.LogGetResponse;
export import LogGetParams = LogsAPI.LogGetParams;
Expand Down
4 changes: 4 additions & 0 deletions src/resources/ai-gateway/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { AIGateway } from './ai-gateway';
export { LogGetResponse, LogGetParams, Logs } from './logs';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as LogsAPI from 'cloudflare/resources/workers/ai/gateways/logs';
import * as LogsAPI from 'cloudflare/resources/ai-gateway/logs';

export class Logs extends APIResource {
/**
Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export * from './shared';
export { ACM } from './acm/acm';
export { AIGateway } from './ai-gateway/ai-gateway';
export { Accounts } from './accounts/accounts';
export { Addressing } from './addressing/addressing';
export { Alerting } from './alerting/alerting';
Expand Down
15 changes: 1 addition & 14 deletions src/resources/workers/ai/ai.ts → src/resources/workers/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as AIAPI from 'cloudflare/resources/workers/ai/ai';
import * as GatewaysAPI from 'cloudflare/resources/workers/ai/gateways/gateways';
import * as AIAPI from 'cloudflare/resources/workers/ai';
import { type Uploadable } from 'cloudflare/core';

export class AI extends APIResource {
gateways: GatewaysAPI.Gateways = new GatewaysAPI.Gateways(this._client);

/**
* This endpoint provides users with the capability to run specific AI models
* on-demand.
Expand Down Expand Up @@ -382,14 +379,4 @@ export namespace AIRunParams {
export namespace AI {
export import AIRunResponse = AIAPI.AIRunResponse;
export import AIRunParams = AIAPI.AIRunParams;
export import Gateways = GatewaysAPI.Gateways;
export import GatewayCreateResponse = GatewaysAPI.GatewayCreateResponse;
export import GatewayUpdateResponse = GatewaysAPI.GatewayUpdateResponse;
export import GatewayListResponse = GatewaysAPI.GatewayListResponse;
export import GatewayDeleteResponse = GatewaysAPI.GatewayDeleteResponse;
export import GatewayGetResponse = GatewaysAPI.GatewayGetResponse;
export import GatewayListResponsesV4PagePaginationArray = GatewaysAPI.GatewayListResponsesV4PagePaginationArray;
export import GatewayCreateParams = GatewaysAPI.GatewayCreateParams;
export import GatewayUpdateParams = GatewaysAPI.GatewayUpdateParams;
export import GatewayListParams = GatewaysAPI.GatewayListParams;
}
15 changes: 0 additions & 15 deletions src/resources/workers/ai/gateways/index.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/resources/workers/ai/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/resources/workers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { AIRunResponse, AIRunParams, AI } from './ai/index';
export { AIRunResponse, AIRunParams, AI } from './ai';
export {
AccountSettingUpdateResponse,
AccountSettingGetResponse,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/workers/workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { APIResource } from 'cloudflare/resource';
import * as AccountSettingsAPI from 'cloudflare/resources/workers/account-settings';
import * as AIAPI from 'cloudflare/resources/workers/ai';
import * as DomainsAPI from 'cloudflare/resources/workers/domains';
import * as SubdomainsAPI from 'cloudflare/resources/workers/subdomains';
import * as AIAPI from 'cloudflare/resources/workers/ai/ai';
import * as ScriptsAPI from 'cloudflare/resources/workers/scripts/scripts';

export class Workers extends APIResource {
Expand Down
Loading