import { BaseResource } from '@gitbeaker/requester-utils' ; import { RequestHelper , Sudo , BaseRequestOptions , PaginatedRequestOptions , endpoint , } from '../infrastructure' ; export interface DeployKeySchema extends Record < string , unknown > { id : number ; title : string ; key : string ; can_push ? : boolean ; created_at : string ; } export class DeployKeys < C extends boolean = false > extends BaseResource < C > { add ( projectId , options ? ) { return RequestHelper . post < DeployKeySchema > ( ) ( this , endpoint `projects/${ projectId }/deploy_keys` , options ) ; } all ( { projectId , ... options } = { } ) { let url ; if ( projectId ) { url = endpoint `projects/${ projectId }/deploy_keys` ; } else { url = 'deploy_keys' ; } return RequestHelper . get < Omit < DeployKeySchema , 'can_push' > [ ] > ( ) ( this , url , options ) ; } edit ( projectId , keyId , options ? ) { return RequestHelper . put < DeployKeySchema > ( ) ( this , endpoint `projects/${ projectId }/deploy_keys/${ keyId }` , options ) ; } enable ( projectId , keyId , options ? ) { return RequestHelper . post < Omit < DeployKeySchema , 'can_push' > > ( ) ( this , endpoint `projects/${ projectId }/deploy_keys/${ keyId }/enable` , options ) ; } remove ( projectId , keyId , options ? ) { return RequestHelper . del ( ) ( this , endpoint `projects/${ projectId }/deploy_keys/${ keyId }` , options ) ; } show ( projectId , keyId , options ? ) { return RequestHelper . get < DeployKeySchema > ( ) ( this , endpoint `projects/${ projectId }/deploy_keys/${ keyId }` , options ) ; } }