import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { AsStream, GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; import type { ImportStatusSchema } from './ProjectImportExports'; export class GroupImportExports extends BaseResource { download( groupId: string | number, options: { asStream: true } & Sudo & ShowExpanded, ): Promise>; download( groupId: string | number, options?: { asStream?: boolean } & Sudo & ShowExpanded, ): Promise>; download( groupId: string | number, options?: AsStream & ShowExpanded & Sudo, ): Promise { return RequestHelper.get()( this, endpoint`groups/${groupId}/export/download`, options, ); } import( file: { content: Blob; filename: string }, path: string, { parentId, name, ...options }: { parentId?: number; name?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'groups/import', { isForm: true, ...options, file: [file.content, file.filename], path, name: name || path.split('/').at(0), parentId, }); } scheduleExport( groupId: string | number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.post<{ message: string }>()( this, endpoint`groups/${groupId}/export`, options, ); } }