Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 7, 2024
1 parent f28f0d7 commit edf2a7e
Show file tree
Hide file tree
Showing 7 changed files with 635 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1269
configured_endpoints: 1275
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-66b404214530cc73c44f34f297dad6bc8da0645b63e61d9d4fcbeb301e127e65.yml
24 changes: 24 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6426,4 +6426,28 @@ Methods:

# 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_id}/ai-gateway/gateways">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">create</a>({ ...params }) -> AIGatewayCreateResponse</code>
- <code title="put /accounts/{account_id}/ai-gateway/gateways/{id}">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">update</a>(id, { ...params }) -> AIGatewayUpdateResponse</code>
- <code title="get /accounts/{account_id}/ai-gateway/gateways">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">list</a>({ ...params }) -> AIGatewayListResponsesV4PagePaginationArray</code>
- <code title="delete /accounts/{account_id}/ai-gateway/gateways/{id}">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">delete</a>(id, { ...params }) -> AIGatewayDeleteResponse</code>
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}">client.aiGateway.<a href="./src/resources/ai-gateway/ai-gateway.ts">get</a>(id, { ...params }) -> AIGatewayGetResponse</code>

## Logs

Types:

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

Methods:

- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs">client.aiGateway.logs.<a href="./src/resources/ai-gateway/logs.ts">get</a>(id, { ...params }) -> LogGetResponse</code>
331 changes: 331 additions & 0 deletions src/resources/ai-gateway/ai-gateway.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,343 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as LogsAPI from 'cloudflare/resources/ai-gateway/logs';
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination';

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

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

/**
* Update a Gateway
*/
update(
id: string,
params: AIGatewayUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<AIGatewayUpdateResponse> {
const { account_id, ...body } = params;
return (
this._client.put(`/accounts/${account_id}/ai-gateway/gateways/${id}`, {
body,
...options,
}) as Core.APIPromise<{ result: AIGatewayUpdateResponse }>
)._thenUnwrap((obj) => obj.result);
}

/**
* List Gateway's
*/
list(
params: AIGatewayListParams,
options?: Core.RequestOptions,
): Core.PagePromise<AIGatewayListResponsesV4PagePaginationArray, AIGatewayListResponse> {
const { account_id, ...query } = params;
return this._client.getAPIList(
`/accounts/${account_id}/ai-gateway/gateways`,
AIGatewayListResponsesV4PagePaginationArray,
{ query, ...options },
);
}

/**
* Delete a Gateway
*/
delete(
id: string,
params: AIGatewayDeleteParams,
options?: Core.RequestOptions,
): Core.APIPromise<AIGatewayDeleteResponse> {
const { account_id } = params;
return (
this._client.delete(`/accounts/${account_id}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{
result: AIGatewayDeleteResponse;
}>
)._thenUnwrap((obj) => obj.result);
}

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

export class AIGatewayListResponsesV4PagePaginationArray extends V4PagePaginationArray<AIGatewayListResponse> {}

export interface AIGatewayCreateResponse {
task: AIGatewayCreateResponse.Task;
}

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

cache_invalidate_on_update: boolean;

cache_ttl: number;

collect_logs: boolean;

created_at: string;

modified_at: string;

name: string;

slug: string;

rate_limiting_interval?: number;

rate_limiting_limit?: number;

rate_limiting_technique?: string;
}
}

export interface AIGatewayUpdateResponse {
id: string;

cache_invalidate_on_update: boolean;

cache_ttl: number;

collect_logs: boolean;

created_at: string;

modified_at: string;

name: string;

slug: string;

rate_limiting_interval?: number;

rate_limiting_limit?: number;

rate_limiting_technique?: string;
}

export interface AIGatewayListResponse {
id: string;

cache_invalidate_on_update: boolean;

cache_ttl: number;

collect_logs: boolean;

created_at: string;

modified_at: string;

name: string;

slug: string;

rate_limiting_interval?: number;

rate_limiting_limit?: number;

rate_limiting_technique?: string;
}

export interface AIGatewayDeleteResponse {
id: string;

cache_invalidate_on_update: boolean;

cache_ttl: number;

collect_logs: boolean;

created_at: string;

modified_at: string;

name: string;

slug: string;

rate_limiting_interval?: number;

rate_limiting_limit?: number;

rate_limiting_technique?: string;
}

export interface AIGatewayGetResponse {
id: string;

cache_invalidate_on_update: boolean;

cache_ttl: number;

collect_logs: boolean;

created_at: string;

modified_at: string;

name: string;

slug: string;

rate_limiting_interval?: number;

rate_limiting_limit?: number;

rate_limiting_technique?: string;
}

export interface AIGatewayCreateParams {
/**
* Path param:
*/
account_id: string;

/**
* Body param:
*/
cache_invalidate_on_update: boolean;

/**
* Body param:
*/
cache_ttl: number;

/**
* Body param:
*/
collect_logs: boolean;

/**
* Body param:
*/
name: string;

/**
* Body param:
*/
slug: string;

/**
* Body param:
*/
rate_limiting_interval?: number;

/**
* Body param:
*/
rate_limiting_limit?: number;

/**
* Body param:
*/
rate_limiting_technique?: string;
}

export interface AIGatewayUpdateParams {
/**
* Path param:
*/
account_id: string;

/**
* Body param:
*/
cache_invalidate_on_update: boolean;

/**
* Body param:
*/
cache_ttl: number;

/**
* Body param:
*/
collect_logs: boolean;

/**
* Body param:
*/
name: string;

/**
* Body param:
*/
slug: string;

/**
* Body param:
*/
rate_limiting_interval?: number;

/**
* Body param:
*/
rate_limiting_limit?: number;

/**
* Body param:
*/
rate_limiting_technique?: string;
}

export interface AIGatewayListParams extends V4PagePaginationArrayParams {
/**
* Path param:
*/
account_id: string;

/**
* Query param:
*/
id?: string;

/**
* Query param: Order By Column Name
*/
order_by?: string;
}

export interface AIGatewayDeleteParams {
account_id: string;
}

export interface AIGatewayGetParams {
account_id: string;
}

export namespace AIGateway {
export import Logs = LogsAPI.Logs;
export import LogGetResponse = LogsAPI.LogGetResponse;
export import LogGetParams = LogsAPI.LogGetParams;
}
2 changes: 1 addition & 1 deletion src/resources/ai-gateway/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { AIGateway } from './ai-gateway';
export { Logs } from './logs';
export { LogGetResponse, LogGetParams, Logs } from './logs';
Loading

0 comments on commit edf2a7e

Please sign in to comment.