import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, OneOrNoneOf, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, } from '../infrastructure'; export interface AuditEventSchema extends Record { id: number; author_id: number; entity_id: number; entity_type: string; details: { change?: string; from?: string; to?: string; custom_message?: string; author_name: string; author_email: string; target_id: string; target_type: string; target_details: string; ip_address: string; entity_path: string; }; created_at: string; } function url({ projectId, groupId, }: { projectId?: string | number; groupId?: string | number } = {}): string { let prefix = ''; if (projectId) prefix = endpoint`projects/${projectId}/`; else if (groupId) prefix = endpoint`groups/${groupId}/`; return `${prefix}audit_events`; } export interface AllAuditEventOptions { createdAfter?: string; createdBefore?: string; entityType?: string; entityId?: number; } export class AuditEvents extends BaseResource { all( { projectId, groupId, ...options }: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & AllAuditEventOptions & Sudo & ShowExpanded & PaginationRequestOptions

= {} as any, ): Promise> { const uri = url({ projectId, groupId }); return RequestHelper.get()( this, uri, options as AllAuditEventOptions & Sudo & ShowExpanded & PaginationRequestOptions

, ); } show( auditEventId: number, { projectId, groupId, ...options }: OneOrNoneOf<{ projectId: string | number; groupId: string | number }> & Sudo & ShowExpanded = {}, ): Promise> { const uri = url({ projectId, groupId }); return RequestHelper.get()(this, `${uri}/${auditEventId}`, options); } }