@sipgate/integration-bridge 1.0.35 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/contact-cache-storage.js +79 -97
- package/dist/cache/contact-cache-storage.js.map +1 -1
- package/dist/cache/storage/memory-storage-adapter.js +8 -22
- package/dist/cache/storage/memory-storage-adapter.js.map +1 -1
- package/dist/cache/storage/redis-storage-adapter.js +16 -30
- package/dist/cache/storage/redis-storage-adapter.js.map +1 -1
- package/dist/cache/token-cache-storage.js +30 -43
- package/dist/cache/token-cache-storage.js.map +1 -1
- package/dist/controllers/call-log.controller.js +63 -78
- package/dist/controllers/call-log.controller.js.map +1 -1
- package/dist/controllers/task.controller.js +60 -75
- package/dist/controllers/task.controller.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +38 -21
- package/dist/index.js.map +1 -1
- package/dist/middlewares/error-handler.middleware.js +1 -2
- package/dist/middlewares/error-handler.middleware.js.map +1 -1
- package/dist/middlewares/extract-header.middleware.d.ts +0 -1
- package/dist/middlewares/extract-header.middleware.js +2 -2
- package/dist/middlewares/extract-header.middleware.js.map +1 -1
- package/dist/models/cache-item-state.model.js +1 -1
- package/dist/models/cache-item-state.model.js.map +1 -1
- package/dist/models/call-direction.enum.js +1 -1
- package/dist/models/call-direction.enum.js.map +1 -1
- package/dist/models/call-event.model.js +2 -2
- package/dist/models/call-event.model.js.map +1 -1
- package/dist/models/contact.model.js +3 -3
- package/dist/models/contact.model.js.map +1 -1
- package/dist/models/controller.model.js +579 -622
- package/dist/models/controller.model.js.map +1 -1
- package/dist/models/integration-entity.model.js +1 -1
- package/dist/models/integration-entity.model.js.map +1 -1
- package/dist/models/integration-error.model.js +1 -1
- package/dist/models/integration-error.model.js.map +1 -1
- package/dist/models/integrations-event.model.js +1 -1
- package/dist/models/integrations-event.model.js.map +1 -1
- package/dist/models/pubsub/pubsub-client.model.js +16 -25
- package/dist/models/pubsub/pubsub-client.model.js.map +1 -1
- package/dist/models/pubsub/pubsub-contacts-message.model.js +1 -1
- package/dist/models/pubsub/pubsub-contacts-message.model.js.map +1 -1
- package/dist/models/server-error.model.js +1 -0
- package/dist/models/server-error.model.js.map +1 -1
- package/dist/swagger/openapi-spec.d.ts +972 -0
- package/dist/swagger/openapi-spec.js +787 -0
- package/dist/swagger/openapi-spec.js.map +1 -0
- package/dist/util/anonymize-key.js +1 -2
- package/dist/util/anonymize-key.js.map +1 -1
- package/dist/util/call-comment.js +5 -6
- package/dist/util/call-comment.js.map +1 -1
- package/dist/util/call-event.util.js +1 -2
- package/dist/util/call-event.util.js.map +1 -1
- package/dist/util/callEventHelper.js +4 -4
- package/dist/util/callEventHelper.js.map +1 -1
- package/dist/util/contact.util.js +10 -8
- package/dist/util/contact.util.js.map +1 -1
- package/dist/util/env.js +19 -9
- package/dist/util/env.js.map +1 -1
- package/dist/util/error/delegate-to-frontend.error.d.ts +5 -0
- package/dist/util/error/delegate-to-frontend.error.js +14 -0
- package/dist/util/error/delegate-to-frontend.error.js.map +1 -0
- package/dist/util/error/error.d.ts +12 -0
- package/dist/util/error/error.js +93 -0
- package/dist/util/error/error.js.map +1 -0
- package/dist/util/gdpr/gdprSlackNotification.js +22 -22
- package/dist/util/gdpr/gdprSlackNotification.js.map +1 -1
- package/dist/util/gdpr/index.js +17 -7
- package/dist/util/gdpr/index.js.map +1 -1
- package/dist/util/get-contact-cache.js +1 -2
- package/dist/util/get-contact-cache.js.map +1 -1
- package/dist/util/http/default-axios.js +1 -2
- package/dist/util/http/default-axios.js.map +1 -1
- package/dist/util/http/index.js +17 -7
- package/dist/util/http/index.js.map +1 -1
- package/dist/util/http/pagination.js +32 -85
- package/dist/util/http/pagination.js.map +1 -1
- package/dist/util/http/rate-limited-axios.js +42 -61
- package/dist/util/http/rate-limited-axios.js.map +1 -1
- package/dist/util/http/retrying-axios.js +11 -23
- package/dist/util/http/retrying-axios.js.map +1 -1
- package/dist/util/http/url.js +1 -2
- package/dist/util/http/url.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.js +21 -9
- package/dist/util/index.js.map +1 -1
- package/dist/util/lang/delay.js +1 -2
- package/dist/util/lang/delay.js.map +1 -1
- package/dist/util/lang/diff.js +19 -10
- package/dist/util/lang/diff.js.map +1 -1
- package/dist/util/logger.util.js +7 -2
- package/dist/util/logger.util.js.map +1 -1
- package/dist/util/oauth.js +131 -134
- package/dist/util/oauth.js.map +1 -1
- package/dist/util/phone-number-utils.js +4 -5
- package/dist/util/phone-number-utils.js.map +1 -1
- package/dist/util/security/index.js +17 -7
- package/dist/util/security/index.js.map +1 -1
- package/dist/util/security/nonce.js +5 -6
- package/dist/util/security/nonce.js.map +1 -1
- package/dist/util/size-of.js +1 -1
- package/dist/util/size-of.js.map +1 -1
- package/dist/util/token-util.js +46 -62
- package/dist/util/token-util.js.map +1 -1
- package/dist/util/validate.js +1 -2
- package/dist/util/validate.js.map +1 -1
- package/package.json +25 -38
- package/README.md +0 -117
- package/dist/util/error.d.ts +0 -7
- package/dist/util/error.js +0 -76
- package/dist/util/error.js.map +0 -1
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openApiSpec = void 0;
|
|
4
|
+
exports.openApiSpec = {
|
|
5
|
+
openapi: '3.0.3',
|
|
6
|
+
info: {
|
|
7
|
+
title: 'Integration Bridge API',
|
|
8
|
+
description: 'API provided by the sipgate Integration Bridge Framework. Each bridge implements a subset of these endpoints via the Adapter interface.\n\nUse the **Authorize** button to set your `x-provider-key`. Configure additional global headers (Provider URL, User ID, Locale) in the **Global Headers** bar above.',
|
|
9
|
+
version: '1.0.36',
|
|
10
|
+
},
|
|
11
|
+
tags: [
|
|
12
|
+
{ name: 'Contacts', description: 'Contact CRUD and streaming' },
|
|
13
|
+
{ name: 'Entities', description: 'Integration entity lookup' },
|
|
14
|
+
{
|
|
15
|
+
name: 'Call Events',
|
|
16
|
+
description: 'Legacy call event handling (deprecated)',
|
|
17
|
+
},
|
|
18
|
+
{ name: 'Call Log', description: 'Call log management' },
|
|
19
|
+
{ name: 'Lifecycle', description: 'Connection lifecycle events' },
|
|
20
|
+
{ name: 'OAuth2', description: 'OAuth2 authentication flow' },
|
|
21
|
+
{ name: 'Account', description: 'Account and token management' },
|
|
22
|
+
{ name: 'Webhooks', description: 'Webhook handling' },
|
|
23
|
+
{ name: 'Tasks', description: 'Task and follow-up management' },
|
|
24
|
+
{ name: 'Health', description: 'Health check' },
|
|
25
|
+
],
|
|
26
|
+
security: [{ providerKey: [] }],
|
|
27
|
+
paths: {
|
|
28
|
+
'/contacts': {
|
|
29
|
+
get: {
|
|
30
|
+
tags: ['Contacts'],
|
|
31
|
+
summary: 'Get all contacts',
|
|
32
|
+
description: 'Returns all contacts from the integration provider. Uses a stale-while-revalidate cache with a 5s timeout — may return an empty array with X-Fetching-State: pending if the fetch is slow.',
|
|
33
|
+
responses: {
|
|
34
|
+
'200': {
|
|
35
|
+
description: 'List of contacts',
|
|
36
|
+
headers: {
|
|
37
|
+
'X-Fetching-State': {
|
|
38
|
+
schema: { type: 'string', enum: ['pending'] },
|
|
39
|
+
description: 'Set to "pending" if contacts are still being fetched',
|
|
40
|
+
},
|
|
41
|
+
'X-Provider-Key': {
|
|
42
|
+
schema: { type: 'string' },
|
|
43
|
+
description: 'Refreshed API key (if token refresh is supported)',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
content: {
|
|
47
|
+
'application/json': {
|
|
48
|
+
schema: {
|
|
49
|
+
type: 'array',
|
|
50
|
+
items: { $ref: '#/components/schemas/Contact' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
post: {
|
|
58
|
+
tags: ['Contacts'],
|
|
59
|
+
summary: 'Create a contact',
|
|
60
|
+
requestBody: {
|
|
61
|
+
required: true,
|
|
62
|
+
content: {
|
|
63
|
+
'application/json': {
|
|
64
|
+
schema: { $ref: '#/components/schemas/ContactTemplate' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
responses: {
|
|
69
|
+
'200': {
|
|
70
|
+
description: 'Created contact',
|
|
71
|
+
content: {
|
|
72
|
+
'application/json': {
|
|
73
|
+
schema: { $ref: '#/components/schemas/Contact' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
'/contacts/{id}': {
|
|
81
|
+
get: {
|
|
82
|
+
tags: ['Contacts'],
|
|
83
|
+
summary: 'Get a single contact',
|
|
84
|
+
parameters: [
|
|
85
|
+
{
|
|
86
|
+
name: 'id',
|
|
87
|
+
in: 'path',
|
|
88
|
+
required: true,
|
|
89
|
+
schema: { type: 'string' },
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'type',
|
|
93
|
+
in: 'query',
|
|
94
|
+
required: true,
|
|
95
|
+
schema: { $ref: '#/components/schemas/IntegrationEntityType' },
|
|
96
|
+
description: 'Contact entity type',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
responses: {
|
|
100
|
+
'200': {
|
|
101
|
+
description: 'Contact',
|
|
102
|
+
content: {
|
|
103
|
+
'application/json': {
|
|
104
|
+
schema: { $ref: '#/components/schemas/Contact' },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
put: {
|
|
111
|
+
tags: ['Contacts'],
|
|
112
|
+
summary: 'Update a contact',
|
|
113
|
+
parameters: [
|
|
114
|
+
{
|
|
115
|
+
name: 'id',
|
|
116
|
+
in: 'path',
|
|
117
|
+
required: true,
|
|
118
|
+
schema: { type: 'string' },
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
requestBody: {
|
|
122
|
+
required: true,
|
|
123
|
+
content: {
|
|
124
|
+
'application/json': {
|
|
125
|
+
schema: { $ref: '#/components/schemas/ContactTemplate' },
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
responses: {
|
|
130
|
+
'200': {
|
|
131
|
+
description: 'Updated contact',
|
|
132
|
+
content: {
|
|
133
|
+
'application/json': {
|
|
134
|
+
schema: { $ref: '#/components/schemas/Contact' },
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
delete: {
|
|
141
|
+
tags: ['Contacts'],
|
|
142
|
+
summary: 'Delete a contact',
|
|
143
|
+
parameters: [
|
|
144
|
+
{
|
|
145
|
+
name: 'id',
|
|
146
|
+
in: 'path',
|
|
147
|
+
required: true,
|
|
148
|
+
schema: { type: 'string' },
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
responses: {
|
|
152
|
+
'200': { description: 'Contact deleted' },
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
'/contacts/stream': {
|
|
157
|
+
post: {
|
|
158
|
+
tags: ['Contacts'],
|
|
159
|
+
summary: 'Stream contacts via PubSub',
|
|
160
|
+
description: 'Triggers async contact streaming via Google PubSub. Returns immediately with a timestamp; contacts are published in batches.',
|
|
161
|
+
responses: {
|
|
162
|
+
'200': {
|
|
163
|
+
description: 'Streaming started',
|
|
164
|
+
content: {
|
|
165
|
+
'application/json': {
|
|
166
|
+
schema: {
|
|
167
|
+
type: 'object',
|
|
168
|
+
properties: { timestamp: { type: 'number' } },
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
'/contacts/{id}/entities': {
|
|
177
|
+
get: {
|
|
178
|
+
tags: ['Contacts'],
|
|
179
|
+
summary: 'Get entities for a contact',
|
|
180
|
+
parameters: [
|
|
181
|
+
{
|
|
182
|
+
name: 'id',
|
|
183
|
+
in: 'path',
|
|
184
|
+
required: true,
|
|
185
|
+
schema: { type: 'string' },
|
|
186
|
+
description: 'Contact ID',
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
responses: {
|
|
190
|
+
'200': {
|
|
191
|
+
description: 'List of entities related to the contact',
|
|
192
|
+
content: {
|
|
193
|
+
'application/json': {
|
|
194
|
+
schema: {
|
|
195
|
+
type: 'array',
|
|
196
|
+
items: {
|
|
197
|
+
$ref: '#/components/schemas/LabeledIntegrationEntity',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
'/entity/{type}/{id}': {
|
|
207
|
+
get: {
|
|
208
|
+
tags: ['Entities'],
|
|
209
|
+
summary: 'Get a single entity',
|
|
210
|
+
parameters: [
|
|
211
|
+
{
|
|
212
|
+
name: 'type',
|
|
213
|
+
in: 'path',
|
|
214
|
+
required: true,
|
|
215
|
+
schema: { $ref: '#/components/schemas/IntegrationEntityType' },
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'id',
|
|
219
|
+
in: 'path',
|
|
220
|
+
required: true,
|
|
221
|
+
schema: { type: 'string' },
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
responses: {
|
|
225
|
+
'200': {
|
|
226
|
+
description: 'Entity',
|
|
227
|
+
content: {
|
|
228
|
+
'application/json': {
|
|
229
|
+
schema: {
|
|
230
|
+
$ref: '#/components/schemas/LabeledIntegrationEntity',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
'/events/calls': {
|
|
239
|
+
post: {
|
|
240
|
+
tags: ['Call Events'],
|
|
241
|
+
summary: 'Handle call event (deprecated)',
|
|
242
|
+
deprecated: true,
|
|
243
|
+
description: 'Use PUT /call-log instead.',
|
|
244
|
+
requestBody: {
|
|
245
|
+
required: true,
|
|
246
|
+
content: {
|
|
247
|
+
'application/json': {
|
|
248
|
+
schema: { $ref: '#/components/schemas/CallEvent' },
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
responses: {
|
|
253
|
+
'200': {
|
|
254
|
+
description: 'Call event reference ID',
|
|
255
|
+
content: {
|
|
256
|
+
'application/json': { schema: { type: 'string' } },
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
'/events/calls/{id}': {
|
|
263
|
+
put: {
|
|
264
|
+
tags: ['Call Events'],
|
|
265
|
+
summary: 'Update call event (deprecated)',
|
|
266
|
+
deprecated: true,
|
|
267
|
+
description: 'Use PUT /call-log instead.',
|
|
268
|
+
parameters: [
|
|
269
|
+
{
|
|
270
|
+
name: 'id',
|
|
271
|
+
in: 'path',
|
|
272
|
+
required: true,
|
|
273
|
+
schema: { type: 'string' },
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
requestBody: {
|
|
277
|
+
required: true,
|
|
278
|
+
content: {
|
|
279
|
+
'application/json': {
|
|
280
|
+
schema: { $ref: '#/components/schemas/CallEvent' },
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
responses: {
|
|
285
|
+
'200': { description: 'Call event updated' },
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
'/events/connected': {
|
|
290
|
+
post: {
|
|
291
|
+
tags: ['Lifecycle'],
|
|
292
|
+
summary: 'Handle connected event',
|
|
293
|
+
description: 'Called when a user connects the integration.',
|
|
294
|
+
responses: {
|
|
295
|
+
'200': { description: 'Connected event handled' },
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
'/events/disconnected': {
|
|
300
|
+
post: {
|
|
301
|
+
tags: ['Lifecycle'],
|
|
302
|
+
summary: 'Handle disconnected event',
|
|
303
|
+
description: 'Called when a user disconnects the integration.',
|
|
304
|
+
responses: {
|
|
305
|
+
'200': { description: 'Disconnected event handled' },
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
'/call-log': {
|
|
310
|
+
put: {
|
|
311
|
+
tags: ['Call Log'],
|
|
312
|
+
summary: 'Create or update call logs for entities',
|
|
313
|
+
requestBody: {
|
|
314
|
+
required: true,
|
|
315
|
+
content: {
|
|
316
|
+
'application/json': {
|
|
317
|
+
schema: {
|
|
318
|
+
$ref: '#/components/schemas/CallEventWithIntegrationEntities',
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
responses: {
|
|
324
|
+
'200': {
|
|
325
|
+
description: 'Logged entities',
|
|
326
|
+
content: {
|
|
327
|
+
'application/json': {
|
|
328
|
+
schema: {
|
|
329
|
+
type: 'array',
|
|
330
|
+
items: {
|
|
331
|
+
$ref: '#/components/schemas/LoggedIntegrationEntity',
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
'/call-log/phoneNumber': {
|
|
341
|
+
put: {
|
|
342
|
+
tags: ['Call Log'],
|
|
343
|
+
summary: 'Create call log for phone number',
|
|
344
|
+
requestBody: {
|
|
345
|
+
required: true,
|
|
346
|
+
content: {
|
|
347
|
+
'application/json': {
|
|
348
|
+
schema: { $ref: '#/components/schemas/CallEvent' },
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
responses: {
|
|
353
|
+
'200': {
|
|
354
|
+
description: 'Logged entity or null',
|
|
355
|
+
content: {
|
|
356
|
+
'application/json': {
|
|
357
|
+
schema: {
|
|
358
|
+
nullable: true,
|
|
359
|
+
$ref: '#/components/schemas/LoggedIntegrationEntity',
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
'/call-log-metadata': {
|
|
368
|
+
get: {
|
|
369
|
+
tags: ['Call Log'],
|
|
370
|
+
summary: 'Get call log metadata',
|
|
371
|
+
responses: {
|
|
372
|
+
'200': {
|
|
373
|
+
description: 'Call log options',
|
|
374
|
+
content: {
|
|
375
|
+
'application/json': {
|
|
376
|
+
schema: {
|
|
377
|
+
$ref: '#/components/schemas/IntegrationDefinedOptions',
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
'/health': {
|
|
386
|
+
get: {
|
|
387
|
+
tags: ['Health'],
|
|
388
|
+
summary: 'Health check',
|
|
389
|
+
description: 'Returns 200 if the service is healthy. No authentication required.',
|
|
390
|
+
security: [],
|
|
391
|
+
responses: {
|
|
392
|
+
'200': { description: 'OK' },
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
'/validate-token': {
|
|
397
|
+
get: {
|
|
398
|
+
tags: ['Account'],
|
|
399
|
+
summary: 'Validate provider token',
|
|
400
|
+
responses: {
|
|
401
|
+
'200': {
|
|
402
|
+
description: 'Token is valid',
|
|
403
|
+
content: {
|
|
404
|
+
'text/plain': { schema: { type: 'string', example: 'OK' } },
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
'401': { description: 'Token is not valid' },
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
'/oauth2/redirect': {
|
|
412
|
+
get: {
|
|
413
|
+
tags: ['OAuth2'],
|
|
414
|
+
summary: 'Get OAuth2 redirect URL',
|
|
415
|
+
description: 'Returns the URL to redirect the user to for OAuth2 authorization.',
|
|
416
|
+
security: [],
|
|
417
|
+
responses: {
|
|
418
|
+
'200': {
|
|
419
|
+
description: 'Redirect URL',
|
|
420
|
+
content: {
|
|
421
|
+
'application/json': {
|
|
422
|
+
schema: {
|
|
423
|
+
type: 'object',
|
|
424
|
+
properties: { redirectUrl: { type: 'string' } },
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
'/oauth2/callback': {
|
|
433
|
+
get: {
|
|
434
|
+
tags: ['OAuth2'],
|
|
435
|
+
summary: 'OAuth2 callback (browser redirect)',
|
|
436
|
+
description: 'Handles the OAuth2 callback and redirects the browser to OAUTH2_REDIRECT_URL with the token.',
|
|
437
|
+
security: [],
|
|
438
|
+
parameters: [
|
|
439
|
+
{
|
|
440
|
+
name: 'code',
|
|
441
|
+
in: 'query',
|
|
442
|
+
schema: { type: 'string' },
|
|
443
|
+
description: 'OAuth2 authorization code',
|
|
444
|
+
},
|
|
445
|
+
],
|
|
446
|
+
responses: {
|
|
447
|
+
'302': {
|
|
448
|
+
description: 'Redirect to OAUTH2_REDIRECT_URL with token params',
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
'/oauth2/token': {
|
|
454
|
+
get: {
|
|
455
|
+
tags: ['OAuth2'],
|
|
456
|
+
summary: 'OAuth2 token exchange (JSON)',
|
|
457
|
+
description: 'Handles the OAuth2 callback and returns the token as JSON instead of redirecting.',
|
|
458
|
+
security: [],
|
|
459
|
+
parameters: [
|
|
460
|
+
{
|
|
461
|
+
name: 'code',
|
|
462
|
+
in: 'query',
|
|
463
|
+
schema: { type: 'string' },
|
|
464
|
+
description: 'OAuth2 authorization code',
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
responses: {
|
|
468
|
+
'200': {
|
|
469
|
+
description: 'OAuth2 credentials',
|
|
470
|
+
content: {
|
|
471
|
+
'application/json': {
|
|
472
|
+
schema: {
|
|
473
|
+
type: 'object',
|
|
474
|
+
properties: {
|
|
475
|
+
apiKey: { type: 'string' },
|
|
476
|
+
apiUrl: { type: 'string' },
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
'/account/id': {
|
|
486
|
+
get: {
|
|
487
|
+
tags: ['Account'],
|
|
488
|
+
summary: 'Get account ID',
|
|
489
|
+
responses: {
|
|
490
|
+
'200': {
|
|
491
|
+
description: 'Account ID',
|
|
492
|
+
content: {
|
|
493
|
+
'application/json': { schema: { type: 'string' } },
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
'/webhook': {
|
|
500
|
+
post: {
|
|
501
|
+
tags: ['Webhooks'],
|
|
502
|
+
summary: 'Handle webhook',
|
|
503
|
+
description: 'Receives webhook events from the integration provider, verifies the request, and publishes events via PubSub.',
|
|
504
|
+
security: [],
|
|
505
|
+
requestBody: {
|
|
506
|
+
required: true,
|
|
507
|
+
content: {
|
|
508
|
+
'application/json': { schema: { type: 'object' } },
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
responses: {
|
|
512
|
+
'200': { description: 'Webhook processed' },
|
|
513
|
+
'403': { description: 'Webhook verification failed' },
|
|
514
|
+
},
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
'/tasks/{id}': {
|
|
518
|
+
get: {
|
|
519
|
+
tags: ['Tasks'],
|
|
520
|
+
summary: 'Get task by ID',
|
|
521
|
+
parameters: [
|
|
522
|
+
{
|
|
523
|
+
name: 'id',
|
|
524
|
+
in: 'path',
|
|
525
|
+
required: true,
|
|
526
|
+
schema: { type: 'string' },
|
|
527
|
+
},
|
|
528
|
+
],
|
|
529
|
+
responses: {
|
|
530
|
+
'200': {
|
|
531
|
+
description: 'Task',
|
|
532
|
+
content: {
|
|
533
|
+
'application/json': {
|
|
534
|
+
schema: { $ref: '#/components/schemas/Task' },
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
'/tasks': {
|
|
542
|
+
post: {
|
|
543
|
+
tags: ['Tasks'],
|
|
544
|
+
summary: 'Create follow-up task',
|
|
545
|
+
requestBody: {
|
|
546
|
+
required: true,
|
|
547
|
+
content: {
|
|
548
|
+
'application/json': {
|
|
549
|
+
schema: {
|
|
550
|
+
$ref: '#/components/schemas/FollowUpWithIntegrationEntities',
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
responses: {
|
|
556
|
+
'200': {
|
|
557
|
+
description: 'Created follow-up ID',
|
|
558
|
+
content: {
|
|
559
|
+
'application/json': {
|
|
560
|
+
schema: {
|
|
561
|
+
type: 'object',
|
|
562
|
+
properties: { followUpId: { type: 'string' } },
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
'/task-metadata': {
|
|
571
|
+
get: {
|
|
572
|
+
tags: ['Tasks'],
|
|
573
|
+
summary: 'Get task metadata',
|
|
574
|
+
responses: {
|
|
575
|
+
'200': {
|
|
576
|
+
description: 'Task options',
|
|
577
|
+
content: {
|
|
578
|
+
'application/json': {
|
|
579
|
+
schema: {
|
|
580
|
+
$ref: '#/components/schemas/IntegrationDefinedOptions',
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
components: {
|
|
590
|
+
securitySchemes: {
|
|
591
|
+
providerKey: {
|
|
592
|
+
type: 'apiKey',
|
|
593
|
+
in: 'header',
|
|
594
|
+
name: 'x-provider-key',
|
|
595
|
+
description: 'API key or OAuth token for the integration provider',
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
schemas: {
|
|
599
|
+
PhoneNumberLabel: {
|
|
600
|
+
type: 'string',
|
|
601
|
+
enum: [
|
|
602
|
+
'WORK', 'MOBILE', 'HOME', 'HOMEFAX', 'WORKFAX', 'OTHERFAX',
|
|
603
|
+
'PAGER', 'WORKMOBILE', 'WORKPAGER', 'MAIN', 'GOOGLEVOICE',
|
|
604
|
+
'OTHER', 'DIRECTDIAL',
|
|
605
|
+
],
|
|
606
|
+
},
|
|
607
|
+
PhoneNumber: {
|
|
608
|
+
type: 'object',
|
|
609
|
+
required: ['label', 'phoneNumber'],
|
|
610
|
+
properties: {
|
|
611
|
+
label: { type: 'string', description: 'PhoneNumberLabel or custom string' },
|
|
612
|
+
phoneNumber: { type: 'string', example: '+4921111111111' },
|
|
613
|
+
},
|
|
614
|
+
},
|
|
615
|
+
ContactScope: {
|
|
616
|
+
type: 'string',
|
|
617
|
+
enum: ['PRIVATE', 'SHARED', 'INTERNAL'],
|
|
618
|
+
},
|
|
619
|
+
IntegrationEntityType: {
|
|
620
|
+
type: 'string',
|
|
621
|
+
enum: [
|
|
622
|
+
'contacts', 'deals', 'companies', 'tickets', 'leads', 'accounts',
|
|
623
|
+
'opportunities', 'cases', 'building_objects', 'building_objects_leads',
|
|
624
|
+
'contacts_folder', 'users', 'tasks',
|
|
625
|
+
],
|
|
626
|
+
},
|
|
627
|
+
ContactTemplate: {
|
|
628
|
+
type: 'object',
|
|
629
|
+
required: ['phoneNumbers'],
|
|
630
|
+
properties: {
|
|
631
|
+
name: { type: 'string', nullable: true },
|
|
632
|
+
firstName: { type: 'string', nullable: true },
|
|
633
|
+
lastName: { type: 'string', nullable: true },
|
|
634
|
+
email: { type: 'string', nullable: true },
|
|
635
|
+
organization: { type: 'string', nullable: true },
|
|
636
|
+
phoneNumbers: {
|
|
637
|
+
type: 'array',
|
|
638
|
+
items: { $ref: '#/components/schemas/PhoneNumber' },
|
|
639
|
+
},
|
|
640
|
+
type: { $ref: '#/components/schemas/IntegrationEntityType' },
|
|
641
|
+
scope: { $ref: '#/components/schemas/ContactScope' },
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
Contact: {
|
|
645
|
+
allOf: [
|
|
646
|
+
{ $ref: '#/components/schemas/ContactTemplate' },
|
|
647
|
+
{
|
|
648
|
+
type: 'object',
|
|
649
|
+
required: ['id'],
|
|
650
|
+
properties: {
|
|
651
|
+
id: { type: 'string' },
|
|
652
|
+
contactUrl: { type: 'string', nullable: true },
|
|
653
|
+
avatarUrl: { type: 'string', nullable: true },
|
|
654
|
+
readonly: { type: 'boolean' },
|
|
655
|
+
relatesTo: {
|
|
656
|
+
type: 'array',
|
|
657
|
+
items: { $ref: '#/components/schemas/IntegrationEntity' },
|
|
658
|
+
},
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
],
|
|
662
|
+
},
|
|
663
|
+
IntegrationEntity: {
|
|
664
|
+
type: 'object',
|
|
665
|
+
required: ['id', 'type', 'source'],
|
|
666
|
+
properties: {
|
|
667
|
+
id: { type: 'string' },
|
|
668
|
+
type: { $ref: '#/components/schemas/IntegrationEntityType' },
|
|
669
|
+
source: { type: 'string' },
|
|
670
|
+
},
|
|
671
|
+
},
|
|
672
|
+
LabeledIntegrationEntity: {
|
|
673
|
+
allOf: [
|
|
674
|
+
{ $ref: '#/components/schemas/IntegrationEntity' },
|
|
675
|
+
{
|
|
676
|
+
type: 'object',
|
|
677
|
+
required: ['label'],
|
|
678
|
+
properties: { label: { type: 'string' } },
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
},
|
|
682
|
+
LoggedIntegrationEntity: {
|
|
683
|
+
allOf: [
|
|
684
|
+
{ $ref: '#/components/schemas/IntegrationEntity' },
|
|
685
|
+
{
|
|
686
|
+
type: 'object',
|
|
687
|
+
required: ['logId'],
|
|
688
|
+
properties: { logId: { type: 'string' } },
|
|
689
|
+
},
|
|
690
|
+
],
|
|
691
|
+
},
|
|
692
|
+
CallDirection: { type: 'string', enum: ['IN', 'OUT'] },
|
|
693
|
+
CallParticipantType: { type: 'string', enum: ['local', 'remote'] },
|
|
694
|
+
CallState: {
|
|
695
|
+
type: 'string',
|
|
696
|
+
enum: ['BUSY', 'CONNECTED', 'MISSED', 'NOT_FOUND'],
|
|
697
|
+
},
|
|
698
|
+
CallParticipant: {
|
|
699
|
+
type: 'object',
|
|
700
|
+
required: ['type', 'phoneNumber'],
|
|
701
|
+
properties: {
|
|
702
|
+
type: { $ref: '#/components/schemas/CallParticipantType' },
|
|
703
|
+
phoneNumber: { type: 'string' },
|
|
704
|
+
},
|
|
705
|
+
},
|
|
706
|
+
CallEvent: {
|
|
707
|
+
type: 'object',
|
|
708
|
+
required: ['id', 'startTime', 'direction', 'participants', 'note', 'state'],
|
|
709
|
+
properties: {
|
|
710
|
+
id: { type: 'string' },
|
|
711
|
+
startTime: { type: 'number' },
|
|
712
|
+
endTime: { type: 'number' },
|
|
713
|
+
direction: { $ref: '#/components/schemas/CallDirection' },
|
|
714
|
+
participants: {
|
|
715
|
+
type: 'array',
|
|
716
|
+
items: { $ref: '#/components/schemas/CallParticipant' },
|
|
717
|
+
},
|
|
718
|
+
note: { type: 'string' },
|
|
719
|
+
state: { $ref: '#/components/schemas/CallState' },
|
|
720
|
+
outcome: { type: 'string' },
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
CallEventWithIntegrationEntities: {
|
|
724
|
+
allOf: [
|
|
725
|
+
{ $ref: '#/components/schemas/CallEvent' },
|
|
726
|
+
{
|
|
727
|
+
type: 'object',
|
|
728
|
+
required: ['integrationEntities'],
|
|
729
|
+
properties: {
|
|
730
|
+
integrationEntities: {
|
|
731
|
+
type: 'array',
|
|
732
|
+
items: { $ref: '#/components/schemas/IntegrationEntity' },
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
],
|
|
737
|
+
},
|
|
738
|
+
Task: {
|
|
739
|
+
type: 'object',
|
|
740
|
+
required: ['id', 'content', 'createdAt', 'dueAt', 'title', 'type'],
|
|
741
|
+
properties: {
|
|
742
|
+
id: { type: 'string' },
|
|
743
|
+
content: { type: 'string' },
|
|
744
|
+
createdAt: { type: 'number' },
|
|
745
|
+
dueAt: { type: 'number' },
|
|
746
|
+
title: { type: 'string' },
|
|
747
|
+
type: { type: 'string' },
|
|
748
|
+
link: { type: 'string' },
|
|
749
|
+
},
|
|
750
|
+
},
|
|
751
|
+
FollowUpWithIntegrationEntities: {
|
|
752
|
+
type: 'object',
|
|
753
|
+
required: ['content', 'dueAt', 'title', 'type', 'integrationEntities'],
|
|
754
|
+
properties: {
|
|
755
|
+
content: { type: 'string' },
|
|
756
|
+
dueAt: { type: 'number' },
|
|
757
|
+
title: { type: 'string' },
|
|
758
|
+
type: { type: 'string' },
|
|
759
|
+
integrationEntities: {
|
|
760
|
+
type: 'array',
|
|
761
|
+
items: { $ref: '#/components/schemas/IntegrationEntity' },
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
},
|
|
765
|
+
IntegrationDefinedOptions: {
|
|
766
|
+
type: 'object',
|
|
767
|
+
required: ['label'],
|
|
768
|
+
properties: {
|
|
769
|
+
label: { type: 'string' },
|
|
770
|
+
type: { type: 'string' },
|
|
771
|
+
options: {
|
|
772
|
+
type: 'array',
|
|
773
|
+
items: {
|
|
774
|
+
type: 'object',
|
|
775
|
+
required: ['label', 'key'],
|
|
776
|
+
properties: {
|
|
777
|
+
label: { type: 'string' },
|
|
778
|
+
key: { type: 'string' },
|
|
779
|
+
},
|
|
780
|
+
},
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
};
|
|
787
|
+
//# sourceMappingURL=openapi-spec.js.map
|