import { BaseResource , BaseResourceOptions } from '@gitbeaker/requester-utils' ; import { endpoint , RequestHelper , Sudo } from '../infrastructure' ; export type AccessLevel = 0 | 5 | 10 | 20 | 30 | 40 | 50 ; export interface AccessRequestSchema extends Record < string , unknown > { id : number ; username : string ; name : string ; state : string ; created_at : string ; requested_at : string ; } export class ResourceAccessRequests < C extends boolean = false > extends BaseResource < C > { constructor ( resourceType , options ) { super ( { prefixUrl : resourceType , ... options } ) ; } all ( resourceId ) { return RequestHelper . get < AccessRequestSchema [ ] > ( ) ( this , endpoint `${ resourceId }/access_requests` ) ; } request ( resourceId ) { return RequestHelper . post < AccessRequestSchema > ( ) ( this , endpoint `${ resourceId }/access_requests` ) ; } approve ( resourceId , userId , options ? ) { return RequestHelper . post < AccessRequestSchema > ( ) ( this , endpoint `${ resourceId }/access_requests/${ userId }/approve` , options ) ; } deny ( resourceId , userId ) { return RequestHelper . del ( ) ( this , endpoint `${ resourceId }/access_requests/${ userId }` ) ; } }