import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper, endpoint } from '../infrastructure'; import type { GitlabAPIResponse, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, } from '../infrastructure'; export interface MetricImageSchema extends Record { id: number; created_at: string; filename: string; file_path: string; url: string; url_text: string; } export class AlertManagement extends BaseResource { allMetricImages( projectId: string | number, alertIId: number, options?: PaginationRequestOptions

& Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, endpoint`projects/${projectId}/alert_management_alerts/${alertIId}/metric_images`, options, ); } editMetricImage( projectId: string | number, alertIId: number, imageId: number, options?: { url?: string; urlText?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.put()( this, endpoint`projects/${projectId}/alert_management_alerts/${alertIId}/metric_images/${imageId}`, options, ); } removeMetricImage( projectId: string | number, alertIId: number, imageId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.del()( this, endpoint`projects/${projectId}/alert_management_alerts/${alertIId}/metric_images/${imageId}`, options, ); } uploadMetricImage( projectId: string | number, alertIId: number, metricImage: { content: Blob; filename: string }, options?: { url?: string; urlText?: string } & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()( this, endpoint`projects/${projectId}/alert_management_alerts/${alertIId}/metric_images`, { isForm: true, file: [metricImage.content, metricImage.filename], ...options, }, ); } }