From c8a89a0eac0b32e098fec6c0c4c0c5715f042ccd Mon Sep 17 00:00:00 2001 From: nael Date: Sat, 15 Jun 2024 01:31:31 +0200 Subject: [PATCH] :sparkles: New features --- .env.example | 2 + .../Connector/ConnectorDisplay.tsx | 81 +- .../components/Connection/ConnectionTable.tsx | 2 +- .../src/hooks/get/useConnections.tsx | 1 + docker-compose.dev.yml | 34 +- docker-compose.source.yml | 1 + docker-compose.yml | 1 + ngrok.yml | 4 +- packages/api/prisma/schema.prisma | 404 +-- packages/api/scripts/connectorUpdate.js | 207 +- packages/api/scripts/init.sql | 6 +- packages/api/scripts/seed.sql | 2 +- .../connections-strategies.service.ts | 2 +- .../@core/environment/environment.service.ts | 3 + .../src/ticketing/@webhook/zendesk/handler.ts | 29 +- packages/api/swagger/swagger-spec.json | 2284 +++++++++-------- packages/shared/src/connectors/enum.ts | 2 +- 17 files changed, 1578 insertions(+), 1487 deletions(-) diff --git a/.env.example b/.env.example index a8186d383..d12846bda 100644 --- a/.env.example +++ b/.env.example @@ -30,6 +30,8 @@ POSTGRES_DB=panora_db POSTGRES_HOST=postgres POSTGRES_PASSWORD=my_password +# Endpoint on which realtime webhooks are sent to +WEBHOOK_INGRESS=http://localhost:3000 # Each Provider is of form PROVIDER_VERTICAL_SOFTWAREMODE_ATTRIBUTE # ================================================ diff --git a/apps/client-ts/src/components/Configuration/Connector/ConnectorDisplay.tsx b/apps/client-ts/src/components/Configuration/Connector/ConnectorDisplay.tsx index 64714dab0..4e54aa115 100644 --- a/apps/client-ts/src/components/Configuration/Connector/ConnectorDisplay.tsx +++ b/apps/client-ts/src/components/Configuration/Connector/ConnectorDisplay.tsx @@ -8,7 +8,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from " import { PasswordInput } from "@/components/ui/password-input" import { z } from "zod" import config from "@/lib/config" -import { AuthStrategy, providerToType, Provider, extractProvider, extractVertical } from "@panora/shared" +import { AuthStrategy, providerToType, Provider, extractProvider, extractVertical, needsSubdomain } from "@panora/shared" import { useEffect, useState } from "react" import useProjectStore from "@/state/projectStore" import { usePostHog } from 'posthog-js/react' @@ -26,24 +26,27 @@ interface ItemDisplayProps { } const formSchema = z.object({ + subdomain: z.string({ + required_error: "Please Enter a Subdomain", + }).optional(), client_id : z.string({ required_error: "Please Enter a Client ID", - }), + }).optional(), client_secret : z.string({ required_error: "Please Enter a Client Secret", - }), + }).optional(), scope : z.string({ required_error: "Please Enter a scope", - }), + }).optional(), api_key: z.string({ required_error: "Please Enter a API Key", - }), + }).optional(), username: z.string({ required_error: "Please Enter Username", - }), + }).optional(), secret: z.string({ required_error: "Please Enter Secret", - }), + }).optional(), }) export function ConnectorDisplay({ item }: ItemDisplayProps) { @@ -62,6 +65,7 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { + subdomain: "", client_id: "", client_secret: "", scope: "", @@ -88,10 +92,11 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { }; function onSubmit(values: z.infer) { - const { client_id, client_secret, scope, api_key, secret, username } = values; + const { client_id, client_secret, scope, api_key, secret, username, subdomain } = values; const performUpdate = mappingConnectionStrategies && mappingConnectionStrategies.length > 0; switch (item?.authStrategy) { case AuthStrategy.oauth2: + const needs_subdomain = needsSubdomain(item.name.toLowerCase(), item.vertical!.toLowerCase()); if (client_id === "" || client_secret === "" || scope === "") { if (client_id === "") { form.setError("client_id", { "message": "Please Enter Client ID" }); @@ -104,6 +109,18 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { } break; } + if(needs_subdomain && subdomain == ""){ + form.setError("subdomain", { "message": "Please Enter Subdomain" }); + } + let ATTRIBUTES = []; + let VALUES = []; + if(needs_subdomain){ + ATTRIBUTES = ["subdomain", "client_id", "client_secret", "scope"], + VALUES = [subdomain!, client_id!, client_secret!, scope!] + }else{ + ATTRIBUTES = ["client_id", "client_secret", "scope"], + VALUES = [client_id!, client_secret!, scope!] + } if (performUpdate) { const dataToUpdate = mappingConnectionStrategies[0]; toast.promise( @@ -111,8 +128,8 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { id_cs: dataToUpdate.id_connection_strategy, updateToggle: false, status: dataToUpdate.status, - attributes: ["client_id", "client_secret", "scope"], - values: [client_id, client_secret, scope] + attributes: ATTRIBUTES, + values: VALUES }), { loading: 'Loading...', @@ -140,8 +157,8 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { toast.promise( createCsPromise({ type: providerToType(item?.name, item?.vertical!, AuthStrategy.oauth2), - attributes: ["client_id", "client_secret", "scope"], - values: [client_id, client_secret, scope] + attributes: ATTRIBUTES, + values: VALUES }), { loading: 'Loading...', @@ -183,7 +200,7 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { updateToggle: false, status: dataToUpdate.status, attributes: ["api_key"], - values: [api_key] + values: [api_key!] }), { loading: 'Loading...', @@ -212,7 +229,7 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { createCsPromise({ type: providerToType(item?.name, item?.vertical!, AuthStrategy.api_key), attributes: ["api_key"], - values: [api_key] + values: [api_key!] }), { loading: 'Loading...', @@ -259,7 +276,7 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { updateToggle: false, status: dataToUpdate.status, attributes: ["username", "secret"], - values: [username, secret] + values: [username!, secret!] }), { loading: 'Loading...', @@ -289,7 +306,7 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { createCsPromise({ type: providerToType(item?.name, item?.vertical!, AuthStrategy.basic), attributes: ["username", "secret"], - values: [username, secret] + values: [username!, secret!] }), { loading: 'Loading...', @@ -324,14 +341,19 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) { if (mappingConnectionStrategies && mappingConnectionStrategies.length > 0) { fetchCredentials({ type: mappingConnectionStrategies[0].type, - attributes: item?.authStrategy === AuthStrategy.oauth2 ? ["client_id", "client_secret", "scope"] + attributes: item?.authStrategy === AuthStrategy.oauth2 ? needsSubdomain(item.name.toLowerCase(), item.vertical!.toLowerCase()) ? ["subdomain", "client_id", "client_secret", "scope"] : ["client_id", "client_secret", "scope"] : item?.authStrategy === AuthStrategy.api_key ? ["api_key"] : ["username", "secret"] }, { onSuccess(data) { if (item?.authStrategy === AuthStrategy.oauth2) { - form.setValue("client_id", data[0]); - form.setValue("client_secret", data[1]); - form.setValue("scope", data[2]); + let i = 0; + if(needsSubdomain(item.name.toLowerCase(), item.vertical!.toLowerCase())){ + form.setValue("subdomain", data[i]); + i = 1; + } + form.setValue("client_id", data[i]); + form.setValue("client_secret", data[i + 1]); + form.setValue("scope", data[i + 2]); } if (item?.authStrategy === AuthStrategy.api_key) { form.setValue("api_key", data[0]); @@ -415,6 +437,25 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) {
{ item.authStrategy == AuthStrategy.oauth2 && <> + + { needsSubdomain(item.name.toLowerCase(), item.vertical!.toLowerCase()) && +
+ ( + + Subdomain + + + + + + )} + /> +
+ } +
diff --git a/apps/client-ts/src/hooks/get/useConnections.tsx b/apps/client-ts/src/hooks/get/useConnections.tsx index 27b4948bc..b82dd6b55 100644 --- a/apps/client-ts/src/hooks/get/useConnections.tsx +++ b/apps/client-ts/src/hooks/get/useConnections.tsx @@ -5,6 +5,7 @@ import Cookies from 'js-cookie'; const useConnections = () => { + console.log(Cookies.get('access_token')) return useQuery({ queryKey: ['connections'], queryFn: async (): Promise => { diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 586a0981c..17aea9853 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -39,6 +39,7 @@ services: REDIS_PORT: ${REDIS_PORT} #REDIS_TLS: 1 # set this variable to 1 when Redis is AWS hosted REDIS_DB: ${REDIS_DB} + WEBHOOK_INGRESS: ${WEBHOOK_INGRESS} ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID} HUBSPOT_CRM_CLOUD_CLIENT_SECRET: ${HUBSPOT_CRM_CLOUD_CLIENT_SECRET} @@ -188,22 +189,23 @@ services: volumes: - .:/app - #ngrok: - #image: ngrok/ngrok:latest - #restart: always - #command: - # - "start" - # - "--all" - # - "--config" - # - "/etc/ngrok.yml" - # volumes: - # - ./ngrok.yml:/etc/ngrok.yml - # ports: - # - 4040:4040 - #depends_on: - # api: - # condition: service_healthy - # network_mode: "host" + ngrok: + image: ngrok/ngrok:latest + restart: always + command: + - "start" + - "--all" + - "--config" + - "/etc/ngrok.yml" + volumes: + - ./ngrok.yml:/etc/ngrok.yml + ports: + - 4040:4040 + depends_on: + api: + condition: service_healthy + network_mode: "host" + docs: build: diff --git a/docker-compose.source.yml b/docker-compose.source.yml index 13cdbe89f..52efe86a7 100644 --- a/docker-compose.source.yml +++ b/docker-compose.source.yml @@ -39,6 +39,7 @@ services: REDIS_PASS: ${REDIS_PASS} BACKEND_PORT: ${BACKEND_PORT} REDIS_DB: ${REDIS_DB} + WEBHOOK_INGRESS: ${WEBHOOK_INGRESS} ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID} HUBSPOT_CRM_CLOUD_CLIENT_SECRET: ${HUBSPOT_CRM_CLOUD_CLIENT_SECRET} diff --git a/docker-compose.yml b/docker-compose.yml index 135130f27..ed87a9316 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,7 @@ services: REDIS_PASS: ${REDIS_PASS} REDIS_PORT: ${REDIS_PORT} REDIS_DB: ${REDIS_DB} + WEBHOOK_INGRESS: ${WEBHOOK_INGRESS} ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID} HUBSPOT_CRM_CLOUD_CLIENT_SECRET: ${HUBSPOT_CRM_CLOUD_CLIENT_SECRET} diff --git a/ngrok.yml b/ngrok.yml index c53b55532..f60f3d752 100644 --- a/ngrok.yml +++ b/ngrok.yml @@ -1,5 +1,5 @@ version: 2 -authtoken: YOUR_NGROK_KEY_HERE +authtoken: 2hkEp1JOOyYzutRyUa5f74UWll5_7oDCZH2Rd5bryqKj9geTV log_level: debug log: stdout @@ -7,4 +7,4 @@ tunnels: api-tunnel: proto: http addr: 3000 - domain: your_ngrok_domain_here \ No newline at end of file + domain: prepared-wildcat-infinitely.ngrok-free.app \ No newline at end of file diff --git a/packages/api/prisma/schema.prisma b/packages/api/prisma/schema.prisma index 7e528d24a..ef9a9158f 100644 --- a/packages/api/prisma/schema.prisma +++ b/packages/api/prisma/schema.prisma @@ -50,6 +50,159 @@ model webhooks_reponses { webhook_delivery_attempts webhook_delivery_attempts[] } +model crm_deals_stages { + id_crm_deals_stage String @id(map: "pk_crm_deal_stages") @db.Uuid + stage_name String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_linked_user String? @db.Uuid + remote_id String? + remote_platform String? + crm_deals crm_deals[] +} + +model crm_users { + id_crm_user String @id(map: "pk_crm_users") @db.Uuid + name String? + email String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_linked_user String? @db.Uuid + remote_id String? + remote_platform String? + crm_companies crm_companies[] + crm_contacts crm_contacts[] + crm_deals crm_deals[] + crm_engagements crm_engagements[] + crm_tasks crm_tasks[] +} + +model cs_attributes { + id_cs_attribute String @id(map: "pk_ct_attributes") @db.Uuid + attribute_slug String + data_type String + id_cs_entity String @db.Uuid +} + +model cs_entities { + id_cs_entity String @id(map: "pk_ct_entities") @db.Uuid + id_connection_strategy String @db.Uuid +} + +model cs_values { + id_cs_value String @id(map: "pk_ct_values") @db.Uuid + value String + id_cs_attribute String @db.Uuid +} + +/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments +model entity { + id_entity String @id(map: "pk_entity") @db.Uuid + ressource_owner_id String @db.Uuid + attribute attribute[] + value value[] +} + +/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments +model remote_data { + id_remote_data String @id(map: "pk_remote_data") @db.Uuid + ressource_owner_id String? @unique(map: "force_unique_ressourceownerid") @db.Uuid + format String? + data String? + created_at DateTime? @db.Timestamp(6) +} + +/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments +model tcg_accounts { + id_tcg_account String @id(map: "pk_tcg_account") @db.Uuid + remote_id String? + name String? + domains String[] + remote_platform String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_linked_user String? @db.Uuid + tcg_contacts tcg_contacts[] +} + +model tcg_collections { + id_tcg_collection String @id(map: "pk_tcg_collections") @db.Uuid + name String? + description String? + remote_id String? + remote_platform String? + collection_type String? + parent_collection String? @db.Uuid + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_linked_user String @db.Uuid +} + +model tcg_teams { + id_tcg_team String @id(map: "pk_tcg_teams") @db.Uuid + remote_id String? + remote_platform String? + name String? + description String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_linked_user String? @db.Uuid +} + +/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments +model tcg_users { + id_tcg_user String @id(map: "pk_tcg_users") @db.Uuid + name String? + email_address String? + remote_id String? + remote_platform String? + teams String[] + created_at DateTime? @db.Timestamp(6) + modified_at DateTime? @db.Timestamp(6) + id_linked_user String? @db.Uuid + tcg_comments tcg_comments[] +} + +/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments +model managed_webhooks { + id_managed_webhook String @id(map: "pk_managed_webhooks") @db.Uuid + active Boolean + id_connection String @db.Uuid + endpoint String @db.Uuid + api_version String? + active_events String[] + remote_signing_secret String? + modified_at DateTime @db.Timestamp(6) + created_at DateTime @db.Timestamp(6) +} + +model fs_drives { + id_fs_drive String @id(map: "pk_fs_drives") @db.Uuid + remote_created_at DateTime? @db.Timestamp(6) + drive_url String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + remote_id String? +} + +/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments +model fs_permissions { + id_fs_permission String @id(map: "pk_fs_permissions") @db.Uuid + remote_id String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + user String @db.Uuid + group String @db.Uuid + type String[] + roles String[] +} + +model fs_shared_links { + id_fs_shared_link String @id(map: "pk_fs_shared_links") @db.Uuid + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) +} + model api_keys { id_api_key String @id(map: "id_") @db.Uuid api_key_hash String @unique(map: "unique_api_keys") @@ -113,6 +266,22 @@ model connections { @@index([id_linked_user], map: "fk_connections_to_linkedusersid") } +model connector_sets { + id_connector_set String @id(map: "pk_project_connector") @db.Uuid + crm_hubspot Boolean + crm_zoho Boolean + crm_attio Boolean + crm_pipedrive Boolean + crm_zendesk Boolean + crm_close Boolean + tcg_zendesk Boolean + tcg_jira Boolean + tcg_gorgias Boolean + tcg_gitlab Boolean + tcg_front Boolean + projects projects[] +} + /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model crm_addresses { id_crm_address String @id(map: "pk_crm_addresses") @db.Uuid @@ -203,17 +372,6 @@ model crm_deals { @@index([id_crm_company], map: "fk_crm_deal_crmcompanyid") } -model crm_deals_stages { - id_crm_deals_stage String @id(map: "pk_crm_deal_stages") @db.Uuid - stage_name String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_linked_user String? @db.Uuid - remote_id String? - remote_platform String? - crm_deals crm_deals[] -} - /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model crm_email_addresses { id_crm_email String @id(map: "pk_crm_contact_email_addresses") @db.Uuid @@ -328,48 +486,6 @@ model crm_tasks { @@index([id_crm_deal], map: "fk_crmtask_dealid") } -model crm_users { - id_crm_user String @id(map: "pk_crm_users") @db.Uuid - name String? - email String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_linked_user String? @db.Uuid - remote_id String? - remote_platform String? - crm_companies crm_companies[] - crm_contacts crm_contacts[] - crm_deals crm_deals[] - crm_engagements crm_engagements[] - crm_tasks crm_tasks[] -} - -model cs_attributes { - id_cs_attribute String @id(map: "pk_ct_attributes") @db.Uuid - attribute_slug String - data_type String - id_cs_entity String @db.Uuid -} - -model cs_entities { - id_cs_entity String @id(map: "pk_ct_entities") @db.Uuid - id_connection_strategy String @db.Uuid -} - -model cs_values { - id_cs_value String @id(map: "pk_ct_values") @db.Uuid - value String - id_cs_attribute String @db.Uuid -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model entity { - id_entity String @id(map: "pk_entity") @db.Uuid - ressource_owner_id String @db.Uuid - attribute attribute[] - value value[] -} - /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model events { id_event String @id(map: "pk_jobs") @db.Uuid @@ -388,6 +504,39 @@ model events { @@index([id_linked_user], map: "fk_linkeduserid_projectid") } +model fs_files { + id_fs_file String @id(map: "pk_fs_files") @db.Uuid + name String? + type String? + path String? + mime_type String? + size BigInt? + remote_id String? + id_fs_folder String? @db.Uuid + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_fs_permission String @db.Uuid + + @@index([id_fs_folder], map: "fk_fs_file_folderid") + @@index([id_fs_permission], map: "fk_fs_file_permissionid") +} + +model fs_folders { + id_fs_folder String @id(map: "pk_fs_folders") @db.Uuid + folder_url String? + size BigInt? + description String? + parent_folder String? @db.Uuid + remote_id String? + created_at DateTime @db.Timestamp(6) + modified_at DateTime @db.Timestamp(6) + id_fs_drive String? @db.Uuid + id_fs_permission String @db.Uuid + + @@index([id_fs_drive], map: "fk_fs_folder_driveid") + @@index([id_fs_permission], map: "fk_fs_folder_permissionid") +} + model invite_links { id_invite_link String @id(map: "pk_invite_links") @db.Uuid status String @@ -442,28 +591,6 @@ model projects { @@index([id_connector_set], map: "fk_connectors_sets") } -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model remote_data { - id_remote_data String @id(map: "pk_remote_data") @db.Uuid - ressource_owner_id String? @unique(map: "force_unique_ressourceownerid") @db.Uuid - format String? - data String? - created_at DateTime? @db.Timestamp(6) -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model tcg_accounts { - id_tcg_account String @id(map: "pk_tcg_account") @db.Uuid - remote_id String? - name String? - domains String[] - remote_platform String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_linked_user String? @db.Uuid - tcg_contacts tcg_contacts[] -} - /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model tcg_attachments { id_tcg_attachment String @id(map: "pk_tcg_attachments") @db.Uuid @@ -484,19 +611,6 @@ model tcg_attachments { @@index([id_tcg_ticket], map: "fk_tcg_attachment_tcg_ticketid") } -model tcg_collections { - id_tcg_collection String @id(map: "pk_tcg_collections") @db.Uuid - name String? - description String? - remote_id String? - remote_platform String? - collection_type String? - parent_collection String? @db.Uuid - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_linked_user String @db.Uuid -} - /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model tcg_comments { id_tcg_comment String @id(map: "pk_tcg_comments") @db.Uuid @@ -555,17 +669,6 @@ model tcg_tags { @@index([id_tcg_ticket], map: "fk_tcg_tag_tcg_ticketid") } -model tcg_teams { - id_tcg_team String @id(map: "pk_tcg_teams") @db.Uuid - remote_id String? - remote_platform String? - name String? - description String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_linked_user String? @db.Uuid -} - /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model tcg_tickets { id_tcg_ticket String @id(map: "pk_tcg_tickets") @db.Uuid @@ -594,20 +697,6 @@ model tcg_tickets { @@index([id_tcg_user], map: "fk_tcg_ticket_tcg_user") } -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model tcg_users { - id_tcg_user String @id(map: "pk_tcg_users") @db.Uuid - name String? - email_address String? - remote_id String? - remote_platform String? - teams String[] - created_at DateTime? @db.Timestamp(6) - modified_at DateTime? @db.Timestamp(6) - id_linked_user String? @db.Uuid - tcg_comments tcg_comments[] -} - /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments model value { id_value String @id(map: "pk_value") @db.Uuid @@ -642,92 +731,3 @@ model webhook_delivery_attempts { @@index([id_event], map: "fk_webhook_delivery_attempt_eventid") @@index([id_webhooks_reponse], map: "fk_webhook_delivery_attempt_webhook_responseid") } - -model connector_sets { - id_connector_set String @id(map: "pk_project_connector") @db.Uuid - crm_hubspot Boolean - crm_zoho Boolean - crm_attio Boolean - crm_pipedrive Boolean - crm_zendesk Boolean - crm_close Boolean - tcg_zendesk Boolean - tcg_jira Boolean - tcg_gorgias Boolean - tcg_gitlab Boolean - tcg_front Boolean - projects projects[] -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model managed_webhooks { - id_managed_webhook String @id(map: "pk_managed_webhooks") @db.Uuid - active Boolean - id_connection String @db.Uuid - endpoint String @db.Uuid - api_version String? - active_events String[] - remote_signing_secret String? - modified_at DateTime @db.Timestamp(6) - created_at DateTime @db.Timestamp(6) -} - -model fs_drives { - id_fs_drive String @id(map: "pk_fs_drives") @db.Uuid - remote_created_at DateTime? @db.Timestamp(6) - drive_url String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - remote_id String? -} - -model fs_files { - id_fs_file String @id(map: "pk_fs_files") @db.Uuid - name String? - type String? - path String? - mime_type String? - size BigInt? - remote_id String? - id_fs_folder String? @db.Uuid - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_fs_permission String @db.Uuid - - @@index([id_fs_folder], map: "fk_fs_file_folderid") - @@index([id_fs_permission], map: "fk_fs_file_permissionid") -} - -model fs_folders { - id_fs_folder String @id(map: "pk_fs_folders") @db.Uuid - folder_url String? - size BigInt? - description String? - parent_folder String? @db.Uuid - remote_id String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - id_fs_drive String? @db.Uuid - id_fs_permission String @db.Uuid - - @@index([id_fs_drive], map: "fk_fs_folder_driveid") - @@index([id_fs_permission], map: "fk_fs_folder_permissionid") -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model fs_permissions { - id_fs_permission String @id(map: "pk_fs_permissions") @db.Uuid - remote_id String? - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) - user String @db.Uuid - group String @db.Uuid - type String[] - roles String[] -} - -model fs_shared_links { - id_fs_shared_link String @id(map: "pk_fs_shared_links") @db.Uuid - created_at DateTime @db.Timestamp(6) - modified_at DateTime @db.Timestamp(6) -} diff --git a/packages/api/scripts/connectorUpdate.js b/packages/api/scripts/connectorUpdate.js index f2582b431..3cee6a1c0 100755 --- a/packages/api/scripts/connectorUpdate.js +++ b/packages/api/scripts/connectorUpdate.js @@ -157,12 +157,9 @@ function updateMappingsFile( ) { let fileContent = fs.readFileSync(mappingsFile, 'utf8'); - // Identify where the existing content before the first import starts, to preserve any comments or metadata at the start of the file const firstImportIndex = fileContent.indexOf('import '); const beforeFirstImport = firstImportIndex > -1 ? fileContent.substring(0, firstImportIndex) : ''; - - // Prepare sections of the file content for updates const afterFirstImport = firstImportIndex > -1 ? fileContent.substring(firstImportIndex) @@ -177,67 +174,80 @@ function updateMappingsFile( let newImports = ''; let newInstances = ''; let newMappings = ''; - newServiceDirs - .filter( - (newServiceName) => - !( - vertical === 'ticketing' && newServiceName.toLowerCase() === 'zendesk' - ), - ) - .forEach((newServiceName) => { + newServiceDirs.forEach((newServiceName) => { + if ( + !(vertical === 'ticketing' && newServiceName.toLowerCase() === 'zendesk') + ) { const serviceNameCapitalized = newServiceName.charAt(0).toUpperCase() + newServiceName.slice(1); const objectCapitalized = objectType.charAt(0).toUpperCase() + objectType.slice(1); - const mapperClassName = `${serviceNameCapitalized}${objectCapitalized}Mapper`; const mapperInstanceName = `${newServiceName.toLowerCase()}${objectCapitalized}Mapper`; - // Prepare the import statement and instance declaration const importStatement = `import { ${mapperClassName} } from '../services/${newServiceName}/mappers';\n`; const instanceDeclaration = `const ${mapperInstanceName} = new ${mapperClassName}();\n`; const mappingEntry = ` ${newServiceName.toLowerCase()}: {\n unify: ${mapperInstanceName}.unify.bind(${mapperInstanceName}),\n desunify: ${mapperInstanceName}.desunify.bind(${mapperInstanceName}),\n },\n`; - // Check and append new import if it's not already present if (!fileContent.includes(importStatement)) { newImports += importStatement; } - - // Append instance declaration if not already present before the mapping object if (!beforeMappingObject.includes(instanceDeclaration)) { newInstances += instanceDeclaration; } - - // Prepare and append new mapping entry if not already present in the mapping object if (!mappingObjectContent.includes(` ${newServiceName}: {`)) { newMappings += mappingEntry; } - }); + } + }); - // Combine updates with the original sections of the file content const updatedContentBeforeMapping = - beforeFirstImport + - newImports + - beforeMappingObject.trim() + - '\n\n' + - newInstances; - - // Update the mapping object content with new mappings - const insertionPoint = mappingObjectContent.lastIndexOf('};'); + beforeFirstImport + newImports + beforeMappingObject.trim(); const updatedMappingObjectContent = [ - mappingObjectContent.slice(0, insertionPoint), + mappingObjectContent.slice(0, mappingObjectContent.lastIndexOf('};')), newMappings, - mappingObjectContent.slice(insertionPoint), + mappingObjectContent.slice(mappingObjectContent.lastIndexOf('};')), ].join(''); - // Reassemble the complete updated file content const updatedFileContent = - updatedContentBeforeMapping + updatedMappingObjectContent; - - // Write the updated content back to the file + updatedContentBeforeMapping + + '\n' + + newInstances + + updatedMappingObjectContent; fs.writeFileSync(mappingsFile, updatedFileContent); } +function activateProviders(metadataFilePath, vertical, providerNames) { + let fileContent = fs.readFileSync(metadataFilePath, 'utf8'); + + providerNames.forEach((providerName) => { + // Define the pattern to find the service entry including the "active: false" line within the specified vertical + const pattern = new RegExp( + `'${vertical}': {([\\s\\S]*?)('${providerName}': {([\\s\\S]*?)}),?\\s*active: false`, + 'm', + ); + const match = fileContent.match(pattern); + + if (match && match[0]) { + // Replace "active: false" with "active: true" + const updatedServiceBlock = match[0].replace( + 'active: false', + 'active: true', + ); + + // Replace the original service block with the updated one in the file content + fileContent = fileContent.replace(pattern, updatedServiceBlock); + console.log( + `Service '${providerName}' in '${vertical}' activated successfully.`, + ); + } else { + console.error(`Service '${providerName}' not found in '${vertical}'.`); + } + }); + + // Write the updated content back to the file after all changes + fs.writeFileSync(metadataFilePath, fileContent); +} // Function to extract the array from a file function extractArrayFromFile(filePath, arrayName) { const fileContents = readFileContents(filePath); @@ -300,24 +310,32 @@ function updateEnumFile(enumFilePath, newServiceDirs, vertical) { const match = fileContent.match(enumRegex); if (match && match[1]) { + // Clean up and prepare the existing enum entries let enumEntries = match[1] .trim() .split(/\n/) - .map((e) => e.trim()) - .filter((e) => e); + .map((entry) => entry.trim()) + .filter((entry) => entry.endsWith(',')) // Ensure all entries end with a comma + .map((entry) => entry.replace(/,$/, '')); // Remove commas for a clean slate + const existingEntries = enumEntries.map((entry) => entry.split('=')[0].trim(), ); // Prepare new entries to be added newServiceDirs.forEach((serviceName) => { - const enumEntryName = serviceName.toUpperCase(); // Assuming the enum entry name is the uppercase service name + const enumEntryName = serviceName.toUpperCase(); if (!existingEntries.includes(enumEntryName)) { // Format the new enum entry, assuming you want the name and value to be the same - enumEntries.push(`${enumEntryName} = '${serviceName}',`); + enumEntries.push(`${enumEntryName} = '${serviceName}'`); } }); + // Add commas back to all entries except the last one + enumEntries = enumEntries.map((entry, index, array) => + index === array.length - 1 ? entry : `${entry},`, + ); + // Rebuild the enum content const updatedEnumContent = `export enum ${enumName} {\n ${enumEntries.join( '\n ', @@ -328,19 +346,21 @@ function updateEnumFile(enumFilePath, newServiceDirs, vertical) { // Write the updated content back to the file fs.writeFileSync(enumFilePath, fileContent); - //console.log(`Updated ${enumName} in ${enumFilePath}`); } else { console.error(`Could not find enum ${enumName} in file.`); } } -// New function to update init.sql function updateInitSQLFile(initSQLFile, newServiceDirs, vertical) { + // Read the content of the SQL file let fileContent = fs.readFileSync(initSQLFile, 'utf8'); + + // Find the insert point just before the PRIMARY KEY constraint const insertPoint = fileContent.indexOf( 'CONSTRAINT PK_project_connector PRIMARY KEY', ); + // Handle the case where the constraint is not found if (insertPoint === -1) { console.error( `Could not find the PRIMARY KEY constraint in ${initSQLFile}`, @@ -348,65 +368,70 @@ function updateInitSQLFile(initSQLFile, newServiceDirs, vertical) { return; } - let newLines = ''; - newServiceDirs.forEach((serviceName) => { - const columnName = `${vertical.toLowerCase()}_${serviceName.toLowerCase()}`; - newLines += ` ${columnName} boolean NOT NULL,\n`; - }); - - fileContent = [ - fileContent.slice(0, insertPoint), - newLines, - fileContent.slice(insertPoint), - ].join(''); - + // Prepare new column lines to be inserted + let newLines = newServiceDirs + .map((serviceName) => { + const columnName = `${vertical.toLowerCase()}_${serviceName.toLowerCase()}`; + return ` ${columnName} boolean NOT NULL,\n`; + }) + .join(''); + + // Insert the new column definitions just before the PRIMARY KEY constraint + fileContent = + fileContent.slice(0, insertPoint) + + newLines + + fileContent.slice(insertPoint); + + // Write the modified content back to the file fs.writeFileSync(initSQLFile, fileContent); } -// New function to update seed.sql function updateSeedSQLFile(seedSQLFile, newServiceDirs, vertical) { let fileContent = fs.readFileSync(seedSQLFile, 'utf8'); - const tableInsertPoint = fileContent.indexOf('INSERT INTO connector_sets'); - if (tableInsertPoint === -1) { - console.error( - `Could not find the INSERT INTO connector_sets statement in ${seedSQLFile}`, - ); - return; + // Regex to find the INSERT statement for connector_sets + const regex = /INSERT INTO connector_sets \(([^)]+)\) VALUES/g; + let match; + let lastMatch; + while ((match = regex.exec(fileContent)) !== null) { + lastMatch = match; // Store the last match } - const columnInsertPoint = fileContent.indexOf('(', tableInsertPoint); - const valuesInsertPoint = fileContent.indexOf('VALUES', columnInsertPoint); - const rowsInsertPoint = fileContent.indexOf('(', valuesInsertPoint); - - if ( - columnInsertPoint === -1 || - valuesInsertPoint === -1 || - rowsInsertPoint === -1 - ) { - console.error( - `Could not find the column or values insert points in ${seedSQLFile}`, - ); + if (!lastMatch) { + console.error('Could not find the INSERT INTO connector_sets statement.'); return; } - let newColumns = ''; - let newValues = ''; - newServiceDirs.forEach((serviceName) => { - const columnName = `${vertical.toLowerCase()}_${serviceName.toLowerCase()}`; - newColumns += `${columnName}, `; - newValues += 'TRUE, '; - }); + // Extracting columns and preparing to insert new ones + let columns = lastMatch[1].split(',').map((col) => col.trim()); + let newColumns = newServiceDirs.map( + (serviceName) => `${vertical.toLowerCase()}_${serviceName.toLowerCase()}`, + ); - const updatedFileContent = [ - fileContent.slice(0, columnInsertPoint + 1), - newColumns, - fileContent.slice(columnInsertPoint + 1, rowsInsertPoint + 1), - newValues, - fileContent.slice(rowsInsertPoint + 1), - ].join(''); + // Filter out existing new columns to avoid duplication + newColumns = newColumns.filter((nc) => !columns.includes(nc)); + if (newColumns.length > 0) { + // Insert new columns before the closing parenthesis in the columns list + columns = [...columns, ...newColumns]; + let newColumnsSection = columns.join(', '); + + // Replace the old columns section with the new one + fileContent = fileContent.replace(lastMatch[1], newColumnsSection); + + // Update each VALUES section + fileContent = fileContent.replace(/VALUES(.*?);/gs, (match) => { + return match + .replace(/\),\s*\(/g, '),\n (') // Fix line formatting + .replace(/\([^\)]+\)/g, (values) => { + let newValues = newColumns.map(() => 'TRUE').join(', '); + return values.slice(0, -1) + ', ' + newValues + ')'; + }); + }); + } - fs.writeFileSync(seedSQLFile, updatedFileContent); + // Write the modified content back to the file + fs.writeFileSync(seedSQLFile, fileContent); + console.log('Seed SQL file has been updated successfully.'); } // Main script logic @@ -486,10 +511,16 @@ function updateObjectTypes(baseDir, objectType, vertical) { // Update SQL files const initSQLFile = path.join(__dirname, './init.sql'); - updateInitSQLFile(initSQLFile, newServiceDirs, slugFromCategory(vertical)); + updateInitSQLFile(initSQLFile, newProviders, slugFromCategory(vertical)); const seedSQLFile = path.join(__dirname, './seed.sql'); - updateSeedSQLFile(seedSQLFile, newServiceDirs, slugFromCategory(vertical)); + updateSeedSQLFile(seedSQLFile, newProviders, slugFromCategory(vertical)); + + const metadata_file = path.join( + __dirname, + '../../shared/src/connectors/metadata.ts', + ); + //activateProviders(metadata_file, vertical, newProviders); } // Example usage for ticketing/team diff --git a/packages/api/scripts/init.sql b/packages/api/scripts/init.sql index 6eb0d80c0..aeb4df49f 100644 --- a/packages/api/scripts/init.sql +++ b/packages/api/scripts/init.sql @@ -423,9 +423,7 @@ CREATE TABLE connector_sets tcg_gorgias boolean NOT NULL, tcg_gitlab boolean NOT NULL, tcg_front boolean NOT NULL, - crm_zendesk boolean NOT NULL, - crm_close boolean NOT NULL, - CONSTRAINT PK_project_connector PRIMARY KEY ( id_connector_set ) +CONSTRAINT PK_project_connector PRIMARY KEY ( id_connector_set ) ); @@ -434,7 +432,6 @@ CREATE TABLE connector_sets - -- ************************************** connection_strategies CREATE TABLE connection_strategies @@ -583,6 +580,7 @@ CREATE TABLE fs_folders CREATE INDEX FK_fs_folder_driveID ON fs_folders ( id_fs_drive +); CREATE INDEX FK_fs_folder_permissionID ON fs_folders ( diff --git a/packages/api/scripts/seed.sql b/packages/api/scripts/seed.sql index 620985342..afb0d02d3 100644 --- a/packages/api/scripts/seed.sql +++ b/packages/api/scripts/seed.sql @@ -1,7 +1,7 @@ INSERT INTO users (id_user, identification_strategy, email, password_hash, first_name, last_name) VALUES ('0ce39030-2901-4c56-8db0-5e326182ec6b', 'b2c','local@panora.dev', '$2b$10$Y7Q8TWGyGuc5ecdIASbBsuXMo3q/Rs3/cnY.mLZP4tUgfGUOCUBlG', 'local', 'Panora'); -INSERT INTO connector_sets (id_connector_set, crm_hubspot, crm_zoho, crm_pipedrive, crm_attio, crm_zendesk, crm_close, tcg_zendesk, tcg_gorgias, tcg_front, tcg_jira, tcg_gitlab) VALUES +INSERT INTO connector_sets (id_connector_set, crm_attio, crm_close, crm_hubspot, crm_pipedrive, crm_zendesk, crm_zoho, tcg_zendesk, tcg_gorgias, tcg_front, tcg_jira, tcg_gitlab) VALUES ('1709da40-17f7-4d3a-93a0-96dc5da6ddd7', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), ('852dfff8-ab63-4530-ae49-e4b2924407f8', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), ('aed0f856-f802-4a79-8640-66d441581a99', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); diff --git a/packages/api/src/@core/connections-strategies/connections-strategies.service.ts b/packages/api/src/@core/connections-strategies/connections-strategies.service.ts index 94a905c59..c0f29f63f 100644 --- a/packages/api/src/@core/connections-strategies/connections-strategies.service.ts +++ b/packages/api/src/@core/connections-strategies/connections-strategies.service.ts @@ -99,7 +99,7 @@ export class ConnectionsStrategiesService { for (let i = 0; i < attributes.length; i++) { const attribute_slug = attributes[i]; const value = values[i]; - //create all attributes (for oauth => client_id, client_secret) + //create all attributes (for oauth => client_id, client_secret, subdomain ??) const attribute_ = await this.prisma.cs_attributes.create({ data: { id_cs_attribute: uuidv4(), diff --git a/packages/api/src/@core/environment/environment.service.ts b/packages/api/src/@core/environment/environment.service.ts index 690e75a89..d28cbf1cf 100644 --- a/packages/api/src/@core/environment/environment.service.ts +++ b/packages/api/src/@core/environment/environment.service.ts @@ -20,6 +20,9 @@ export class EnvironmentService { getEnvMode(): string { return this.configService.get('ENV'); } + getWebhookIngress(): string { + return this.configService.get('WEBHOOK_INGRESS'); + } getSentryDsn(): string { return this.configService.get('SENTRY_DSN'); } diff --git a/packages/api/src/ticketing/@webhook/zendesk/handler.ts b/packages/api/src/ticketing/@webhook/zendesk/handler.ts index bb8589090..31c5b05e6 100644 --- a/packages/api/src/ticketing/@webhook/zendesk/handler.ts +++ b/packages/api/src/ticketing/@webhook/zendesk/handler.ts @@ -63,21 +63,31 @@ export class ZendeskHandlerService { if (!conn) throw ReferenceError('Connection undefined'); const unified_events = mw.active_events; - const events_ = unified_events - .flatMap((event) => mapToRemoteEvent(event)) - .filter((item) => item !== null && item !== undefined); - + const events_ = Array.from( + new Set( + unified_events + .flatMap((event) => mapToRemoteEvent(event)) + .filter((item) => item !== null && item !== undefined), + ), + ); // Converts the Set back into an array const body_data = { webhook: { name: webhook_name, status: 'active', - endpoint: `${this.env.getPanoraBaseUrl()}/mw/${mw.endpoint}`, + endpoint: `${this.env.getWebhookIngress()}/mw/${mw.endpoint}`, http_method: 'POST', request_format: 'json', subscriptions: events_, }, }; + this.logger.log( + `Logging data with token: ${this.cryptoService.decrypt( + conn.access_token, + )} to endpoint :${conn.account_url}/webhooks` + + JSON.stringify(body_data), + ); + this.logger.log('Creating basic webhook... '); const resp = await axios.post( @@ -150,7 +160,7 @@ export class ZendeskHandlerService { webhook: { name: webhook_name, status: 'active', - endpoint: `${this.env.getPanoraBaseUrl()}/mw/${mw.endpoint}`, + endpoint: `${this.env.getWebhookIngress()}/mw/${mw.endpoint}`, http_method: 'POST', request_format: 'json', subscriptions: ['conditional_ticket_events'], @@ -210,10 +220,6 @@ export class ZendeskHandlerService { field: 'priority', operator: 'changed', }, - { - field: 'status', - value: 'changed', - }, { field: 'update_type', value: 'Create', @@ -310,7 +316,7 @@ export class ZendeskHandlerService { action: 'UPDATE', data: { remote_id: payload.ticketId as string }, }, - ); + ); } else { //non-ticket payload const payload_ = payload as NonTicketPayload; @@ -393,7 +399,6 @@ export class ZendeskHandlerService { return [values[0], values[1]]; } - async verifyWebhookAuthenticity( signature: string, timestamp: string, diff --git a/packages/api/swagger/swagger-spec.json b/packages/api/swagger/swagger-spec.json index cbc4cc7e3..a266f957d 100644 --- a/packages/api/swagger/swagger-spec.json +++ b/packages/api/swagger/swagger-spec.json @@ -599,10 +599,10 @@ ] } }, - "/crm/companies": { + "/ticketing/tickets": { "get": { - "operationId": "getCompanies", - "summary": "List a batch of Companies", + "operationId": "getTickets", + "summary": "List a batch of Tickets", "parameters": [ { "name": "x-connection-token", @@ -655,7 +655,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } @@ -666,7 +666,7 @@ } }, "tags": [ - "crm/companies" + "ticketing/tickets" ], "security": [ { @@ -675,9 +675,9 @@ ] }, "post": { - "operationId": "addCompany", - "summary": "Create a Company", - "description": "Create a company in any supported Crm software", + "operationId": "addTicket", + "summary": "Create a Ticket", + "description": "Create a ticket in any supported Ticketing software", "parameters": [ { "name": "x-connection-token", @@ -692,7 +692,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original Ticketing software.", "schema": { "type": "boolean" } @@ -703,7 +703,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedCompanyInput" + "$ref": "#/components/schemas/UnifiedTicketInput" } } } @@ -721,7 +721,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } @@ -735,14 +735,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } } }, "tags": [ - "crm/companies" + "ticketing/tickets" ], "security": [ { @@ -751,8 +751,8 @@ ] }, "patch": { - "operationId": "updateCompany", - "summary": "Update a Company", + "operationId": "updateTicket", + "summary": "Update a Ticket", "parameters": [ { "name": "id", @@ -769,25 +769,14 @@ "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ApiResponse" - }, - { - "properties": { - "data": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" - } - } - } - ] + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } } }, "tags": [ - "crm/companies" + "ticketing/tickets" ], "security": [ { @@ -796,17 +785,17 @@ ] } }, - "/crm/companies/{id}": { + "/ticketing/tickets/{id}": { "get": { - "operationId": "getCompany", - "summary": "Retrieve a Company", - "description": "Retrieve a company from any connected Crm software", + "operationId": "getTicket", + "summary": "Retrieve a Ticket", + "description": "Retrieve a ticket from any connected Ticketing software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the company you want to retrieve.", + "description": "id of the `ticket` you want to retrive.", "schema": { "type": "string" } @@ -815,7 +804,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original Ticketing software.", "schema": { "type": "boolean" } @@ -834,7 +823,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } @@ -845,7 +834,7 @@ } }, "tags": [ - "crm/companies" + "ticketing/tickets" ], "security": [ { @@ -854,10 +843,10 @@ ] } }, - "/crm/companies/batch": { + "/ticketing/tickets/batch": { "post": { - "operationId": "addCompanies", - "summary": "Add a batch of Companies", + "operationId": "addTickets", + "summary": "Add a batch of Tickets", "parameters": [ { "name": "x-connection-token", @@ -872,7 +861,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original Ticketing software.", "schema": { "type": "boolean" } @@ -885,7 +874,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedCompanyInput" + "$ref": "#/components/schemas/UnifiedTicketInput" } } } @@ -904,7 +893,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } @@ -920,7 +909,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedCompanyOutput" + "$ref": "#/components/schemas/UnifiedTicketOutput" } } } @@ -928,7 +917,7 @@ } }, "tags": [ - "crm/companies" + "ticketing/tickets" ], "security": [ { @@ -937,10 +926,10 @@ ] } }, - "/crm/contacts": { + "/ticketing/users": { "get": { - "operationId": "getContacts", - "summary": "List a batch of CRM Contacts", + "operationId": "getUsers", + "summary": "List a batch of Users", "parameters": [ { "name": "x-connection-token", @@ -993,7 +982,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedContactOutput" + "$ref": "#/components/schemas/UnifiedUserOutput" } } } @@ -1004,24 +993,26 @@ } }, "tags": [ - "crm/contacts" + "ticketing/users" ], "security": [ { "JWT": [] } ] - }, - "post": { - "operationId": "addContact", - "summary": "Create CRM Contact", - "description": "Create a contact in any supported CRM", + } + }, + "/ticketing/users/{id}": { + "get": { + "operationId": "getUser", + "summary": "Retrieve a User", + "description": "Retrieve a user from any connected Ticketing software", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", + "in": "path", + "description": "id of the user you want to retrieve.", "schema": { "type": "string" } @@ -1030,22 +1021,12 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original CRM software.", + "description": "Set to true to include data from the original Ticketing software.", "schema": { "type": "boolean" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedContactInput" - } - } - } - }, "responses": { "200": { "description": "", @@ -1059,7 +1040,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedContactOutput" + "$ref": "#/components/schemas/UnifiedUserOutput" } } } @@ -1067,54 +1048,10 @@ } } } - }, - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedContactOutput" - } - } - } - } - }, - "tags": [ - "crm/contacts" - ], - "security": [ - { - "JWT": [] - } - ] - }, - "patch": { - "operationId": "updateContact", - "summary": "Update a CRM Contact", - "parameters": [ - { - "name": "id", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedContactOutput" - } - } - } } }, "tags": [ - "crm/contacts" + "ticketing/users" ], "security": [ { @@ -1123,17 +1060,16 @@ ] } }, - "/crm/contacts/{id}": { + "/ticketing/accounts": { "get": { - "operationId": "getContact", - "summary": "Retrieve a CRM Contact", - "description": "Retrieve a contact from any connected CRM", + "operationId": "getAccounts", + "summary": "List a batch of Accounts", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the `contact` you want to retrive.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -1142,10 +1078,29 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original CRM software.", + "description": "Set to true to include data from the original software.", "schema": { "type": "boolean" } + }, + { + "name": "pageSize", + "required": false, + "in": "query", + "description": "Set to get the number of records.", + "schema": { + "default": 50, + "type": "number" + } + }, + { + "name": "cursor", + "required": false, + "in": "query", + "description": "Set to get the number of records after this cursor.", + "schema": { + "type": "string" + } } ], "responses": { @@ -1161,7 +1116,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedContactOutput" + "$ref": "#/components/schemas/UnifiedAccountOutput" } } } @@ -1172,7 +1127,7 @@ } }, "tags": [ - "crm/contacts" + "ticketing/accounts" ], "security": [ { @@ -1181,16 +1136,17 @@ ] } }, - "/crm/contacts/batch": { - "post": { - "operationId": "addContacts", - "summary": "Add a batch of CRM Contacts", + "/ticketing/accounts/{id}": { + "get": { + "operationId": "getAccount", + "summary": "Retrieve an Account", + "description": "Retrieve an account from any connected Ticketing software", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", + "in": "path", + "description": "id of the account you want to retrieve.", "schema": { "type": "string" } @@ -1199,25 +1155,12 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original CRM software.", + "description": "Set to true to include data from the original Ticketing software.", "schema": { "type": "boolean" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UnifiedContactInput" - } - } - } - } - }, "responses": { "200": { "description": "", @@ -1231,7 +1174,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedContactOutput" + "$ref": "#/components/schemas/UnifiedAccountOutput" } } } @@ -1239,23 +1182,10 @@ } } } - }, - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UnifiedContactOutput" - } - } - } - } } }, "tags": [ - "crm/contacts" + "ticketing/accounts" ], "security": [ { @@ -1264,10 +1194,10 @@ ] } }, - "/crm/deals": { + "/ticketing/contacts": { "get": { - "operationId": "getDeals", - "summary": "List a batch of Deals", + "operationId": "getContacts", + "summary": "List a batch of Contacts", "parameters": [ { "name": "x-connection-token", @@ -1320,7 +1250,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } @@ -1331,7 +1261,141 @@ } }, "tags": [ - "crm/deals" + "ticketing/contacts" + ], + "security": [ + { + "JWT": [] + } + ] + } + }, + "/ticketing/contacts/{id}": { + "get": { + "operationId": "getContact", + "summary": "Retrieve a Contact", + "description": "Retrieve a contact from any connected Ticketing software", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "description": "id of the contact you want to retrieve.", + "schema": { + "type": "string" + } + }, + { + "name": "remote_data", + "required": false, + "in": "query", + "description": "Set to true to include data from the original Ticketing software.", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ApiResponse" + }, + { + "properties": { + "data": { + "$ref": "#/components/schemas/UnifiedContactOutput" + } + } + } + ] + } + } + } + } + }, + "tags": [ + "ticketing/contacts" + ], + "security": [ + { + "JWT": [] + } + ] + } + }, + "/crm/companies": { + "get": { + "operationId": "getCompanies", + "summary": "List a batch of Companies", + "parameters": [ + { + "name": "x-connection-token", + "required": true, + "in": "header", + "description": "The connection token", + "schema": { + "type": "string" + } + }, + { + "name": "remote_data", + "required": false, + "in": "query", + "description": "Set to true to include data from the original software.", + "schema": { + "type": "boolean" + } + }, + { + "name": "pageSize", + "required": false, + "in": "query", + "description": "Set to get the number of records.", + "schema": { + "default": 50, + "type": "number" + } + }, + { + "name": "cursor", + "required": false, + "in": "query", + "description": "Set to get the number of records after this cursor.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ApiResponse" + }, + { + "properties": { + "data": { + "$ref": "#/components/schemas/UnifiedCompanyOutput" + } + } + } + ] + } + } + } + } + }, + "tags": [ + "crm/companies" ], "security": [ { @@ -1340,9 +1404,9 @@ ] }, "post": { - "operationId": "addDeal", - "summary": "Create a Deal", - "description": "Create a deal in any supported Crm software", + "operationId": "addCompany", + "summary": "Create a Company", + "description": "Create a company in any supported Crm software", "parameters": [ { "name": "x-connection-token", @@ -1368,7 +1432,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedDealInput" + "$ref": "#/components/schemas/UnifiedCompanyInput" } } } @@ -1386,7 +1450,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedCompanyOutput" } } } @@ -1400,44 +1464,31 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedCompanyOutput" } } } } }, "tags": [ - "crm/deals" + "crm/companies" ], "security": [ { "JWT": [] } ] - } - }, - "/crm/deals/{id}": { - "get": { - "operationId": "getDeal", - "summary": "Retrieve a Deal", - "description": "Retrieve a deal from any connected Crm software", + }, + "patch": { + "operationId": "updateCompany", + "summary": "Update a Company", "parameters": [ { "name": "id", "required": true, - "in": "path", - "description": "id of the deal you want to retrieve.", - "schema": { - "type": "string" - } - }, - { - "name": "remote_data", - "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", "schema": { - "type": "boolean" + "type": "string" } } ], @@ -1454,7 +1505,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedCompanyOutput" } } } @@ -1465,25 +1516,38 @@ } }, "tags": [ - "crm/deals" + "crm/companies" ], "security": [ { "JWT": [] } ] - }, - "patch": { - "operationId": "updateDeal", - "summary": "Update a Deal", + } + }, + "/crm/companies/{id}": { + "get": { + "operationId": "getCompany", + "summary": "Retrieve a Company", + "description": "Retrieve a company from any connected Crm software", "parameters": [ { "name": "id", "required": true, "in": "path", + "description": "id of the company you want to retrieve.", "schema": { "type": "string" } + }, + { + "name": "remote_data", + "required": false, + "in": "query", + "description": "Set to true to include data from the original Crm software.", + "schema": { + "type": "boolean" + } } ], "responses": { @@ -1499,7 +1563,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedCompanyOutput" } } } @@ -1510,7 +1574,7 @@ } }, "tags": [ - "crm/deals" + "crm/companies" ], "security": [ { @@ -1519,10 +1583,10 @@ ] } }, - "/crm/deals/batch": { + "/crm/companies/batch": { "post": { - "operationId": "addDeals", - "summary": "Add a batch of Deals", + "operationId": "addCompanies", + "summary": "Add a batch of Companies", "parameters": [ { "name": "x-connection-token", @@ -1550,7 +1614,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedDealInput" + "$ref": "#/components/schemas/UnifiedCompanyInput" } } } @@ -1569,7 +1633,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedCompanyOutput" } } } @@ -1585,7 +1649,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedDealOutput" + "$ref": "#/components/schemas/UnifiedCompanyOutput" } } } @@ -1593,7 +1657,7 @@ } }, "tags": [ - "crm/deals" + "crm/companies" ], "security": [ { @@ -1602,10 +1666,10 @@ ] } }, - "/crm/engagements": { + "/crm/contacts": { "get": { - "operationId": "getEngagements", - "summary": "List a batch of Engagements", + "operationId": "getContacts", + "summary": "List a batch of CRM Contacts", "parameters": [ { "name": "x-connection-token", @@ -1658,7 +1722,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } @@ -1669,7 +1733,7 @@ } }, "tags": [ - "crm/engagements" + "crm/contacts" ], "security": [ { @@ -1678,9 +1742,9 @@ ] }, "post": { - "operationId": "addEngagement", - "summary": "Create a Engagement", - "description": "Create a engagement in any supported Crm software", + "operationId": "addContact", + "summary": "Create CRM Contact", + "description": "Create a contact in any supported CRM", "parameters": [ { "name": "x-connection-token", @@ -1695,7 +1759,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original CRM software.", "schema": { "type": "boolean" } @@ -1706,7 +1770,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedEngagementInput" + "$ref": "#/components/schemas/UnifiedContactInput" } } } @@ -1724,7 +1788,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } @@ -1738,14 +1802,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } } }, "tags": [ - "crm/engagements" + "crm/contacts" ], "security": [ { @@ -1754,8 +1818,8 @@ ] }, "patch": { - "operationId": "updateEngagement", - "summary": "Update a Engagement", + "operationId": "updateContact", + "summary": "Update a CRM Contact", "parameters": [ { "name": "id", @@ -1772,25 +1836,14 @@ "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ApiResponse" - }, - { - "properties": { - "data": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" - } - } - } - ] + "$ref": "#/components/schemas/UnifiedContactOutput" } } } } }, "tags": [ - "crm/engagements" + "crm/contacts" ], "security": [ { @@ -1799,17 +1852,17 @@ ] } }, - "/crm/engagements/{id}": { + "/crm/contacts/{id}": { "get": { - "operationId": "getEngagement", - "summary": "Retrieve a Engagement", - "description": "Retrieve a engagement from any connected Crm software", + "operationId": "getContact", + "summary": "Retrieve a CRM Contact", + "description": "Retrieve a contact from any connected CRM", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the engagement you want to retrieve.", + "description": "id of the `contact` you want to retrive.", "schema": { "type": "string" } @@ -1818,7 +1871,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original CRM software.", "schema": { "type": "boolean" } @@ -1837,7 +1890,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } @@ -1848,7 +1901,7 @@ } }, "tags": [ - "crm/engagements" + "crm/contacts" ], "security": [ { @@ -1857,10 +1910,10 @@ ] } }, - "/crm/engagements/batch": { + "/crm/contacts/batch": { "post": { - "operationId": "addEngagements", - "summary": "Add a batch of Engagements", + "operationId": "addContacts", + "summary": "Add a batch of CRM Contacts", "parameters": [ { "name": "x-connection-token", @@ -1875,7 +1928,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original CRM software.", "schema": { "type": "boolean" } @@ -1888,7 +1941,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedEngagementInput" + "$ref": "#/components/schemas/UnifiedContactInput" } } } @@ -1907,7 +1960,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } @@ -1923,7 +1976,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedEngagementOutput" + "$ref": "#/components/schemas/UnifiedContactOutput" } } } @@ -1931,7 +1984,7 @@ } }, "tags": [ - "crm/engagements" + "crm/contacts" ], "security": [ { @@ -1940,10 +1993,10 @@ ] } }, - "/crm/notes": { + "/crm/deals": { "get": { - "operationId": "getNotes", - "summary": "List a batch of Notes", + "operationId": "getDeals", + "summary": "List a batch of Deals", "parameters": [ { "name": "x-connection-token", @@ -1996,7 +2049,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedNoteOutput" + "$ref": "#/components/schemas/UnifiedDealOutput" } } } @@ -2007,7 +2060,7 @@ } }, "tags": [ - "crm/notes" + "crm/deals" ], "security": [ { @@ -2016,9 +2069,9 @@ ] }, "post": { - "operationId": "addNote", - "summary": "Create a Note", - "description": "Create a note in any supported Crm software", + "operationId": "addDeal", + "summary": "Create a Deal", + "description": "Create a deal in any supported Crm software", "parameters": [ { "name": "x-connection-token", @@ -2044,7 +2097,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedNoteInput" + "$ref": "#/components/schemas/UnifiedDealInput" } } } @@ -2062,7 +2115,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedNoteOutput" + "$ref": "#/components/schemas/UnifiedDealOutput" } } } @@ -2076,14 +2129,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedNoteOutput" + "$ref": "#/components/schemas/UnifiedDealOutput" } } } } }, "tags": [ - "crm/notes" + "crm/deals" ], "security": [ { @@ -2092,17 +2145,17 @@ ] } }, - "/crm/notes/{id}": { + "/crm/deals/{id}": { "get": { - "operationId": "getNote", - "summary": "Retrieve a Note", - "description": "Retrieve a note from any connected Crm software", + "operationId": "getDeal", + "summary": "Retrieve a Deal", + "description": "Retrieve a deal from any connected Crm software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the note you want to retrieve.", + "description": "id of the deal you want to retrieve.", "schema": { "type": "string" } @@ -2130,7 +2183,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedNoteOutput" + "$ref": "#/components/schemas/UnifiedDealOutput" } } } @@ -2141,7 +2194,52 @@ } }, "tags": [ - "crm/notes" + "crm/deals" + ], + "security": [ + { + "JWT": [] + } + ] + }, + "patch": { + "operationId": "updateDeal", + "summary": "Update a Deal", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ApiResponse" + }, + { + "properties": { + "data": { + "$ref": "#/components/schemas/UnifiedDealOutput" + } + } + } + ] + } + } + } + } + }, + "tags": [ + "crm/deals" ], "security": [ { @@ -2150,10 +2248,10 @@ ] } }, - "/crm/notes/batch": { + "/crm/deals/batch": { "post": { - "operationId": "addNotes", - "summary": "Add a batch of Notes", + "operationId": "addDeals", + "summary": "Add a batch of Deals", "parameters": [ { "name": "x-connection-token", @@ -2181,7 +2279,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedNoteInput" + "$ref": "#/components/schemas/UnifiedDealInput" } } } @@ -2200,7 +2298,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedNoteOutput" + "$ref": "#/components/schemas/UnifiedDealOutput" } } } @@ -2216,7 +2314,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedNoteOutput" + "$ref": "#/components/schemas/UnifiedDealOutput" } } } @@ -2224,7 +2322,7 @@ } }, "tags": [ - "crm/notes" + "crm/deals" ], "security": [ { @@ -2233,10 +2331,10 @@ ] } }, - "/crm/stages": { + "/crm/engagements": { "get": { - "operationId": "getStages", - "summary": "List a batch of Stages", + "operationId": "getEngagements", + "summary": "List a batch of Engagements", "parameters": [ { "name": "x-connection-token", @@ -2289,7 +2387,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedStageOutput" + "$ref": "#/components/schemas/UnifiedEngagementOutput" } } } @@ -2300,26 +2398,24 @@ } }, "tags": [ - "crm/stages" + "crm/engagements" ], "security": [ { "JWT": [] } ] - } - }, - "/crm/stages/{id}": { - "get": { - "operationId": "getStage", - "summary": "Retrieve a Stage", - "description": "Retrieve a stage from any connected Crm software", + }, + "post": { + "operationId": "addEngagement", + "summary": "Create a Engagement", + "description": "Create a engagement in any supported Crm software", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the stage you want to retrieve.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -2334,6 +2430,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnifiedEngagementInput" + } + } + } + }, "responses": { "200": { "description": "", @@ -2347,7 +2453,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedStageOutput" + "$ref": "#/components/schemas/UnifiedEngagementOutput" } } } @@ -2355,56 +2461,35 @@ } } } + }, + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnifiedEngagementOutput" + } + } + } } }, "tags": [ - "crm/stages" + "crm/engagements" ], "security": [ { "JWT": [] } ] - } - }, - "/crm/tasks": { - "get": { - "operationId": "getTasks", - "summary": "List a batch of Tasks", + }, + "patch": { + "operationId": "updateEngagement", + "summary": "Update a Engagement", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", - "schema": { - "type": "string" - } - }, - { - "name": "remote_data", - "required": false, - "in": "query", - "description": "Set to true to include data from the original software.", - "schema": { - "type": "boolean" - } - }, - { - "name": "pageSize", - "required": false, - "in": "query", - "description": "Set to get the number of records.", - "schema": { - "default": 50, - "type": "number" - } - }, - { - "name": "cursor", - "required": false, "in": "query", - "description": "Set to get the number of records after this cursor.", "schema": { "type": "string" } @@ -2423,7 +2508,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTaskOutput" + "$ref": "#/components/schemas/UnifiedEngagementOutput" } } } @@ -2434,24 +2519,26 @@ } }, "tags": [ - "crm/tasks" + "crm/engagements" ], "security": [ { "JWT": [] } ] - }, - "post": { - "operationId": "addTask", - "summary": "Create a Task", - "description": "Create a task in any supported Crm software", + } + }, + "/crm/engagements/{id}": { + "get": { + "operationId": "getEngagement", + "summary": "Retrieve a Engagement", + "description": "Retrieve a engagement from any connected Crm software", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", + "in": "path", + "description": "id of the engagement you want to retrieve.", "schema": { "type": "string" } @@ -2466,16 +2553,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedTaskInput" - } - } - } - }, "responses": { "200": { "description": "", @@ -2489,7 +2566,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTaskOutput" + "$ref": "#/components/schemas/UnifiedEngagementOutput" } } } @@ -2497,40 +2574,55 @@ } } } - }, - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedTaskOutput" - } - } - } } }, "tags": [ - "crm/tasks" + "crm/engagements" ], "security": [ { "JWT": [] } ] - }, - "patch": { - "operationId": "updateTask", - "summary": "Update a Task", + } + }, + "/crm/engagements/batch": { + "post": { + "operationId": "addEngagements", + "summary": "Add a batch of Engagements", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "query", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } + }, + { + "name": "remote_data", + "required": false, + "in": "query", + "description": "Set to true to include data from the original Crm software.", + "schema": { + "type": "boolean" + } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnifiedEngagementInput" + } + } + } + } + }, "responses": { "200": { "description": "", @@ -2544,7 +2636,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTaskOutput" + "$ref": "#/components/schemas/UnifiedEngagementOutput" } } } @@ -2552,10 +2644,23 @@ } } } + }, + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnifiedEngagementOutput" + } + } + } + } } }, "tags": [ - "crm/tasks" + "crm/engagements" ], "security": [ { @@ -2564,17 +2669,16 @@ ] } }, - "/crm/tasks/{id}": { + "/crm/notes": { "get": { - "operationId": "getTask", - "summary": "Retrieve a Task", - "description": "Retrieve a task from any connected Crm software", + "operationId": "getNotes", + "summary": "List a batch of Notes", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the task you want to retrieve.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -2583,10 +2687,29 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Crm software.", + "description": "Set to true to include data from the original software.", "schema": { "type": "boolean" } + }, + { + "name": "pageSize", + "required": false, + "in": "query", + "description": "Set to get the number of records.", + "schema": { + "default": 50, + "type": "number" + } + }, + { + "name": "cursor", + "required": false, + "in": "query", + "description": "Set to get the number of records after this cursor.", + "schema": { + "type": "string" + } } ], "responses": { @@ -2602,7 +2725,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTaskOutput" + "$ref": "#/components/schemas/UnifiedNoteOutput" } } } @@ -2613,19 +2736,18 @@ } }, "tags": [ - "crm/tasks" + "crm/notes" ], "security": [ { "JWT": [] } ] - } - }, - "/crm/tasks/batch": { + }, "post": { - "operationId": "addTasks", - "summary": "Add a batch of Tasks", + "operationId": "addNote", + "summary": "Create a Note", + "description": "Create a note in any supported Crm software", "parameters": [ { "name": "x-connection-token", @@ -2651,10 +2773,7 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UnifiedTaskInput" - } + "$ref": "#/components/schemas/UnifiedNoteInput" } } } @@ -2672,7 +2791,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTaskOutput" + "$ref": "#/components/schemas/UnifiedNoteOutput" } } } @@ -2686,17 +2805,14 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UnifiedTaskOutput" - } + "$ref": "#/components/schemas/UnifiedNoteOutput" } } } } }, "tags": [ - "crm/tasks" + "crm/notes" ], "security": [ { @@ -2705,16 +2821,17 @@ ] } }, - "/crm/users": { + "/crm/notes/{id}": { "get": { - "operationId": "getUsers", - "summary": "List a batch of Users", + "operationId": "getNote", + "summary": "Retrieve a Note", + "description": "Retrieve a note from any connected Crm software", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", + "in": "path", + "description": "id of the note you want to retrieve.", "schema": { "type": "string" } @@ -2723,29 +2840,10 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original software.", + "description": "Set to true to include data from the original Crm software.", "schema": { "type": "boolean" } - }, - { - "name": "pageSize", - "required": false, - "in": "query", - "description": "Set to get the number of records.", - "schema": { - "default": 50, - "type": "number" - } - }, - { - "name": "cursor", - "required": false, - "in": "query", - "description": "Set to get the number of records after this cursor.", - "schema": { - "type": "string" - } } ], "responses": { @@ -2761,7 +2859,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedUserOutput" + "$ref": "#/components/schemas/UnifiedNoteOutput" } } } @@ -2772,7 +2870,7 @@ } }, "tags": [ - "crm/users" + "crm/notes" ], "security": [ { @@ -2781,17 +2879,16 @@ ] } }, - "/crm/users/{id}": { - "get": { - "operationId": "getUser", - "summary": "Retrieve a User", - "description": "Retrieve a user from any connected Crm software", + "/crm/notes/batch": { + "post": { + "operationId": "addNotes", + "summary": "Add a batch of Notes", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the user you want to retrieve.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -2806,6 +2903,19 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnifiedNoteInput" + } + } + } + } + }, "responses": { "200": { "description": "", @@ -2819,7 +2929,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedUserOutput" + "$ref": "#/components/schemas/UnifiedNoteOutput" } } } @@ -2827,10 +2937,23 @@ } } } + }, + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnifiedNoteOutput" + } + } + } + } } }, "tags": [ - "crm/users" + "crm/notes" ], "security": [ { @@ -2839,10 +2962,10 @@ ] } }, - "/ticketing/accounts": { + "/crm/stages": { "get": { - "operationId": "getAccounts", - "summary": "List a batch of Accounts", + "operationId": "getStages", + "summary": "List a batch of Stages", "parameters": [ { "name": "x-connection-token", @@ -2895,7 +3018,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedAccountOutput" + "$ref": "#/components/schemas/UnifiedStageOutput" } } } @@ -2906,7 +3029,7 @@ } }, "tags": [ - "ticketing/accounts" + "crm/stages" ], "security": [ { @@ -2915,17 +3038,17 @@ ] } }, - "/ticketing/accounts/{id}": { + "/crm/stages/{id}": { "get": { - "operationId": "getAccount", - "summary": "Retrieve an Account", - "description": "Retrieve an account from any connected Ticketing software", + "operationId": "getStage", + "summary": "Retrieve a Stage", + "description": "Retrieve a stage from any connected Crm software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the account you want to retrieve.", + "description": "id of the stage you want to retrieve.", "schema": { "type": "string" } @@ -2934,7 +3057,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", + "description": "Set to true to include data from the original Crm software.", "schema": { "type": "boolean" } @@ -2953,7 +3076,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedAccountOutput" + "$ref": "#/components/schemas/UnifiedStageOutput" } } } @@ -2964,7 +3087,7 @@ } }, "tags": [ - "ticketing/accounts" + "crm/stages" ], "security": [ { @@ -2973,10 +3096,10 @@ ] } }, - "/ticketing/collections": { + "/crm/tasks": { "get": { - "operationId": "getCollections", - "summary": "List a batch of Collections", + "operationId": "getTasks", + "summary": "List a batch of Tasks", "parameters": [ { "name": "x-connection-token", @@ -3029,7 +3152,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCollectionOutput" + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } @@ -3040,26 +3163,24 @@ } }, "tags": [ - "ticketing/collections" + "crm/tasks" ], "security": [ { "JWT": [] } ] - } - }, - "/ticketing/collections/{id}": { - "get": { - "operationId": "getCollection", - "summary": "Retrieve a Collection", - "description": "Retrieve a collection from any connected Ticketing software", + }, + "post": { + "operationId": "addTask", + "summary": "Create a Task", + "description": "Create a task in any supported Crm software", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the collection you want to retrieve.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -3068,12 +3189,22 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", + "description": "Set to true to include data from the original Crm software.", "schema": { "type": "boolean" } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnifiedTaskInput" + } + } + } + }, "responses": { "200": { "description": "", @@ -3087,7 +3218,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCollectionOutput" + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } @@ -3095,86 +3226,20 @@ } } } - } - }, - "tags": [ - "ticketing/collections" - ], - "security": [ - { - "JWT": [] - } - ] - } - }, - "/ticketing/comments": { - "get": { - "operationId": "getComments", - "summary": "List a batch of Comments", - "parameters": [ - { - "name": "x-connection-token", - "required": true, - "in": "header", - "description": "The connection token", - "schema": { - "type": "string" - } - }, - { - "name": "remote_data", - "required": false, - "in": "query", - "description": "Set to true to include data from the original software.", - "schema": { - "type": "boolean" - } - }, - { - "name": "pageSize", - "required": false, - "in": "query", - "description": "Set to get the number of records.", - "schema": { - "default": 50, - "type": "number" - } }, - { - "name": "cursor", - "required": false, - "in": "query", - "description": "Set to get the number of records after this cursor.", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { + "201": { "description": "", "content": { "application/json": { "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ApiResponse" - }, - { - "properties": { - "data": { - "$ref": "#/components/schemas/UnifiedCommentOutput" - } - } - } - ] + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } } }, "tags": [ - "ticketing/comments" + "crm/tasks" ], "security": [ { @@ -3182,40 +3247,19 @@ } ] }, - "post": { - "operationId": "addComment", - "summary": "Create a Comment", - "description": "Create a comment in any supported Ticketing software", + "patch": { + "operationId": "updateTask", + "summary": "Update a Task", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", - "schema": { - "type": "string" - } - }, - { - "name": "remote_data", - "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", "schema": { - "type": "boolean" + "type": "string" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedCommentInput" - } - } - } - }, "responses": { "200": { "description": "", @@ -3229,7 +3273,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCommentOutput" + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } @@ -3237,20 +3281,10 @@ } } } - }, - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedCommentOutput" - } - } - } } }, "tags": [ - "ticketing/comments" + "crm/tasks" ], "security": [ { @@ -3259,17 +3293,17 @@ ] } }, - "/ticketing/comments/{id}": { + "/crm/tasks/{id}": { "get": { - "operationId": "getComment", - "summary": "Retrieve a Comment", - "description": "Retrieve a comment from any connected Ticketing software", + "operationId": "getTask", + "summary": "Retrieve a Task", + "description": "Retrieve a task from any connected Crm software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the `comment` you want to retrive.", + "description": "id of the task you want to retrieve.", "schema": { "type": "string" } @@ -3278,7 +3312,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", + "description": "Set to true to include data from the original Crm software.", "schema": { "type": "boolean" } @@ -3297,7 +3331,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCommentOutput" + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } @@ -3308,7 +3342,7 @@ } }, "tags": [ - "ticketing/comments" + "crm/tasks" ], "security": [ { @@ -3317,10 +3351,10 @@ ] } }, - "/ticketing/comments/batch": { + "/crm/tasks/batch": { "post": { - "operationId": "addComments", - "summary": "Add a batch of Comments", + "operationId": "addTasks", + "summary": "Add a batch of Tasks", "parameters": [ { "name": "x-connection-token", @@ -3335,7 +3369,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", + "description": "Set to true to include data from the original Crm software.", "schema": { "type": "boolean" } @@ -3348,7 +3382,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedCommentInput" + "$ref": "#/components/schemas/UnifiedTaskInput" } } } @@ -3367,7 +3401,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedCommentOutput" + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } @@ -3383,7 +3417,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/UnifiedCommentOutput" + "$ref": "#/components/schemas/UnifiedTaskOutput" } } } @@ -3391,7 +3425,7 @@ } }, "tags": [ - "ticketing/comments" + "crm/tasks" ], "security": [ { @@ -3400,10 +3434,10 @@ ] } }, - "/ticketing/contacts": { + "/crm/users": { "get": { - "operationId": "getContacts", - "summary": "List a batch of Contacts", + "operationId": "getUsers", + "summary": "List a batch of Users", "parameters": [ { "name": "x-connection-token", @@ -3456,7 +3490,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedContactOutput" + "$ref": "#/components/schemas/UnifiedUserOutput" } } } @@ -3467,7 +3501,7 @@ } }, "tags": [ - "ticketing/contacts" + "crm/users" ], "security": [ { @@ -3476,17 +3510,17 @@ ] } }, - "/ticketing/contacts/{id}": { + "/crm/users/{id}": { "get": { - "operationId": "getContact", - "summary": "Retrieve a Contact", - "description": "Retrieve a contact from any connected Ticketing software", + "operationId": "getUser", + "summary": "Retrieve a User", + "description": "Retrieve a user from any connected Crm software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the contact you want to retrieve.", + "description": "id of the user you want to retrieve.", "schema": { "type": "string" } @@ -3495,7 +3529,7 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", + "description": "Set to true to include data from the original Crm software.", "schema": { "type": "boolean" } @@ -3514,7 +3548,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedContactOutput" + "$ref": "#/components/schemas/UnifiedUserOutput" } } } @@ -3525,7 +3559,7 @@ } }, "tags": [ - "ticketing/contacts" + "crm/users" ], "security": [ { @@ -3534,10 +3568,10 @@ ] } }, - "/ticketing/tags": { + "/ticketing/collections": { "get": { - "operationId": "getTags", - "summary": "List a batch of Tags", + "operationId": "getCollections", + "summary": "List a batch of Collections", "parameters": [ { "name": "x-connection-token", @@ -3590,7 +3624,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTagOutput" + "$ref": "#/components/schemas/UnifiedCollectionOutput" } } } @@ -3601,7 +3635,7 @@ } }, "tags": [ - "ticketing/tags" + "ticketing/collections" ], "security": [ { @@ -3610,17 +3644,17 @@ ] } }, - "/ticketing/tags/{id}": { + "/ticketing/collections/{id}": { "get": { - "operationId": "getTag", - "summary": "Retrieve a Tag", - "description": "Retrieve a tag from any connected Ticketing software", + "operationId": "getCollection", + "summary": "Retrieve a Collection", + "description": "Retrieve a collection from any connected Ticketing software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the tag you want to retrieve.", + "description": "id of the collection you want to retrieve.", "schema": { "type": "string" } @@ -3648,7 +3682,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTagOutput" + "$ref": "#/components/schemas/UnifiedCollectionOutput" } } } @@ -3659,7 +3693,7 @@ } }, "tags": [ - "ticketing/tags" + "ticketing/collections" ], "security": [ { @@ -3668,10 +3702,10 @@ ] } }, - "/ticketing/teams": { + "/ticketing/comments": { "get": { - "operationId": "getTeams", - "summary": "List a batch of Teams", + "operationId": "getComments", + "summary": "List a batch of Comments", "parameters": [ { "name": "x-connection-token", @@ -3724,7 +3758,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTeamOutput" + "$ref": "#/components/schemas/UnifiedCommentOutput" } } } @@ -3735,26 +3769,24 @@ } }, "tags": [ - "ticketing/teams" + "ticketing/comments" ], "security": [ { "JWT": [] } ] - } - }, - "/ticketing/teams/{id}": { - "get": { - "operationId": "getTeam", - "summary": "Retrieve a Team", - "description": "Retrieve a team from any connected Ticketing software", + }, + "post": { + "operationId": "addComment", + "summary": "Create a Comment", + "description": "Create a comment in any supported Ticketing software", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the team you want to retrieve.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -3769,6 +3801,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnifiedCommentInput" + } + } + } + }, "responses": { "200": { "description": "", @@ -3782,7 +3824,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTeamOutput" + "$ref": "#/components/schemas/UnifiedCommentOutput" } } } @@ -3790,10 +3832,20 @@ } } } + }, + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnifiedCommentOutput" + } + } + } } }, "tags": [ - "ticketing/teams" + "ticketing/comments" ], "security": [ { @@ -3802,16 +3854,17 @@ ] } }, - "/ticketing/tickets": { + "/ticketing/comments/{id}": { "get": { - "operationId": "getTickets", - "summary": "List a batch of Tickets", + "operationId": "getComment", + "summary": "Retrieve a Comment", + "description": "Retrieve a comment from any connected Ticketing software", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", + "in": "path", + "description": "id of the `comment` you want to retrive.", "schema": { "type": "string" } @@ -3820,29 +3873,10 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original software.", + "description": "Set to true to include data from the original Ticketing software.", "schema": { "type": "boolean" } - }, - { - "name": "pageSize", - "required": false, - "in": "query", - "description": "Set to get the number of records.", - "schema": { - "default": 50, - "type": "number" - } - }, - { - "name": "cursor", - "required": false, - "in": "query", - "description": "Set to get the number of records after this cursor.", - "schema": { - "type": "string" - } } ], "responses": { @@ -3858,7 +3892,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTicketOutput" + "$ref": "#/components/schemas/UnifiedCommentOutput" } } } @@ -3869,18 +3903,19 @@ } }, "tags": [ - "ticketing/tickets" + "ticketing/comments" ], "security": [ { "JWT": [] } ] - }, + } + }, + "/ticketing/comments/batch": { "post": { - "operationId": "addTicket", - "summary": "Create a Ticket", - "description": "Create a ticket in any supported Ticketing software", + "operationId": "addComments", + "summary": "Add a batch of Comments", "parameters": [ { "name": "x-connection-token", @@ -3906,7 +3941,10 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedTicketInput" + "type": "array", + "items": { + "$ref": "#/components/schemas/UnifiedCommentInput" + } } } } @@ -3924,7 +3962,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTicketOutput" + "$ref": "#/components/schemas/UnifiedCommentOutput" } } } @@ -3938,48 +3976,17 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnifiedTicketOutput" - } - } - } - } - }, - "tags": [ - "ticketing/tickets" - ], - "security": [ - { - "JWT": [] - } - ] - }, - "patch": { - "operationId": "updateTicket", - "summary": "Update a Ticket", - "parameters": [ - { - "name": "id", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnifiedTicketOutput" + "type": "array", + "items": { + "$ref": "#/components/schemas/UnifiedCommentOutput" + } } } } } }, "tags": [ - "ticketing/tickets" + "ticketing/comments" ], "security": [ { @@ -3988,17 +3995,16 @@ ] } }, - "/ticketing/tickets/{id}": { + "/ticketing/tags": { "get": { - "operationId": "getTicket", - "summary": "Retrieve a Ticket", - "description": "Retrieve a ticket from any connected Ticketing software", + "operationId": "getTags", + "summary": "List a batch of Tags", "parameters": [ { - "name": "id", + "name": "x-connection-token", "required": true, - "in": "path", - "description": "id of the `ticket` you want to retrive.", + "in": "header", + "description": "The connection token", "schema": { "type": "string" } @@ -4007,10 +4013,29 @@ "name": "remote_data", "required": false, "in": "query", - "description": "Set to true to include data from the original Ticketing software.", + "description": "Set to true to include data from the original software.", "schema": { "type": "boolean" } + }, + { + "name": "pageSize", + "required": false, + "in": "query", + "description": "Set to get the number of records.", + "schema": { + "default": 50, + "type": "number" + } + }, + { + "name": "cursor", + "required": false, + "in": "query", + "description": "Set to get the number of records after this cursor.", + "schema": { + "type": "string" + } } ], "responses": { @@ -4026,7 +4051,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTicketOutput" + "$ref": "#/components/schemas/UnifiedTagOutput" } } } @@ -4037,7 +4062,7 @@ } }, "tags": [ - "ticketing/tickets" + "ticketing/tags" ], "security": [ { @@ -4046,16 +4071,17 @@ ] } }, - "/ticketing/tickets/batch": { - "post": { - "operationId": "addTickets", - "summary": "Add a batch of Tickets", + "/ticketing/tags/{id}": { + "get": { + "operationId": "getTag", + "summary": "Retrieve a Tag", + "description": "Retrieve a tag from any connected Ticketing software", "parameters": [ { - "name": "x-connection-token", + "name": "id", "required": true, - "in": "header", - "description": "The connection token", + "in": "path", + "description": "id of the tag you want to retrieve.", "schema": { "type": "string" } @@ -4070,19 +4096,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UnifiedTicketInput" - } - } - } - } - }, "responses": { "200": { "description": "", @@ -4096,7 +4109,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedTicketOutput" + "$ref": "#/components/schemas/UnifiedTagOutput" } } } @@ -4104,23 +4117,10 @@ } } } - }, - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UnifiedTicketOutput" - } - } - } - } } }, "tags": [ - "ticketing/tickets" + "ticketing/tags" ], "security": [ { @@ -4129,10 +4129,10 @@ ] } }, - "/ticketing/users": { + "/ticketing/teams": { "get": { - "operationId": "getUsers", - "summary": "List a batch of Users", + "operationId": "getTeams", + "summary": "List a batch of Teams", "parameters": [ { "name": "x-connection-token", @@ -4185,7 +4185,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedUserOutput" + "$ref": "#/components/schemas/UnifiedTeamOutput" } } } @@ -4196,7 +4196,7 @@ } }, "tags": [ - "ticketing/users" + "ticketing/teams" ], "security": [ { @@ -4205,17 +4205,17 @@ ] } }, - "/ticketing/users/{id}": { + "/ticketing/teams/{id}": { "get": { - "operationId": "getUser", - "summary": "Retrieve a User", - "description": "Retrieve a user from any connected Ticketing software", + "operationId": "getTeam", + "summary": "Retrieve a Team", + "description": "Retrieve a team from any connected Ticketing software", "parameters": [ { "name": "id", "required": true, "in": "path", - "description": "id of the user you want to retrieve.", + "description": "id of the team you want to retrieve.", "schema": { "type": "string" } @@ -4243,7 +4243,7 @@ { "properties": { "data": { - "$ref": "#/components/schemas/UnifiedUserOutput" + "$ref": "#/components/schemas/UnifiedTeamOutput" } } } @@ -4254,7 +4254,7 @@ } }, "tags": [ - "ticketing/users" + "ticketing/teams" ], "security": [ { @@ -5642,35 +5642,387 @@ "statusCode" ] }, - "Email": { + "UnifiedCommentInput": { "type": "object", "properties": { - "email_address": { + "body": { "type": "string", - "description": "The email address" + "description": "The body of the comment" }, - "email_address_type": { + "html_body": { "type": "string", - "description": "The email address type. Authorized values are either PERSONAL or WORK." + "description": "The html body of the comment" }, - "owner_type": { - "type": "string", - "description": "The owner type of an email" - } - }, - "required": [ - "email_address", - "email_address_type" - ] - }, - "Address": { - "type": "object", - "properties": { - "street_1": { - "type": "string", - "description": "The street" + "is_private": { + "type": "boolean", + "description": "The public status of the comment" }, - "street_2": { + "creator_type": { + "type": "string", + "description": "The creator type of the comment. Authorized values are either USER or CONTACT" + }, + "ticket_id": { + "type": "string", + "description": "The uuid of the ticket the comment is tied to" + }, + "contact_id": { + "type": "string", + "description": "The uuid of the contact which the comment belongs to (if no user_id specified)" + }, + "user_id": { + "type": "string", + "description": "The uuid of the user which the comment belongs to (if no contact_id specified)" + }, + "attachments": { + "description": "The attachements uuids tied to the comment", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "body" + ] + }, + "UnifiedTicketOutput": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the ticket" + }, + "status": { + "type": "string", + "description": "The status of the ticket. Authorized values are OPEN or CLOSED." + }, + "description": { + "type": "string", + "description": "The description of the ticket" + }, + "due_date": { + "format": "date-time", + "type": "string", + "description": "The date the ticket is due" + }, + "type": { + "type": "string", + "description": "The type of the ticket. Authorized values are PROBLEM, QUESTION, or TASK" + }, + "parent_ticket": { + "type": "string", + "description": "The uuid of the parent ticket" + }, + "project_id": { + "type": "string", + "description": "The uuid of the collection (project) the ticket belongs to" + }, + "tags": { + "description": "The tags names of the ticket", + "type": "array", + "items": { + "type": "string" + } + }, + "completed_at": { + "format": "date-time", + "type": "string", + "description": "The date the ticket has been completed" + }, + "priority": { + "type": "string", + "description": "The priority of the ticket. Authorized values are HIGH, MEDIUM or LOW." + }, + "assigned_to": { + "description": "The users uuids the ticket is assigned to", + "type": "array", + "items": { + "type": "string" + } + }, + "comment": { + "description": "The comment of the ticket", + "allOf": [ + { + "$ref": "#/components/schemas/UnifiedCommentInput" + } + ] + }, + "account_id": { + "type": "string", + "description": "The uuid of the account which the ticket belongs to" + }, + "contact_id": { + "type": "string", + "description": "The uuid of the contact which the ticket belongs to" + }, + "field_mappings": { + "type": "object", + "properties": {} + }, + "id": { + "type": "string", + "description": "The uuid of the ticket" + }, + "remote_id": { + "type": "string", + "description": "The id of the ticket in the context of the 3rd Party" + }, + "remote_data": { + "type": "object", + "properties": {} + } + }, + "required": [ + "name", + "description", + "field_mappings", + "remote_data" + ] + }, + "UnifiedTicketInput": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the ticket" + }, + "status": { + "type": "string", + "description": "The status of the ticket. Authorized values are OPEN or CLOSED." + }, + "description": { + "type": "string", + "description": "The description of the ticket" + }, + "due_date": { + "format": "date-time", + "type": "string", + "description": "The date the ticket is due" + }, + "type": { + "type": "string", + "description": "The type of the ticket. Authorized values are PROBLEM, QUESTION, or TASK" + }, + "parent_ticket": { + "type": "string", + "description": "The uuid of the parent ticket" + }, + "project_id": { + "type": "string", + "description": "The uuid of the collection (project) the ticket belongs to" + }, + "tags": { + "description": "The tags names of the ticket", + "type": "array", + "items": { + "type": "string" + } + }, + "completed_at": { + "format": "date-time", + "type": "string", + "description": "The date the ticket has been completed" + }, + "priority": { + "type": "string", + "description": "The priority of the ticket. Authorized values are HIGH, MEDIUM or LOW." + }, + "assigned_to": { + "description": "The users uuids the ticket is assigned to", + "type": "array", + "items": { + "type": "string" + } + }, + "comment": { + "description": "The comment of the ticket", + "allOf": [ + { + "$ref": "#/components/schemas/UnifiedCommentInput" + } + ] + }, + "account_id": { + "type": "string", + "description": "The uuid of the account which the ticket belongs to" + }, + "contact_id": { + "type": "string", + "description": "The uuid of the contact which the ticket belongs to" + }, + "field_mappings": { + "type": "object", + "properties": {} + } + }, + "required": [ + "name", + "description", + "field_mappings" + ] + }, + "UnifiedUserOutput": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the user" + }, + "email": { + "type": "string", + "description": "The email of the user" + }, + "field_mappings": { + "type": "object", + "properties": {} + }, + "id": { + "type": "string", + "description": "The uuid of the user" + }, + "remote_id": { + "type": "string", + "description": "The id of the user in the context of the Crm 3rd Party" + }, + "remote_data": { + "type": "object", + "properties": {} + } + }, + "required": [ + "name", + "email", + "field_mappings", + "remote_data" + ] + }, + "UnifiedAccountOutput": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the account" + }, + "domains": { + "description": "The domains of the account", + "type": "array", + "items": { + "type": "string" + } + }, + "field_mappings": { + "type": "object", + "properties": {} + }, + "id": { + "type": "string", + "description": "The uuid of the account" + }, + "remote_id": { + "type": "string", + "description": "The id of the account in the context of the 3rd Party" + }, + "remote_data": { + "type": "object", + "properties": {} + } + }, + "required": [ + "name", + "field_mappings", + "remote_data" + ] + }, + "UnifiedContactOutput": { + "type": "object", + "properties": { + "first_name": { + "type": "string", + "description": "The first name of the contact" + }, + "last_name": { + "type": "string", + "description": "The last name of the contact" + }, + "email_addresses": { + "description": "The email addresses of the contact", + "type": "array", + "items": { + "$ref": "#/components/schemas/Email" + } + }, + "phone_numbers": { + "description": "The phone numbers of the contact", + "type": "array", + "items": { + "$ref": "#/components/schemas/Phone" + } + }, + "addresses": { + "description": "The addresses of the contact", + "type": "array", + "items": { + "$ref": "#/components/schemas/Address" + } + }, + "user_id": { + "type": "string", + "description": "The uuid of the user who owns the contact" + }, + "field_mappings": { + "type": "object", + "properties": {} + }, + "id": { + "type": "string", + "description": "The uuid of the contact" + }, + "remote_id": { + "type": "string", + "description": "The id of the contact in the context of the Crm 3rd Party" + }, + "remote_data": { + "type": "object", + "properties": {} + } + }, + "required": [ + "first_name", + "last_name", + "field_mappings", + "remote_data" + ] + }, + "Email": { + "type": "object", + "properties": { + "email_address": { + "type": "string", + "description": "The email address" + }, + "email_address_type": { + "type": "string", + "description": "The email address type. Authorized values are either PERSONAL or WORK." + }, + "owner_type": { + "type": "string", + "description": "The owner type of an email" + } + }, + "required": [ + "email_address", + "email_address_type" + ] + }, + "Address": { + "type": "object", + "properties": { + "street_1": { + "type": "string", + "description": "The street" + }, + "street_2": { "type": "string", "description": "More information about the street " }, @@ -5844,49 +6196,6 @@ "field_mappings" ] }, - "UnifiedContactOutput": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the contact" - }, - "email_address": { - "type": "string", - "description": "The email address of the contact" - }, - "phone_number": { - "type": "string", - "description": "The phone number of the contact" - }, - "details": { - "type": "string", - "description": "The details of the contact" - }, - "field_mappings": { - "type": "object", - "properties": {} - }, - "id": { - "type": "string", - "description": "The uuid of the contact" - }, - "remote_id": { - "type": "string", - "description": "The id of the contact in the context of the 3rd Party" - }, - "remote_data": { - "type": "object", - "properties": {} - } - }, - "required": [ - "name", - "email_address", - "field_mappings", - "remote_data" - ] - }, "UnifiedContactInput": { "type": "object", "properties": { @@ -6333,120 +6642,37 @@ "description": "The status of the task. Authorized values are PENDING, COMPLETED." }, "due_date": { - "format": "date-time", - "type": "string", - "description": "The due date of the task" - }, - "finished_date": { - "format": "date-time", - "type": "string", - "description": "The finished date of the task" - }, - "user_id": { - "type": "string", - "description": "The uuid of the user tied to the task" - }, - "company_id": { - "type": "string", - "description": "The uuid fo the company tied to the task" - }, - "deal_id": { - "type": "string", - "description": "The uuid of the deal tied to the task" - }, - "field_mappings": { - "type": "object", - "properties": {} - } - }, - "required": [ - "subject", - "content", - "status", - "field_mappings" - ] - }, - "UnifiedUserOutput": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the user" - }, - "email_address": { - "type": "string", - "description": "The email address of the user" - }, - "teams": { - "description": "The teams whose the user is part of", - "type": "array", - "items": { - "type": "string" - } - }, - "account_id": { - "type": "string", - "description": "The account or organization the user is part of" - }, - "field_mappings": { - "type": "object", - "properties": {} - }, - "id": { - "type": "string", - "description": "The uuid of the user" - }, - "remote_id": { - "type": "string", - "description": "The id of the user in the context of the 3rd Party" - }, - "remote_data": { - "type": "object", - "properties": {} - } - }, - "required": [ - "name", - "email_address", - "field_mappings", - "remote_data" - ] - }, - "UnifiedAccountOutput": { - "type": "object", - "properties": { - "name": { + "format": "date-time", "type": "string", - "description": "The name of the account" + "description": "The due date of the task" }, - "domains": { - "description": "The domains of the account", - "type": "array", - "items": { - "type": "string" - } + "finished_date": { + "format": "date-time", + "type": "string", + "description": "The finished date of the task" }, - "field_mappings": { - "type": "object", - "properties": {} + "user_id": { + "type": "string", + "description": "The uuid of the user tied to the task" }, - "id": { + "company_id": { "type": "string", - "description": "The uuid of the account" + "description": "The uuid fo the company tied to the task" }, - "remote_id": { + "deal_id": { "type": "string", - "description": "The id of the account in the context of the 3rd Party" + "description": "The uuid of the deal tied to the task" }, - "remote_data": { + "field_mappings": { "type": "object", "properties": {} } }, "required": [ - "name", - "field_mappings", - "remote_data" + "subject", + "content", + "status", + "field_mappings" ] }, "UnifiedCollectionOutput": { @@ -6578,49 +6804,6 @@ "remote_data" ] }, - "UnifiedCommentInput": { - "type": "object", - "properties": { - "body": { - "type": "string", - "description": "The body of the comment" - }, - "html_body": { - "type": "string", - "description": "The html body of the comment" - }, - "is_private": { - "type": "boolean", - "description": "The public status of the comment" - }, - "creator_type": { - "type": "string", - "description": "The creator type of the comment. Authorized values are either USER or CONTACT" - }, - "ticket_id": { - "type": "string", - "description": "The uuid of the ticket the comment is tied to" - }, - "contact_id": { - "type": "string", - "description": "The uuid of the contact which the comment belongs to (if no user_id specified)" - }, - "user_id": { - "type": "string", - "description": "The uuid of the user which the comment belongs to (if no contact_id specified)" - }, - "attachments": { - "description": "The attachements uuids tied to the comment", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "body" - ] - }, "UnifiedTagOutput": { "type": "object", "properties": { @@ -6685,183 +6868,6 @@ "remote_data" ] }, - "UnifiedTicketOutput": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the ticket" - }, - "status": { - "type": "string", - "description": "The status of the ticket. Authorized values are OPEN or CLOSED." - }, - "description": { - "type": "string", - "description": "The description of the ticket" - }, - "due_date": { - "format": "date-time", - "type": "string", - "description": "The date the ticket is due" - }, - "type": { - "type": "string", - "description": "The type of the ticket. Authorized values are PROBLEM, QUESTION, or TASK" - }, - "parent_ticket": { - "type": "string", - "description": "The uuid of the parent ticket" - }, - "project_id": { - "type": "string", - "description": "The uuid of the collection (project) the ticket belongs to" - }, - "tags": { - "description": "The tags names of the ticket", - "type": "array", - "items": { - "type": "string" - } - }, - "completed_at": { - "format": "date-time", - "type": "string", - "description": "The date the ticket has been completed" - }, - "priority": { - "type": "string", - "description": "The priority of the ticket. Authorized values are HIGH, MEDIUM or LOW." - }, - "assigned_to": { - "description": "The users uuids the ticket is assigned to", - "type": "array", - "items": { - "type": "string" - } - }, - "comment": { - "description": "The comment of the ticket", - "allOf": [ - { - "$ref": "#/components/schemas/UnifiedCommentInput" - } - ] - }, - "account_id": { - "type": "string", - "description": "The uuid of the account which the ticket belongs to" - }, - "contact_id": { - "type": "string", - "description": "The uuid of the contact which the ticket belongs to" - }, - "field_mappings": { - "type": "object", - "properties": {} - }, - "id": { - "type": "string", - "description": "The uuid of the ticket" - }, - "remote_id": { - "type": "string", - "description": "The id of the ticket in the context of the 3rd Party" - }, - "remote_data": { - "type": "object", - "properties": {} - } - }, - "required": [ - "name", - "description", - "field_mappings", - "remote_data" - ] - }, - "UnifiedTicketInput": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the ticket" - }, - "status": { - "type": "string", - "description": "The status of the ticket. Authorized values are OPEN or CLOSED." - }, - "description": { - "type": "string", - "description": "The description of the ticket" - }, - "due_date": { - "format": "date-time", - "type": "string", - "description": "The date the ticket is due" - }, - "type": { - "type": "string", - "description": "The type of the ticket. Authorized values are PROBLEM, QUESTION, or TASK" - }, - "parent_ticket": { - "type": "string", - "description": "The uuid of the parent ticket" - }, - "project_id": { - "type": "string", - "description": "The uuid of the collection (project) the ticket belongs to" - }, - "tags": { - "description": "The tags names of the ticket", - "type": "array", - "items": { - "type": "string" - } - }, - "completed_at": { - "format": "date-time", - "type": "string", - "description": "The date the ticket has been completed" - }, - "priority": { - "type": "string", - "description": "The priority of the ticket. Authorized values are HIGH, MEDIUM or LOW." - }, - "assigned_to": { - "description": "The users uuids the ticket is assigned to", - "type": "array", - "items": { - "type": "string" - } - }, - "comment": { - "description": "The comment of the ticket", - "allOf": [ - { - "$ref": "#/components/schemas/UnifiedCommentInput" - } - ] - }, - "account_id": { - "type": "string", - "description": "The uuid of the account which the ticket belongs to" - }, - "contact_id": { - "type": "string", - "description": "The uuid of the contact which the ticket belongs to" - }, - "field_mappings": { - "type": "object", - "properties": {} - } - }, - "required": [ - "name", - "description", - "field_mappings" - ] - }, "CreateLinkedUserDto": { "type": "object", "properties": { diff --git a/packages/shared/src/connectors/enum.ts b/packages/shared/src/connectors/enum.ts index 7c3a770e9..60a861084 100644 --- a/packages/shared/src/connectors/enum.ts +++ b/packages/shared/src/connectors/enum.ts @@ -7,7 +7,7 @@ export enum CrmConnectors { CLOSE = 'close' } -export enum TicketingConnectors { +export enum TicketingConnectors { ZENDESK = 'zendesk', FRONT = 'front', GITHUB = 'github',