@altostra/core
Version:
Core library for shared types and logic
31 lines (30 loc) • 1.84 kB
TypeScript
/// <reference types="node" />
import type { Readable } from 'stream';
import type { NonEmptyString } from "../../common/CustomTypes/NonEmptyString";
import type { Logger } from "../../common/Logging";
import type { AxiosInstance } from 'axios';
import type { GitUtilsInitialization } from "../git-utils";
import { BitbucketGitUtils } from "../git-utils/Bitbucket/BitbucketGitUtils";
import type { CommitFilesRequest, CreatePullRequestOptions, CreateRepoRequest, CreateRepoResult, IGitHost, ListFilesOptions } from "../Types";
import type { BitbucketAuth } from "./Types";
export interface BitbucketApiOptions {
authentication: BitbucketAuth;
axios?: AxiosInstance;
logger?: Logger;
}
export declare class BitbucketGitHost extends BitbucketGitUtils implements IGitHost {
#private;
constructor({ axios, authentication: { accessToken, ...authentication }, logger, }: BitbucketApiOptions);
getHeadSha(repository: string, branch?: string): Promise<string>;
createRepository({ name, privateRepo }: CreateRepoRequest): Promise<CreateRepoResult>;
commitFiles({ commitMessage, targetRepositoryName, filesToCommit, targetBranch, }: CommitFilesRequest): Promise<string>;
listRepositories(filter?: string): Promise<string[]>;
downloadFile(repository: string, path: string): Promise<Buffer>;
downloadRepo(repository: string): Promise<Readable>;
createBranch(repository: string, branch: string): Promise<void>;
createPullRequest({ repository, sourceBranch, targetBranch, title, content, }: CreatePullRequestOptions): Promise<string>;
getDefaultBranch(repository: string): Promise<NonEmptyString>;
listFiles(repository: string, { path, extFilter, }?: ListFilesOptions): Promise<string[]>;
getGitUtilsInitialization(): GitUtilsInitialization;
validateAuthentication(): Promise<void>;
}