import { BaseResource , BaseResourceOptions } from '@gitbeaker/requester-utils' ; import { RequestHelper , PaginatedRequestOptions , endpoint } from '../infrastructure' ; export interface VariableSchema extends Record < string , unknown > { variable_type : 'env_var' | 'file' ; value : string ; protected : boolean ; masked : boolean ; environment_scope ? : string ; key : string ; } export class ResourceVariables < C extends boolean > extends BaseResource < C > { constructor ( resourceType , options ) { super ( { prefixUrl : resourceType , ... options } ) ; } all ( resourceId , options ? ) { return RequestHelper . get < VariableSchema [ ] > ( ) ( this , endpoint `${ resourceId }/variables` , options ) ; } create ( resourceId , options ? ) { return RequestHelper . post < VariableSchema > ( ) ( this , endpoint `${ resourceId }/variables` , options ) ; } edit ( resourceId , keyId , options ? ) { return RequestHelper . put < VariableSchema > ( ) ( this , endpoint `${ resourceId }/variables/${ keyId }` , options ) ; } show ( resourceId , keyId , options ? ) { return RequestHelper . get < VariableSchema > ( ) ( this , endpoint `${ resourceId }/variables/${ keyId }` , options ) ; } remove ( resourceId , keyId , options ? ) { return RequestHelper . del ( ) ( this , endpoint `${ resourceId }/variables/${ keyId }` , options ) ; } }