cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/ai-gateway/urls.ts
43lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import { APIResource } from '../../resource'; |
| 4 | import * as Core from '../../core'; |
| 5 | |
| 6 | export class URLs extends APIResource { |
| 7 | /** |
| 8 | * Get Gateway URL |
| 9 | * |
| 10 | * @example |
| 11 | * ```ts |
| 12 | * const url = await client.aiGateway.urls.get( |
| 13 | * 'my-gateway', |
| 14 | * 'workers-ai', |
| 15 | * { account_id: '0d37909e38d3e99c29fa2cd343ac421a' }, |
| 16 | * ); |
| 17 | * ``` |
| 18 | */ |
| 19 | get( |
| 20 | gatewayId: string, |
| 21 | provider: string, |
| 22 | params: URLGetParams, |
| 23 | options?: Core.RequestOptions, |
| 24 | ): Core.APIPromise<URLGetResponse> { |
| 25 | const { account_id } = params; |
| 26 | return ( |
| 27 | this._client.get( |
| 28 | `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/url/${provider}`, |
| 29 | options, |
| 30 | ) as Core.APIPromise<{ result: URLGetResponse }> |
| 31 | )._thenUnwrap((obj) => obj.result); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export type URLGetResponse = string; |
| 36 | |
| 37 | export interface URLGetParams { |
| 38 | account_id: string; |
| 39 | } |
| 40 | |
| 41 | export declare namespace URLs { |
| 42 | export { type URLGetResponse as URLGetResponse, type URLGetParams as URLGetParams }; |
| 43 | } |
| 44 | |