/* tslint:disable */ /* eslint-disable */ /** * Faraday REST API * The [Faraday](https://faraday.ai) API makes it easy to predict customer behavior programmatically. See our [API change policy](https://faraday.ai/legal). * * The version of the OpenAPI document: 1.0.0 * Contact: support@faraday.ai * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import { AccountUsageSummary, DatasetIngressLog, } from '../models'; export interface GetAccountUsageRequest { accountId: string; } export interface GetDatasetIngressLogRequest { datasetId: string; logId: string; } export interface GetDatasetIngressLogsRequest { datasetId: string; limit?: number; offset?: number; } /** * */ export class ExperimentalApi extends runtime.BaseAPI { /** * Get historical usage metrics for the current account from the most recent metrics dashboard event. * Get usage metrics for current account */ async getAccountCurrentUsageRaw(): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/accounts/current/usage`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get historical usage metrics for the current account from the most recent metrics dashboard event. * Get usage metrics for current account */ async getAccountCurrentUsage(): Promise { const response = await this.getAccountCurrentUsageRaw(); return await response.value(); } /** * Get aggregated historical usage metrics for the current account and all of its sub-accounts. * Get usage metrics for current and sub accounts */ async getAccountCurrentUsageAllRaw(): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/accounts/current/usage/all`, method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get aggregated historical usage metrics for the current account and all of its sub-accounts. * Get usage metrics for current and sub accounts */ async getAccountCurrentUsageAll(): Promise { const response = await this.getAccountCurrentUsageAllRaw(); return await response.value(); } /** * Get usage metrics for a specific account */ async getAccountUsageRaw(requestParameters: GetAccountUsageRequest, ): Promise> { if (requestParameters.accountId === null || requestParameters.accountId === undefined) { throw new runtime.RequiredError('accountId','Required parameter requestParameters.accountId was null or undefined when calling getAccountUsage.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/accounts/{account_id}/usage`.replace(`{${"account_id"}}`, encodeURIComponent(String(requestParameters.accountId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get usage metrics for a specific account */ async getAccountUsage(accountId: string, ): Promise { const response = await this.getAccountUsageRaw({ accountId: accountId }, ); return await response.value(); } /** * Retrieves a specific ingress log entry for a dataset * Get a single dataset ingress log by ID */ async getDatasetIngressLogRaw(requestParameters: GetDatasetIngressLogRequest, ): Promise> { if (requestParameters.datasetId === null || requestParameters.datasetId === undefined) { throw new runtime.RequiredError('datasetId','Required parameter requestParameters.datasetId was null or undefined when calling getDatasetIngressLog.'); } if (requestParameters.logId === null || requestParameters.logId === undefined) { throw new runtime.RequiredError('logId','Required parameter requestParameters.logId was null or undefined when calling getDatasetIngressLog.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/datasets/{dataset_id}/logs/ingress/{log_id}`.replace(`{${"dataset_id"}}`, encodeURIComponent(String(requestParameters.datasetId))).replace(`{${"log_id"}}`, encodeURIComponent(String(requestParameters.logId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Retrieves a specific ingress log entry for a dataset * Get a single dataset ingress log by ID */ async getDatasetIngressLog(datasetId: string, logId: string, ): Promise { const response = await this.getDatasetIngressLogRaw({ datasetId: datasetId, logId: logId }, ); return await response.value(); } /** * Retrieves ingress metrics for a specific dataset * Get dataset ingress metrics over time */ async getDatasetIngressLogsRaw(requestParameters: GetDatasetIngressLogsRequest, ): Promise>> { if (requestParameters.datasetId === null || requestParameters.datasetId === undefined) { throw new runtime.RequiredError('datasetId','Required parameter requestParameters.datasetId was null or undefined when calling getDatasetIngressLogs.'); } const queryParameters: any = {}; if (requestParameters.limit !== undefined) { queryParameters['limit'] = requestParameters.limit; } if (requestParameters.offset !== undefined) { queryParameters['offset'] = requestParameters.offset; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("bearer", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/datasets/{dataset_id}/logs/ingress`.replace(`{${"dataset_id"}}`, encodeURIComponent(String(requestParameters.datasetId))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Retrieves ingress metrics for a specific dataset * Get dataset ingress metrics over time */ async getDatasetIngressLogs(datasetId: string, limit?: number, offset?: number, ): Promise> { const response = await this.getDatasetIngressLogsRaw({ datasetId: datasetId, limit: limit, offset: offset }, ); return await response.value(); } }