feat: Org Webhooks API V2 (#16274)

* --init

* add is webhook in org guard

* --

* doc

* e2e

* --feedback

* --

* fix typo

* delete unnecessary file

* fix v2 e2e

* fix v2 e2e

* fix e2e

* fix v2 e2e

---------

Co-authored-by: Morgan <[email protected]>
This commit is contained in:
Syed Ali ShahbazandMorgan authored and GitHub committed 2024-08-29 17:52:42 +04:00
1 parent 4424aa5b38
commit cf50566a10
9 files changed
+922 -5

No files matched your search

+325 -2
View File
@@ -1668,8 +1668,25 @@
},
"/v2/organizations/{orgId}/memberships/{membershipId}": {
"get": {
"operationId": "OrganizationsMembershipsController_getUserSchedule",
"parameters": [],
"operationId": "OrganizationsMembershipsController_getOrgMembership",
"parameters": [
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "membershipId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
@@ -2268,6 +2285,214 @@
]
}
},
"/v2/organizations/{orgId}/webhooks": {
"get": {
"operationId": "OrganizationsWebhooksController_getAllWebhooks",
"parameters": [
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "take",
"required": false,
"in": "query",
"description": "The number of items to return",
"example": 10,
"schema": {
"type": "number"
}
},
{
"name": "skip",
"required": false,
"in": "query",
"description": "The number of items to skip",
"example": 0,
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrgWebhooksResponseDto"
}
}
}
}
},
"tags": [
"Organizations Webhooks"
]
},
"post": {
"operationId": "OrganizationsWebhooksController_createWebhook",
"parameters": [
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateWebhookInputDto"
}
}
}
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrgWebhooksResponseDto"
}
}
}
}
},
"tags": [
"Organizations Webhooks"
]
}
},
"/v2/organizations/{orgId}/webhooks/{webhookId}": {
"get": {
"operationId": "OrganizationsWebhooksController_getOrgWebhook",
"parameters": [
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrgWebhooksResponseDto"
}
}
}
}
},
"tags": [
"Organizations Webhooks"
]
},
"delete": {
"operationId": "OrganizationsWebhooksController_deleteWebhook",
"parameters": [
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrgWebhooksResponseDto"
}
}
}
}
},
"tags": [
"Organizations Webhooks"
]
},
"patch": {
"operationId": "OrganizationsWebhooksController_updateWebhook",
"parameters": [
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "webhookId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateWebhookInputDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrgWebhooksResponseDto"
}
}
}
}
},
"tags": [
"Organizations Webhooks"
]
}
},
"/v2/schedules": {
"post": {
"operationId": "SchedulesController_2024_04_15_createSchedule",
@@ -9163,6 +9388,84 @@
"active"
]
},
"OrgWebhookOutputDto": {
"type": "object",
"properties": {
"payloadTemplate": {
"type": "string",
"description": "The template of the payload that will be sent to the subscriberUrl, check cal.com/docs/core-features/webhooks for more information",
"example": "{\"content\":\"A new event has been scheduled\",\"type\":\"{{type}}\",\"name\":\"{{title}}\",\"organizer\":\"{{organizer.name}}\",\"booker\":\"{{attendees.0.name}}\"}"
},
"teamId": {
"type": "number"
},
"id": {
"type": "number"
},
"triggers": {
"type": "array",
"items": {
"type": "object"
}
},
"subscriberUrl": {
"type": "string"
},
"active": {
"type": "boolean"
},
"secret": {
"type": "string"
}
},
"required": [
"payloadTemplate",
"userId",
"id",
"triggers",
"subscriberUrl",
"active"
]
},
"GetAllOrgWebhooksDto": {
"type": "object",
"properties": {
"payloadTemplate": {
"type": "string",
"description": "The template of the payload that will be sent to the subscriberUrl, check cal.com/docs/core-features/webhooks for more information",
"example": "{\"content\":\"A new event has been scheduled\",\"type\":\"{{type}}\",\"name\":\"{{title}}\",\"organizer\":\"{{organizer.name}}\",\"booker\":\"{{attendees.0.name}}\"}"
},
"teamId": {
"type": "number"
},
"id": {
"type": "number"
},
"triggers": {
"type": "array",
"items": {
"type": "object"
}
},
"subscriberUrl": {
"type": "string"
},
"active": {
"type": "boolean"
},
"secret": {
"type": "string"
}
},
"required": [
"payloadTemplate",
"userId",
"id",
"triggers",
"subscriberUrl",
"active"
]
},
"UserWebhookOutputResponseDto": {
"type": "object",
"properties": {
@@ -9183,6 +9486,26 @@
"data"
]
},
"OrgWebhooksResponseDto": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/GetAllOrgWebhooksDto"
}
},
"required": [
"status",
"data"
]
},
"UpdateWebhookInputDto": {
"type": "object",
"properties": {