0

Update alert receiver

by
Published Oct 17, 2025

Update an existing alert receiver

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update alert receiver
4
 * Update an existing alert receiver
5
 */
6
export async function main(
7
	auth: RT.Qovery,
8
	alertReceiverId: string,
9
	body: AlertReceiverEditRequest
10
) {
11
	const url = new URL(`https://api.qovery.com/api/alert-receivers/${alertReceiverId}`)
12

13
	const response = await fetch(url, {
14
		method: 'PUT',
15
		headers: {
16
			'Content-Type': 'application/json',
17
			Authorization: 'Token ' + auth.apiKey
18
		},
19
		body: JSON.stringify(body)
20
	})
21
	if (!response.ok) {
22
		const text = await response.text()
23
		throw new Error(`${response.status} ${text}`)
24
	}
25
	return await response.json()
26
}
27

28
/* eslint-disable */
29
/**
30
 * This file was automatically generated by json-schema-to-typescript.
31
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
32
 * and run json-schema-to-typescript to regenerate this file.
33
 */
34

35
export type AlertReceiverType = 'SLACK'
36

37
export interface AlertReceiverEditRequest {
38
	name: string
39
	description: string
40
	type: AlertReceiverType
41
	send_resolved: boolean
42
	[k: string]: unknown
43
}
44