Webhook Endpoints
The 10 operations under webhook-endpoints, as typed calls on the generated REST client.
Webhook Endpoints
Available from @codespar/sdk 0.12.0, which is not on npm yet. The published version today is 0.11.0, and it has no cs.api; 0.12.0 is on the main branch of codespar-core. The examples below are not compiled against the installed package for that reason.
Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.
import { CodeSpar } from "@codespar/sdk";
const cs = new CodeSpar({ apiKey: process.env.CODESPAR_API_KEY });GET /v1/webhook-endpoints
/v1/webhook-endpointsList triggers
const result = await cs.api.get("/v1/webhook-endpoints");Parameters, body and every documented response: GET /v1/webhook-endpoints in the HTTP reference.
POST /v1/webhook-endpoints
/v1/webhook-endpointsSubscribe a webhook to an event
const result = await cs.api.post("/v1/webhook-endpoints", {
body: {
name: "Example",
event: "string",
server_id: "srv_0000000000000000",
webhook_url: "https://example.com/hook"
}
});Parameters, body and every documented response: POST /v1/webhook-endpoints in the HTTP reference.
POST /v1/webhook-endpoints/deliveries/{delivery_id}/redeliver
/v1/webhook-endpoints/deliveries/{delivery_id}/redeliverQueue a delivery to be sent again
const result = await cs.api.post("/v1/webhook-endpoints/deliveries/{delivery_id}/redeliver", {
path: {
delivery_id: "delivery_0000000000000000"
}
});Parameters, body and every documented response: POST /v1/webhook-endpoints/deliveries/{delivery_id}/redeliver in the HTTP reference.
POST /v1/webhook-endpoints/retry-pending
/v1/webhook-endpoints/retry-pendingDrain the retry queue for this project
const result = await cs.api.post("/v1/webhook-endpoints/retry-pending");Parameters, body and every documented response: POST /v1/webhook-endpoints/retry-pending in the HTTP reference.
GET /v1/webhook-endpoints/{id}
/v1/webhook-endpoints/{id}Read one webhook endpoint
const result = await cs.api.get("/v1/webhook-endpoints/{id}", {
path: {
id: "webhookendpoint_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/webhook-endpoints/{id} in the HTTP reference.
DELETE /v1/webhook-endpoints/{id}
/v1/webhook-endpoints/{id}Delete a webhook endpoint
const result = await cs.api.delete("/v1/webhook-endpoints/{id}", {
path: {
id: "webhookendpoint_0000000000000000"
}
});Parameters, body and every documented response: DELETE /v1/webhook-endpoints/{id} in the HTTP reference.
GET /v1/webhook-endpoints/{id}/deliveries
/v1/webhook-endpoints/{id}/deliveriesList recent delivery attempts
const result = await cs.api.get("/v1/webhook-endpoints/{id}/deliveries", {
path: {
id: "webhookendpoint_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/webhook-endpoints/{id}/deliveries in the HTTP reference.
GET /v1/webhook-endpoints/{id}/deliveries/{delivery_id}
/v1/webhook-endpoints/{id}/deliveries/{delivery_id}Inspect one delivery attempt
const result = await cs.api.get("/v1/webhook-endpoints/{id}/deliveries/{delivery_id}", {
path: {
id: "webhookendpoint_0000000000000000",
delivery_id: "delivery_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/webhook-endpoints/{id}/deliveries/{delivery_id} in the HTTP reference.
GET /v1/webhook-endpoints/{id}/dlq
/v1/webhook-endpoints/{id}/dlqList dead lettered deliveries
const result = await cs.api.get("/v1/webhook-endpoints/{id}/dlq", {
path: {
id: "webhookendpoint_0000000000000000"
}
});Parameters, body and every documented response: GET /v1/webhook-endpoints/{id}/dlq in the HTTP reference.
POST /v1/webhook-endpoints/{id}/rotate-secret
/v1/webhook-endpoints/{id}/rotate-secretMint a new signing secret for a webhook endpoint
const result = await cs.api.post("/v1/webhook-endpoints/{id}/rotate-secret", {
path: {
id: "webhookendpoint_0000000000000000"
}
});Parameters, body and every documented response: POST /v1/webhook-endpoints/{id}/rotate-secret in the HTTP reference.