export type PatchApiPipelinePipelineIdUsageThresholdAlertUsageThresholdAlertIdArgs = {pipeline_id: string, usage_threshold_alert_id: string, body: {enabled: boolean}}; export type PatchApiPipelinePipelineIdUsageThresholdAlertUsageThresholdAlertIdOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Partially update an existing threshold alert * * PATCH /pipeline/{pipeline_id}/usage-threshold-alert/{usage_threshold_alert_id} */ export const patchApiPipelinePipelineIdUsageThresholdAlertUsageThresholdAlertId = async (args: PatchApiPipelinePipelineIdUsageThresholdAlertUsageThresholdAlertIdArgs, options?: PatchApiPipelinePipelineIdUsageThresholdAlertUsageThresholdAlertIdOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/pipeline/${encodeURIComponent(String(args.pipeline_id))}/usage-threshold-alert/${encodeURIComponent(String(args.usage_threshold_alert_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };