UNPKG

@altostra/core

Version:

Core library for shared types and logic

30 lines (29 loc) 2.32 kB
/// <reference types="node" /> import type { Readable } from 'stream'; import type { AnonymousGithubIntegration, GitHubInstallationId, OrganizationGithubIntegration, UserGithubIntegration } from "../../bizops/GitHubAppInstallation/Types"; import type { NonEmptyString } from "../../common/CustomTypes/NonEmptyString"; import type { Logger } from "../../common/Logging"; import type { GitUtilsInitialization } from "../git-utils"; import { GitHubGitUtils } from "../git-utils/GitHub"; import type { CommitFilesRequest, CreatePullRequestOptions, CreateRepoRequest, CreateRepoResult, IGitHost, ListFilesOptions } from "../Types"; import type { GitHubGitHostConfigurations } from "./Types"; export declare const MAX_RETRY_TIMES = 3; export declare type ValidGithubInstallation = OrganizationGithubIntegration | UserGithubIntegration; export declare type GithubInstallationOrAnonymous = AnonymousGithubIntegration | OrganizationGithubIntegration | UserGithubIntegration; export declare class GitHubGitHost extends GitHubGitUtils implements IGitHost { #private; constructor(installation: GithubInstallationOrAnonymous, { logger, maxRetries, axios, auth, refreshTokenFn, }?: GitHubGitHostConfigurations); static removeInstallation(installationId: GitHubInstallationId, appId: number, secret: string, logger?: Logger<import("@altostra/common/Logging").DefaultSeverity>): Promise<void>; getHeadSha(repository: string, branch?: string): Promise<string>; createRepository({ name, privateRepo }: CreateRepoRequest): Promise<CreateRepoResult>; commitFiles({ commitMessage, filesToCommit, targetRepositoryName, 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>; }