import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper } from '../infrastructure'; import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; export interface RepositoryImportStatusSchema extends Record { id: number; name: string; full_path: string; full_name: string; } export interface ExpandedRepositoryImportStatusSchema extends RepositoryImportStatusSchema { import_source: string; import_status: string; human_import_status_name: string; provider_link: string; } export class Import extends BaseResource { importGithubRepository( personalAccessToken: string, repositoryId: number, targetNamespace: string, options?: { newName?: string; githubHostname?: string; optionalStages?: Record; } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'import/github', { personalAccessToken, repoId: repositoryId, targetNamespace, ...options, }); } cancelGithubRepositoryImport( projectId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'import/github/cancel', { projectId, ...options, }); } importGithubGists( personalAccessToken: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'import/github/gists', { personalAccessToken, ...options, }); } importBitbucketServerRepository( bitbucketServerUrl: string, bitbucketServerUsername: string, personalAccessToken: string, bitbucketServerProject: string, bitbucketServerRepository: string, options?: { newName?: string; targetNamespace?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'import/bitbucket_server', { bitbucketServerUrl, bitbucketServerUsername, personalAccessToken, bitbucketServerProject, bitbucketServerRepo: bitbucketServerRepository, ...options, }); } }