// TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; import {SecurityAuthentication} from '../auth/auth'; import { DbtSearchResponse } from '../models/DbtSearchResponse'; import { ErrorResponse } from '../models/ErrorResponse'; /** * no description */ export class DBTApiRequestFactory extends BaseAPIRequestFactory { /** * Version: 9.9.0.cl or later Creates a DBT connection object in ThoughtSpot. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege or `DATAMANAGEMENT` (**Can manage data**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the following Data control privileges may be required: - `CAN_MANAGE_CUSTOM_CALENDAR`(**Can manage custom calendars**) - `CAN_CREATE_OR_EDIT_CONNECTIONS` (**Can create/edit Connections**) - `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) #### About create DBT connection DBT connection in ThoughtSpot is used by the user to define DBT credentials for cloud . The API needs embrace connection, embrace database name, DBT url, import type, DBT account identifier, DBT project identifier, DBT access token and environment details (or) embrace connection, embrace database name, import type, file_content to create a connection object. To know more about DBT, see ThoughtSpot Product Documentation. * @param connectionName Name of the connection. * @param databaseName Name of the Database. * @param importType Mention type of Import * @param accessToken Access token is mandatory when Import_Type is DBT_CLOUD. * @param dbtUrl DBT URL is mandatory when Import_Type is DBT_CLOUD. * @param accountId Account ID is mandatory when Import_Type is DBT_CLOUD * @param projectId Project ID is mandatory when Import_Type is DBT_CLOUD * @param dbtEnvId DBT Environment ID\\\" * @param projectName Name of the project * @param fileContent Upload DBT Manifest and Catalog artifact files as a ZIP file. This field is Mandatory when Import Type is \\\'ZIP_FILE\\\' */ public async dbtConnection(connectionName: string, databaseName: string, importType?: string, accessToken?: string, dbtUrl?: string, accountId?: string, projectId?: string, dbtEnvId?: string, projectName?: string, fileContent?: HttpFile, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'connectionName' is not null or undefined if (connectionName === null || connectionName === undefined) { throw new RequiredError("DBTApi", "dbtConnection", "connectionName"); } // verify required parameter 'databaseName' is not null or undefined if (databaseName === null || databaseName === undefined) { throw new RequiredError("DBTApi", "dbtConnection", "databaseName"); } // Path Params const localVarPath = '/api/rest/2.0/dbt/dbt-connection'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Form Params const useForm = canConsumeForm([ 'multipart/form-data', ]); let localVarFormParams if (useForm) { localVarFormParams = new FormData(); } else { localVarFormParams = new URLSearchParams(); } if (connectionName !== undefined) { // TODO: replace .append with .set localVarFormParams.append('connection_name', connectionName as any); } if (databaseName !== undefined) { // TODO: replace .append with .set localVarFormParams.append('database_name', databaseName as any); } if (importType !== undefined) { // TODO: replace .append with .set localVarFormParams.append('import_type', importType as any); } if (accessToken !== undefined) { // TODO: replace .append with .set localVarFormParams.append('access_token', accessToken as any); } if (dbtUrl !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_url', dbtUrl as any); } if (accountId !== undefined) { // TODO: replace .append with .set localVarFormParams.append('account_id', accountId as any); } if (projectId !== undefined) { // TODO: replace .append with .set localVarFormParams.append('project_id', projectId as any); } if (dbtEnvId !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_env_id', dbtEnvId as any); } if (projectName !== undefined) { // TODO: replace .append with .set localVarFormParams.append('project_name', projectName as any); } if (fileContent !== undefined) { // TODO: replace .append with .set if (localVarFormParams instanceof FormData) { localVarFormParams.append('file_content', fileContent, fileContent.name); } } requestContext.setBody(localVarFormParams); if(!useForm) { const contentType = ObjectSerializer.getPreferredMediaType([ "multipart/form-data" ]); requestContext.setHeaderParam("Content-Type", contentType); } let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 9.9.0.cl or later Resynchronize the existing list of models, tables, worksheet tml’s and import them to Thoughtspot based on the DBT connection object. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege or `DATAMANAGEMENT` (**Can manage data**) privilege, along with an existing DBT connection. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the following data control privileges may be required: - `CAN_MANAGE_CUSTOM_CALENDAR`(**Can manage custom calendars**) - `CAN_CREATE_OR_EDIT_CONNECTIONS` (**Can create/edit Connections**) - `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) * @param dbtConnectionIdentifier Unique ID of the DBT connection. * @param fileContent Upload DBT Manifest and Catalog artifact files as a ZIP file. This field is mandatory if the connection was created with import_type ‘ZIP_FILE’ */ public async dbtGenerateSyncTml(dbtConnectionIdentifier: string, fileContent?: HttpFile, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'dbtConnectionIdentifier' is not null or undefined if (dbtConnectionIdentifier === null || dbtConnectionIdentifier === undefined) { throw new RequiredError("DBTApi", "dbtGenerateSyncTml", "dbtConnectionIdentifier"); } // Path Params const localVarPath = '/api/rest/2.0/dbt/generate-sync-tml'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Form Params const useForm = canConsumeForm([ 'multipart/form-data', ]); let localVarFormParams if (useForm) { localVarFormParams = new FormData(); } else { localVarFormParams = new URLSearchParams(); } if (dbtConnectionIdentifier !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_connection_identifier', dbtConnectionIdentifier as any); } if (fileContent !== undefined) { // TODO: replace .append with .set if (localVarFormParams instanceof FormData) { localVarFormParams.append('file_content', fileContent, fileContent.name); } } requestContext.setBody(localVarFormParams); if(!useForm) { const contentType = ObjectSerializer.getPreferredMediaType([ "multipart/form-data" ]); requestContext.setHeaderParam("Content-Type", contentType); } let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 9.9.0.cl or later Generate required table and worksheet and import them. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege or `DATAMANAGEMENT` (**Can manage data**) privilege, along with an existing DBT connection. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the following data control privileges may be required: - `CAN_MANAGE_CUSTOM_CALENDAR`(**Can manage custom calendars**) - `CAN_CREATE_OR_EDIT_CONNECTIONS` (**Can create/edit Connections**) - `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) #### About generate TML Models and Worksheets to be imported can be selected by the user as part of the API. * @param dbtConnectionIdentifier Unique ID of the DBT connection. * @param modelTables List of Models and their respective Tables Example: \\\'[{\\\"model_name\\\": \\\"model_name\\\", \\\"tables\\\": [\\\"table_name\\\"]}]\\\' * @param importWorksheets Mention the worksheet tmls to import * @param worksheets List of worksheets is mandatory when import_Worksheets is type SELECTED Example: [\\\"worksheet_name\\\"] * @param fileContent Upload DBT Manifest and Catalog artifact files as a ZIP file. This field is mandatory if the connection was created with import_type ‘ZIP_FILE’ */ public async dbtGenerateTml(dbtConnectionIdentifier: string, modelTables: string, importWorksheets: string, worksheets?: string, fileContent?: HttpFile, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'dbtConnectionIdentifier' is not null or undefined if (dbtConnectionIdentifier === null || dbtConnectionIdentifier === undefined) { throw new RequiredError("DBTApi", "dbtGenerateTml", "dbtConnectionIdentifier"); } // verify required parameter 'modelTables' is not null or undefined if (modelTables === null || modelTables === undefined) { throw new RequiredError("DBTApi", "dbtGenerateTml", "modelTables"); } // verify required parameter 'importWorksheets' is not null or undefined if (importWorksheets === null || importWorksheets === undefined) { throw new RequiredError("DBTApi", "dbtGenerateTml", "importWorksheets"); } // Path Params const localVarPath = '/api/rest/2.0/dbt/generate-tml'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Form Params const useForm = canConsumeForm([ 'multipart/form-data', ]); let localVarFormParams if (useForm) { localVarFormParams = new FormData(); } else { localVarFormParams = new URLSearchParams(); } if (dbtConnectionIdentifier !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_connection_identifier', dbtConnectionIdentifier as any); } if (modelTables !== undefined) { // TODO: replace .append with .set localVarFormParams.append('model_tables', modelTables as any); } if (importWorksheets !== undefined) { // TODO: replace .append with .set localVarFormParams.append('import_worksheets', importWorksheets as any); } if (worksheets !== undefined) { // TODO: replace .append with .set localVarFormParams.append('worksheets', worksheets as any); } if (fileContent !== undefined) { // TODO: replace .append with .set if (localVarFormParams instanceof FormData) { localVarFormParams.append('file_content', fileContent, fileContent.name); } } requestContext.setBody(localVarFormParams); if(!useForm) { const contentType = ObjectSerializer.getPreferredMediaType([ "multipart/form-data" ]); requestContext.setHeaderParam("Content-Type", contentType); } let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 9.9.0.cl or later Gets a list of DBT connection objects by user and organization, available on the ThoughtSpot system. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege or `DATAMANAGEMENT` (**Can manage data**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the following Data control privileges may be required: - `CAN_MANAGE_CUSTOM_CALENDAR`(**Can manage custom calendars**) - `CAN_CREATE_OR_EDIT_CONNECTIONS` (**Can create/edit Connections**) - `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) #### About search DBT connection To get details of a specific DBT connection identifier, database connection identifier, database connection name, database name, project name, project identifier, environment identifier , import type and author. */ public async dbtSearch(_options?: Configuration): Promise { let _config = _options || this.configuration; // Path Params const localVarPath = '/api/rest/2.0/dbt/search'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 9.9.0.cl or later Removes the specified DBT connection object from the ThoughtSpot system. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) or `DATAMANAGEMENT` (**Can manage data ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the following Data control privileges may be required: - `CAN_MANAGE_CUSTOM_CALENDAR`(**Can manage custom calendars**) - `CAN_CREATE_OR_EDIT_CONNECTIONS` (**Can create/edit Connections**) - `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) * @param dbtConnectionIdentifier Unique ID of the DBT Connection. */ public async deleteDbtConnection(dbtConnectionIdentifier: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'dbtConnectionIdentifier' is not null or undefined if (dbtConnectionIdentifier === null || dbtConnectionIdentifier === undefined) { throw new RequiredError("DBTApi", "deleteDbtConnection", "dbtConnectionIdentifier"); } // Path Params const localVarPath = '/api/rest/2.0/dbt/{dbt_connection_identifier}/delete' .replace('{' + 'dbt_connection_identifier' + '}', encodeURIComponent(String(dbtConnectionIdentifier))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 9.9.0.cl or later Updates a DBT connection object. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege or `DATAMANAGEMENT` (**Can manage data ThoughtSpot**) privilege, along with an existing DBT connection. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the following data control privileges may be required: - `CAN_MANAGE_CUSTOM_CALENDAR`(**Can manage custom calendars**) - `CAN_CREATE_OR_EDIT_CONNECTIONS` (**Can create/edit Connections**) - `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) #### About update DBT connection You can modify DBT connection object properties such as embrace connection name, embrace database name, import type, account identifier, access token, project identifier and environment (or) embrace connection, embrace database name, import type, file_content settings. * @param dbtConnectionIdentifier Unique ID of the DBT Connection. * @param connectionName Name of the connection. * @param databaseName Name of the Database. * @param importType Mention type of Import * @param accessToken Access token is mandatory when Import_Type is DBT_CLOUD. * @param dbtUrl DBT URL is mandatory when Import_Type is DBT_CLOUD. * @param accountId Account ID is mandatory when Import_Type is DBT_CLOUD * @param projectId Project ID is mandatory when Import_Type is DBT_CLOUD * @param dbtEnvId DBT Environment ID\\\" * @param projectName Name of the project * @param fileContent Upload DBT Manifest and Catalog artifact files as a ZIP file. This field is Mandatory when Import Type is \\\'ZIP_FILE\\\' */ public async updateDbtConnection(dbtConnectionIdentifier: string, connectionName?: string, databaseName?: string, importType?: string, accessToken?: string, dbtUrl?: string, accountId?: string, projectId?: string, dbtEnvId?: string, projectName?: string, fileContent?: HttpFile, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'dbtConnectionIdentifier' is not null or undefined if (dbtConnectionIdentifier === null || dbtConnectionIdentifier === undefined) { throw new RequiredError("DBTApi", "updateDbtConnection", "dbtConnectionIdentifier"); } // Path Params const localVarPath = '/api/rest/2.0/dbt/update-dbt-connection'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Form Params const useForm = canConsumeForm([ 'multipart/form-data', ]); let localVarFormParams if (useForm) { localVarFormParams = new FormData(); } else { localVarFormParams = new URLSearchParams(); } if (dbtConnectionIdentifier !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_connection_identifier', dbtConnectionIdentifier as any); } if (connectionName !== undefined) { // TODO: replace .append with .set localVarFormParams.append('connection_name', connectionName as any); } if (databaseName !== undefined) { // TODO: replace .append with .set localVarFormParams.append('database_name', databaseName as any); } if (importType !== undefined) { // TODO: replace .append with .set localVarFormParams.append('import_type', importType as any); } if (accessToken !== undefined) { // TODO: replace .append with .set localVarFormParams.append('access_token', accessToken as any); } if (dbtUrl !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_url', dbtUrl as any); } if (accountId !== undefined) { // TODO: replace .append with .set localVarFormParams.append('account_id', accountId as any); } if (projectId !== undefined) { // TODO: replace .append with .set localVarFormParams.append('project_id', projectId as any); } if (dbtEnvId !== undefined) { // TODO: replace .append with .set localVarFormParams.append('dbt_env_id', dbtEnvId as any); } if (projectName !== undefined) { // TODO: replace .append with .set localVarFormParams.append('project_name', projectName as any); } if (fileContent !== undefined) { // TODO: replace .append with .set if (localVarFormParams instanceof FormData) { localVarFormParams.append('file_content', fileContent, fileContent.name); } } requestContext.setBody(localVarFormParams); if(!useForm) { const contentType = ObjectSerializer.getPreferredMediaType([ "multipart/form-data" ]); requestContext.setHeaderParam("Content-Type", contentType); } let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } } export class DBTApiResponseProcessor { /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to dbtConnection * @throws ApiException if the response code was not in [200, 299] */ public async dbtConnection(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Forbidden access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to dbtGenerateSyncTml * @throws ApiException if the response code was not in [200, 299] */ public async dbtGenerateSyncTml(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Forbidden access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to dbtGenerateTml * @throws ApiException if the response code was not in [200, 299] */ public async dbtGenerateTml(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Forbidden access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to dbtSearch * @throws ApiException if the response code was not in [200, 299] */ public async dbtSearch(response: ResponseContext): Promise > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Forbidden access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to deleteDbtConnection * @throws ApiException if the response code was not in [200, 299] */ public async deleteDbtConnection(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("204", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Forbidden access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to updateDbtConnection * @throws ApiException if the response code was not in [200, 299] */ public async updateDbtConnection(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Forbidden access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: any = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "any", "" ) as any; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } }