UNPKG

@codefresh-io/cf-git-providers

Version:

An NPM module/CLI for interacting with various git providers

152 lines 4.28 kB
import { Branch, CommitStatus, GitAuth, PermissionScopes, Provider, ProviderName, PullRequest, Repository, RepositoryPermission, User, Webhook } from './types'; export default class Github implements Provider { static tokenResetMemory: Map<string, number>; private readonly githubClient; private readonly auth; constructor(opt: { apiUrl?: string; apiHost?: string; apiPathPrefix?: string; password: string; timeout?: number; insecure?: boolean; }); getName(): ProviderName; private getPaginatedResults; fetchRawFile(opt: { owner: string; repo: string; ref: string; path: string; }): Promise<string>; getBranch(opt: { owner: string; repo: string; branch: string; }): Promise<Branch>; getRepository(opt: { owner: string; repo: string; }): Promise<Repository>; createRepository(opt: { owner: string; repo: string; autoInit?: boolean; private?: boolean; }): Promise<Repository>; listBranches(opt: { owner: string; repo: string; limit?: number; page?: number; }): Promise<Branch[]>; createBranch(opt: { owner: string; repo: string; branch: string; sha: string; }): Promise<Branch>; listRepositoriesForOwner(opt: { owner: string; sort?: 'name' | 'pushed' | 'created'; direction?: 'desc' | 'asc'; limit?: number; page?: number; }): Promise<Repository[]>; listRepositoriesWithAffiliation(opt: { limit?: number; page?: number; }): Promise<Repository[]>; listRepositoriesForOrganization(opt: { organization: string; sort?: 'name' | 'pushed' | 'created'; direction?: 'desc' | 'asc'; limit?: number; page?: number; }): Promise<Repository[]>; listWebhooks(opt: { owner: string; repo: string; limit?: number; page?: number; }): Promise<Webhook[]>; createRepositoryWebhook(opt: { owner: string; repo: string; endpoint: string; secret: string; }): Promise<Webhook>; deleteRepositoryWebhook(opt: { owner: string; repo: string; hookId: number; }): Promise<void>; listOrganizations(opt: { limit?: number; page?: number; }): Promise<string[]>; createCommitStatus(opt: { owner: string; repo: string; sha: string; targetUrl: string; state: CommitStatus; description: string; context: string; }): Promise<void>; getPullRequestFiles(opt: { owner: string; repo: string; pullNumber: number; }): Promise<string[]>; getPullRequest(opt: { owner: string; repo: string; pullNumber: number; }): Promise<PullRequest>; searchMergedPullRequestByCommitSha(opt: { owner: string; repo: string; sha: string; }): Promise<PullRequest | undefined>; createPullRequest(opt: { owner: string; repo: string; title: string; body?: string; head: string; base: string; }): Promise<PullRequest>; getUser(opt?: { username?: string; }): Promise<User>; getUserByEmail(email: string): Promise<User>; getRepositoryPermissions(opt: { owner: string; repo: string; }): Promise<RepositoryPermission>; assertApiScopes(opt: { scopes: PermissionScopes[]; repoUrl?: string; }): Promise<void>; validateToken(): Promise<void>; skipPermissionsValidation(): { skip: boolean; reason: string; } | { skip: boolean; reason?: undefined; }; private isTokenFineGrained; toOwnerRepo(fullRepoName: string): [string, string]; getAuth(): GitAuth; isTokenMutable(): boolean; requiresRepoToCheckTokenScopes(): boolean; useAdminForUserPermission(): boolean; private constructSearchQuery; private getRateLimit; private createRateLimitError; private reachedRateLimit; private rateLimitAssertionWrapper; } //# sourceMappingURL=github.d.ts.map