cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/ai/tasks.ts
49lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import { APIResource } from '../../resource'; |
| 4 | import { isRequestOptions } from '../../core'; |
| 5 | import * as Core from '../../core'; |
| 6 | import { SinglePage } from '../../pagination'; |
| 7 | |
| 8 | export class Tasks extends APIResource { |
| 9 | /** |
| 10 | * Searches Workers AI models by task type (e.g., text-generation, embeddings). |
| 11 | */ |
| 12 | list( |
| 13 | params?: TaskListParams, |
| 14 | options?: Core.RequestOptions, |
| 15 | ): Core.PagePromise<TaskListResponsesSinglePage, TaskListResponse>; |
| 16 | list(options?: Core.RequestOptions): Core.PagePromise<TaskListResponsesSinglePage, TaskListResponse>; |
| 17 | list( |
| 18 | params: TaskListParams | Core.RequestOptions = {}, |
| 19 | options?: Core.RequestOptions, |
| 20 | ): Core.PagePromise<TaskListResponsesSinglePage, TaskListResponse> { |
| 21 | if (isRequestOptions(params)) { |
| 22 | return this.list({}, params); |
| 23 | } |
| 24 | const { account_id = this._client.accountId } = params; |
| 25 | return this._client.getAPIList( |
| 26 | `/accounts/${account_id}/ai/tasks/search`, |
| 27 | TaskListResponsesSinglePage, |
| 28 | options, |
| 29 | ); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | export class TaskListResponsesSinglePage extends SinglePage<TaskListResponse> {} |
| 34 | |
| 35 | export type TaskListResponse = unknown; |
| 36 | |
| 37 | export interface TaskListParams { |
| 38 | account_id?: string; |
| 39 | } |
| 40 | |
| 41 | Tasks.TaskListResponsesSinglePage = TaskListResponsesSinglePage; |
| 42 | |
| 43 | export declare namespace Tasks { |
| 44 | export { |
| 45 | type TaskListResponse as TaskListResponse, |
| 46 | TaskListResponsesSinglePage as TaskListResponsesSinglePage, |
| 47 | type TaskListParams as TaskListParams, |
| 48 | }; |
| 49 | } |
| 50 | |