/// <reference types="node" />
import type { Readable } from 'stream';
import type { NonEmptyString } from "../../common/CustomTypes/NonEmptyString";
import type { NaturalNumber } from "../../common/CustomTypes/Numerics";
import type { Maybe } from "../../common/Maybe";
import type { AxiosInstance } from 'axios';
import type { GitUtilsInitialization } from "../git-utils";
import { GitLabGitUtils } from "../git-utils/GitLab";
import type { CommitFilesRequest, CreatePullRequestOptions, CreateRepoRequest, CreateRepoResult, IGitHost, ListFilesOptions } from "../Types";
import type { GitlabIntegration, GitlabToken } from "./Types";
export interface GitlabGitHostOptions {
    axios?: AxiosInstance;
    maxRetries?: NaturalNumber;
    clientId: NonEmptyString;
    clientSecret: NonEmptyString;
}
export interface RunWithRetriesParams<T> {
    operationName: string;
    getIntegrationFn: GetIntegrationFn;
    fn: (gitlabIntegration: GitlabIntegration) => Promise<T>;
    tryRefreshTokenFn: () => Promise<Maybe<GitlabToken>>;
    updateTokenFn: UpdateToken;
    retriesCount?: NaturalNumber;
    retryAttemptCount?: number;
    lastError?: Error;
}
export declare const GITLAB_REQUIRE_AUTHORIZATION_CODE = "gitlab.require-authorization";
export declare type UpdateToken = (token: GitlabToken) => Promise<void>;
export declare type GetIntegrationFn = () => Promise<GitlabIntegration>;
export declare class GitlabGitHost extends GitLabGitUtils implements IGitHost {
    #private;
    constructor(integration: GitlabIntegration, getIntegration: () => Promise<GitlabIntegration>, updateToken: UpdateToken, { axios, maxRetries, clientId, clientSecret, }: GitlabGitHostOptions);
    private get headers();
    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, title, content, targetBranch, }: CreatePullRequestOptions): Promise<string>;
    getDefaultBranch(repository: string): Promise<NonEmptyString>;
    static tryRefreshToken(integration: GitlabIntegration, clientId: NonEmptyString, clientSecret: NonEmptyString, axios: AxiosInstance): Promise<Maybe<GitlabToken>>;
    static runWithRetries<T>({ operationName, getIntegrationFn, fn, tryRefreshTokenFn, updateTokenFn, retriesCount, retryAttemptCount, lastError, }: RunWithRetriesParams<T>): Promise<T>;
    listFiles(repository: string, { path, extFilter, }?: ListFilesOptions): Promise<string[]>;
    getGitUtilsInitialization(): GitUtilsInitialization;
    validateAuthentication(): Promise<void>;
}
