diff --git a/src/apis/index.ts b/src/apis/index.ts index 6910ee8..11f6947 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -21,4 +21,4 @@ export { VectorStores } from './vectorStores'; export { BetaChat } from './betaChat'; export { Uploads } from './uploads'; export { ApiKeys } from './apiKeys'; -export { LogsExport } from './logsExport'; \ No newline at end of file +export { LogsExport } from './logsExport'; diff --git a/src/apis/logsExport.ts b/src/apis/logsExport.ts index 4b2d745..4a426c0 100644 --- a/src/apis/logsExport.ts +++ b/src/apis/logsExport.ts @@ -1,166 +1,208 @@ -import { ApiResource } from "../apiResource"; -import { APIResponseType, ApiClientInterface } from "../_types/generalTypes"; -import { APIPromise, RequestOptions } from "../baseClient"; -import { createHeaders } from "./createHeaders"; -import { toQueryParams } from "../utils"; +import { ApiResource } from '../apiResource'; +import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; +import { APIPromise, RequestOptions } from '../baseClient'; +import { createHeaders } from './createHeaders'; +import { toQueryParams } from '../utils'; export interface LogsExportCreateParams { - filters?:Record; - workspace_id?:string; - description?:string; - requested_data?:string[]; + filters?: Record; + workspace_id?: string; + description?: string; + requested_data?: string[]; } export interface LogsExportCreateResponse extends APIResponseType { - id?:string; - total?:number; - object?:string; + id?: string; + total?: number; + object?: string; } -export interface LogsExportListParams{ - workspace_id?:string; +export interface LogsExportListParams { + workspace_id?: string; } export interface LogsExportListResponse extends APIResponseType { - object?:string; - total?: number; - data?: Record[]; + object?: string; + total?: number; + data?: Record[]; } -export interface LogsExportUpdateParams{ - exportId?:string; - workspace_id?:string; - filters?:Record; - requested_data?:string[]; +export interface LogsExportUpdateParams { + exportId?: string; + workspace_id?: string; + filters?: Record; + requested_data?: string[]; } -export interface LogsExportUpdateResponse extends APIResponseType{ - id?:string; - total?:number; - object?:string; +export interface LogsExportUpdateResponse extends APIResponseType { + id?: string; + total?: number; + object?: string; } export interface LogsExportCancelParams { - exportId?:string; + exportId?: string; } -export interface LogsExportCancelResponse extends APIResponseType{ - message?:string; - object?:string; +export interface LogsExportCancelResponse extends APIResponseType { + message?: string; + object?: string; } export interface LogsExportRetrieveParams { - exportId:string; + exportId: string; } -export interface LogsExportRetrieveResponse extends APIResponseType{ - id?:string; - organisation_id?: string; - filters?:Record; - requested_data?:string[]; - status?:string; - description?:string; - created_at?: Date; - last_updated_at?:Date; - created_by?: string; - workspace_id?:string; - total_records?:number; - object?:string; +export interface LogsExportRetrieveResponse extends APIResponseType { + id?: string; + organisation_id?: string; + filters?: Record; + requested_data?: string[]; + status?: string; + description?: string; + created_at?: Date; + last_updated_at?: Date; + created_by?: string; + workspace_id?: string; + total_records?: number; + object?: string; } -export interface LogsExportStartParams{ - exportId?:string; +export interface LogsExportStartParams { + exportId?: string; } -export interface LogsExportStartResponse extends APIResponseType{ - message?:string; - object?:string; +export interface LogsExportStartResponse extends APIResponseType { + message?: string; + object?: string; } -export interface LogsExportDownloadParams{ - exportId?: string; +export interface LogsExportDownloadParams { + exportId?: string; } -export interface LogsExportDownloadResponse extends APIResponseType{ - signed_url?:string; +export interface LogsExportDownloadResponse extends APIResponseType { + signed_url?: string; } export class LogsExport extends ApiResource { - create( - _body:LogsExportCreateParams, - params?:ApiClientInterface, - opts?:RequestOptions - ):APIPromise{ - const body = _body; - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.post('/logs/exports', { body, ...opts }); - return response; + create( + _body: LogsExportCreateParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; } - retrieve( - _body:LogsExportRetrieveParams, - params?: ApiClientInterface, - opts?: RequestOptions - ): APIPromise { - const body = _body; - const exportId = body.exportId; - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.getMethod(`/logs/exports/${exportId}`, { ...opts }); - return response; - } - list( - _body:LogsExportListParams, - params?: ApiClientInterface, - opts?: RequestOptions - ): APIPromise{ - const body = _body; - const query = toQueryParams(body); - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.getMethod(`/logs/exports${query}`, {...opts}); - return response; + const response = this.post('/logs/exports', { + body, + ...opts, + }); + return response; + } + retrieve( + _body: LogsExportRetrieveParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + const exportId = body.exportId; + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; } - update( - _body: LogsExportUpdateParams, - params?: ApiClientInterface, - opts?: RequestOptions - ): APIPromise { - const body = _body; - const exportId = body.exportId; - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.put(`/logs/exports/${exportId}`, { body, ...opts }); - return response; - } - start( - _body:LogsExportStartParams, - params?:ApiClientInterface, - opts?:RequestOptions - ): APIPromise{ - const body = _body - const exportId = body.exportId; - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.post(`/logs/exports/${exportId}/start`, { body, ...opts }); - return response; + const response = this.getMethod( + `/logs/exports/${exportId}`, + { ...opts } + ); + return response; + } + list( + _body: LogsExportListParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + const query = toQueryParams(body); + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; } - cancel( - _body:LogsExportCancelParams, - params?:ApiClientInterface, - opts?:RequestOptions - ): APIPromise{ - const body=_body; - const exportId=body.exportId; - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.post(`/logs/exports/${exportId}/cancel`, { body, ...opts }); - return response; + const response = this.getMethod( + `/logs/exports${query}`, + { ...opts } + ); + return response; + } + update( + _body: LogsExportUpdateParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + const exportId = body.exportId; + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; } - download( - _body: LogsExportDownloadParams, - params?:ApiClientInterface, - opts?:RequestOptions - ): APIPromise{ - const body=_body; - const exportId=body.exportId; - if (params) { - this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } - } - const response = this.getMethod(`/logs/exports/${exportId}/download`, { body, ...opts }); - return response; + const response = this.put( + `/logs/exports/${exportId}`, + { body, ...opts } + ); + return response; + } + start( + _body: LogsExportStartParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + const exportId = body.exportId; + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; } -} \ No newline at end of file + const response = this.post( + `/logs/exports/${exportId}/start`, + { body, ...opts } + ); + return response; + } + cancel( + _body: LogsExportCancelParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + const exportId = body.exportId; + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; + } + const response = this.post( + `/logs/exports/${exportId}/cancel`, + { body, ...opts } + ); + return response; + } + download( + _body: LogsExportDownloadParams, + params?: ApiClientInterface, + opts?: RequestOptions + ): APIPromise { + const body = _body; + const exportId = body.exportId; + if (params) { + this.client.customHeaders = { + ...this.client.customHeaders, + ...createHeaders({ ...params }), + }; + } + const response = this.getMethod( + `/logs/exports/${exportId}/download`, + { body, ...opts } + ); + return response; + } +} diff --git a/src/client.ts b/src/client.ts index f6ef325..d8bda4f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -169,7 +169,7 @@ export class Portkey extends ApiClient { vectorStores: new API.VectorStores(this), chat: new API.BetaChat(this), }; - + post = ( url: string, _body: PostBodyParams,