import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, OneOrNoneOf, ShowExpanded } from '../infrastructure'; export class Maven extends BaseResource { downloadPackageFile( path: string, filename: string, { projectId, groupId, ...options }: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & ShowExpanded, ): Promise> { let url = endpoint`packages/maven/${path}/${filename}`; if (projectId) url = endpoint`projects/${projectId}/${url}`; else if (groupId) url = endpoint`groups/${groupId}/-/${url}`; return RequestHelper.get()(this, url, options as ShowExpanded); } uploadPackageFile( projectId: string | number, path: string, packageFile: { content: Blob; filename: string }, options?: ShowExpanded, ): Promise> { return RequestHelper.put()( this, endpoint`projects/${projectId}/packages/maven/${path}/${packageFile.filename}`, { isForm: true, ...options, file: [packageFile.content, packageFile.filename], }, ); } }