// 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 { CommitBranchRequest } from '../models/CommitBranchRequest'; import { CommitHistoryResponse } from '../models/CommitHistoryResponse'; import { CommitResponse } from '../models/CommitResponse'; import { CreateConfigRequest } from '../models/CreateConfigRequest'; import { DeleteConfigRequest } from '../models/DeleteConfigRequest'; import { DeployCommitRequest } from '../models/DeployCommitRequest'; import { DeployResponse } from '../models/DeployResponse'; import { ErrorResponse } from '../models/ErrorResponse'; import { RepoConfigObject } from '../models/RepoConfigObject'; import { RevertCommitRequest } from '../models/RevertCommitRequest'; import { RevertResponse } from '../models/RevertResponse'; import { SearchCommitsRequest } from '../models/SearchCommitsRequest'; import { SearchConfigRequest } from '../models/SearchConfigRequest'; import { UpdateConfigRequest } from '../models/UpdateConfigRequest'; import { ValidateMergeRequest } from '../models/ValidateMergeRequest'; /** * no description */ export class VersionControlApiRequestFactory extends BaseAPIRequestFactory { /** * Version: 9.2.0.cl or later Commits TML files of metadata objects to the Git branch configured on your instance. Requires at least edit access to objects used in the commit operation. Before using this endpoint to push your commits: * Enable Git integration on your instance. * Make sure the Git repository and branch details are configured on your instance. For more information, see [Git integration documentation](https://developers.thoughtspot.com/docs/git-integration). * @param commitBranchRequest */ public async commitBranch(commitBranchRequest: CommitBranchRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'commitBranchRequest' is not null or undefined if (commitBranchRequest === null || commitBranchRequest === undefined) { throw new RequiredError("VersionControlApi", "commitBranch", "commitBranchRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/branches/commit'; // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(commitBranchRequest, "CommitBranchRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Allows you to connect a ThoughtSpot instance to a Git repository. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance on your instance, the `CAN_SETUP_VERSION_CONTROL` (**Can set up version control**) privilege. You can use this API endpoint to connect your ThoughtSpot development and production environments to the development and production branches of a Git repository. Before using this endpoint to connect your ThoughtSpot instance to a Git repository, check the following prerequisites: * You have a Git repository. If you are using GitHub, make sure you have a valid account and an access token to connect ThoughtSpot to GitHub. For information about generating a token, see [GitHub Documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). * Your access token has `repo` scope that grants full access to public and private repositories. * Your Git repository has a branch that can be configured as a default branch in ThoughtSpot. For more information, see [Git integration documentation](https://developers.thoughtspot.com/docs/?pageid=git-integration). **Note**: ThoughtSpot supports only GitHub / itHub Enterprise for CI/CD. * @param createConfigRequest */ public async createConfig(createConfigRequest: CreateConfigRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'createConfigRequest' is not null or undefined if (createConfigRequest === null || createConfigRequest === undefined) { throw new RequiredError("VersionControlApi", "createConfig", "createConfigRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/config/create'; // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(createConfigRequest, "CreateConfigRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Deletes Git repository configuration from your ThoughtSpot instance. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance on your instance, the `CAN_SETUP_VERSION_CONTROL` (**Can set up version control**) privilege. * @param deleteConfigRequest */ public async deleteConfig(deleteConfigRequest: DeleteConfigRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'deleteConfigRequest' is not null or undefined if (deleteConfigRequest === null || deleteConfigRequest === undefined) { throw new RequiredError("VersionControlApi", "deleteConfig", "deleteConfigRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/config/delete'; // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(deleteConfigRequest, "DeleteConfigRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Allows you to deploy a commit and publish TML content to your ThoughtSpot instance. Requires at least edit access to the objects used in the deploy operation. The API deploys the head of the branch unless a `commit_id` is specified in the API request. If the branch name is not defined in the request, the default branch is considered for deploying commits. For more information, see [Git integration documentation](https://developers.thoughtspot.com/docs/git-integration). * @param deployCommitRequest */ public async deployCommit(deployCommitRequest: DeployCommitRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'deployCommitRequest' is not null or undefined if (deployCommitRequest === null || deployCommitRequest === undefined) { throw new RequiredError("VersionControlApi", "deployCommit", "deployCommitRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/commits/deploy'; // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(deployCommitRequest, "DeployCommitRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Reverts TML objects to a previous commit specified in the API request. Requires at least edit access to objects. In the API request, specify the `commit_id`. If the branch name is not specified in the request, the API will consider the default branch configured on your instance. By default, the API reverts all objects. If the revert operation fails for one of the objects provided in the commit, the API returns an error and does not revert any object. For more information, see [Git integration documentation](https://developers.thoughtspot.com/docs/git-integration). * @param commitId Commit id to which the object should be reverted * @param revertCommitRequest */ public async revertCommit(commitId: string, revertCommitRequest: RevertCommitRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'commitId' is not null or undefined if (commitId === null || commitId === undefined) { throw new RequiredError("VersionControlApi", "revertCommit", "commitId"); } // verify required parameter 'revertCommitRequest' is not null or undefined if (revertCommitRequest === null || revertCommitRequest === undefined) { throw new RequiredError("VersionControlApi", "revertCommit", "revertCommitRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/commits/{commit_id}/revert' .replace('{' + 'commit_id' + '}', encodeURIComponent(String(commitId))); // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(revertCommitRequest, "RevertCommitRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Gets a list of commits for a given metadata object. Requires `DATAMANAGEMENT` (**Can manage data**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance on your instance, the `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) privilege and edit access to the metadata objects. * @param searchCommitsRequest */ public async searchCommits(searchCommitsRequest: SearchCommitsRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'searchCommitsRequest' is not null or undefined if (searchCommitsRequest === null || searchCommitsRequest === undefined) { throw new RequiredError("VersionControlApi", "searchCommits", "searchCommitsRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/commits/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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(searchCommitsRequest, "SearchCommitsRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Gets Git repository connections configured on the ThoughtSpot instance. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance on your instance, the `CAN_SETUP_VERSION_CONTROL` (**Can set up version control**) privilege. * @param searchConfigRequest */ public async searchConfig(searchConfigRequest: SearchConfigRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'searchConfigRequest' is not null or undefined if (searchConfigRequest === null || searchConfigRequest === undefined) { throw new RequiredError("VersionControlApi", "searchConfig", "searchConfigRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/config/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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(searchConfigRequest, "SearchConfigRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Updates Git repository configuration settings. Requires `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance on your instance, the `CAN_SETUP_VERSION_CONTROL` (**Can set up version control**) privilege. * @param updateConfigRequest */ public async updateConfig(updateConfigRequest: UpdateConfigRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'updateConfigRequest' is not null or undefined if (updateConfigRequest === null || updateConfigRequest === undefined) { throw new RequiredError("VersionControlApi", "updateConfig", "updateConfigRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/config/update'; // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(updateConfigRequest, "UpdateConfigRequest", ""), contentType ); requestContext.setBody(serializedBody); 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.2.0.cl or later Validates the content of your source branch against the objects in your destination environment. Before merging content from your source branch to the destination branch, run this API operation from your destination environment and ensure that the changes from the source branch function in the destination environment. Requires `DATAMANAGEMENT` (**Can manage data**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance on your instance, the `CAN_MANAGE_WORKSHEET_VIEWS_TABLES` (**Can manage data models**) privilege and edit access to the metadata objects. * @param validateMergeRequest */ public async validateMerge(validateMergeRequest: ValidateMergeRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'validateMergeRequest' is not null or undefined if (validateMergeRequest === null || validateMergeRequest === undefined) { throw new RequiredError("VersionControlApi", "validateMerge", "validateMergeRequest"); } // Path Params const localVarPath = '/api/rest/2.0/vcs/git/branches/validate'; // 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") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(validateMergeRequest, "ValidateMergeRequest", ""), contentType ); requestContext.setBody(serializedBody); 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 VersionControlApiResponseProcessor { /** * 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 commitBranch * @throws ApiException if the response code was not in [200, 299] */ public async commitBranch(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: CommitResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "CommitResponse", "" ) as CommitResponse; 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: CommitResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "CommitResponse", "" ) as CommitResponse; 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 createConfig * @throws ApiException if the response code was not in [200, 299] */ public async createConfig(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: RepoConfigObject = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RepoConfigObject", "" ) as RepoConfigObject; 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: RepoConfigObject = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RepoConfigObject", "" ) as RepoConfigObject; 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 deleteConfig * @throws ApiException if the response code was not in [200, 299] */ public async deleteConfig(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 deployCommit * @throws ApiException if the response code was not in [200, 299] */ public async deployCommit(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 revertCommit * @throws ApiException if the response code was not in [200, 299] */ public async revertCommit(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: RevertResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RevertResponse", "" ) as RevertResponse; 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: RevertResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RevertResponse", "" ) as RevertResponse; 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 searchCommits * @throws ApiException if the response code was not in [200, 299] */ public async searchCommits(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 searchConfig * @throws ApiException if the response code was not in [200, 299] */ public async searchConfig(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 updateConfig * @throws ApiException if the response code was not in [200, 299] */ public async updateConfig(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: RepoConfigObject = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RepoConfigObject", "" ) as RepoConfigObject; 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: RepoConfigObject = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RepoConfigObject", "" ) as RepoConfigObject; 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 validateMerge * @throws ApiException if the response code was not in [200, 299] */ public async validateMerge(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); } }