From 680d1ec655b91328736568e5c85888dd7b580f6a Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Thu, 6 Aug 2026 15:56:01 +0300 Subject: [PATCH] lexicons/temp/webhook: define org.tangled.temp.webhook.* xrpc lexicons Seven XRPC method lexicons for webhook management, hosted on spindle: createWebhook, updateWebhook, deleteWebhook, toggleWebhook, listWebhooks, listDeliveries, retryDelivery. Signed-off-by: dawn --- lexicons/temp/webhook/createWebhook.json | 62 +++++++++++++ lexicons/temp/webhook/deleteWebhook.json | 31 +++++++ .../webhook/getDeliveriesForWebhooks.json | 91 +++++++++++++++++++ lexicons/temp/webhook/listWebhooks.json | 71 +++++++++++++++ lexicons/temp/webhook/retryDelivery.json | 36 ++++++++ lexicons/temp/webhook/toggleWebhook.json | 44 +++++++++ lexicons/temp/webhook/updateWebhook.json | 48 ++++++++++ 7 files changed, 383 insertions(+) create mode 100644 lexicons/temp/webhook/createWebhook.json create mode 100644 lexicons/temp/webhook/deleteWebhook.json create mode 100644 lexicons/temp/webhook/getDeliveriesForWebhooks.json create mode 100644 lexicons/temp/webhook/listWebhooks.json create mode 100644 lexicons/temp/webhook/retryDelivery.json create mode 100644 lexicons/temp/webhook/toggleWebhook.json create mode 100644 lexicons/temp/webhook/updateWebhook.json diff --git a/lexicons/temp/webhook/createWebhook.json b/lexicons/temp/webhook/createWebhook.json new file mode 100644 index 00000000..3d8ea45d --- /dev/null +++ b/lexicons/temp/webhook/createWebhook.json @@ -0,0 +1,62 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.createWebhook", + "defs": { + "main": { + "type": "procedure", + "description": "Create a new webhook for a repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repoDid", "url", "events"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + }, + "url": { + "type": "string", + "format": "uri", + "description": "Endpoint URL that will receive webhook payloads." + }, + "secret": { + "type": "string", + "description": "Optional HMAC secret used to sign payloads. If omitted, payloads are not signed." + }, + "active": { + "type": "boolean", + "description": "Whether the webhook should be active immediately. Defaults to true." + }, + "events": { + "type": "array", + "description": "Event types to subscribe to (e.g. 'push', 'repository:renamed').", + "items": { + "type": "string" + } + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["id"], + "properties": { + "id": { + "type": "integer", + "description": "ID of the newly created webhook." + } + } + } + }, + "errors": [ + { "name": "NoEventsSelected", "description": "At least one event type must be specified." }, + { "name": "InvalidEvent" }, + { "name": "WebhookLimitExceeded" } + ] + } + } +} diff --git a/lexicons/temp/webhook/deleteWebhook.json b/lexicons/temp/webhook/deleteWebhook.json new file mode 100644 index 00000000..32ca3de2 --- /dev/null +++ b/lexicons/temp/webhook/deleteWebhook.json @@ -0,0 +1,31 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.deleteWebhook", + "defs": { + "main": { + "type": "procedure", + "description": "Delete a webhook from a repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repoDid", "id"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + }, + "id": { + "type": "integer", + "description": "Webhook ID to delete." + } + } + } + }, + "errors": [ + { "name": "WebhookNotFound" } + ] + } + } +} diff --git a/lexicons/temp/webhook/getDeliveriesForWebhooks.json b/lexicons/temp/webhook/getDeliveriesForWebhooks.json new file mode 100644 index 00000000..9de6fc6e --- /dev/null +++ b/lexicons/temp/webhook/getDeliveriesForWebhooks.json @@ -0,0 +1,91 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.getDeliveriesForWebhooks", + "defs": { + "main": { + "type": "query", + "description": "List recent delivery attempts for the given webhooks.", + "parameters": { + "type": "params", + "required": ["repoDid", "ids"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "description": "Webhook ID." + }, + "maxLength": 50 + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 5 + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["deliveries"], + "properties": { + "deliveries": { + "type": "array", + "items": { + "type": "ref", + "ref": "#delivery" + } + } + } + } + } + }, + "delivery": { + "type": "object", + "required": ["id", "webhookId", "deliveryId", "event", "url", "success", "createdAt"], + "properties": { + "id": { + "type": "integer" + }, + "webhookId": { + "type": "integer" + }, + "deliveryId": { + "type": "string", + "description": "UUID for tracking this delivery attempt." + }, + "event": { + "type": "string", + "description": "Event type that triggered the delivery." + }, + "url": { + "type": "string", + "format": "uri" + }, + "requestBody": { + "type": "string" + }, + "responseCode": { + "type": "integer" + }, + "responseBody": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "createdAt": { + "type": "string", + "format": "datetime" + } + } + } + } +} diff --git a/lexicons/temp/webhook/listWebhooks.json b/lexicons/temp/webhook/listWebhooks.json new file mode 100644 index 00000000..aa485efc --- /dev/null +++ b/lexicons/temp/webhook/listWebhooks.json @@ -0,0 +1,71 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.listWebhooks", + "defs": { + "main": { + "type": "query", + "description": "List webhooks configured for a repository.", + "parameters": { + "type": "params", + "required": ["repoDid"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["webhooks"], + "properties": { + "webhooks": { + "type": "array", + "items": { + "type": "ref", + "ref": "#webhook" + } + } + } + } + } + }, + "webhook": { + "type": "object", + "required": ["id", "url", "active", "events", "createdAt"], + "properties": { + "id": { + "type": "integer", + "description": "Webhook identifier." + }, + "url": { + "type": "string", + "format": "uri", + "description": "Endpoint URL that receives webhook payloads." + }, + "active": { + "type": "boolean", + "description": "Whether the webhook is currently enabled." + }, + "events": { + "type": "array", + "description": "Event types this webhook is subscribed to (e.g. 'push', 'repository:renamed').", + "items": { + "type": "string" + } + }, + "createdAt": { + "type": "string", + "format": "datetime" + }, + "updatedAt": { + "type": "string", + "format": "datetime" + } + } + } + } +} diff --git a/lexicons/temp/webhook/retryDelivery.json b/lexicons/temp/webhook/retryDelivery.json new file mode 100644 index 00000000..db1cda8a --- /dev/null +++ b/lexicons/temp/webhook/retryDelivery.json @@ -0,0 +1,36 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.retryDelivery", + "defs": { + "main": { + "type": "procedure", + "description": "Re-send a specific webhook delivery.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repoDid", "webhookId", "deliveryId"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + }, + "webhookId": { + "type": "integer", + "description": "Webhook ID that owns the delivery." + }, + "deliveryId": { + "type": "string", + "description": "UUID of the delivery to retry." + } + } + } + }, + "errors": [ + { "name": "WebhookNotFound" }, + { "name": "DeliveryNotFound" } + ] + } + } +} diff --git a/lexicons/temp/webhook/toggleWebhook.json b/lexicons/temp/webhook/toggleWebhook.json new file mode 100644 index 00000000..98a378a4 --- /dev/null +++ b/lexicons/temp/webhook/toggleWebhook.json @@ -0,0 +1,44 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.toggleWebhook", + "defs": { + "main": { + "type": "procedure", + "description": "Toggle the active state of a webhook.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repoDid", "id"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + }, + "id": { + "type": "integer", + "description": "Webhook ID to toggle." + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["active"], + "properties": { + "active": { + "type": "boolean", + "description": "New active state of the webhook." + } + } + } + }, + "errors": [ + { "name": "WebhookNotFound" } + ] + } + } +} diff --git a/lexicons/temp/webhook/updateWebhook.json b/lexicons/temp/webhook/updateWebhook.json new file mode 100644 index 00000000..f96cfb54 --- /dev/null +++ b/lexicons/temp/webhook/updateWebhook.json @@ -0,0 +1,48 @@ +{ + "lexicon": 1, + "id": "org.tangled.temp.webhook.updateWebhook", + "defs": { + "main": { + "type": "procedure", + "description": "Update an existing webhook. Only supplied fields are changed.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["repoDid", "id"], + "properties": { + "repoDid": { + "type": "string", + "format": "did", + "description": "DID of the repository as minted by the knot." + }, + "id": { + "type": "integer", + "description": "Webhook ID to update." + }, + "url": { + "type": "string", + "format": "uri" + }, + "secret": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "events": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "errors": [ + { "name": "WebhookNotFound" }, + { "name": "InvalidEvent" } + ] + } + } +} -- 2.54.0