Skip to content

Instantly share code, notes, and snippets.

@moorthi07
Last active May 21, 2025 00:13
Show Gist options
  • Save moorthi07/70b3962a09c5d9293076251e840e33e2 to your computer and use it in GitHub Desktop.
Save moorthi07/70b3962a09c5d9293076251e840e33e2 to your computer and use it in GitHub Desktop.
Harness RepositoryApi access
import { RepositoryApi } from './api/repositoryApi';
import * as fs from 'fs';
import * as path from 'path';
async function pushFolderToRepo(
repoRef: string,
folderPath: string,
basePath: string,
accessToken: string
): Promise<void> {
const repositoryApi = new RepositoryApi(basePath);
repositoryApi.accessToken = accessToken;
try {
console.log(`Checking if repository '${repoRef}' exists...`);
await repositoryApi.findRepository(repoRef);
console.log(`Repository '${repoRef}' exists.`);
// Check if the folder exists locally
if (!fs.existsSync(folderPath)) {
throw new Error(`Folder '${folderPath}' does not exist.`);
}
// Stage changes using the API
// console.log('Staging changes...');
// const files = fs.readdirSync(folderPath).map((file) => path.join(folderPath, file));
// await repositoryApi.stageFiles(repoRef, files);
// console.log('Files staged successfully.');
// Commit changes using the API
console.log('Committing changes...');
await repositoryApi.commitFiles(repoRef, {
message: 'Pushing folder to repository',
author: { name: 'pvmoorthi', email: '[email protected]' },
});
console.log('Changes committed successfully.');
// Push changes using the API
// console.log('Pushing changes to the repository...');
// await repositoryApi.push(repoRef);
// console.log(`Successfully pushed folder '${folderPath}' to repository '${repoRef}'.`);
} catch (error: any) {
if (error.response && error.response.statusCode === 404) {
console.error(`Repository '${repoRef}' does not exist.`);
} else {
console.error(`Failed to push folder to repository: ${error.message}`);
}
}
}
// Example usage
(async () => {
const repoRef = 'camerascii';
const folderPath = '/Users/admin/workSpace/camerascii';
const basePath = 'http://localhost:3000/git/test-api/camerascii';
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCIpXVCJ9.eyJleHAiOjE3NTAzMDkyNjEsImlhdCI6MTc0NzcxNzI2MSwiaXNzIjoiR2l0bmVzcyIsInBpZCI6NCwidGtuIjp7InR5cCI6InBhdCIsImlkIjozfX0.r8ftrdxcBtdeFfPLpstazVdqHHH1wzGXJEDPIyOVi-Y';
await pushFolderToRepo(repoRef, folderPath, basePath, accessToken);
})();
RepositoryApiApi.ts
/**
* API Specification
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 3.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { ApiFileDiffRequest } from '../model/apiFileDiffRequest';
import { DefineRepoLabelRequest } from '../model/defineRepoLabelRequest';
import { DefineRepoLabelValueRequest } from '../model/defineRepoLabelValueRequest';
import { GitBlamePart } from '../model/gitBlamePart';
import { GitFileDiff } from '../model/gitFileDiff';
import { ImportRepositoryRequest } from '../model/importRepositoryRequest';
import { OpenapiCalculateCommitDivergenceRequest } from '../model/openapiCalculateCommitDivergenceRequest';
import { OpenapiCommitFilesRequest } from '../model/openapiCommitFilesRequest';
import { OpenapiCreateBranchRequest } from '../model/openapiCreateBranchRequest';
import { OpenapiCreateRepositoryRequest } from '../model/openapiCreateRepositoryRequest';
import { OpenapiCreateTagRequest } from '../model/openapiCreateTagRequest';
import { OpenapiGeneralSettingsRequest } from '../model/openapiGeneralSettingsRequest';
import { OpenapiGetContentOutput } from '../model/openapiGetContentOutput';
import { OpenapiMoveRepoRequest } from '../model/openapiMoveRepoRequest';
import { OpenapiPathsDetailsRequest } from '../model/openapiPathsDetailsRequest';
import { OpenapiRestoreRequest } from '../model/openapiRestoreRequest';
import { OpenapiRule } from '../model/openapiRule';
import { OpenapiSecuritySettingsRequest } from '../model/openapiSecuritySettingsRequest';
import { OpenapiUpdateDefaultBranchRequest } from '../model/openapiUpdateDefaultBranchRequest';
import { OpenapiUpdateRepoPublicAccessRequest } from '../model/openapiUpdateRepoPublicAccessRequest';
import { OpenapiUpdateRepoRequest } from '../model/openapiUpdateRepoRequest';
import { RebaseBranchRequest } from '../model/rebaseBranchRequest';
import { RepoCommitTag } from '../model/repoCommitTag';
import { RepoListPathsOutput } from '../model/repoListPathsOutput';
import { RepoMergeCheck } from '../model/repoMergeCheck';
import { RepoPathsDetailsOutput } from '../model/repoPathsDetailsOutput';
import { RepoRepositoryOutput } from '../model/repoRepositoryOutput';
import { RepoRuleAddRequest } from '../model/repoRuleAddRequest';
import { RepoRuleUpdateRequest } from '../model/repoRuleUpdateRequest';
import { RepoSoftDeleteResponse } from '../model/repoSoftDeleteResponse';
import { ReposettingsGeneralSettings } from '../model/reposettingsGeneralSettings';
import { ReposettingsSecuritySettings } from '../model/reposettingsSecuritySettings';
import { SaveRepoLabelRequest } from '../model/saveRepoLabelRequest';
import { SquashBranchRequest } from '../model/squashBranchRequest';
import { TypesBranchExtended } from '../model/typesBranchExtended';
import { TypesCommit } from '../model/typesCommit';
import { TypesCommitDivergence } from '../model/typesCommitDivergence';
import { TypesCommitFilesResponse } from '../model/typesCommitFilesResponse';
import { TypesCreateBranchOutput } from '../model/typesCreateBranchOutput';
import { TypesDeleteBranchOutput } from '../model/typesDeleteBranchOutput';
import { TypesDiffStats } from '../model/typesDiffStats';
import { TypesLabel } from '../model/typesLabel';
import { TypesLabelValue } from '../model/typesLabelValue';
import { TypesLabelWithValues } from '../model/typesLabelWithValues';
import { TypesListCommitResponse } from '../model/typesListCommitResponse';
import { TypesMergeViolations } from '../model/typesMergeViolations';
import { TypesRebaseResponse } from '../model/typesRebaseResponse';
import { TypesRepositorySummary } from '../model/typesRepositorySummary';
import { TypesRulesViolations } from '../model/typesRulesViolations';
import { TypesServiceAccount } from '../model/typesServiceAccount';
import { TypesSquashResponse } from '../model/typesSquashResponse';
import { UsererrorError } from '../model/usererrorError';
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
import { HttpError, RequestFile } from './apis';
let defaultBasePath = '/api/v1';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
export enum RepositoryApiApiKeys {
}
export class RepositoryApi {
protected _basePath = defaultBasePath;
protected _defaultHeaders : any = {};
protected _useQuerystring : boolean = false;
protected authentications = {
'default': <Authentication>new VoidAuth(),
'bearerAuth': new HttpBearerAuth(),
}
protected interceptors: Interceptor[] = [];
constructor(basePath?: string);
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
set useQuerystring(value: boolean) {
this._useQuerystring = value;
}
set basePath(basePath: string) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders: any) {
this._defaultHeaders = defaultHeaders;
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
public setDefaultAuthentication(auth: Authentication) {
this.authentications.default = auth;
}
public setApiKey(key: RepositoryApiApiKeys, value: string) {
(this.authentications as any)[RepositoryApiApiKeys[key]].apiKey = value;
}
set accessToken(accessToken: string | (() => string)) {
this.authentications.bearerAuth.accessToken = accessToken;
}
public addInterceptor(interceptor: Interceptor) {
this.interceptors.push(interceptor);
}
/**
*
* @param repoRef
* @param gitRef
* @param format
* @param path Without an optional path parameter, all files and subdirectories of the current working directory are included in the archive. If one or more paths are specified, only these are included.
* @param prefix Prepend &lt;prefix&gt;/ to paths in the archive.
* @param attributes Look for attributes in .gitattributes files in the working tree as well
* @param time Set modification time of archive entries. Without this option the committer time is used if &lt;tree-ish&gt; is a commit or tag, and the current time if it is a tree.
* @param compression Specify compression level. Larger values allow the command to spend more time to compress to smaller size.
*/
public async archive (repoRef: string, gitRef: string, format: string, path?: Array<string>, prefix?: string, attributes?: string, time?: string, compression?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: string; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/archive/{git_ref}.{format}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'git_ref' + '}', encodeURIComponent(String(gitRef)))
.replace('{' + 'format' + '}', encodeURIComponent(String(format)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/gzip', 'application/tar', 'application/zip', 'application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling archive.');
}
// verify required parameter 'gitRef' is not null or undefined
if (gitRef === null || gitRef === undefined) {
throw new Error('Required parameter gitRef was null or undefined when calling archive.');
}
// verify required parameter 'format' is not null or undefined
if (format === null || format === undefined) {
throw new Error('Required parameter format was null or undefined when calling archive.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = ObjectSerializer.serialize(path, "Array<string>");
}
if (prefix !== undefined) {
localVarQueryParameters['prefix'] = ObjectSerializer.serialize(prefix, "string");
}
if (attributes !== undefined) {
localVarQueryParameters['attributes'] = ObjectSerializer.serialize(attributes, "string");
}
if (time !== undefined) {
localVarQueryParameters['time'] = ObjectSerializer.serialize(time, "string");
}
if (compression !== undefined) {
localVarQueryParameters['compression'] = ObjectSerializer.serialize(compression, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: string; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "string");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiCalculateCommitDivergenceRequest
*/
public async calculateCommitDivergence (repoRef: string, openapiCalculateCommitDivergenceRequest?: OpenapiCalculateCommitDivergenceRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<TypesCommitDivergence>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/commits/calculate-divergence'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling calculateCommitDivergence.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiCalculateCommitDivergenceRequest, "OpenapiCalculateCommitDivergenceRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<TypesCommitDivergence>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<TypesCommitDivergence>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
*/
public async codeOwnersValidate (repoRef: string, gitRef?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/codeowners/validate'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling codeOwnersValidate.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiCommitFilesRequest
*/
public async commitFiles (repoRef: string, openapiCommitFilesRequest?: OpenapiCommitFilesRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesCommitFilesResponse; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/commits'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling commitFiles.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiCommitFilesRequest, "OpenapiCommitFilesRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesCommitFilesResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesCommitFilesResponse");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiCreateBranchRequest
*/
public async createBranch (repoRef: string, openapiCreateBranchRequest?: OpenapiCreateBranchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesCreateBranchOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/branches'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling createBranch.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiCreateBranchRequest, "OpenapiCreateBranchRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesCreateBranchOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesCreateBranchOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param spacePath path of parent space (Not needed in standalone).
* @param openapiCreateRepositoryRequest
*/
public async createRepository (spacePath?: string, openapiCreateRepositoryRequest?: OpenapiCreateRepositoryRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
if (spacePath !== undefined) {
localVarQueryParameters['space_path'] = ObjectSerializer.serialize(spacePath, "string");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiCreateRepositoryRequest, "OpenapiCreateRepositoryRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiCreateTagRequest
*/
public async createTag (repoRef: string, openapiCreateTagRequest?: OpenapiCreateTagRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoCommitTag; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/tags'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling createTag.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiCreateTagRequest, "OpenapiCreateTagRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoCommitTag; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoCommitTag");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param defineRepoLabelRequest
*/
public async defineRepoLabel (repoRef: string, defineRepoLabelRequest?: DefineRepoLabelRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesLabel; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling defineRepoLabel.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(defineRepoLabelRequest, "DefineRepoLabelRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesLabel; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesLabel");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param key
* @param defineRepoLabelValueRequest
*/
public async defineRepoLabelValue (repoRef: string, key: string, defineRepoLabelValueRequest?: DefineRepoLabelValueRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesLabelValue; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels/{key}/values'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'key' + '}', encodeURIComponent(String(key)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling defineRepoLabelValue.');
}
// verify required parameter 'key' is not null or undefined
if (key === null || key === undefined) {
throw new Error('Required parameter key was null or undefined when calling defineRepoLabelValue.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(defineRepoLabelValueRequest, "DefineRepoLabelValueRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesLabelValue; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesLabelValue");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param branchName
* @param bypassRules Bypass rule violations if possible.
* @param dryRunRules Dry run rules for operations
*/
public async deleteBranch (repoRef: string, branchName: string, bypassRules?: boolean, dryRunRules?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesDeleteBranchOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/branches/{branch_name}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'branch_name' + '}', encodeURIComponent(String(branchName)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling deleteBranch.');
}
// verify required parameter 'branchName' is not null or undefined
if (branchName === null || branchName === undefined) {
throw new Error('Required parameter branchName was null or undefined when calling deleteBranch.');
}
if (bypassRules !== undefined) {
localVarQueryParameters['bypass_rules'] = ObjectSerializer.serialize(bypassRules, "boolean");
}
if (dryRunRules !== undefined) {
localVarQueryParameters['dry_run_rules'] = ObjectSerializer.serialize(dryRunRules, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesDeleteBranchOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesDeleteBranchOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param key
*/
public async deleteRepoLabel (repoRef: string, key: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels/{key}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'key' + '}', encodeURIComponent(String(key)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling deleteRepoLabel.');
}
// verify required parameter 'key' is not null or undefined
if (key === null || key === undefined) {
throw new Error('Required parameter key was null or undefined when calling deleteRepoLabel.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param key
* @param value
*/
public async deleteRepoLabelValue (repoRef: string, key: string, value: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels/{key}/values/{value}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'key' + '}', encodeURIComponent(String(key)))
.replace('{' + 'value' + '}', encodeURIComponent(String(value)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling deleteRepoLabelValue.');
}
// verify required parameter 'key' is not null or undefined
if (key === null || key === undefined) {
throw new Error('Required parameter key was null or undefined when calling deleteRepoLabelValue.');
}
// verify required parameter 'value' is not null or undefined
if (value === null || value === undefined) {
throw new Error('Required parameter value was null or undefined when calling deleteRepoLabelValue.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
*/
public async deleteRepository (repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoSoftDeleteResponse; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling deleteRepository.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoSoftDeleteResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoSoftDeleteResponse");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param tagName
* @param bypassRules Bypass rule violations if possible.
*/
public async deleteTag (repoRef: string, tagName: string, bypassRules?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/tags/{tag_name}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'tag_name' + '}', encodeURIComponent(String(tagName)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling deleteTag.');
}
// verify required parameter 'tagName' is not null or undefined
if (tagName === null || tagName === undefined) {
throw new Error('Required parameter tagName was null or undefined when calling deleteTag.');
}
if (bypassRules !== undefined) {
localVarQueryParameters['bypass_rules'] = ObjectSerializer.serialize(bypassRules, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param range
* @param path provide path for diff operation
*/
public async diffStats (repoRef: string, range: string, path?: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesDiffStats; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/diff-stats/{range}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'range' + '}', encodeURIComponent(String(range)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling diffStats.');
}
// verify required parameter 'range' is not null or undefined
if (range === null || range === undefined) {
throw new Error('Required parameter range was null or undefined when calling diffStats.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = ObjectSerializer.serialize(path, "Array<string>");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesDiffStats; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesDiffStats");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
*/
public async findGeneralSettings (repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ReposettingsGeneralSettings; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/settings/general'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling findGeneralSettings.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: ReposettingsGeneralSettings; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "ReposettingsGeneralSettings");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
*/
public async findRepository (repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling findRepository.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
*/
public async findSecuritySettings (repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ReposettingsSecuritySettings; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/settings/security'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling findSecuritySettings.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: ReposettingsSecuritySettings; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "ReposettingsSecuritySettings");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param path
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
* @param lineFrom Line number from which the file data is considered
* @param lineTo Line number to which the file data is considered
*/
public async getBlame (repoRef: string, path: string, gitRef?: string, lineFrom?: number, lineTo?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<GitBlamePart>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/blame/{path}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling getBlame.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling getBlame.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
if (lineFrom !== undefined) {
localVarQueryParameters['line_from'] = ObjectSerializer.serialize(lineFrom, "number");
}
if (lineTo !== undefined) {
localVarQueryParameters['line_to'] = ObjectSerializer.serialize(lineTo, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<GitBlamePart>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<GitBlamePart>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param branchName
* @param includeChecks If true, the summary of check for the branch commit SHA would be included in the response.
* @param includeRules If true, a list of rules that apply to this branch would be included in the response.
* @param includePullreqs If true, a list of pull requests from the branch would be included in the response.
* @param maxDivergence If greater than zero, branch divergence from the default branch will be included in the response. The divergence would be calculated up the this many commits.
*/
public async getBranch (repoRef: string, branchName: string, includeChecks?: boolean, includeRules?: boolean, includePullreqs?: boolean, maxDivergence?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesBranchExtended; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/branches/{branch_name}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'branch_name' + '}', encodeURIComponent(String(branchName)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling getBranch.');
}
// verify required parameter 'branchName' is not null or undefined
if (branchName === null || branchName === undefined) {
throw new Error('Required parameter branchName was null or undefined when calling getBranch.');
}
if (includeChecks !== undefined) {
localVarQueryParameters['include_checks'] = ObjectSerializer.serialize(includeChecks, "boolean");
}
if (includeRules !== undefined) {
localVarQueryParameters['include_rules'] = ObjectSerializer.serialize(includeRules, "boolean");
}
if (includePullreqs !== undefined) {
localVarQueryParameters['include_pullreqs'] = ObjectSerializer.serialize(includePullreqs, "boolean");
}
if (maxDivergence !== undefined) {
localVarQueryParameters['max_divergence'] = ObjectSerializer.serialize(maxDivergence, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesBranchExtended; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesBranchExtended");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param commitSha
*/
public async getCommit (repoRef: string, commitSha: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesCommit; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/commits/{commit_sha}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'commit_sha' + '}', encodeURIComponent(String(commitSha)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling getCommit.');
}
// verify required parameter 'commitSha' is not null or undefined
if (commitSha === null || commitSha === undefined) {
throw new Error('Required parameter commitSha was null or undefined when calling getCommit.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesCommit; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesCommit");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param commitSha
*/
public async getCommitDiff (repoRef: string, commitSha: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: string; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/commits/{commit_sha}/diff'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'commit_sha' + '}', encodeURIComponent(String(commitSha)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['text/plain', 'application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling getCommitDiff.');
}
// verify required parameter 'commitSha' is not null or undefined
if (commitSha === null || commitSha === undefined) {
throw new Error('Required parameter commitSha was null or undefined when calling getCommitDiff.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: string; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "string");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param path
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
* @param includeCommit Indicates whether optional commit information should be included in the response.
* @param flattenDirectories Flatten directories that contain just one subdirectory.
*/
public async getContent (repoRef: string, path: string, gitRef?: string, includeCommit?: boolean, flattenDirectories?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: OpenapiGetContentOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/content/{path}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling getContent.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling getContent.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
if (includeCommit !== undefined) {
localVarQueryParameters['include_commit'] = ObjectSerializer.serialize(includeCommit, "boolean");
}
if (flattenDirectories !== undefined) {
localVarQueryParameters['flatten_directories'] = ObjectSerializer.serialize(flattenDirectories, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: OpenapiGetContentOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "OpenapiGetContentOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param path
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
*/
public async getRaw (repoRef: string, path: string, gitRef?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/raw/{path}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling getRaw.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling getRaw.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param spacePath path of parent space (Not needed in standalone).
* @param importRepositoryRequest
*/
public async importRepository (spacePath?: string, importRepositoryRequest?: ImportRepositoryRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/import';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
if (spacePath !== undefined) {
localVarQueryParameters['space_path'] = ObjectSerializer.serialize(spacePath, "string");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(importRepositoryRequest, "ImportRepositoryRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param query The substring by which the branches are filtered.
* @param order The order of the output.
* @param sort The data by which the branches are sorted.
* @param page The page to return.
* @param limit The maximum number of results to return.
* @param includeCommit Indicates whether optional commit information should be included in the response.
* @param includeChecks If true, the summary of check for the branch commit SHA would be included in the response.
* @param includeRules If true, a list of rules that apply to this branch would be included in the response.
* @param includePullreqs If true, a list of pull requests from the branch would be included in the response.
* @param maxDivergence If greater than zero, branch divergence from the default branch will be included in the response. The divergence would be calculated up the this many commits.
*/
public async listBranches (repoRef: string, query?: string, order?: 'asc' | 'desc', sort?: 'name' | 'date', page?: number, limit?: number, includeCommit?: boolean, includeChecks?: boolean, includeRules?: boolean, includePullreqs?: boolean, maxDivergence?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<TypesBranchExtended>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/branches'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listBranches.');
}
if (query !== undefined) {
localVarQueryParameters['query'] = ObjectSerializer.serialize(query, "string");
}
if (order !== undefined) {
localVarQueryParameters['order'] = ObjectSerializer.serialize(order, "'asc' | 'desc'");
}
if (sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'name' | 'date'");
}
if (page !== undefined) {
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (includeCommit !== undefined) {
localVarQueryParameters['include_commit'] = ObjectSerializer.serialize(includeCommit, "boolean");
}
if (includeChecks !== undefined) {
localVarQueryParameters['include_checks'] = ObjectSerializer.serialize(includeChecks, "boolean");
}
if (includeRules !== undefined) {
localVarQueryParameters['include_rules'] = ObjectSerializer.serialize(includeRules, "boolean");
}
if (includePullreqs !== undefined) {
localVarQueryParameters['include_pullreqs'] = ObjectSerializer.serialize(includePullreqs, "boolean");
}
if (maxDivergence !== undefined) {
localVarQueryParameters['max_divergence'] = ObjectSerializer.serialize(maxDivergence, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<TypesBranchExtended>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<TypesBranchExtended>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
* @param after The result should only contain commits that occurred after the provided reference.
* @param path Path for which commit information should be retrieved
* @param since Epoch since when commit information should be retrieved.
* @param until Epoch until when commit information should be retrieved.
* @param committer Committer pattern for which commit information should be retrieved.
* @param page The page to return.
* @param limit The maximum number of results to return.
* @param includeStats Indicates whether optional stats should be included in the response.
*/
public async listCommits (repoRef: string, gitRef?: string, after?: string, path?: string, since?: number, until?: number, committer?: string, page?: number, limit?: number, includeStats?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesListCommitResponse; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/commits'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listCommits.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
if (after !== undefined) {
localVarQueryParameters['after'] = ObjectSerializer.serialize(after, "string");
}
if (path !== undefined) {
localVarQueryParameters['path'] = ObjectSerializer.serialize(path, "string");
}
if (since !== undefined) {
localVarQueryParameters['since'] = ObjectSerializer.serialize(since, "number");
}
if (until !== undefined) {
localVarQueryParameters['until'] = ObjectSerializer.serialize(until, "number");
}
if (committer !== undefined) {
localVarQueryParameters['committer'] = ObjectSerializer.serialize(committer, "string");
}
if (page !== undefined) {
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (includeStats !== undefined) {
localVarQueryParameters['include_stats'] = ObjectSerializer.serialize(includeStats, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesListCommitResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesListCommitResponse");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
* @param includeDirectories Indicates whether directories should be included in the response.
*/
public async listPaths (repoRef: string, gitRef?: string, includeDirectories?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoListPathsOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/paths'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listPaths.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
if (includeDirectories !== undefined) {
localVarQueryParameters['include_directories'] = ObjectSerializer.serialize(includeDirectories, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoListPathsOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoListPathsOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param key
*/
public async listRepoLabelValues (repoRef: string, key: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<TypesLabelValue>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels/{key}/values'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'key' + '}', encodeURIComponent(String(key)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listRepoLabelValues.');
}
// verify required parameter 'key' is not null or undefined
if (key === null || key === undefined) {
throw new Error('Required parameter key was null or undefined when calling listRepoLabelValues.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<TypesLabelValue>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<TypesLabelValue>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param page The page to return.
* @param limit The maximum number of results to return.
* @param inherited The result should inherit entities from parent spaces.
* @param query The substring which is used to filter the labels by their key.
*/
public async listRepoLabels (repoRef: string, page?: number, limit?: number, inherited?: boolean, query?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<TypesLabel>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listRepoLabels.');
}
if (page !== undefined) {
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (inherited !== undefined) {
localVarQueryParameters['inherited'] = ObjectSerializer.serialize(inherited, "boolean");
}
if (query !== undefined) {
localVarQueryParameters['query'] = ObjectSerializer.serialize(query, "string");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<TypesLabel>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<TypesLabel>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
*/
public async listRepositoryServiceAccounts (repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<TypesServiceAccount>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/service-accounts'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listRepositoryServiceAccounts.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<TypesServiceAccount>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<TypesServiceAccount>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param includeCommit Indicates whether optional commit information should be included in the response.
* @param query The substring by which the tags are filtered.
* @param order The order of the output.
* @param sort The data by which the tags are sorted.
* @param page The page to return.
* @param limit The maximum number of results to return.
*/
public async listTags (repoRef: string, includeCommit?: boolean, query?: string, order?: 'asc' | 'desc', sort?: 'name' | 'date', page?: number, limit?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<RepoCommitTag>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/tags'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling listTags.');
}
if (includeCommit !== undefined) {
localVarQueryParameters['include_commit'] = ObjectSerializer.serialize(includeCommit, "boolean");
}
if (query !== undefined) {
localVarQueryParameters['query'] = ObjectSerializer.serialize(query, "string");
}
if (order !== undefined) {
localVarQueryParameters['order'] = ObjectSerializer.serialize(order, "'asc' | 'desc'");
}
if (sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'name' | 'date'");
}
if (page !== undefined) {
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<RepoCommitTag>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<RepoCommitTag>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param range
* @param path provide path for diff operation
*/
public async mergeCheck (repoRef: string, range: string, path?: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoMergeCheck; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/merge-check/{range}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'range' + '}', encodeURIComponent(String(range)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling mergeCheck.');
}
// verify required parameter 'range' is not null or undefined
if (range === null || range === undefined) {
throw new Error('Required parameter range was null or undefined when calling mergeCheck.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = ObjectSerializer.serialize(path, "Array<string>");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoMergeCheck; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoMergeCheck");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiMoveRepoRequest
*/
public async moveRepository (repoRef: string, openapiMoveRepoRequest?: OpenapiMoveRepoRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/move'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling moveRepository.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiMoveRepoRequest, "OpenapiMoveRepoRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param gitRef The git reference (branch / tag / commitID) that will be used to retrieve the data. If no value is provided the default branch of the repository is used.
* @param openapiPathsDetailsRequest
*/
public async pathDetails (repoRef: string, gitRef?: string, openapiPathsDetailsRequest?: OpenapiPathsDetailsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoPathsDetailsOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/path-details'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling pathDetails.');
}
if (gitRef !== undefined) {
localVarQueryParameters['git_ref'] = ObjectSerializer.serialize(gitRef, "string");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiPathsDetailsRequest, "OpenapiPathsDetailsRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoPathsDetailsOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoPathsDetailsOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param deletedAt The exact time the resource was delete at in epoch format.
* @param repoRef
*/
public async purgeRepository (deletedAt: number, repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/purge'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'deletedAt' is not null or undefined
if (deletedAt === null || deletedAt === undefined) {
throw new Error('Required parameter deletedAt was null or undefined when calling purgeRepository.');
}
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling purgeRepository.');
}
if (deletedAt !== undefined) {
localVarQueryParameters['deleted_at'] = ObjectSerializer.serialize(deletedAt, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param range
* @param path provide path for diff operation
*/
public async rawDiff (repoRef: string, range: string, path?: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<GitFileDiff>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/diff/{range}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'range' + '}', encodeURIComponent(String(range)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json', 'text/plain'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling rawDiff.');
}
// verify required parameter 'range' is not null or undefined
if (range === null || range === undefined) {
throw new Error('Required parameter range was null or undefined when calling rawDiff.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = ObjectSerializer.serialize(path, "Array<string>");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<GitFileDiff>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<GitFileDiff>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param range
* @param apiFileDiffRequest
*/
public async rawDiffPost (repoRef: string, range: string, apiFileDiffRequest?: Array<ApiFileDiffRequest>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<GitFileDiff>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/diff/{range}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'range' + '}', encodeURIComponent(String(range)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json', 'text/plain'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling rawDiffPost.');
}
// verify required parameter 'range' is not null or undefined
if (range === null || range === undefined) {
throw new Error('Required parameter range was null or undefined when calling rawDiffPost.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(apiFileDiffRequest, "Array<ApiFileDiffRequest>")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<GitFileDiff>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<GitFileDiff>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param rebaseBranchRequest
*/
public async rebaseBranch (repoRef: string, rebaseBranchRequest?: RebaseBranchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesRebaseResponse; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/rebase'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling rebaseBranch.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(rebaseBranchRequest, "RebaseBranchRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesRebaseResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesRebaseResponse");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param repoRuleAddRequest
*/
public async repoRuleAdd (repoRef: string, repoRuleAddRequest?: RepoRuleAddRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: OpenapiRule; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/rules'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling repoRuleAdd.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(repoRuleAddRequest, "RepoRuleAddRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: OpenapiRule; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "OpenapiRule");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param ruleIdentifier
*/
public async repoRuleDelete (repoRef: string, ruleIdentifier: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/rules/{rule_identifier}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'rule_identifier' + '}', encodeURIComponent(String(ruleIdentifier)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling repoRuleDelete.');
}
// verify required parameter 'ruleIdentifier' is not null or undefined
if (ruleIdentifier === null || ruleIdentifier === undefined) {
throw new Error('Required parameter ruleIdentifier was null or undefined when calling repoRuleDelete.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param ruleIdentifier
*/
public async repoRuleGet (repoRef: string, ruleIdentifier: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: OpenapiRule; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/rules/{rule_identifier}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'rule_identifier' + '}', encodeURIComponent(String(ruleIdentifier)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling repoRuleGet.');
}
// verify required parameter 'ruleIdentifier' is not null or undefined
if (ruleIdentifier === null || ruleIdentifier === undefined) {
throw new Error('Required parameter ruleIdentifier was null or undefined when calling repoRuleGet.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: OpenapiRule; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "OpenapiRule");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param query The substring by which the repository protection rules are filtered.
* @param order The order of the output.
* @param sort The field by which the protection rules are sorted.
* @param page The page to return.
* @param limit The maximum number of results to return.
* @param inherited The result should inherit entities from parent spaces.
*/
public async repoRuleList (repoRef: string, query?: string, order?: 'asc' | 'desc', sort?: 'created_at' | 'identifier' | 'uid' | 'updated_at', page?: number, limit?: number, inherited?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<OpenapiRule>; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/rules'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling repoRuleList.');
}
if (query !== undefined) {
localVarQueryParameters['query'] = ObjectSerializer.serialize(query, "string");
}
if (order !== undefined) {
localVarQueryParameters['order'] = ObjectSerializer.serialize(order, "'asc' | 'desc'");
}
if (sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'created_at' | 'identifier' | 'uid' | 'updated_at'");
}
if (page !== undefined) {
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
}
if (inherited !== undefined) {
localVarQueryParameters['inherited'] = ObjectSerializer.serialize(inherited, "boolean");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Array<OpenapiRule>; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Array<OpenapiRule>");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param ruleIdentifier
* @param repoRuleUpdateRequest
*/
public async repoRuleUpdate (repoRef: string, ruleIdentifier: string, repoRuleUpdateRequest?: RepoRuleUpdateRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: OpenapiRule; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/rules/{rule_identifier}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'rule_identifier' + '}', encodeURIComponent(String(ruleIdentifier)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling repoRuleUpdate.');
}
// verify required parameter 'ruleIdentifier' is not null or undefined
if (ruleIdentifier === null || ruleIdentifier === undefined) {
throw new Error('Required parameter ruleIdentifier was null or undefined when calling repoRuleUpdate.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PATCH',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(repoRuleUpdateRequest, "RepoRuleUpdateRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: OpenapiRule; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "OpenapiRule");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param deletedAt The exact time the resource was delete at in epoch format.
* @param repoRef
* @param openapiRestoreRequest
*/
public async restoreRepository (deletedAt: number, repoRef: string, openapiRestoreRequest?: OpenapiRestoreRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/restore'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'deletedAt' is not null or undefined
if (deletedAt === null || deletedAt === undefined) {
throw new Error('Required parameter deletedAt was null or undefined when calling restoreRepository.');
}
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling restoreRepository.');
}
if (deletedAt !== undefined) {
localVarQueryParameters['deleted_at'] = ObjectSerializer.serialize(deletedAt, "number");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiRestoreRequest, "OpenapiRestoreRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param saveRepoLabelRequest
*/
public async saveRepoLabel (repoRef: string, saveRepoLabelRequest?: SaveRepoLabelRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesLabelWithValues; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling saveRepoLabel.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(saveRepoLabelRequest, "SaveRepoLabelRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesLabelWithValues; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesLabelWithValues");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param squashBranchRequest
*/
public async squashBranch (repoRef: string, squashBranchRequest?: SquashBranchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesSquashResponse; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/squash'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling squashBranch.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(squashBranchRequest, "SquashBranchRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesSquashResponse; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesSquashResponse");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
*/
public async summary (repoRef: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesRepositorySummary; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/summary'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling summary.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesRepositorySummary; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesRepositorySummary");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiUpdateDefaultBranchRequest
*/
public async updateDefaultBranch (repoRef: string, openapiUpdateDefaultBranchRequest?: OpenapiUpdateDefaultBranchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/default-branch'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updateDefaultBranch.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiUpdateDefaultBranchRequest, "OpenapiUpdateDefaultBranchRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiGeneralSettingsRequest
*/
public async updateGeneralSettings (repoRef: string, openapiGeneralSettingsRequest?: OpenapiGeneralSettingsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ReposettingsGeneralSettings; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/settings/general'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updateGeneralSettings.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PATCH',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiGeneralSettingsRequest, "OpenapiGeneralSettingsRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: ReposettingsGeneralSettings; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "ReposettingsGeneralSettings");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiUpdateRepoPublicAccessRequest
*/
public async updatePublicAccess (repoRef: string, openapiUpdateRepoPublicAccessRequest?: OpenapiUpdateRepoPublicAccessRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/public-access'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updatePublicAccess.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiUpdateRepoPublicAccessRequest, "OpenapiUpdateRepoPublicAccessRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param key
* @param defineRepoLabelRequest
*/
public async updateRepoLabel (repoRef: string, key: string, defineRepoLabelRequest?: DefineRepoLabelRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesLabel; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels/{key}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'key' + '}', encodeURIComponent(String(key)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updateRepoLabel.');
}
// verify required parameter 'key' is not null or undefined
if (key === null || key === undefined) {
throw new Error('Required parameter key was null or undefined when calling updateRepoLabel.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PATCH',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(defineRepoLabelRequest, "DefineRepoLabelRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesLabel; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesLabel");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param key
* @param value
* @param defineRepoLabelValueRequest
*/
public async updateRepoLabelValue (repoRef: string, key: string, value: string, defineRepoLabelValueRequest?: DefineRepoLabelValueRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TypesLabelValue; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/labels/{key}/values/{value}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)))
.replace('{' + 'key' + '}', encodeURIComponent(String(key)))
.replace('{' + 'value' + '}', encodeURIComponent(String(value)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updateRepoLabelValue.');
}
// verify required parameter 'key' is not null or undefined
if (key === null || key === undefined) {
throw new Error('Required parameter key was null or undefined when calling updateRepoLabelValue.');
}
// verify required parameter 'value' is not null or undefined
if (value === null || value === undefined) {
throw new Error('Required parameter value was null or undefined when calling updateRepoLabelValue.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PATCH',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(defineRepoLabelValueRequest, "DefineRepoLabelValueRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: TypesLabelValue; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "TypesLabelValue");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiUpdateRepoRequest
*/
public async updateRepository (repoRef: string, openapiUpdateRepoRequest?: OpenapiUpdateRepoRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updateRepository.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PATCH',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiUpdateRepoRequest, "OpenapiUpdateRepoRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: RepoRepositoryOutput; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RepoRepositoryOutput");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @param repoRef
* @param openapiSecuritySettingsRequest
*/
public async updateSecuritySettings (repoRef: string, openapiSecuritySettingsRequest?: OpenapiSecuritySettingsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ReposettingsSecuritySettings; }> {
const localVarPath = this.basePath + '/repos/{repo_ref}/settings/security'
.replace('{' + 'repo_ref' + '}', encodeURIComponent(String(repoRef)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['application/json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'repoRef' is not null or undefined
if (repoRef === null || repoRef === undefined) {
throw new Error('Required parameter repoRef was null or undefined when calling updateSecuritySettings.');
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'PATCH',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(openapiSecuritySettingsRequest, "OpenapiSecuritySettingsRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.bearerAuth.accessToken) {
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: ReposettingsSecuritySettings; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "ReposettingsSecuritySettings");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment