cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
update-example-structure

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/ai-gateway/logs.ts

112lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { APIResource } from '../../resource';
4import * as Core from '../../core';
5import * as LogsAPI from './logs';
6import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination';
7
8export class Logs extends APIResource {
9 /**
10 * List Gateway Logs
11 */
12 list(
13 id: string,
14 params: LogListParams,
15 options?: Core.RequestOptions,
16 ): Core.PagePromise<LogListResponsesV4PagePaginationArray, LogListResponse> {
17 const { account_id, ...query } = params;
18 return this._client.getAPIList(
19 `/accounts/${account_id}/ai-gateway/gateways/${id}/logs`,
20 LogListResponsesV4PagePaginationArray,
21 { query, ...options },
22 );
23 }
24}
25
26export class LogListResponsesV4PagePaginationArray extends V4PagePaginationArray<LogListResponse> {}
27
28export interface LogListResponse {
29 id: string;
30
31 cached: boolean;
32
33 created_at: string;
34
35 duration: number;
36
37 model: string;
38
39 path: string;
40
41 provider: string;
42
43 request: string;
44
45 response: string;
46
47 success: boolean;
48
49 tokens_in: number;
50
51 tokens_out: number;
52
53 metadata?: string;
54
55 request_content_type?: string;
56
57 request_type?: string;
58
59 response_content_type?: string;
60
61 status_code?: number;
62
63 step?: number;
64}
65
66export interface LogListParams extends V4PagePaginationArrayParams {
67 /**
68 * Path param:
69 */
70 account_id: string;
71
72 /**
73 * Query param:
74 */
75 cached?: boolean;
76
77 /**
78 * Query param:
79 */
80 direction?: 'asc' | 'desc';
81
82 /**
83 * Query param:
84 */
85 end_date?: string;
86
87 /**
88 * Query param:
89 */
90 order_by?: 'created_at' | 'provider';
91
92 /**
93 * Query param:
94 */
95 search?: string;
96
97 /**
98 * Query param:
99 */
100 start_date?: string;
101
102 /**
103 * Query param:
104 */
105 success?: boolean;
106}
107
108export namespace Logs {
109 export import LogListResponse = LogsAPI.LogListResponse;
110 export import LogListResponsesV4PagePaginationArray = LogsAPI.LogListResponsesV4PagePaginationArray;
111 export import LogListParams = LogsAPI.LogListParams;
112}
113