import { BaseResource } from '@gitbeaker/requester-utils'; import { RequestHelper } from '../infrastructure'; import type { GitlabAPIResponse, PaginationRequestOptions, PaginationTypes, ShowExpanded, Sudo, } from '../infrastructure'; import { AccessLevel } from '../constants'; export interface BroadcastMessageSchema extends Record { message: string; starts_at: string; ends_at: string; color: string; font: string; id: number; active: boolean; target_path: string; target_access_levels: Exclude< AccessLevel, AccessLevel.MINIMAL_ACCESS | AccessLevel.NO_ACCESS | AccessLevel.ADMIN >[]; broadcast_type: string; dismissable: boolean; } export interface BroadcastMessageOptions extends Record { message?: string; startsAt?: string; endsAt?: string; color?: string; font?: string; active?: boolean; targetPath?: string; targetAccessLevels?: Exclude< AccessLevel, AccessLevel.MINIMAL_ACCESS | AccessLevel.NO_ACCESS | AccessLevel.ADMIN >[]; broadcastType?: string; dismissable?: boolean; } export class BroadcastMessages extends BaseResource { all( options?: PaginationRequestOptions

& Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()(this, 'broadcast_messages', options); } create( options?: BroadcastMessageOptions & Sudo & ShowExpanded, ): Promise> { return RequestHelper.post()(this, 'broadcast_messages', options); } edit( broadcastMessageId: number, options?: BroadcastMessageOptions & Sudo & ShowExpanded, ): Promise> { return RequestHelper.put()( this, `broadcast_messages/${broadcastMessageId}`, options, ); } remove( broadcastMessageId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.del()(this, `broadcast_messages/${broadcastMessageId}`, options); } show( broadcastMessageId: number, options?: Sudo & ShowExpanded, ): Promise> { return RequestHelper.get()( this, `broadcast_messages/${broadcastMessageId}`, options, ); } }