cloudflare/cloudflare-typescript

Public

mirrored fromhttps://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/tasks.ts

49lines · 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';
6import { SinglePage } from '../../pagination';
7
8export 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
33export class TaskListResponsesSinglePage extends SinglePage<TaskListResponse> {}
34
35export type TaskListResponse = unknown;
36
37export interface TaskListParams {
38 account_id?: string;
39}
40
41Tasks.TaskListResponsesSinglePage = TaskListResponsesSinglePage;
42
43export declare namespace Tasks {
44 export {
45 type TaskListResponse as TaskListResponse,
46 TaskListResponsesSinglePage as TaskListResponsesSinglePage,
47 type TaskListParams as TaskListParams,
48 };
49}
50