//native
type Digitalocean = {
token: string;
};
/**
* Get Trigger
* Gets the trigger details. To get the trigger details, send a GET request to `/v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME`.
*/
export async function main(
auth: Digitalocean,
namespace_id: string,
trigger_name: string,
) {
const url = new URL(
`https://api.digitalocean.com/v2/functions/namespaces/${namespace_id}/triggers/${trigger_name}`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 536 days ago