import { BaseResource } from '@gitbeaker/requester-utils' ; import * as Mime from 'mime/lite' ; import { RequestHelper , Sudo } from '../infrastructure' ; export class PackageRegistry < C extends boolean = false > extends BaseResource < C > { publish ( projectId , packageName , packageVersion , filename , content , { contentType , ... options } = { } ) { const pId = encodeURIComponent ( projectId ) ; const meta = { filename , contentType } ; if ( ! meta . contentType ) meta . contentType = Mime . getType ( meta . filename ) || undefined ; return RequestHelper . put < { message : string ; } > ( ) ( this , `projects/${ pId }/packages/generic/${ packageName }/${ packageVersion }/${ filename }` , { isForm : true , file : [ content , meta ] , ... options , } ) ; } download ( projectId , packageName , packageVersion , filename , options ? ) { const pId = encodeURIComponent ( projectId ) ; return RequestHelper . get < { message : string ; } > ( ) ( this , `projects/${ pId }/packages/generic/${ packageName }/${ packageVersion }/${ filename }` , options ) ; } }