cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.3.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/ai-gateway/logs.ts

119lines · modecode

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