cloudflare
Version:
The official TypeScript library for the Cloudflare API
2,409 lines • 45.8 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class BaseDynamicRouting extends APIResource {
static override readonly _key: readonly ['aiGateway', 'dynamicRouting'] = Object.freeze([
'aiGateway',
'dynamicRouting',
] as const);
/**
* Creates a dynamic route on an AI Gateway from the specified routing elements.
* Clients call the route by using `dynamic/{name}` as the model name.
*
* @example
* ```ts
* const dynamicRouting =
* await client.aiGateway.dynamicRouting.create('54442216', {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* elements: [
* {
* id: 'id',
* outputs: { next: { elementId: 'elementId' } },
* type: 'start',
* },
* ],
* name: 'x',
* });
* ```
*/
create(
gatewayID: string,
params: DynamicRoutingCreateParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingCreateResponse> {
const { account_id, ...body } = params;
return (
this._client.post(path`/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/routes`, {
body,
...options,
}) as APIPromise<{ result: DynamicRoutingCreateResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Updates the name of a dynamic route. To change routing behaviour, create and
* deploy a new version.
*
* @example
* ```ts
* const dynamicRouting =
* await client.aiGateway.dynamicRouting.update('54442216', {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* name: 'Route Name',
* });
* ```
*/
update(
id: string,
params: DynamicRoutingUpdateParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingUpdateResponse> {
const { account_id, gateway_id, ...body } = params;
return this._client.patch(path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}`, {
body,
...options,
});
}
/**
* Lists the dynamic routes configured on an AI Gateway.
*
* @example
* ```ts
* const dynamicRoutings =
* await client.aiGateway.dynamicRouting.list('54442216', {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* });
* ```
*/
list(
gatewayID: string,
params: DynamicRoutingListParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingListResponse> {
const { account_id, ...query } = params;
return this._client.get(path`/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/routes`, {
query,
...options,
});
}
/**
* Deletes a dynamic route from an AI Gateway.
*
* @example
* ```ts
* const dynamicRouting =
* await client.aiGateway.dynamicRouting.delete('54442216', {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* });
* ```
*/
delete(
id: string,
params: DynamicRoutingDeleteParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingDeleteResponse> {
const { account_id, gateway_id } = params;
return (
this._client.delete(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}`,
options,
) as APIPromise<{ result: DynamicRoutingDeleteResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Deploys the specified version of a dynamic route so that it serves traffic.
* Deploy an earlier version to roll back.
*
* @example
* ```ts
* const response =
* await client.aiGateway.dynamicRouting.createDeployment(
* '54442216',
* {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* version_id: '54442216',
* },
* );
* ```
*/
createDeployment(
id: string,
params: DynamicRoutingCreateDeploymentParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingCreateDeploymentResponse> {
const { account_id, gateway_id, ...body } = params;
return (
this._client.post(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}/deployments`,
{ body, ...options },
) as APIPromise<{ result: DynamicRoutingCreateDeploymentResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Creates a new version of a dynamic route from the specified routing elements.
* The version does not serve traffic until you deploy it.
*
* @example
* ```ts
* const response =
* await client.aiGateway.dynamicRouting.createVersion(
* '54442216',
* {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* elements: [
* {
* id: 'id',
* outputs: { next: { elementId: 'elementId' } },
* type: 'start',
* },
* ],
* },
* );
* ```
*/
createVersion(
id: string,
params: DynamicRoutingCreateVersionParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingCreateVersionResponse> {
const { account_id, gateway_id, ...body } = params;
return (
this._client.post(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}/versions`,
{ body, ...options },
) as APIPromise<{ result: DynamicRoutingCreateVersionResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves a dynamic route with its routing elements, active version, and current
* deployment.
*
* @example
* ```ts
* const dynamicRouting =
* await client.aiGateway.dynamicRouting.get('54442216', {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* });
* ```
*/
get(
id: string,
params: DynamicRoutingGetParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingGetResponse> {
const { account_id, gateway_id } = params;
return (
this._client.get(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}`,
options,
) as APIPromise<{ result: DynamicRoutingGetResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves a saved version of a dynamic route, including its routing elements.
*
* @example
* ```ts
* const response =
* await client.aiGateway.dynamicRouting.getVersion(
* '54442216',
* {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* id: '54442216',
* },
* );
* ```
*/
getVersion(
versionID: string,
params: DynamicRoutingGetVersionParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingGetVersionResponse> {
const { account_id, gateway_id, id } = params;
return (
this._client.get(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}/versions/${versionID}`,
options,
) as APIPromise<{ result: DynamicRoutingGetVersionResponse }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Lists the deployment history of a dynamic route.
*
* @example
* ```ts
* const response =
* await client.aiGateway.dynamicRouting.listDeployments(
* '54442216',
* {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* },
* );
* ```
*/
listDeployments(
id: string,
params: DynamicRoutingListDeploymentsParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingListDeploymentsResponse> {
const { account_id, gateway_id } = params;
return this._client.get(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}/deployments`,
options,
);
}
/**
* Lists the saved versions of a dynamic route.
*
* @example
* ```ts
* const response =
* await client.aiGateway.dynamicRouting.listVersions(
* '54442216',
* {
* account_id: '0d37909e38d3e99c29fa2cd343ac421a',
* gateway_id: '54442216',
* },
* );
* ```
*/
listVersions(
id: string,
params: DynamicRoutingListVersionsParams,
options?: RequestOptions,
): APIPromise<DynamicRoutingListVersionsResponse> {
const { account_id, gateway_id } = params;
return this._client.get(
path`/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/routes/${id}/versions`,
options,
);
}
}
export class DynamicRouting extends BaseDynamicRouting {}
export interface DynamicRoutingCreateResponse {
id: string;
created_at: string;
deployment: DynamicRoutingCreateResponse.Deployment;
elements: Array<
| DynamicRoutingCreateResponse.UnionMember0
| DynamicRoutingCreateResponse.UnionMember1
| DynamicRoutingCreateResponse.UnionMember2
| DynamicRoutingCreateResponse.UnionMember3
| DynamicRoutingCreateResponse.UnionMember4
| DynamicRoutingCreateResponse.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
version: DynamicRoutingCreateResponse.Version;
}
export namespace DynamicRoutingCreateResponse {
export interface Deployment {
created_at: string;
deployment_id: string;
version_id: string;
}
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
export interface Version {
active: 'true' | 'false';
created_at: string;
data: string;
version_id: string;
is_valid?: boolean;
}
}
export interface DynamicRoutingUpdateResponse {
route: DynamicRoutingUpdateResponse.Route;
success: boolean;
}
export namespace DynamicRoutingUpdateResponse {
export interface Route {
id: string;
account_tag: string;
created_at: string;
deployment: Route.Deployment;
elements: Array<
| Route.UnionMember0
| Route.UnionMember1
| Route.UnionMember2
| Route.UnionMember3
| Route.UnionMember4
| Route.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
version: Route.Version;
}
export namespace Route {
export interface Deployment {
created_at: string;
deployment_id: string;
version_id: string;
}
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
export interface Version {
active: 'true' | 'false';
created_at: string;
data: string;
version_id: string;
is_valid?: boolean;
}
}
}
export interface DynamicRoutingListResponse {
data: DynamicRoutingListResponse.Data;
success: boolean;
}
export namespace DynamicRoutingListResponse {
export interface Data {
order_by: string;
order_by_direction: string;
page: number;
per_page: number;
routes: Array<Data.Route>;
}
export namespace Data {
export interface Route {
id: string;
account_tag: string;
created_at: string;
deployment: Route.Deployment;
elements: Array<
| Route.UnionMember0
| Route.UnionMember1
| Route.UnionMember2
| Route.UnionMember3
| Route.UnionMember4
| Route.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
version: Route.Version;
}
export namespace Route {
export interface Deployment {
created_at: string;
deployment_id: string;
version_id: string;
}
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
export interface Version {
active: 'true' | 'false';
created_at: string;
data: string;
version_id: string;
is_valid?: boolean;
}
}
}
}
export interface DynamicRoutingDeleteResponse {
id: string;
created_at: string;
elements: Array<
| DynamicRoutingDeleteResponse.UnionMember0
| DynamicRoutingDeleteResponse.UnionMember1
| DynamicRoutingDeleteResponse.UnionMember2
| DynamicRoutingDeleteResponse.UnionMember3
| DynamicRoutingDeleteResponse.UnionMember4
| DynamicRoutingDeleteResponse.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
}
export namespace DynamicRoutingDeleteResponse {
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
}
export interface DynamicRoutingCreateDeploymentResponse {
id: string;
created_at: string;
elements: Array<
| DynamicRoutingCreateDeploymentResponse.UnionMember0
| DynamicRoutingCreateDeploymentResponse.UnionMember1
| DynamicRoutingCreateDeploymentResponse.UnionMember2
| DynamicRoutingCreateDeploymentResponse.UnionMember3
| DynamicRoutingCreateDeploymentResponse.UnionMember4
| DynamicRoutingCreateDeploymentResponse.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
}
export namespace DynamicRoutingCreateDeploymentResponse {
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
}
export interface DynamicRoutingCreateVersionResponse {
id: string;
created_at: string;
elements: Array<
| DynamicRoutingCreateVersionResponse.UnionMember0
| DynamicRoutingCreateVersionResponse.UnionMember1
| DynamicRoutingCreateVersionResponse.UnionMember2
| DynamicRoutingCreateVersionResponse.UnionMember3
| DynamicRoutingCreateVersionResponse.UnionMember4
| DynamicRoutingCreateVersionResponse.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
}
export namespace DynamicRoutingCreateVersionResponse {
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
}
export interface DynamicRoutingGetResponse {
id: string;
created_at: string;
deployment: DynamicRoutingGetResponse.Deployment;
elements: Array<
| DynamicRoutingGetResponse.UnionMember0
| DynamicRoutingGetResponse.UnionMember1
| DynamicRoutingGetResponse.UnionMember2
| DynamicRoutingGetResponse.UnionMember3
| DynamicRoutingGetResponse.UnionMember4
| DynamicRoutingGetResponse.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
version: DynamicRoutingGetResponse.Version;
}
export namespace DynamicRoutingGetResponse {
export interface Deployment {
created_at: string;
deployment_id: string;
version_id: string;
}
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
export interface Version {
active: 'true' | 'false';
created_at: string;
data: string;
version_id: string;
is_valid?: boolean;
}
}
export interface DynamicRoutingGetVersionResponse {
id: string;
active: 'true' | 'false';
created_at: string;
data: string;
elements: Array<
| DynamicRoutingGetVersionResponse.UnionMember0
| DynamicRoutingGetVersionResponse.UnionMember1
| DynamicRoutingGetVersionResponse.UnionMember2
| DynamicRoutingGetVersionResponse.UnionMember3
| DynamicRoutingGetVersionResponse.UnionMember4
| DynamicRoutingGetVersionResponse.UnionMember5
>;
gateway_id: string;
modified_at: string;
name: string;
version_id: string;
is_valid?: boolean;
}
export namespace DynamicRoutingGetVersionResponse {
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
}
export interface DynamicRoutingListDeploymentsResponse {
data: DynamicRoutingListDeploymentsResponse.Data;
success: boolean;
}
export namespace DynamicRoutingListDeploymentsResponse {
export interface Data {
deployments: Array<Data.Deployment>;
order_by: string;
order_by_direction: string;
page: number;
per_page: number;
}
export namespace Data {
export interface Deployment {
created_at: string;
deployment_id: string;
version_id: string;
}
}
}
export interface DynamicRoutingListVersionsResponse {
data: DynamicRoutingListVersionsResponse.Data;
success: boolean;
}
export namespace DynamicRoutingListVersionsResponse {
export interface Data {
order_by: string;
order_by_direction: string;
page: number;
per_page: number;
versions: Array<Data.Version>;
}
export namespace Data {
export interface Version {
active: 'true' | 'false';
created_at: string;
data: string;
version_id: string;
is_valid?: boolean;
}
}
}
export interface DynamicRoutingCreateParams {
/**
* Path param
*/
account_id: string;
/**
* Body param
*/
elements: Array<
| DynamicRoutingCreateParams.UnionMember0
| DynamicRoutingCreateParams.UnionMember1
| DynamicRoutingCreateParams.UnionMember2
| DynamicRoutingCreateParams.UnionMember3
| DynamicRoutingCreateParams.UnionMember4
| DynamicRoutingCreateParams.UnionMember5
>;
/**
* Body param
*/
name: string;
}
export namespace DynamicRoutingCreateParams {
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
}
export interface DynamicRoutingUpdateParams {
/**
* Path param
*/
account_id: string;
/**
* Path param
*/
gateway_id: string;
/**
* Body param
*/
name: string;
}
export interface DynamicRoutingListParams {
/**
* Path param
*/
account_id: string;
/**
* Query param: Page number
*/
page?: number;
/**
* Query param: Number of routes per page
*/
per_page?: number;
}
export interface DynamicRoutingDeleteParams {
account_id: string;
gateway_id: string;
}
export interface DynamicRoutingCreateDeploymentParams {
/**
* Path param
*/
account_id: string;
/**
* Path param
*/
gateway_id: string;
/**
* Body param
*/
version_id: string;
}
export interface DynamicRoutingCreateVersionParams {
/**
* Path param
*/
account_id: string;
/**
* Path param
*/
gateway_id: string;
/**
* Body param
*/
elements: Array<
| DynamicRoutingCreateVersionParams.UnionMember0
| DynamicRoutingCreateVersionParams.UnionMember1
| DynamicRoutingCreateVersionParams.UnionMember2
| DynamicRoutingCreateVersionParams.UnionMember3
| DynamicRoutingCreateVersionParams.UnionMember4
| DynamicRoutingCreateVersionParams.UnionMember5
>;
}
export namespace DynamicRoutingCreateVersionParams {
export interface UnionMember0 {
id: string;
outputs: UnionMember0.Outputs;
type: 'start';
}
export namespace UnionMember0 {
export interface Outputs {
next: Outputs.Next;
}
export namespace Outputs {
export interface Next {
elementId: string;
}
}
}
export interface UnionMember1 {
id: string;
outputs: UnionMember1.Outputs;
properties: UnionMember1.Properties;
type: 'conditional';
}
export namespace UnionMember1 {
export interface Outputs {
false: Outputs.False;
true: Outputs.True;
}
export namespace Outputs {
export interface False {
elementId: string;
}
export interface True {
elementId: string;
}
}
export interface Properties {
conditions?: unknown;
}
}
export interface UnionMember2 {
id: string;
outputs: { [key: string]: UnionMember2.Outputs };
type: 'percentage';
}
export namespace UnionMember2 {
export interface Outputs {
elementId: string;
}
}
export interface UnionMember3 {
id: string;
outputs: UnionMember3.Outputs;
properties: UnionMember3.Properties;
type: 'rate';
}
export namespace UnionMember3 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
key: string;
limit: number;
limitType: 'count' | 'cost';
window: number;
}
}
export interface UnionMember4 {
id: string;
outputs: UnionMember4.Outputs;
properties: UnionMember4.Properties;
type: 'model';
}
export namespace UnionMember4 {
export interface Outputs {
fallback: Outputs.Fallback;
success: Outputs.Success;
}
export namespace Outputs {
export interface Fallback {
elementId: string;
}
export interface Success {
elementId: string;
}
}
export interface Properties {
model: string;
provider: string;
retries: number;
timeout: number;
}
}
export interface UnionMember5 {
id: string;
outputs: { [key: string]: UnionMember5.Outputs };
type: 'end';
}
export namespace UnionMember5 {
export interface Outputs {
elementId: string;
}
}
}
export interface DynamicRoutingGetParams {
account_id: string;
gateway_id: string;
}
export interface DynamicRoutingGetVersionParams {
account_id: string;
gateway_id: string;
id: string;
}
export interface DynamicRoutingListDeploymentsParams {
account_id: string;
gateway_id: string;
}
export interface DynamicRoutingListVersionsParams {
account_id: string;
gateway_id: string;
}
export declare namespace DynamicRouting {
export {
type DynamicRoutingCreateResponse as DynamicRoutingCreateResponse,
type DynamicRoutingUpdateResponse as DynamicRoutingUpdateResponse,
type DynamicRoutingListResponse as DynamicRoutingListResponse,
type DynamicRoutingDeleteResponse as DynamicRoutingDeleteResponse,
type DynamicRoutingCreateDeploymentResponse as DynamicRoutingCreateDeploymentResponse,
type DynamicRoutingCreateVersionResponse as DynamicRoutingCreateVersionResponse,
type DynamicRoutingGetResponse as DynamicRoutingGetResponse,
type DynamicRoutingGetVersionResponse as DynamicRoutingGetVersionResponse,
type DynamicRoutingListDeploymentsResponse as DynamicRoutingListDeploymentsResponse,
type DynamicRoutingListVersionsResponse as DynamicRoutingListVersionsResponse,
type DynamicRoutingCreateParams as DynamicRoutingCreateParams,
type DynamicRoutingUpdateParams as DynamicRoutingUpdateParams,
type DynamicRoutingListParams as DynamicRoutingListParams,
type DynamicRoutingDeleteParams as DynamicRoutingDeleteParams,
type DynamicRoutingCreateDeploymentParams as DynamicRoutingCreateDeploymentParams,
type DynamicRoutingCreateVersionParams as DynamicRoutingCreateVersionParams,
type DynamicRoutingGetParams as DynamicRoutingGetParams,
type DynamicRoutingGetVersionParams as DynamicRoutingGetVersionParams,
type DynamicRoutingListDeploymentsParams as DynamicRoutingListDeploymentsParams,
type DynamicRoutingListVersionsParams as DynamicRoutingListVersionsParams,
};
}