export type UpdateIncidentRequestModel = {title?: string | undefined, issued_at?: string | undefined, started_at?: string | undefined, ended_at?: string | undefined, git_ref?: string | undefined, teams?: Array | undefined, services?: Array | undefined, repository_urls?: Array | undefined}; export type CreateApiApiV1IncidentsProviderIdArgs = {provider_id: string, body: UpdateIncidentRequestModel}; export type CreateApiApiV1IncidentsProviderIdOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Incident * * POST /api/v1/incidents/{provider_id} */ export const createApiApiV1IncidentsProviderId = async (args: CreateApiApiV1IncidentsProviderIdArgs, options?: CreateApiApiV1IncidentsProviderIdOptions) => { const {baseUrl = "https://public-api.linearb.io", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyHeader !== undefined) headers.set("x-api-key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/incidents/${encodeURIComponent(String(args.provider_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };