cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.0.0-beta.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/ai-gateway/urls.ts

54lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { APIResource } from '../../resource';
4import { isRequestOptions } from '../../core';
5import * as Core from '../../core';
6
7export class URLs extends APIResource {
8 /**
9 * Retrieves the endpoint URL for an AI Gateway.
10 *
11 * @example
12 * ```ts
13 * const url = await client.aiGateway.urls.get(
14 * 'my-gateway',
15 * 'workers-ai',
16 * { account_id: '0d37909e38d3e99c29fa2cd343ac421a' },
17 * );
18 * ```
19 */
20 get(
21 gatewayId: string,
22 provider: string,
23 params?: URLGetParams,
24 options?: Core.RequestOptions,
25 ): Core.APIPromise<URLGetResponse>;
26 get(gatewayId: string, provider: string, options?: Core.RequestOptions): Core.APIPromise<URLGetResponse>;
27 get(
28 gatewayId: string,
29 provider: string,
30 params: URLGetParams | Core.RequestOptions = {},
31 options?: Core.RequestOptions,
32 ): Core.APIPromise<URLGetResponse> {
33 if (isRequestOptions(params)) {
34 return this.get(gatewayId, provider, {}, params);
35 }
36 const { account_id = this._client.accountId } = params;
37 return (
38 this._client.get(
39 `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/url/${provider}`,
40 options,
41 ) as Core.APIPromise<{ result: URLGetResponse }>
42 )._thenUnwrap((obj) => obj.result);
43 }
44}
45
46export type URLGetResponse = string;
47
48export interface URLGetParams {
49 account_id?: string;
50}
51
52export declare namespace URLs {
53 export { type URLGetResponse as URLGetResponse, type URLGetParams as URLGetParams };
54}
55