//native
/**
* Edit an organization webhook
* Edit an organization webhook
*/
export async function main(auth: RT.Qovery, organizationId: string, webhookId: string, body: Body) {
const url = new URL(`https://api.qovery.com/organization/${organizationId}/webhook/${webhookId}`)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Token ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
/**
* Define the type of the webhook. `SLACK` is a special webhook type to push notifications directly to slack. The `target_url` must be a Slack compatible endpoint.
*/
kind: 'STANDARD' | 'SLACK'
/**
* Set the public HTTP or HTTPS endpoint that will receive the specified events.
* The target URL must starts with `http://` or `https://`
*
*/
target_url: string
/**
* Make sure you receive a payload to sign the Qovery request with your secret.
* Qovery will add a HTTP header `Qovery-Signature: <Your Secret>` to every webhook requests sent to your target URL.
*
*/
target_secret?: string
description?: string
/**
* Turn on or off your endpoint.
*/
enabled?: boolean
events: (
| 'DEPLOYMENT_STARTED'
| 'DEPLOYMENT_CANCELLED'
| 'DEPLOYMENT_FAILURE'
| 'DEPLOYMENT_SUCCESSFUL'
)[]
/**
* Specify the project names you want to filter to.
* This webhook will be triggered only if the event is coming from the specified Project IDs.
* Notes: 1. Wildcard is accepted E.g. `product*`. 2. Name is case insensitive.
*
*/
project_names_filter?: string[]
/**
* Specify the environment modes you want to filter to.
* This webhook will be triggered only if the event is coming from an environment with the specified mode.
*
*/
environment_types_filter?: ('DEVELOPMENT' | 'PREVIEW' | 'PRODUCTION' | 'STAGING')[]
[k: string]: unknown
}
Submitted by hugo697 235 days ago