import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper } from '../infrastructure'; import type { GitlabAPIResponse, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, } from '../infrastructure'; export interface LicenseSchema extends Record { id: number; plan: string; created_at: string; starts_at: string; expires_at: string; historical_max: number; maximum_user_count: number; expired: boolean; overage: number; user_limit: number; active_users: number; licensee: { Name: string; }; add_ons: { GitLab_FileLocks: number; GitLab_Auditor_User: number; }; } export class License extends BaseResource { add( license: string, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'license', { searchParams: { license }, ...options, }); } all( options?: Sudo & ShowExpanded & PaginationRequestOptions

, ): Promise> { return RequestHelper.get()(this, 'licenses', options); } show( options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()(this, 'license', options); } remove( licenceId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.del()(this, `license/${licenceId}`, options); } recalculateBillableUsers( licenceId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.put<{ success: boolean }>()( this, `license/${licenceId}/refresh_billable_users`, options, ); } }