import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure'; export interface CICDVariableSchema extends Record { key: string; variable_type: string; value: string; protected: boolean; masked: boolean; raw: boolean; } export class InstanceLevelCICDVariables extends BaseResource { all( options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()(this, 'admin/ci/variables', options); } create( key: string, value: string, options?: { variableType?: string; protected?: boolean; masked?: boolean; raw?: boolean; } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'admin/ci/variables', { key, value, ...options, }); } edit( keyId: string, value: string, options?: { variableType?: string; protected?: boolean; masked?: boolean; raw?: boolean; } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.put()(this, endpoint`admin/ci/variables/${keyId}`, { value, ...options, }); } show( keyId: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`admin/ci/variables/${keyId}`, options, ); } remove( keyId: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()(this, endpoint`admin/ci/variables/${keyId}`, options); } }