@opens/gateways 1.11.1 → 1.11.2
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/index.d.mts +78 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +117 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -3
- package/dist/index.mjs.map +1 -1
- package/dist/integrations/contracts/index.d.mts +97 -0
- package/dist/integrations/contracts/index.d.ts +97 -0
- package/dist/integrations/contracts/index.js +19 -0
- package/dist/integrations/contracts/index.js.map +1 -0
- package/dist/integrations/contracts/index.mjs +1 -0
- package/dist/integrations/contracts/index.mjs.map +1 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,8 @@ import { GetPresignedUrlRequest, UploadPresignedUrlResponse, AudioConvertRespons
|
|
|
11
11
|
export { IUploadPresignedUrlResponse } from './assets/contracts/index.mjs';
|
|
12
12
|
import { GetContactPhonesParams, ContactPhoneSearchResponse, ContactCategoryResponse } from './contact-list/contracts/index.mjs';
|
|
13
13
|
export { ContactPhoneResponse } from './contact-list/contracts/index.mjs';
|
|
14
|
+
import { GetIntegrationPartnersByCompanyRequest, IntegrationPartner, GetIntegrationHooksCatalogRequest, HookCatalogItem, CreateIntegrationPartnerRequest, DeleteIntegrationPartnerParams, CreateIntegrationActionRequest, IntegrationAction, UpdateIntegrationActionParams, CreateIntegrationFieldRequest, IntegrationField, UpdateIntegrationFieldParams, DeleteIntegrationFieldParams, DeleteIntegrationActionParams } from './integrations/contracts/index.mjs';
|
|
15
|
+
export { UpdateIntegrationActionRequest, UpdateIntegrationFieldRequest } from './integrations/contracts/index.mjs';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Gateway for interacting with the Customer Service API.
|
|
@@ -251,6 +253,77 @@ declare class ContactListGateway {
|
|
|
251
253
|
getCategoryList(): Promise<ContactCategoryResponse[]>;
|
|
252
254
|
}
|
|
253
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Gateway for interacting with the Integrations API.
|
|
258
|
+
*/
|
|
259
|
+
declare class IntegrationsGateway {
|
|
260
|
+
private readonly httpClient;
|
|
261
|
+
private readonly baseUrl;
|
|
262
|
+
constructor(httpClient: AxiosInstance, baseUrl: string);
|
|
263
|
+
/**
|
|
264
|
+
* Retrieves all integration partners configured for a company.
|
|
265
|
+
* @param companyId - The company identifier.
|
|
266
|
+
* @returns The integration partners configured for the company.
|
|
267
|
+
*/
|
|
268
|
+
getPartnersByCompany({ companyId, name }: GetIntegrationPartnersByCompanyRequest): Promise<IntegrationPartner[]>;
|
|
269
|
+
/**
|
|
270
|
+
* Retrieves the hook catalog, optionally scoped by module.
|
|
271
|
+
* @param module - The optional module identifier used by the Integrations API filter.
|
|
272
|
+
* @returns The hook catalog items, filtered by module when provided.
|
|
273
|
+
*/
|
|
274
|
+
getHooksCatalog({ module }?: GetIntegrationHooksCatalogRequest): Promise<HookCatalogItem[]>;
|
|
275
|
+
/**
|
|
276
|
+
* Creates an integration partner.
|
|
277
|
+
* @param payload - The partner creation payload.
|
|
278
|
+
* @returns The created integration partner.
|
|
279
|
+
*/
|
|
280
|
+
createPartner(payload: CreateIntegrationPartnerRequest): Promise<IntegrationPartner>;
|
|
281
|
+
/**
|
|
282
|
+
* Deletes an integration partner.
|
|
283
|
+
* @param partnerId - The partner identifier.
|
|
284
|
+
* @returns A promise that resolves when the partner is deleted.
|
|
285
|
+
*/
|
|
286
|
+
deletePartner({ partnerId }: DeleteIntegrationPartnerParams): Promise<void>;
|
|
287
|
+
/**
|
|
288
|
+
* Creates an integration action.
|
|
289
|
+
* @param payload - The action creation payload.
|
|
290
|
+
* @returns The created integration action.
|
|
291
|
+
*/
|
|
292
|
+
createAction(payload: CreateIntegrationActionRequest): Promise<IntegrationAction>;
|
|
293
|
+
/**
|
|
294
|
+
* Updates an integration action.
|
|
295
|
+
* @param actionId - The action identifier.
|
|
296
|
+
* @param payload - The action update payload.
|
|
297
|
+
* @returns The updated integration action.
|
|
298
|
+
*/
|
|
299
|
+
updateAction({ actionId, payload }: UpdateIntegrationActionParams): Promise<IntegrationAction>;
|
|
300
|
+
/**
|
|
301
|
+
* Creates an integration action field/header.
|
|
302
|
+
* @param payload - The field creation payload.
|
|
303
|
+
* @returns The created integration field.
|
|
304
|
+
*/
|
|
305
|
+
createField(payload: CreateIntegrationFieldRequest): Promise<IntegrationField>;
|
|
306
|
+
/**
|
|
307
|
+
* Updates an integration action field/header.
|
|
308
|
+
* @param fieldId - The field identifier.
|
|
309
|
+
* @param payload - The field update payload.
|
|
310
|
+
* @returns The updated integration field response.
|
|
311
|
+
*/
|
|
312
|
+
updateField({ fieldId, payload }: UpdateIntegrationFieldParams): Promise<IntegrationField | number[]>;
|
|
313
|
+
/**
|
|
314
|
+
* Deletes an integration action field/header.
|
|
315
|
+
* @param fieldId - The field identifier.
|
|
316
|
+
* @returns A promise that resolves when the field is deleted.
|
|
317
|
+
*/
|
|
318
|
+
deleteField({ fieldId }: DeleteIntegrationFieldParams): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Deletes an integration action.
|
|
321
|
+
* @param actionId - The action identifier.
|
|
322
|
+
* @returns A promise that resolves when the action is deleted.
|
|
323
|
+
*/
|
|
324
|
+
deleteAction({ actionId }: DeleteIntegrationActionParams): Promise<void>;
|
|
325
|
+
}
|
|
326
|
+
|
|
254
327
|
/**
|
|
255
328
|
* Maps service identifiers to their corresponding gateway types.
|
|
256
329
|
* Used by the `gateway()` function to infer the correct return type
|
|
@@ -266,6 +339,7 @@ type GatewayMap = {
|
|
|
266
339
|
'chat-adapter': ChatAdapterGateway;
|
|
267
340
|
'assets': AssetsGateway;
|
|
268
341
|
'contact-list': ContactListGateway;
|
|
342
|
+
'integrations': IntegrationsGateway;
|
|
269
343
|
};
|
|
270
344
|
/**
|
|
271
345
|
* Parameters required to configure the SDK client.
|
|
@@ -296,6 +370,9 @@ interface GatewayClientParams {
|
|
|
296
370
|
contactList?: {
|
|
297
371
|
baseUrl: string;
|
|
298
372
|
};
|
|
373
|
+
integrations?: {
|
|
374
|
+
baseUrl: string;
|
|
375
|
+
};
|
|
299
376
|
};
|
|
300
377
|
}
|
|
301
378
|
|
|
@@ -322,4 +399,4 @@ declare const configure: (params: GatewayClientParams) => void;
|
|
|
322
399
|
*/
|
|
323
400
|
declare function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];
|
|
324
401
|
|
|
325
|
-
export { AttachmentByIdResponse, AudioConvertResponse, Campaign, CampaignContactPaginatedResponse, CampaignContactQueryParams, CampaignContactResponse, CampaignPaginatedResponse, CampaignQueryParams, CampaignUser, CampaignWorkGroup, CampaignWorkGroupPaginatedResponse, CampaignWorkGroupQueryParams, CompanyResponse, ConfigListByProviderResponse, ContactCategoryResponse, ContactPhoneSearchResponse, CreateCampaignContactRequest, CreateCampaignRequest, CreateCampaignWorkGroupRequest, FindOrCreateQueueRuleRequest, GetAllUsersParams, GetAllUsersResponse, GetAttachmentByIdRequest, GetConfigTemplatesParams, GetConfigTemplatesResponse, GetConfigsByProviderParams, GetContactPhonesParams, GetManagedUsersResponse, GetPresignedUrlRequest, GetRootRulesRequest, MetaTemplateConfigResponse, MetaTemplateConfigsResponse, PatchCampaignContactRequest, PatchCampaignRequest, ProviderListResponse, Queue, QueueRule, RootRulesResponse, UploadPresignedUrlResponse, WorkGroupListResponse, WorkGroupMembersResponse, WorkGroupResponse, configure, gateway };
|
|
402
|
+
export { AttachmentByIdResponse, AudioConvertResponse, Campaign, CampaignContactPaginatedResponse, CampaignContactQueryParams, CampaignContactResponse, CampaignPaginatedResponse, CampaignQueryParams, CampaignUser, CampaignWorkGroup, CampaignWorkGroupPaginatedResponse, CampaignWorkGroupQueryParams, CompanyResponse, ConfigListByProviderResponse, ContactCategoryResponse, ContactPhoneSearchResponse, CreateCampaignContactRequest, CreateCampaignRequest, CreateCampaignWorkGroupRequest, CreateIntegrationActionRequest, CreateIntegrationFieldRequest, CreateIntegrationPartnerRequest, DeleteIntegrationActionParams, DeleteIntegrationFieldParams, DeleteIntegrationPartnerParams, FindOrCreateQueueRuleRequest, GetAllUsersParams, GetAllUsersResponse, GetAttachmentByIdRequest, GetConfigTemplatesParams, GetConfigTemplatesResponse, GetConfigsByProviderParams, GetContactPhonesParams, GetIntegrationHooksCatalogRequest, GetIntegrationPartnersByCompanyRequest, GetManagedUsersResponse, GetPresignedUrlRequest, GetRootRulesRequest, HookCatalogItem, IntegrationAction, IntegrationField, IntegrationPartner, MetaTemplateConfigResponse, MetaTemplateConfigsResponse, PatchCampaignContactRequest, PatchCampaignRequest, ProviderListResponse, Queue, QueueRule, RootRulesResponse, UpdateIntegrationActionParams, UpdateIntegrationFieldParams, UploadPresignedUrlResponse, WorkGroupListResponse, WorkGroupMembersResponse, WorkGroupResponse, configure, gateway };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { GetPresignedUrlRequest, UploadPresignedUrlResponse, AudioConvertRespons
|
|
|
11
11
|
export { IUploadPresignedUrlResponse } from './assets/contracts/index.js';
|
|
12
12
|
import { GetContactPhonesParams, ContactPhoneSearchResponse, ContactCategoryResponse } from './contact-list/contracts/index.js';
|
|
13
13
|
export { ContactPhoneResponse } from './contact-list/contracts/index.js';
|
|
14
|
+
import { GetIntegrationPartnersByCompanyRequest, IntegrationPartner, GetIntegrationHooksCatalogRequest, HookCatalogItem, CreateIntegrationPartnerRequest, DeleteIntegrationPartnerParams, CreateIntegrationActionRequest, IntegrationAction, UpdateIntegrationActionParams, CreateIntegrationFieldRequest, IntegrationField, UpdateIntegrationFieldParams, DeleteIntegrationFieldParams, DeleteIntegrationActionParams } from './integrations/contracts/index.js';
|
|
15
|
+
export { UpdateIntegrationActionRequest, UpdateIntegrationFieldRequest } from './integrations/contracts/index.js';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Gateway for interacting with the Customer Service API.
|
|
@@ -251,6 +253,77 @@ declare class ContactListGateway {
|
|
|
251
253
|
getCategoryList(): Promise<ContactCategoryResponse[]>;
|
|
252
254
|
}
|
|
253
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Gateway for interacting with the Integrations API.
|
|
258
|
+
*/
|
|
259
|
+
declare class IntegrationsGateway {
|
|
260
|
+
private readonly httpClient;
|
|
261
|
+
private readonly baseUrl;
|
|
262
|
+
constructor(httpClient: AxiosInstance, baseUrl: string);
|
|
263
|
+
/**
|
|
264
|
+
* Retrieves all integration partners configured for a company.
|
|
265
|
+
* @param companyId - The company identifier.
|
|
266
|
+
* @returns The integration partners configured for the company.
|
|
267
|
+
*/
|
|
268
|
+
getPartnersByCompany({ companyId, name }: GetIntegrationPartnersByCompanyRequest): Promise<IntegrationPartner[]>;
|
|
269
|
+
/**
|
|
270
|
+
* Retrieves the hook catalog, optionally scoped by module.
|
|
271
|
+
* @param module - The optional module identifier used by the Integrations API filter.
|
|
272
|
+
* @returns The hook catalog items, filtered by module when provided.
|
|
273
|
+
*/
|
|
274
|
+
getHooksCatalog({ module }?: GetIntegrationHooksCatalogRequest): Promise<HookCatalogItem[]>;
|
|
275
|
+
/**
|
|
276
|
+
* Creates an integration partner.
|
|
277
|
+
* @param payload - The partner creation payload.
|
|
278
|
+
* @returns The created integration partner.
|
|
279
|
+
*/
|
|
280
|
+
createPartner(payload: CreateIntegrationPartnerRequest): Promise<IntegrationPartner>;
|
|
281
|
+
/**
|
|
282
|
+
* Deletes an integration partner.
|
|
283
|
+
* @param partnerId - The partner identifier.
|
|
284
|
+
* @returns A promise that resolves when the partner is deleted.
|
|
285
|
+
*/
|
|
286
|
+
deletePartner({ partnerId }: DeleteIntegrationPartnerParams): Promise<void>;
|
|
287
|
+
/**
|
|
288
|
+
* Creates an integration action.
|
|
289
|
+
* @param payload - The action creation payload.
|
|
290
|
+
* @returns The created integration action.
|
|
291
|
+
*/
|
|
292
|
+
createAction(payload: CreateIntegrationActionRequest): Promise<IntegrationAction>;
|
|
293
|
+
/**
|
|
294
|
+
* Updates an integration action.
|
|
295
|
+
* @param actionId - The action identifier.
|
|
296
|
+
* @param payload - The action update payload.
|
|
297
|
+
* @returns The updated integration action.
|
|
298
|
+
*/
|
|
299
|
+
updateAction({ actionId, payload }: UpdateIntegrationActionParams): Promise<IntegrationAction>;
|
|
300
|
+
/**
|
|
301
|
+
* Creates an integration action field/header.
|
|
302
|
+
* @param payload - The field creation payload.
|
|
303
|
+
* @returns The created integration field.
|
|
304
|
+
*/
|
|
305
|
+
createField(payload: CreateIntegrationFieldRequest): Promise<IntegrationField>;
|
|
306
|
+
/**
|
|
307
|
+
* Updates an integration action field/header.
|
|
308
|
+
* @param fieldId - The field identifier.
|
|
309
|
+
* @param payload - The field update payload.
|
|
310
|
+
* @returns The updated integration field response.
|
|
311
|
+
*/
|
|
312
|
+
updateField({ fieldId, payload }: UpdateIntegrationFieldParams): Promise<IntegrationField | number[]>;
|
|
313
|
+
/**
|
|
314
|
+
* Deletes an integration action field/header.
|
|
315
|
+
* @param fieldId - The field identifier.
|
|
316
|
+
* @returns A promise that resolves when the field is deleted.
|
|
317
|
+
*/
|
|
318
|
+
deleteField({ fieldId }: DeleteIntegrationFieldParams): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Deletes an integration action.
|
|
321
|
+
* @param actionId - The action identifier.
|
|
322
|
+
* @returns A promise that resolves when the action is deleted.
|
|
323
|
+
*/
|
|
324
|
+
deleteAction({ actionId }: DeleteIntegrationActionParams): Promise<void>;
|
|
325
|
+
}
|
|
326
|
+
|
|
254
327
|
/**
|
|
255
328
|
* Maps service identifiers to their corresponding gateway types.
|
|
256
329
|
* Used by the `gateway()` function to infer the correct return type
|
|
@@ -266,6 +339,7 @@ type GatewayMap = {
|
|
|
266
339
|
'chat-adapter': ChatAdapterGateway;
|
|
267
340
|
'assets': AssetsGateway;
|
|
268
341
|
'contact-list': ContactListGateway;
|
|
342
|
+
'integrations': IntegrationsGateway;
|
|
269
343
|
};
|
|
270
344
|
/**
|
|
271
345
|
* Parameters required to configure the SDK client.
|
|
@@ -296,6 +370,9 @@ interface GatewayClientParams {
|
|
|
296
370
|
contactList?: {
|
|
297
371
|
baseUrl: string;
|
|
298
372
|
};
|
|
373
|
+
integrations?: {
|
|
374
|
+
baseUrl: string;
|
|
375
|
+
};
|
|
299
376
|
};
|
|
300
377
|
}
|
|
301
378
|
|
|
@@ -322,4 +399,4 @@ declare const configure: (params: GatewayClientParams) => void;
|
|
|
322
399
|
*/
|
|
323
400
|
declare function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];
|
|
324
401
|
|
|
325
|
-
export { AttachmentByIdResponse, AudioConvertResponse, Campaign, CampaignContactPaginatedResponse, CampaignContactQueryParams, CampaignContactResponse, CampaignPaginatedResponse, CampaignQueryParams, CampaignUser, CampaignWorkGroup, CampaignWorkGroupPaginatedResponse, CampaignWorkGroupQueryParams, CompanyResponse, ConfigListByProviderResponse, ContactCategoryResponse, ContactPhoneSearchResponse, CreateCampaignContactRequest, CreateCampaignRequest, CreateCampaignWorkGroupRequest, FindOrCreateQueueRuleRequest, GetAllUsersParams, GetAllUsersResponse, GetAttachmentByIdRequest, GetConfigTemplatesParams, GetConfigTemplatesResponse, GetConfigsByProviderParams, GetContactPhonesParams, GetManagedUsersResponse, GetPresignedUrlRequest, GetRootRulesRequest, MetaTemplateConfigResponse, MetaTemplateConfigsResponse, PatchCampaignContactRequest, PatchCampaignRequest, ProviderListResponse, Queue, QueueRule, RootRulesResponse, UploadPresignedUrlResponse, WorkGroupListResponse, WorkGroupMembersResponse, WorkGroupResponse, configure, gateway };
|
|
402
|
+
export { AttachmentByIdResponse, AudioConvertResponse, Campaign, CampaignContactPaginatedResponse, CampaignContactQueryParams, CampaignContactResponse, CampaignPaginatedResponse, CampaignQueryParams, CampaignUser, CampaignWorkGroup, CampaignWorkGroupPaginatedResponse, CampaignWorkGroupQueryParams, CompanyResponse, ConfigListByProviderResponse, ContactCategoryResponse, ContactPhoneSearchResponse, CreateCampaignContactRequest, CreateCampaignRequest, CreateCampaignWorkGroupRequest, CreateIntegrationActionRequest, CreateIntegrationFieldRequest, CreateIntegrationPartnerRequest, DeleteIntegrationActionParams, DeleteIntegrationFieldParams, DeleteIntegrationPartnerParams, FindOrCreateQueueRuleRequest, GetAllUsersParams, GetAllUsersResponse, GetAttachmentByIdRequest, GetConfigTemplatesParams, GetConfigTemplatesResponse, GetConfigsByProviderParams, GetContactPhonesParams, GetIntegrationHooksCatalogRequest, GetIntegrationPartnersByCompanyRequest, GetManagedUsersResponse, GetPresignedUrlRequest, GetRootRulesRequest, HookCatalogItem, IntegrationAction, IntegrationField, IntegrationPartner, MetaTemplateConfigResponse, MetaTemplateConfigsResponse, PatchCampaignContactRequest, PatchCampaignRequest, ProviderListResponse, Queue, QueueRule, RootRulesResponse, UpdateIntegrationActionParams, UpdateIntegrationFieldParams, UploadPresignedUrlResponse, WorkGroupListResponse, WorkGroupMembersResponse, WorkGroupResponse, configure, gateway };
|
package/dist/index.js
CHANGED
|
@@ -458,6 +458,112 @@ var ContactListGateway = class {
|
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
460
|
|
|
461
|
+
// src/integrations/index.ts
|
|
462
|
+
var IntegrationsGateway = class {
|
|
463
|
+
constructor(httpClient, baseUrl) {
|
|
464
|
+
this.httpClient = httpClient;
|
|
465
|
+
this.baseUrl = baseUrl;
|
|
466
|
+
}
|
|
467
|
+
httpClient;
|
|
468
|
+
baseUrl;
|
|
469
|
+
/**
|
|
470
|
+
* Retrieves all integration partners configured for a company.
|
|
471
|
+
* @param companyId - The company identifier.
|
|
472
|
+
* @returns The integration partners configured for the company.
|
|
473
|
+
*/
|
|
474
|
+
async getPartnersByCompany({ companyId, name }) {
|
|
475
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/partner/company/${companyId}`, {
|
|
476
|
+
params: name ? { name } : void 0
|
|
477
|
+
});
|
|
478
|
+
return data;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Retrieves the hook catalog, optionally scoped by module.
|
|
482
|
+
* @param module - The optional module identifier used by the Integrations API filter.
|
|
483
|
+
* @returns The hook catalog items, filtered by module when provided.
|
|
484
|
+
*/
|
|
485
|
+
async getHooksCatalog({ module: module2 } = {}) {
|
|
486
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/hooks`, {
|
|
487
|
+
params: module2 ? { module: module2 } : void 0
|
|
488
|
+
});
|
|
489
|
+
return data;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Creates an integration partner.
|
|
493
|
+
* @param payload - The partner creation payload.
|
|
494
|
+
* @returns The created integration partner.
|
|
495
|
+
*/
|
|
496
|
+
async createPartner(payload) {
|
|
497
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/partner`, payload);
|
|
498
|
+
return data;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Deletes an integration partner.
|
|
502
|
+
* @param partnerId - The partner identifier.
|
|
503
|
+
* @returns A promise that resolves when the partner is deleted.
|
|
504
|
+
*/
|
|
505
|
+
async deletePartner({ partnerId }) {
|
|
506
|
+
await this.httpClient.delete(`${this.baseUrl}/partner/${partnerId}`);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Creates an integration action.
|
|
510
|
+
* @param payload - The action creation payload.
|
|
511
|
+
* @returns The created integration action.
|
|
512
|
+
*/
|
|
513
|
+
async createAction(payload) {
|
|
514
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/action`, {
|
|
515
|
+
...payload,
|
|
516
|
+
actionName: payload.actionName ?? payload.hook
|
|
517
|
+
});
|
|
518
|
+
return data;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Updates an integration action.
|
|
522
|
+
* @param actionId - The action identifier.
|
|
523
|
+
* @param payload - The action update payload.
|
|
524
|
+
* @returns The updated integration action.
|
|
525
|
+
*/
|
|
526
|
+
async updateAction({ actionId, payload }) {
|
|
527
|
+
const { data } = await this.httpClient.patch(`${this.baseUrl}/action/${actionId}`, payload);
|
|
528
|
+
return data;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Creates an integration action field/header.
|
|
532
|
+
* @param payload - The field creation payload.
|
|
533
|
+
* @returns The created integration field.
|
|
534
|
+
*/
|
|
535
|
+
async createField(payload) {
|
|
536
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/field`, payload);
|
|
537
|
+
return data;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Updates an integration action field/header.
|
|
541
|
+
* @param fieldId - The field identifier.
|
|
542
|
+
* @param payload - The field update payload.
|
|
543
|
+
* @returns The updated integration field response.
|
|
544
|
+
*/
|
|
545
|
+
async updateField({ fieldId, payload }) {
|
|
546
|
+
const { data } = await this.httpClient.put(`${this.baseUrl}/field/${fieldId}`, payload);
|
|
547
|
+
return data;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Deletes an integration action field/header.
|
|
551
|
+
* @param fieldId - The field identifier.
|
|
552
|
+
* @returns A promise that resolves when the field is deleted.
|
|
553
|
+
*/
|
|
554
|
+
async deleteField({ fieldId }) {
|
|
555
|
+
await this.httpClient.delete(`${this.baseUrl}/field/${fieldId}`);
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Deletes an integration action.
|
|
559
|
+
* @param actionId - The action identifier.
|
|
560
|
+
* @returns A promise that resolves when the action is deleted.
|
|
561
|
+
*/
|
|
562
|
+
async deleteAction({ actionId }) {
|
|
563
|
+
await this.httpClient.delete(`${this.baseUrl}/action/${actionId}`);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
|
|
461
567
|
// src/@common/client.ts
|
|
462
568
|
var import_axios = __toESM(require("axios"));
|
|
463
569
|
var SDKGateways = class {
|
|
@@ -467,13 +573,15 @@ var SDKGateways = class {
|
|
|
467
573
|
chatAdapter;
|
|
468
574
|
assets;
|
|
469
575
|
contactList;
|
|
470
|
-
|
|
576
|
+
integrations;
|
|
577
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations) {
|
|
471
578
|
this.customerService = customerService;
|
|
472
579
|
this.chatConfig = chatConfig;
|
|
473
580
|
this.campaigns = campaigns;
|
|
474
581
|
this.chatAdapter = chatAdapter;
|
|
475
582
|
this.assets = assets;
|
|
476
583
|
this.contactList = contactList;
|
|
584
|
+
this.integrations = integrations;
|
|
477
585
|
}
|
|
478
586
|
};
|
|
479
587
|
function createClient(params) {
|
|
@@ -488,7 +596,8 @@ function createClient(params) {
|
|
|
488
596
|
const chatAdapter = params.services.chatAdapter ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl) : null;
|
|
489
597
|
const assets = params.services.assets ? new AssetsGateway(httpClient, params.services.assets.baseUrl) : null;
|
|
490
598
|
const contactList = params.services.contactList ? new ContactListGateway(httpClient, params.services.contactList.baseUrl) : null;
|
|
491
|
-
|
|
599
|
+
const integrations = params.services.integrations ? new IntegrationsGateway(httpClient, params.services.integrations.baseUrl) : null;
|
|
600
|
+
return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations);
|
|
492
601
|
}
|
|
493
602
|
|
|
494
603
|
// src/@common/enums.ts
|
|
@@ -498,7 +607,8 @@ var SERVICE_GATEWAYS = {
|
|
|
498
607
|
CAMPAIGNS: "campaigns",
|
|
499
608
|
CHAT_ADAPTER: "chat-adapter",
|
|
500
609
|
ASSETS: "assets",
|
|
501
|
-
CONTACT_LIST: "contact-list"
|
|
610
|
+
CONTACT_LIST: "contact-list",
|
|
611
|
+
INTEGRATIONS: "integrations"
|
|
502
612
|
};
|
|
503
613
|
|
|
504
614
|
// src/index.ts
|
|
@@ -542,6 +652,10 @@ function gateway(service) {
|
|
|
542
652
|
if (!sdk.client.contactList)
|
|
543
653
|
throw new Error(`Service 'contact-list' is not configured. Provide its baseUrl in configure().`);
|
|
544
654
|
return sdk.client.contactList;
|
|
655
|
+
case SERVICE_GATEWAYS.INTEGRATIONS:
|
|
656
|
+
if (!sdk.client.integrations)
|
|
657
|
+
throw new Error(`Service 'integrations' is not configured. Provide its baseUrl in configure().`);
|
|
658
|
+
return sdk.client.integrations;
|
|
545
659
|
default:
|
|
546
660
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
547
661
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/assets/index.ts","../src/contact-list/index.ts","../src/@common/client.ts","../src/@common/enums.ts"],"sourcesContent":["import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n case SERVICE_GATEWAYS.CHAT_ADAPTER:\n if (!sdk.client.chatAdapter)\n throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatAdapter;\n case SERVICE_GATEWAYS.ASSETS:\n if (!sdk.client.assets)\n throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.assets;\n case SERVICE_GATEWAYS.CONTACT_LIST:\n if (!sdk.client.contactList)\n throw new Error(`Service 'contact-list' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.contactList;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\nexport * from './chat-adapter/contracts';\nexport * from './assets/contracts';\nexport * from './contact-list/contracts';\n","import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type {\n WorkGroupListResponse,\n WorkGroupMembersResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nimport type {\n GetAllUsersParams,\n GetAllUsersResponse,\n GetManagedUsersResponse,\n} from './contracts/user';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(\n groupId: string,\n companyId?: string,\n profile?: string[],\n ): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n\n async getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse> {\n const { data } = await this.httpClient.get<GetAllUsersResponse>(\n `${this.baseUrl}/companies/users`,\n { params },\n );\n return data;\n }\n\n async getManagedUsers(managerId: string): Promise<GetManagedUsersResponse> {\n const { data } = await this.httpClient.get<GetManagedUsersResponse>(\n `${this.baseUrl}/users/managed/${managerId}`,\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type {\n WorkGroup,\n WorkGroupMember,\n WorkGroupMembersResponse,\n WorkGroupListResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nexport type {\n User,\n GetAllUsersParams,\n GetAllUsersResponse,\n ManagedUser,\n GetManagedUsersResponse,\n} from './contracts/user';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport type { Queue, QueueListResponse } from './contracts/queues';\nimport type { MetaTemplateConfigResponse, MetaTemplateConfigsResponse } from './contracts/meta-template';\nimport type {\n FindOrCreateQueueRuleRequest,\n GetRootRulesRequest,\n RootRulesResponse,\n Rule,\n QueueRule,\n} from './contracts/rule';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n\n async getQueues(): Promise<Queue[]> {\n const { data } = await this.httpClient.get<Queue[]>(`${this.baseUrl}/queues`);\n return data;\n }\n\n /**\n * Retrieves a Meta template configuration by its ID.\n * @param templateId - The unique identifier of the template.\n * @returns The Meta template configuration.\n */\n async getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigResponse>(\n `${this.baseUrl}/meta-templates-config/${templateId}`,\n );\n return data;\n }\n\n /**\n * Retrieves template configurations associated with a configuration ID.\n * @param configId - The configuration identifier.\n * @returns The list of template configurations.\n */\n async getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigsResponse>(\n `${this.baseUrl}/meta-templates-config/config/${configId}`,\n );\n return data;\n }\n\n /**\n * Finds an existing queue rule or creates a new one if it does not exist.\n * @param payload - The payload containing companyId, queueId, and configId.\n * @returns The found or created queue rule.\n */\n async findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule> {\n const { data } = await this.httpClient.put<QueueRule>(`${this.baseUrl}/rules/queue/find-or-create`, payload);\n return data;\n }\n\n /**\n * @param params - The company and pagination parameters.\n * @returns The paginated initial service rules.\n */\n async getRootRules(params: GetRootRulesRequest): Promise<RootRulesResponse> {\n const { data } = await this.httpClient.get<RootRulesResponse>(`${this.baseUrl}/rules/paginated`, {\n params: {\n archiveStatus: 'unarchived',\n companyId: params.companyId,\n offset: params.offset,\n limit: params.limit,\n name: params?.name,\n isRoot: true,\n },\n });\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType, QueueListResponse } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\nexport type {\n MetaTemplateButton,\n MetaTemplateConfigResponse,\n MetaTemplateConfigsResponse,\n} from './contracts/meta-template';\nexport type { FindOrCreateQueueRuleRequest, QueueRule, RootRulesResponse, Rule } from './contracts/rule';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nimport type {\n CampaignContactPaginatedResponse,\n CampaignContactQueryParams,\n CampaignContactResponse,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nimport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Retrieves a paginated list of campaign contacts.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaign contacts response.\n */\n async findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignContactPaginatedResponse>(`${this.baseUrl}/campaign-contacts`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The campaign contact data.\n */\n async getCampaignContacts(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.get<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign contact.\n * @param payload - The campaign contact data to create.\n * @returns The created campaign contact.\n */\n async createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.post<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts`, payload);\n return data;\n }\n\n /**\n * Adds multiple contacts to a campaign in a single request.\n * @param payload - The list of campaign contacts to create.\n * @returns The created campaign contacts.\n */\n async addContactsToCampaign(payload: CreateCampaignContactRequest[]): Promise<CampaignContactResponse[]> {\n const { data } = await this.httpClient.post<CampaignContactResponse[]>(\n `${this.baseUrl}/campaign-contacts`,\n payload,\n );\n return data;\n }\n\n /**\n * Partially updates an existing campaign contact.\n * @param id - The unique identifier of the campaign contact.\n * @param payload - The fields to update.\n * @returns The updated campaign contact.\n */\n async patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.patch<CampaignContactResponse>(\n `${this.baseUrl}/campaign-contacts/${id}`,\n payload,\n );\n return data;\n }\n\n /**\n * Removes a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The removed campaign contact.\n */\n async removeCampaignContact(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.delete<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n async getUsers() {\n const { data } = await this.httpClient.get<CampaignUser[]>(`${this.baseUrl}/users`);\n return data;\n }\n\n async listWorkGroups(query?: CampaignWorkGroupQueryParams): Promise<CampaignWorkGroupPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignWorkGroupPaginatedResponse>(`${this.baseUrl}/work-groups`, {\n params: query,\n });\n return data;\n }\n\n async createWorkGroup(payload: CreateCampaignWorkGroupRequest): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.post<CampaignWorkGroup>(`${this.baseUrl}/work-groups`, payload);\n return data;\n }\n\n async deleteWorkGroup(id: string): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.delete<CampaignWorkGroup>(`${this.baseUrl}/work-groups/${id}`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignRetryConfig,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nexport type {\n CampaignContactCampaignStatus,\n CampaignContactDispatchStatus,\n CampaignContactLikeQueryOperators,\n CampaignContactPaginatedResponse,\n CampaignContactQueryOperators,\n CampaignContactQueryParams,\n CampaignContactQueryValue,\n CampaignContactResponse,\n CampaignContactSortDirection,\n CampaignContactSortParams,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nexport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n","import type { AxiosInstance } from 'axios';\nimport type { GetConfigTemplatesResponse, GetConfigTemplatesParams } from './contracts/chat-adapter';\n\n/**\n * Gateway for interacting with the Chat Adapter API.\n */\nexport class ChatAdapterGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves message templates associated with a configuration.\n * @param configId - The unique identifier of the configuration.\n * @param params - Optional query parameters for filtering and pagination.\n * @returns A promise that resolves to the template list response.\n */\n async getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse> {\n const { data } = await this.httpClient.get<GetConfigTemplatesResponse>(\n `${this.baseUrl}/message-templates/${configId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type {\n GetConfigTemplatesResponse,\n GetConfigTemplatesParams,\n MessageTemplate,\n MessageTemplateComponent,\n ConfigTemplatesPaging,\n} from './contracts/chat-adapter';\n","import type { AxiosInstance } from 'axios';\nimport type { GetPresignedUrlRequest, UploadPresignedUrlResponse, AudioConvertResponse, GetAttachmentByIdRequest, AttachmentByIdResponse } from './contracts/assets';\n\n/**\n * Gateway for interacting with the Assets API.\n */\nexport class AssetsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n /**\n * Retrieves a presigned URL to upload a file to the Assets API.\n * @param params - The configuration options and parameters for the presigned URL.\n * @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.\n */\n async getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse> {\n const { data } = await this.httpClient.get<UploadPresignedUrlResponse>(`${this.baseUrl}/uploads/presigned-url`, {\n params,\n });\n return data;\n }\n\n /**\n * Converts an audio file to M4A format via the Assets API.\n * @param params - The audio file to convert.\n * @param params.file - The audio file to upload for conversion.\n * @returns The converted audio response with base64-encoded data, mimetype, extension and filename.\n */\n async convertAudioToM4A(formData: any): Promise<AudioConvertResponse> {\n const { data } = await this.httpClient.post<AudioConvertResponse>(\n `${this.baseUrl}/whatsapp/audio-convert`,\n formData,\n {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n },\n );\n return data;\n }\n\n /**\n * Fetches an attachment by its file ID or storage key.\n *\n * When `key` is provided, the path is built from the key directly and no\n * `x-bucket-provider` header is sent. Otherwise, `fileId` and `provider` are\n * used to build the path and the provider header respectively.\n *\n * @param params - The parameters identifying the attachment.\n * @returns A signed URL to access the attachment.\n */\n async getAttachmentById(params: GetAttachmentByIdRequest): Promise<AttachmentByIdResponse> {\n const path = params.key\n ? `/uploads/${encodeURIComponent(params.key)}`\n : `/uploads/${encodeURIComponent(params.fileId!)}`;\n\n const axiosParams: Record<string, string> = {};\n\n if (params.download) axiosParams.download = 'true';\n if (params.filename) axiosParams.filename = params.filename;\n const headers: Record<string, string> = {};\n if (!params.key && params.provider) headers['x-bucket-provider'] = params.provider!;\n\n const { data } = await this.httpClient.get<AttachmentByIdResponse>(`${this.baseUrl}${path}`, {\n params: axiosParams,\n headers,\n });\n return data;\n }\n}\n\nexport type {\n GetPresignedUrlRequest,\n UploadPresignedUrlResponse,\n IUploadPresignedUrlResponse,\n AudioConvertResponse,\n GetAttachmentByIdRequest,\n AttachmentByIdResponse,\n} from './contracts/assets';\n","import type { AxiosInstance } from 'axios';\nimport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n\n/**\n * Gateway for interacting with the Contact List API.\n */\nexport class ContactListGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Searches for contact phones with optional filtering and pagination.\n * @param params - The query parameters for the search.\n * @returns The paginated contact phones response.\n */\n async getContactsPhones(params: GetContactPhonesParams): Promise<ContactPhoneSearchResponse> {\n const { data } = await this.httpClient.get<ContactPhoneSearchResponse>(\n `${this.baseUrl}/contact/phone/search`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves all contact categories.\n * @returns An array of contact categories.\n */\n async getCategoryList(): Promise<ContactCategoryResponse[]> {\n const { data } = await this.httpClient.get<ContactCategoryResponse[]>(\n `${this.baseUrl}/contact/category`,\n );\n return data;\n }\n}\n\nexport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactPhoneResponse,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AssetsGateway } from '../assets';\nimport { ContactListGateway } from '../contact-list';\nimport axios, { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n 'chat-adapter': ChatAdapterGateway;\n 'assets': AssetsGateway;\n 'contact-list': ContactListGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n assets: AssetsGateway | null,\n contactList: ContactListGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n this.assets = assets;\n this.contactList = contactList;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests (optional). */\n axiosClient?: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n chatAdapter?: {\n baseUrl: string;\n };\n assets?: {\n baseUrl: string;\n };\n contactList?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient || axios.create({\n headers: {\n Authorization: `Bearer ${params.apiToken}`,\n },\n });\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n const chatAdapter = params.services.chatAdapter\n ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl)\n : null;\n const assets = params.services.assets\n ? new AssetsGateway(httpClient, params.services.assets.baseUrl)\n : null;\n const contactList = params.services.contactList\n ? new ContactListGateway(httpClient, params.services.contactList.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets, contactList);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n CHAT_ADAPTER: 'chat-adapter',\n ASSETS: 'assets',\n CONTACT_LIST: 'contact-list',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAA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AACF;","names":["axios"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/assets/index.ts","../src/contact-list/index.ts","../src/integrations/index.ts","../src/@common/client.ts","../src/@common/enums.ts"],"sourcesContent":["import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n case SERVICE_GATEWAYS.CHAT_ADAPTER:\n if (!sdk.client.chatAdapter)\n throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatAdapter;\n case SERVICE_GATEWAYS.ASSETS:\n if (!sdk.client.assets)\n throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.assets;\n case SERVICE_GATEWAYS.CONTACT_LIST:\n if (!sdk.client.contactList)\n throw new Error(`Service 'contact-list' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.contactList;\n case SERVICE_GATEWAYS.INTEGRATIONS:\n if (!sdk.client.integrations)\n throw new Error(`Service 'integrations' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.integrations;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\nexport * from './chat-adapter/contracts';\nexport * from './assets/contracts';\nexport * from './contact-list/contracts';\nexport * from './integrations/contracts';\n","import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type {\n WorkGroupListResponse,\n WorkGroupMembersResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nimport type {\n GetAllUsersParams,\n GetAllUsersResponse,\n GetManagedUsersResponse,\n} from './contracts/user';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(\n groupId: string,\n companyId?: string,\n profile?: string[],\n ): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n\n async getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse> {\n const { data } = await this.httpClient.get<GetAllUsersResponse>(\n `${this.baseUrl}/companies/users`,\n { params },\n );\n return data;\n }\n\n async getManagedUsers(managerId: string): Promise<GetManagedUsersResponse> {\n const { data } = await this.httpClient.get<GetManagedUsersResponse>(\n `${this.baseUrl}/users/managed/${managerId}`,\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type {\n WorkGroup,\n WorkGroupMember,\n WorkGroupMembersResponse,\n WorkGroupListResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nexport type {\n User,\n GetAllUsersParams,\n GetAllUsersResponse,\n ManagedUser,\n GetManagedUsersResponse,\n} from './contracts/user';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport type { Queue, QueueListResponse } from './contracts/queues';\nimport type { MetaTemplateConfigResponse, MetaTemplateConfigsResponse } from './contracts/meta-template';\nimport type {\n FindOrCreateQueueRuleRequest,\n GetRootRulesRequest,\n RootRulesResponse,\n Rule,\n QueueRule,\n} from './contracts/rule';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n\n async getQueues(): Promise<Queue[]> {\n const { data } = await this.httpClient.get<Queue[]>(`${this.baseUrl}/queues`);\n return data;\n }\n\n /**\n * Retrieves a Meta template configuration by its ID.\n * @param templateId - The unique identifier of the template.\n * @returns The Meta template configuration.\n */\n async getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigResponse>(\n `${this.baseUrl}/meta-templates-config/${templateId}`,\n );\n return data;\n }\n\n /**\n * Retrieves template configurations associated with a configuration ID.\n * @param configId - The configuration identifier.\n * @returns The list of template configurations.\n */\n async getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigsResponse>(\n `${this.baseUrl}/meta-templates-config/config/${configId}`,\n );\n return data;\n }\n\n /**\n * Finds an existing queue rule or creates a new one if it does not exist.\n * @param payload - The payload containing companyId, queueId, and configId.\n * @returns The found or created queue rule.\n */\n async findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule> {\n const { data } = await this.httpClient.put<QueueRule>(`${this.baseUrl}/rules/queue/find-or-create`, payload);\n return data;\n }\n\n /**\n * @param params - The company and pagination parameters.\n * @returns The paginated initial service rules.\n */\n async getRootRules(params: GetRootRulesRequest): Promise<RootRulesResponse> {\n const { data } = await this.httpClient.get<RootRulesResponse>(`${this.baseUrl}/rules/paginated`, {\n params: {\n archiveStatus: 'unarchived',\n companyId: params.companyId,\n offset: params.offset,\n limit: params.limit,\n name: params?.name,\n isRoot: true,\n },\n });\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType, QueueListResponse } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\nexport type {\n MetaTemplateButton,\n MetaTemplateConfigResponse,\n MetaTemplateConfigsResponse,\n} from './contracts/meta-template';\nexport type { FindOrCreateQueueRuleRequest, QueueRule, RootRulesResponse, Rule } from './contracts/rule';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nimport type {\n CampaignContactPaginatedResponse,\n CampaignContactQueryParams,\n CampaignContactResponse,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nimport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Retrieves a paginated list of campaign contacts.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaign contacts response.\n */\n async findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignContactPaginatedResponse>(`${this.baseUrl}/campaign-contacts`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The campaign contact data.\n */\n async getCampaignContacts(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.get<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign contact.\n * @param payload - The campaign contact data to create.\n * @returns The created campaign contact.\n */\n async createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.post<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts`, payload);\n return data;\n }\n\n /**\n * Adds multiple contacts to a campaign in a single request.\n * @param payload - The list of campaign contacts to create.\n * @returns The created campaign contacts.\n */\n async addContactsToCampaign(payload: CreateCampaignContactRequest[]): Promise<CampaignContactResponse[]> {\n const { data } = await this.httpClient.post<CampaignContactResponse[]>(\n `${this.baseUrl}/campaign-contacts`,\n payload,\n );\n return data;\n }\n\n /**\n * Partially updates an existing campaign contact.\n * @param id - The unique identifier of the campaign contact.\n * @param payload - The fields to update.\n * @returns The updated campaign contact.\n */\n async patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.patch<CampaignContactResponse>(\n `${this.baseUrl}/campaign-contacts/${id}`,\n payload,\n );\n return data;\n }\n\n /**\n * Removes a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The removed campaign contact.\n */\n async removeCampaignContact(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.delete<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n async getUsers() {\n const { data } = await this.httpClient.get<CampaignUser[]>(`${this.baseUrl}/users`);\n return data;\n }\n\n async listWorkGroups(query?: CampaignWorkGroupQueryParams): Promise<CampaignWorkGroupPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignWorkGroupPaginatedResponse>(`${this.baseUrl}/work-groups`, {\n params: query,\n });\n return data;\n }\n\n async createWorkGroup(payload: CreateCampaignWorkGroupRequest): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.post<CampaignWorkGroup>(`${this.baseUrl}/work-groups`, payload);\n return data;\n }\n\n async deleteWorkGroup(id: string): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.delete<CampaignWorkGroup>(`${this.baseUrl}/work-groups/${id}`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignRetryConfig,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nexport type {\n CampaignContactCampaignStatus,\n CampaignContactDispatchStatus,\n CampaignContactLikeQueryOperators,\n CampaignContactPaginatedResponse,\n CampaignContactQueryOperators,\n CampaignContactQueryParams,\n CampaignContactQueryValue,\n CampaignContactResponse,\n CampaignContactSortDirection,\n CampaignContactSortParams,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nexport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n","import type { AxiosInstance } from 'axios';\nimport type { GetConfigTemplatesResponse, GetConfigTemplatesParams } from './contracts/chat-adapter';\n\n/**\n * Gateway for interacting with the Chat Adapter API.\n */\nexport class ChatAdapterGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves message templates associated with a configuration.\n * @param configId - The unique identifier of the configuration.\n * @param params - Optional query parameters for filtering and pagination.\n * @returns A promise that resolves to the template list response.\n */\n async getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse> {\n const { data } = await this.httpClient.get<GetConfigTemplatesResponse>(\n `${this.baseUrl}/message-templates/${configId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type {\n GetConfigTemplatesResponse,\n GetConfigTemplatesParams,\n MessageTemplate,\n MessageTemplateComponent,\n ConfigTemplatesPaging,\n} from './contracts/chat-adapter';\n","import type { AxiosInstance } from 'axios';\nimport type { GetPresignedUrlRequest, UploadPresignedUrlResponse, AudioConvertResponse, GetAttachmentByIdRequest, AttachmentByIdResponse } from './contracts/assets';\n\n/**\n * Gateway for interacting with the Assets API.\n */\nexport class AssetsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n /**\n * Retrieves a presigned URL to upload a file to the Assets API.\n * @param params - The configuration options and parameters for the presigned URL.\n * @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.\n */\n async getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse> {\n const { data } = await this.httpClient.get<UploadPresignedUrlResponse>(`${this.baseUrl}/uploads/presigned-url`, {\n params,\n });\n return data;\n }\n\n /**\n * Converts an audio file to M4A format via the Assets API.\n * @param params - The audio file to convert.\n * @param params.file - The audio file to upload for conversion.\n * @returns The converted audio response with base64-encoded data, mimetype, extension and filename.\n */\n async convertAudioToM4A(formData: any): Promise<AudioConvertResponse> {\n const { data } = await this.httpClient.post<AudioConvertResponse>(\n `${this.baseUrl}/whatsapp/audio-convert`,\n formData,\n {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n },\n );\n return data;\n }\n\n /**\n * Fetches an attachment by its file ID or storage key.\n *\n * When `key` is provided, the path is built from the key directly and no\n * `x-bucket-provider` header is sent. Otherwise, `fileId` and `provider` are\n * used to build the path and the provider header respectively.\n *\n * @param params - The parameters identifying the attachment.\n * @returns A signed URL to access the attachment.\n */\n async getAttachmentById(params: GetAttachmentByIdRequest): Promise<AttachmentByIdResponse> {\n const path = params.key\n ? `/uploads/${encodeURIComponent(params.key)}`\n : `/uploads/${encodeURIComponent(params.fileId!)}`;\n\n const axiosParams: Record<string, string> = {};\n\n if (params.download) axiosParams.download = 'true';\n if (params.filename) axiosParams.filename = params.filename;\n const headers: Record<string, string> = {};\n if (!params.key && params.provider) headers['x-bucket-provider'] = params.provider!;\n\n const { data } = await this.httpClient.get<AttachmentByIdResponse>(`${this.baseUrl}${path}`, {\n params: axiosParams,\n headers,\n });\n return data;\n }\n}\n\nexport type {\n GetPresignedUrlRequest,\n UploadPresignedUrlResponse,\n IUploadPresignedUrlResponse,\n AudioConvertResponse,\n GetAttachmentByIdRequest,\n AttachmentByIdResponse,\n} from './contracts/assets';\n","import type { AxiosInstance } from 'axios';\nimport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n\n/**\n * Gateway for interacting with the Contact List API.\n */\nexport class ContactListGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Searches for contact phones with optional filtering and pagination.\n * @param params - The query parameters for the search.\n * @returns The paginated contact phones response.\n */\n async getContactsPhones(params: GetContactPhonesParams): Promise<ContactPhoneSearchResponse> {\n const { data } = await this.httpClient.get<ContactPhoneSearchResponse>(\n `${this.baseUrl}/contact/phone/search`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves all contact categories.\n * @returns An array of contact categories.\n */\n async getCategoryList(): Promise<ContactCategoryResponse[]> {\n const { data } = await this.httpClient.get<ContactCategoryResponse[]>(\n `${this.baseUrl}/contact/category`,\n );\n return data;\n }\n}\n\nexport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactPhoneResponse,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n","import type { AxiosInstance } from 'axios';\nimport type {\n CreateIntegrationActionRequest,\n CreateIntegrationFieldRequest,\n CreateIntegrationPartnerRequest,\n DeleteIntegrationActionParams,\n DeleteIntegrationFieldParams,\n DeleteIntegrationPartnerParams,\n GetIntegrationHooksCatalogRequest,\n GetIntegrationPartnersByCompanyRequest,\n HookCatalogItem,\n IntegrationAction,\n IntegrationField,\n IntegrationPartner,\n UpdateIntegrationActionParams,\n UpdateIntegrationActionRequest,\n UpdateIntegrationFieldParams,\n UpdateIntegrationFieldRequest,\n} from './contracts';\n\n/**\n * Gateway for interacting with the Integrations API.\n */\nexport class IntegrationsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all integration partners configured for a company.\n * @param companyId - The company identifier.\n * @returns The integration partners configured for the company.\n */\n async getPartnersByCompany({ companyId, name }: GetIntegrationPartnersByCompanyRequest): Promise<IntegrationPartner[]> {\n const { data } = await this.httpClient.get<IntegrationPartner[]>(`${this.baseUrl}/partner/company/${companyId}`, {\n params: name ? { name } : undefined,\n });\n return data;\n }\n\n /**\n * Retrieves the hook catalog, optionally scoped by module.\n * @param module - The optional module identifier used by the Integrations API filter.\n * @returns The hook catalog items, filtered by module when provided.\n */\n async getHooksCatalog({ module }: GetIntegrationHooksCatalogRequest = {}): Promise<HookCatalogItem[]> {\n const { data } = await this.httpClient.get<HookCatalogItem[]>(`${this.baseUrl}/hooks`, {\n params: module ? { module } : undefined,\n });\n return data;\n }\n\n /**\n * Creates an integration partner.\n * @param payload - The partner creation payload.\n * @returns The created integration partner.\n */\n async createPartner(payload: CreateIntegrationPartnerRequest): Promise<IntegrationPartner> {\n const { data } = await this.httpClient.post<IntegrationPartner>(`${this.baseUrl}/partner`, payload);\n return data;\n }\n\n /**\n * Deletes an integration partner.\n * @param partnerId - The partner identifier.\n * @returns A promise that resolves when the partner is deleted.\n */\n async deletePartner({ partnerId }: DeleteIntegrationPartnerParams): Promise<void> {\n await this.httpClient.delete(`${this.baseUrl}/partner/${partnerId}`);\n }\n\n /**\n * Creates an integration action.\n * @param payload - The action creation payload.\n * @returns The created integration action.\n */\n async createAction(payload: CreateIntegrationActionRequest): Promise<IntegrationAction> {\n const { data } = await this.httpClient.post<IntegrationAction>(`${this.baseUrl}/action`, {\n ...payload,\n actionName: payload.actionName ?? payload.hook,\n });\n return data;\n }\n\n /**\n * Updates an integration action.\n * @param actionId - The action identifier.\n * @param payload - The action update payload.\n * @returns The updated integration action.\n */\n async updateAction({ actionId, payload }: UpdateIntegrationActionParams): Promise<IntegrationAction> {\n const { data } = await this.httpClient.patch<IntegrationAction>(`${this.baseUrl}/action/${actionId}`, payload);\n return data;\n }\n\n /**\n * Creates an integration action field/header.\n * @param payload - The field creation payload.\n * @returns The created integration field.\n */\n async createField(payload: CreateIntegrationFieldRequest): Promise<IntegrationField> {\n const { data } = await this.httpClient.post<IntegrationField>(`${this.baseUrl}/field`, payload);\n return data;\n }\n\n /**\n * Updates an integration action field/header.\n * @param fieldId - The field identifier.\n * @param payload - The field update payload.\n * @returns The updated integration field response.\n */\n async updateField({ fieldId, payload }: UpdateIntegrationFieldParams): Promise<IntegrationField | number[]> {\n const { data } = await this.httpClient.put<IntegrationField | number[]>(`${this.baseUrl}/field/${fieldId}`, payload);\n return data;\n }\n\n /**\n * Deletes an integration action field/header.\n * @param fieldId - The field identifier.\n * @returns A promise that resolves when the field is deleted.\n */\n async deleteField({ fieldId }: DeleteIntegrationFieldParams): Promise<void> {\n await this.httpClient.delete(`${this.baseUrl}/field/${fieldId}`);\n }\n\n /**\n * Deletes an integration action.\n * @param actionId - The action identifier.\n * @returns A promise that resolves when the action is deleted.\n */\n async deleteAction({ actionId }: DeleteIntegrationActionParams): Promise<void> {\n await this.httpClient.delete(`${this.baseUrl}/action/${actionId}`);\n }\n}\n\nexport type {\n CreateIntegrationActionRequest,\n CreateIntegrationFieldRequest,\n CreateIntegrationPartnerRequest,\n DeleteIntegrationActionParams,\n DeleteIntegrationFieldParams,\n DeleteIntegrationPartnerParams,\n GetIntegrationHooksCatalogRequest,\n GetIntegrationPartnersByCompanyRequest,\n HookCatalogItem,\n IntegrationAction,\n IntegrationField,\n IntegrationPartner,\n UpdateIntegrationActionParams,\n UpdateIntegrationActionRequest,\n UpdateIntegrationFieldParams,\n UpdateIntegrationFieldRequest,\n} from './contracts';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AssetsGateway } from '../assets';\nimport { ContactListGateway } from '../contact-list';\nimport { IntegrationsGateway } from '../integrations';\nimport axios, { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n 'chat-adapter': ChatAdapterGateway;\n 'assets': AssetsGateway;\n 'contact-list': ContactListGateway;\n 'integrations': IntegrationsGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n integrations: IntegrationsGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n integrations: IntegrationsGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n assets: AssetsGateway | null,\n contactList: ContactListGateway | null,\n integrations: IntegrationsGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n this.assets = assets;\n this.contactList = contactList;\n this.integrations = integrations;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests (optional). */\n axiosClient?: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n chatAdapter?: {\n baseUrl: string;\n };\n assets?: {\n baseUrl: string;\n };\n contactList?: {\n baseUrl: string;\n };\n integrations?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient || axios.create({\n headers: {\n Authorization: `Bearer ${params.apiToken}`,\n },\n });\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n const chatAdapter = params.services.chatAdapter\n ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl)\n : null;\n const assets = params.services.assets\n ? new AssetsGateway(httpClient, params.services.assets.baseUrl)\n : null;\n const contactList = params.services.contactList\n ? new ContactListGateway(httpClient, params.services.contactList.baseUrl)\n : null;\n const integrations = params.services.integrations\n ? new IntegrationsGateway(httpClient, params.services.integrations.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n CHAT_ADAPTER: 'chat-adapter',\n ASSETS: 'assets',\n CONTACT_LIST: 'contact-list',\n INTEGRATIONS: 'integrations',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW,IAAqB,GAAG,KAAK,OAAO,qBAAqB,SAAS,EAAE;AAC3G,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,WAAmD;AACrE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW;AAAA,MACrC,GAAG,KAAK,OAAO;AAAA,MACf,EAAE,QAAQ,EAAE,YAAY,UAAU,EAAE;AAAA,IACtC;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,aAAqB,WAAgD;AAC1F,UAAM,SAAS,YAAY,EAAE,YAAY,UAAU,IAAI;AACvD,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW;AAAA,MACrC,GAAG,KAAK,OAAO,0BAA0B,WAAW;AAAA,MACpD,EAAE,OAAO;AAAA,IACX;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,oBACJ,SACA,WACA,SACmC;AACnC,UAAM,SAAsD,CAAC;AAC7D,QAAI,UAAW,QAAO,aAAa;AACnC,QAAI,QAAS,QAAO,UAAU;A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B;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,yEAAyE;AAC3F,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,+EAA+E;AACjG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,+EAA+E;AACjG,aAAO,IAAI,OAAO;AAAA,IACpB;AACE,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":["module","axios"]}
|
package/dist/index.mjs
CHANGED
|
@@ -421,6 +421,112 @@ var ContactListGateway = class {
|
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
|
|
424
|
+
// src/integrations/index.ts
|
|
425
|
+
var IntegrationsGateway = class {
|
|
426
|
+
constructor(httpClient, baseUrl) {
|
|
427
|
+
this.httpClient = httpClient;
|
|
428
|
+
this.baseUrl = baseUrl;
|
|
429
|
+
}
|
|
430
|
+
httpClient;
|
|
431
|
+
baseUrl;
|
|
432
|
+
/**
|
|
433
|
+
* Retrieves all integration partners configured for a company.
|
|
434
|
+
* @param companyId - The company identifier.
|
|
435
|
+
* @returns The integration partners configured for the company.
|
|
436
|
+
*/
|
|
437
|
+
async getPartnersByCompany({ companyId, name }) {
|
|
438
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/partner/company/${companyId}`, {
|
|
439
|
+
params: name ? { name } : void 0
|
|
440
|
+
});
|
|
441
|
+
return data;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Retrieves the hook catalog, optionally scoped by module.
|
|
445
|
+
* @param module - The optional module identifier used by the Integrations API filter.
|
|
446
|
+
* @returns The hook catalog items, filtered by module when provided.
|
|
447
|
+
*/
|
|
448
|
+
async getHooksCatalog({ module } = {}) {
|
|
449
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/hooks`, {
|
|
450
|
+
params: module ? { module } : void 0
|
|
451
|
+
});
|
|
452
|
+
return data;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Creates an integration partner.
|
|
456
|
+
* @param payload - The partner creation payload.
|
|
457
|
+
* @returns The created integration partner.
|
|
458
|
+
*/
|
|
459
|
+
async createPartner(payload) {
|
|
460
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/partner`, payload);
|
|
461
|
+
return data;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Deletes an integration partner.
|
|
465
|
+
* @param partnerId - The partner identifier.
|
|
466
|
+
* @returns A promise that resolves when the partner is deleted.
|
|
467
|
+
*/
|
|
468
|
+
async deletePartner({ partnerId }) {
|
|
469
|
+
await this.httpClient.delete(`${this.baseUrl}/partner/${partnerId}`);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Creates an integration action.
|
|
473
|
+
* @param payload - The action creation payload.
|
|
474
|
+
* @returns The created integration action.
|
|
475
|
+
*/
|
|
476
|
+
async createAction(payload) {
|
|
477
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/action`, {
|
|
478
|
+
...payload,
|
|
479
|
+
actionName: payload.actionName ?? payload.hook
|
|
480
|
+
});
|
|
481
|
+
return data;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Updates an integration action.
|
|
485
|
+
* @param actionId - The action identifier.
|
|
486
|
+
* @param payload - The action update payload.
|
|
487
|
+
* @returns The updated integration action.
|
|
488
|
+
*/
|
|
489
|
+
async updateAction({ actionId, payload }) {
|
|
490
|
+
const { data } = await this.httpClient.patch(`${this.baseUrl}/action/${actionId}`, payload);
|
|
491
|
+
return data;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Creates an integration action field/header.
|
|
495
|
+
* @param payload - The field creation payload.
|
|
496
|
+
* @returns The created integration field.
|
|
497
|
+
*/
|
|
498
|
+
async createField(payload) {
|
|
499
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/field`, payload);
|
|
500
|
+
return data;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Updates an integration action field/header.
|
|
504
|
+
* @param fieldId - The field identifier.
|
|
505
|
+
* @param payload - The field update payload.
|
|
506
|
+
* @returns The updated integration field response.
|
|
507
|
+
*/
|
|
508
|
+
async updateField({ fieldId, payload }) {
|
|
509
|
+
const { data } = await this.httpClient.put(`${this.baseUrl}/field/${fieldId}`, payload);
|
|
510
|
+
return data;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Deletes an integration action field/header.
|
|
514
|
+
* @param fieldId - The field identifier.
|
|
515
|
+
* @returns A promise that resolves when the field is deleted.
|
|
516
|
+
*/
|
|
517
|
+
async deleteField({ fieldId }) {
|
|
518
|
+
await this.httpClient.delete(`${this.baseUrl}/field/${fieldId}`);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Deletes an integration action.
|
|
522
|
+
* @param actionId - The action identifier.
|
|
523
|
+
* @returns A promise that resolves when the action is deleted.
|
|
524
|
+
*/
|
|
525
|
+
async deleteAction({ actionId }) {
|
|
526
|
+
await this.httpClient.delete(`${this.baseUrl}/action/${actionId}`);
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
|
|
424
530
|
// src/@common/client.ts
|
|
425
531
|
import axios from "axios";
|
|
426
532
|
var SDKGateways = class {
|
|
@@ -430,13 +536,15 @@ var SDKGateways = class {
|
|
|
430
536
|
chatAdapter;
|
|
431
537
|
assets;
|
|
432
538
|
contactList;
|
|
433
|
-
|
|
539
|
+
integrations;
|
|
540
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations) {
|
|
434
541
|
this.customerService = customerService;
|
|
435
542
|
this.chatConfig = chatConfig;
|
|
436
543
|
this.campaigns = campaigns;
|
|
437
544
|
this.chatAdapter = chatAdapter;
|
|
438
545
|
this.assets = assets;
|
|
439
546
|
this.contactList = contactList;
|
|
547
|
+
this.integrations = integrations;
|
|
440
548
|
}
|
|
441
549
|
};
|
|
442
550
|
function createClient(params) {
|
|
@@ -451,7 +559,8 @@ function createClient(params) {
|
|
|
451
559
|
const chatAdapter = params.services.chatAdapter ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl) : null;
|
|
452
560
|
const assets = params.services.assets ? new AssetsGateway(httpClient, params.services.assets.baseUrl) : null;
|
|
453
561
|
const contactList = params.services.contactList ? new ContactListGateway(httpClient, params.services.contactList.baseUrl) : null;
|
|
454
|
-
|
|
562
|
+
const integrations = params.services.integrations ? new IntegrationsGateway(httpClient, params.services.integrations.baseUrl) : null;
|
|
563
|
+
return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations);
|
|
455
564
|
}
|
|
456
565
|
|
|
457
566
|
// src/@common/enums.ts
|
|
@@ -461,7 +570,8 @@ var SERVICE_GATEWAYS = {
|
|
|
461
570
|
CAMPAIGNS: "campaigns",
|
|
462
571
|
CHAT_ADAPTER: "chat-adapter",
|
|
463
572
|
ASSETS: "assets",
|
|
464
|
-
CONTACT_LIST: "contact-list"
|
|
573
|
+
CONTACT_LIST: "contact-list",
|
|
574
|
+
INTEGRATIONS: "integrations"
|
|
465
575
|
};
|
|
466
576
|
|
|
467
577
|
// src/index.ts
|
|
@@ -505,6 +615,10 @@ function gateway(service) {
|
|
|
505
615
|
if (!sdk.client.contactList)
|
|
506
616
|
throw new Error(`Service 'contact-list' is not configured. Provide its baseUrl in configure().`);
|
|
507
617
|
return sdk.client.contactList;
|
|
618
|
+
case SERVICE_GATEWAYS.INTEGRATIONS:
|
|
619
|
+
if (!sdk.client.integrations)
|
|
620
|
+
throw new Error(`Service 'integrations' is not configured. Provide its baseUrl in configure().`);
|
|
621
|
+
return sdk.client.integrations;
|
|
508
622
|
default:
|
|
509
623
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
510
624
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/assets/index.ts","../src/contact-list/index.ts","../src/@common/client.ts","../src/@common/enums.ts","../src/index.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type {\n WorkGroupListResponse,\n WorkGroupMembersResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nimport type {\n GetAllUsersParams,\n GetAllUsersResponse,\n GetManagedUsersResponse,\n} from './contracts/user';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(\n groupId: string,\n companyId?: string,\n profile?: string[],\n ): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n\n async getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse> {\n const { data } = await this.httpClient.get<GetAllUsersResponse>(\n `${this.baseUrl}/companies/users`,\n { params },\n );\n return data;\n }\n\n async getManagedUsers(managerId: string): Promise<GetManagedUsersResponse> {\n const { data } = await this.httpClient.get<GetManagedUsersResponse>(\n `${this.baseUrl}/users/managed/${managerId}`,\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type {\n WorkGroup,\n WorkGroupMember,\n WorkGroupMembersResponse,\n WorkGroupListResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nexport type {\n User,\n GetAllUsersParams,\n GetAllUsersResponse,\n ManagedUser,\n GetManagedUsersResponse,\n} from './contracts/user';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport type { Queue, QueueListResponse } from './contracts/queues';\nimport type { MetaTemplateConfigResponse, MetaTemplateConfigsResponse } from './contracts/meta-template';\nimport type {\n FindOrCreateQueueRuleRequest,\n GetRootRulesRequest,\n RootRulesResponse,\n Rule,\n QueueRule,\n} from './contracts/rule';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n\n async getQueues(): Promise<Queue[]> {\n const { data } = await this.httpClient.get<Queue[]>(`${this.baseUrl}/queues`);\n return data;\n }\n\n /**\n * Retrieves a Meta template configuration by its ID.\n * @param templateId - The unique identifier of the template.\n * @returns The Meta template configuration.\n */\n async getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigResponse>(\n `${this.baseUrl}/meta-templates-config/${templateId}`,\n );\n return data;\n }\n\n /**\n * Retrieves template configurations associated with a configuration ID.\n * @param configId - The configuration identifier.\n * @returns The list of template configurations.\n */\n async getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigsResponse>(\n `${this.baseUrl}/meta-templates-config/config/${configId}`,\n );\n return data;\n }\n\n /**\n * Finds an existing queue rule or creates a new one if it does not exist.\n * @param payload - The payload containing companyId, queueId, and configId.\n * @returns The found or created queue rule.\n */\n async findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule> {\n const { data } = await this.httpClient.put<QueueRule>(`${this.baseUrl}/rules/queue/find-or-create`, payload);\n return data;\n }\n\n /**\n * @param params - The company and pagination parameters.\n * @returns The paginated initial service rules.\n */\n async getRootRules(params: GetRootRulesRequest): Promise<RootRulesResponse> {\n const { data } = await this.httpClient.get<RootRulesResponse>(`${this.baseUrl}/rules/paginated`, {\n params: {\n archiveStatus: 'unarchived',\n companyId: params.companyId,\n offset: params.offset,\n limit: params.limit,\n name: params?.name,\n isRoot: true,\n },\n });\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType, QueueListResponse } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\nexport type {\n MetaTemplateButton,\n MetaTemplateConfigResponse,\n MetaTemplateConfigsResponse,\n} from './contracts/meta-template';\nexport type { FindOrCreateQueueRuleRequest, QueueRule, RootRulesResponse, Rule } from './contracts/rule';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nimport type {\n CampaignContactPaginatedResponse,\n CampaignContactQueryParams,\n CampaignContactResponse,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nimport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Retrieves a paginated list of campaign contacts.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaign contacts response.\n */\n async findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignContactPaginatedResponse>(`${this.baseUrl}/campaign-contacts`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The campaign contact data.\n */\n async getCampaignContacts(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.get<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign contact.\n * @param payload - The campaign contact data to create.\n * @returns The created campaign contact.\n */\n async createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.post<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts`, payload);\n return data;\n }\n\n /**\n * Adds multiple contacts to a campaign in a single request.\n * @param payload - The list of campaign contacts to create.\n * @returns The created campaign contacts.\n */\n async addContactsToCampaign(payload: CreateCampaignContactRequest[]): Promise<CampaignContactResponse[]> {\n const { data } = await this.httpClient.post<CampaignContactResponse[]>(\n `${this.baseUrl}/campaign-contacts`,\n payload,\n );\n return data;\n }\n\n /**\n * Partially updates an existing campaign contact.\n * @param id - The unique identifier of the campaign contact.\n * @param payload - The fields to update.\n * @returns The updated campaign contact.\n */\n async patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.patch<CampaignContactResponse>(\n `${this.baseUrl}/campaign-contacts/${id}`,\n payload,\n );\n return data;\n }\n\n /**\n * Removes a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The removed campaign contact.\n */\n async removeCampaignContact(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.delete<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n async getUsers() {\n const { data } = await this.httpClient.get<CampaignUser[]>(`${this.baseUrl}/users`);\n return data;\n }\n\n async listWorkGroups(query?: CampaignWorkGroupQueryParams): Promise<CampaignWorkGroupPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignWorkGroupPaginatedResponse>(`${this.baseUrl}/work-groups`, {\n params: query,\n });\n return data;\n }\n\n async createWorkGroup(payload: CreateCampaignWorkGroupRequest): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.post<CampaignWorkGroup>(`${this.baseUrl}/work-groups`, payload);\n return data;\n }\n\n async deleteWorkGroup(id: string): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.delete<CampaignWorkGroup>(`${this.baseUrl}/work-groups/${id}`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignRetryConfig,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nexport type {\n CampaignContactCampaignStatus,\n CampaignContactDispatchStatus,\n CampaignContactLikeQueryOperators,\n CampaignContactPaginatedResponse,\n CampaignContactQueryOperators,\n CampaignContactQueryParams,\n CampaignContactQueryValue,\n CampaignContactResponse,\n CampaignContactSortDirection,\n CampaignContactSortParams,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nexport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n","import type { AxiosInstance } from 'axios';\nimport type { GetConfigTemplatesResponse, GetConfigTemplatesParams } from './contracts/chat-adapter';\n\n/**\n * Gateway for interacting with the Chat Adapter API.\n */\nexport class ChatAdapterGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves message templates associated with a configuration.\n * @param configId - The unique identifier of the configuration.\n * @param params - Optional query parameters for filtering and pagination.\n * @returns A promise that resolves to the template list response.\n */\n async getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse> {\n const { data } = await this.httpClient.get<GetConfigTemplatesResponse>(\n `${this.baseUrl}/message-templates/${configId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type {\n GetConfigTemplatesResponse,\n GetConfigTemplatesParams,\n MessageTemplate,\n MessageTemplateComponent,\n ConfigTemplatesPaging,\n} from './contracts/chat-adapter';\n","import type { AxiosInstance } from 'axios';\nimport type { GetPresignedUrlRequest, UploadPresignedUrlResponse, AudioConvertResponse, GetAttachmentByIdRequest, AttachmentByIdResponse } from './contracts/assets';\n\n/**\n * Gateway for interacting with the Assets API.\n */\nexport class AssetsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n /**\n * Retrieves a presigned URL to upload a file to the Assets API.\n * @param params - The configuration options and parameters for the presigned URL.\n * @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.\n */\n async getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse> {\n const { data } = await this.httpClient.get<UploadPresignedUrlResponse>(`${this.baseUrl}/uploads/presigned-url`, {\n params,\n });\n return data;\n }\n\n /**\n * Converts an audio file to M4A format via the Assets API.\n * @param params - The audio file to convert.\n * @param params.file - The audio file to upload for conversion.\n * @returns The converted audio response with base64-encoded data, mimetype, extension and filename.\n */\n async convertAudioToM4A(formData: any): Promise<AudioConvertResponse> {\n const { data } = await this.httpClient.post<AudioConvertResponse>(\n `${this.baseUrl}/whatsapp/audio-convert`,\n formData,\n {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n },\n );\n return data;\n }\n\n /**\n * Fetches an attachment by its file ID or storage key.\n *\n * When `key` is provided, the path is built from the key directly and no\n * `x-bucket-provider` header is sent. Otherwise, `fileId` and `provider` are\n * used to build the path and the provider header respectively.\n *\n * @param params - The parameters identifying the attachment.\n * @returns A signed URL to access the attachment.\n */\n async getAttachmentById(params: GetAttachmentByIdRequest): Promise<AttachmentByIdResponse> {\n const path = params.key\n ? `/uploads/${encodeURIComponent(params.key)}`\n : `/uploads/${encodeURIComponent(params.fileId!)}`;\n\n const axiosParams: Record<string, string> = {};\n\n if (params.download) axiosParams.download = 'true';\n if (params.filename) axiosParams.filename = params.filename;\n const headers: Record<string, string> = {};\n if (!params.key && params.provider) headers['x-bucket-provider'] = params.provider!;\n\n const { data } = await this.httpClient.get<AttachmentByIdResponse>(`${this.baseUrl}${path}`, {\n params: axiosParams,\n headers,\n });\n return data;\n }\n}\n\nexport type {\n GetPresignedUrlRequest,\n UploadPresignedUrlResponse,\n IUploadPresignedUrlResponse,\n AudioConvertResponse,\n GetAttachmentByIdRequest,\n AttachmentByIdResponse,\n} from './contracts/assets';\n","import type { AxiosInstance } from 'axios';\nimport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n\n/**\n * Gateway for interacting with the Contact List API.\n */\nexport class ContactListGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Searches for contact phones with optional filtering and pagination.\n * @param params - The query parameters for the search.\n * @returns The paginated contact phones response.\n */\n async getContactsPhones(params: GetContactPhonesParams): Promise<ContactPhoneSearchResponse> {\n const { data } = await this.httpClient.get<ContactPhoneSearchResponse>(\n `${this.baseUrl}/contact/phone/search`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves all contact categories.\n * @returns An array of contact categories.\n */\n async getCategoryList(): Promise<ContactCategoryResponse[]> {\n const { data } = await this.httpClient.get<ContactCategoryResponse[]>(\n `${this.baseUrl}/contact/category`,\n );\n return data;\n }\n}\n\nexport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactPhoneResponse,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AssetsGateway } from '../assets';\nimport { ContactListGateway } from '../contact-list';\nimport axios, { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n 'chat-adapter': ChatAdapterGateway;\n 'assets': AssetsGateway;\n 'contact-list': ContactListGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n assets: AssetsGateway | null,\n contactList: ContactListGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n this.assets = assets;\n this.contactList = contactList;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests (optional). */\n axiosClient?: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n chatAdapter?: {\n baseUrl: string;\n };\n assets?: {\n baseUrl: string;\n };\n contactList?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient || axios.create({\n headers: {\n Authorization: `Bearer ${params.apiToken}`,\n },\n });\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n const chatAdapter = params.services.chatAdapter\n ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl)\n : null;\n const assets = params.services.assets\n ? new AssetsGateway(httpClient, params.services.assets.baseUrl)\n : null;\n const contactList = params.services.contactList\n ? new ContactListGateway(httpClient, params.services.contactList.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets, contactList);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n CHAT_ADAPTER: 'chat-adapter',\n ASSETS: 'assets',\n CONTACT_LIST: 'contact-list',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n","import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n case SERVICE_GATEWAYS.CHAT_ADAPTER:\n if (!sdk.client.chatAdapter)\n throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatAdapter;\n case SERVICE_GATEWAYS.ASSETS:\n if (!sdk.client.assets)\n throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.assets;\n case SERVICE_GATEWAYS.CONTACT_LIST:\n if (!sdk.client.contactList)\n throw new Error(`Service 'contact-list' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.contactList;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\nexport * from './chat-adapter/contracts';\nexport * from './assets/contracts';\nexport * from './contact-list/contracts';\n"],"mappings":";AAgBO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW,IAAqB,GAAG,KAAK,OAAO,qBAAqB,SAAS,EAAE;AAC3G,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,WAAmD;AACrE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW;AAAA,MACrC,GAAG,KAAK,OAAO;AAAA,MACf,EAAE,QAAQ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,QAA6B;AACrC,SAAK,SAAS,aAAa,MAAM;AAAA,EACnC;AACF;AACA,IAAM,MAAM,IAAI,IAAI;AAMb,IAAM,YAAY,CAAC,WAAgC;AACxD,MAAI,UAAU,MAAM;AACtB;AAmBO,SAAS,QAAQ,SAA2B;AACjD,MAAI,CAAC,IAAI;AACP,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEF,UAAQ,SAAS;AAAA,IACf,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,mFAAmF;AACrG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,8EAA8E;AAChG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,4EAA4E;AAC9F,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,+EAA+E;AACjG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,yEAAyE;AAC3F,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,+EAA+E;AACjG,aAAO,IAAI,OAAO;AAAA,IACpB;AACE,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/assets/index.ts","../src/contact-list/index.ts","../src/integrations/index.ts","../src/@common/client.ts","../src/@common/enums.ts","../src/index.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type {\n WorkGroupListResponse,\n WorkGroupMembersResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nimport type {\n GetAllUsersParams,\n GetAllUsersResponse,\n GetManagedUsersResponse,\n} from './contracts/user';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(\n groupId: string,\n companyId?: string,\n profile?: string[],\n ): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n\n async getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse> {\n const { data } = await this.httpClient.get<GetAllUsersResponse>(\n `${this.baseUrl}/companies/users`,\n { params },\n );\n return data;\n }\n\n async getManagedUsers(managerId: string): Promise<GetManagedUsersResponse> {\n const { data } = await this.httpClient.get<GetManagedUsersResponse>(\n `${this.baseUrl}/users/managed/${managerId}`,\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type {\n WorkGroup,\n WorkGroupMember,\n WorkGroupMembersResponse,\n WorkGroupListResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nexport type {\n User,\n GetAllUsersParams,\n GetAllUsersResponse,\n ManagedUser,\n GetManagedUsersResponse,\n} from './contracts/user';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport type { Queue, QueueListResponse } from './contracts/queues';\nimport type { MetaTemplateConfigResponse, MetaTemplateConfigsResponse } from './contracts/meta-template';\nimport type {\n FindOrCreateQueueRuleRequest,\n GetRootRulesRequest,\n RootRulesResponse,\n Rule,\n QueueRule,\n} from './contracts/rule';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n\n async getQueues(): Promise<Queue[]> {\n const { data } = await this.httpClient.get<Queue[]>(`${this.baseUrl}/queues`);\n return data;\n }\n\n /**\n * Retrieves a Meta template configuration by its ID.\n * @param templateId - The unique identifier of the template.\n * @returns The Meta template configuration.\n */\n async getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigResponse>(\n `${this.baseUrl}/meta-templates-config/${templateId}`,\n );\n return data;\n }\n\n /**\n * Retrieves template configurations associated with a configuration ID.\n * @param configId - The configuration identifier.\n * @returns The list of template configurations.\n */\n async getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigsResponse>(\n `${this.baseUrl}/meta-templates-config/config/${configId}`,\n );\n return data;\n }\n\n /**\n * Finds an existing queue rule or creates a new one if it does not exist.\n * @param payload - The payload containing companyId, queueId, and configId.\n * @returns The found or created queue rule.\n */\n async findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule> {\n const { data } = await this.httpClient.put<QueueRule>(`${this.baseUrl}/rules/queue/find-or-create`, payload);\n return data;\n }\n\n /**\n * @param params - The company and pagination parameters.\n * @returns The paginated initial service rules.\n */\n async getRootRules(params: GetRootRulesRequest): Promise<RootRulesResponse> {\n const { data } = await this.httpClient.get<RootRulesResponse>(`${this.baseUrl}/rules/paginated`, {\n params: {\n archiveStatus: 'unarchived',\n companyId: params.companyId,\n offset: params.offset,\n limit: params.limit,\n name: params?.name,\n isRoot: true,\n },\n });\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType, QueueListResponse } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\nexport type {\n MetaTemplateButton,\n MetaTemplateConfigResponse,\n MetaTemplateConfigsResponse,\n} from './contracts/meta-template';\nexport type { FindOrCreateQueueRuleRequest, QueueRule, RootRulesResponse, Rule } from './contracts/rule';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nimport type {\n CampaignContactPaginatedResponse,\n CampaignContactQueryParams,\n CampaignContactResponse,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nimport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Retrieves a paginated list of campaign contacts.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaign contacts response.\n */\n async findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignContactPaginatedResponse>(`${this.baseUrl}/campaign-contacts`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The campaign contact data.\n */\n async getCampaignContacts(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.get<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign contact.\n * @param payload - The campaign contact data to create.\n * @returns The created campaign contact.\n */\n async createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.post<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts`, payload);\n return data;\n }\n\n /**\n * Adds multiple contacts to a campaign in a single request.\n * @param payload - The list of campaign contacts to create.\n * @returns The created campaign contacts.\n */\n async addContactsToCampaign(payload: CreateCampaignContactRequest[]): Promise<CampaignContactResponse[]> {\n const { data } = await this.httpClient.post<CampaignContactResponse[]>(\n `${this.baseUrl}/campaign-contacts`,\n payload,\n );\n return data;\n }\n\n /**\n * Partially updates an existing campaign contact.\n * @param id - The unique identifier of the campaign contact.\n * @param payload - The fields to update.\n * @returns The updated campaign contact.\n */\n async patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.patch<CampaignContactResponse>(\n `${this.baseUrl}/campaign-contacts/${id}`,\n payload,\n );\n return data;\n }\n\n /**\n * Removes a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The removed campaign contact.\n */\n async removeCampaignContact(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.delete<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n async getUsers() {\n const { data } = await this.httpClient.get<CampaignUser[]>(`${this.baseUrl}/users`);\n return data;\n }\n\n async listWorkGroups(query?: CampaignWorkGroupQueryParams): Promise<CampaignWorkGroupPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignWorkGroupPaginatedResponse>(`${this.baseUrl}/work-groups`, {\n params: query,\n });\n return data;\n }\n\n async createWorkGroup(payload: CreateCampaignWorkGroupRequest): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.post<CampaignWorkGroup>(`${this.baseUrl}/work-groups`, payload);\n return data;\n }\n\n async deleteWorkGroup(id: string): Promise<CampaignWorkGroup> {\n const { data } = await this.httpClient.delete<CampaignWorkGroup>(`${this.baseUrl}/work-groups/${id}`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignRetryConfig,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\nexport type {\n CampaignContactCampaignStatus,\n CampaignContactDispatchStatus,\n CampaignContactLikeQueryOperators,\n CampaignContactPaginatedResponse,\n CampaignContactQueryOperators,\n CampaignContactQueryParams,\n CampaignContactQueryValue,\n CampaignContactResponse,\n CampaignContactSortDirection,\n CampaignContactSortParams,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\nexport type {\n CampaignWorkGroup,\n CampaignWorkGroupPaginatedResponse,\n CampaignWorkGroupQueryParams,\n CreateCampaignWorkGroupRequest,\n} from './contracts/work-group';\n","import type { AxiosInstance } from 'axios';\nimport type { GetConfigTemplatesResponse, GetConfigTemplatesParams } from './contracts/chat-adapter';\n\n/**\n * Gateway for interacting with the Chat Adapter API.\n */\nexport class ChatAdapterGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves message templates associated with a configuration.\n * @param configId - The unique identifier of the configuration.\n * @param params - Optional query parameters for filtering and pagination.\n * @returns A promise that resolves to the template list response.\n */\n async getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse> {\n const { data } = await this.httpClient.get<GetConfigTemplatesResponse>(\n `${this.baseUrl}/message-templates/${configId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type {\n GetConfigTemplatesResponse,\n GetConfigTemplatesParams,\n MessageTemplate,\n MessageTemplateComponent,\n ConfigTemplatesPaging,\n} from './contracts/chat-adapter';\n","import type { AxiosInstance } from 'axios';\nimport type { GetPresignedUrlRequest, UploadPresignedUrlResponse, AudioConvertResponse, GetAttachmentByIdRequest, AttachmentByIdResponse } from './contracts/assets';\n\n/**\n * Gateway for interacting with the Assets API.\n */\nexport class AssetsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n /**\n * Retrieves a presigned URL to upload a file to the Assets API.\n * @param params - The configuration options and parameters for the presigned URL.\n * @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.\n */\n async getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse> {\n const { data } = await this.httpClient.get<UploadPresignedUrlResponse>(`${this.baseUrl}/uploads/presigned-url`, {\n params,\n });\n return data;\n }\n\n /**\n * Converts an audio file to M4A format via the Assets API.\n * @param params - The audio file to convert.\n * @param params.file - The audio file to upload for conversion.\n * @returns The converted audio response with base64-encoded data, mimetype, extension and filename.\n */\n async convertAudioToM4A(formData: any): Promise<AudioConvertResponse> {\n const { data } = await this.httpClient.post<AudioConvertResponse>(\n `${this.baseUrl}/whatsapp/audio-convert`,\n formData,\n {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n },\n );\n return data;\n }\n\n /**\n * Fetches an attachment by its file ID or storage key.\n *\n * When `key` is provided, the path is built from the key directly and no\n * `x-bucket-provider` header is sent. Otherwise, `fileId` and `provider` are\n * used to build the path and the provider header respectively.\n *\n * @param params - The parameters identifying the attachment.\n * @returns A signed URL to access the attachment.\n */\n async getAttachmentById(params: GetAttachmentByIdRequest): Promise<AttachmentByIdResponse> {\n const path = params.key\n ? `/uploads/${encodeURIComponent(params.key)}`\n : `/uploads/${encodeURIComponent(params.fileId!)}`;\n\n const axiosParams: Record<string, string> = {};\n\n if (params.download) axiosParams.download = 'true';\n if (params.filename) axiosParams.filename = params.filename;\n const headers: Record<string, string> = {};\n if (!params.key && params.provider) headers['x-bucket-provider'] = params.provider!;\n\n const { data } = await this.httpClient.get<AttachmentByIdResponse>(`${this.baseUrl}${path}`, {\n params: axiosParams,\n headers,\n });\n return data;\n }\n}\n\nexport type {\n GetPresignedUrlRequest,\n UploadPresignedUrlResponse,\n IUploadPresignedUrlResponse,\n AudioConvertResponse,\n GetAttachmentByIdRequest,\n AttachmentByIdResponse,\n} from './contracts/assets';\n","import type { AxiosInstance } from 'axios';\nimport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n\n/**\n * Gateway for interacting with the Contact List API.\n */\nexport class ContactListGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Searches for contact phones with optional filtering and pagination.\n * @param params - The query parameters for the search.\n * @returns The paginated contact phones response.\n */\n async getContactsPhones(params: GetContactPhonesParams): Promise<ContactPhoneSearchResponse> {\n const { data } = await this.httpClient.get<ContactPhoneSearchResponse>(\n `${this.baseUrl}/contact/phone/search`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves all contact categories.\n * @returns An array of contact categories.\n */\n async getCategoryList(): Promise<ContactCategoryResponse[]> {\n const { data } = await this.httpClient.get<ContactCategoryResponse[]>(\n `${this.baseUrl}/contact/category`,\n );\n return data;\n }\n}\n\nexport type {\n ContactPhoneSearchResponse,\n GetContactPhonesParams,\n ContactPhoneResponse,\n ContactCategoryResponse,\n} from './contracts/contact-phone';\n","import type { AxiosInstance } from 'axios';\nimport type {\n CreateIntegrationActionRequest,\n CreateIntegrationFieldRequest,\n CreateIntegrationPartnerRequest,\n DeleteIntegrationActionParams,\n DeleteIntegrationFieldParams,\n DeleteIntegrationPartnerParams,\n GetIntegrationHooksCatalogRequest,\n GetIntegrationPartnersByCompanyRequest,\n HookCatalogItem,\n IntegrationAction,\n IntegrationField,\n IntegrationPartner,\n UpdateIntegrationActionParams,\n UpdateIntegrationActionRequest,\n UpdateIntegrationFieldParams,\n UpdateIntegrationFieldRequest,\n} from './contracts';\n\n/**\n * Gateway for interacting with the Integrations API.\n */\nexport class IntegrationsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all integration partners configured for a company.\n * @param companyId - The company identifier.\n * @returns The integration partners configured for the company.\n */\n async getPartnersByCompany({ companyId, name }: GetIntegrationPartnersByCompanyRequest): Promise<IntegrationPartner[]> {\n const { data } = await this.httpClient.get<IntegrationPartner[]>(`${this.baseUrl}/partner/company/${companyId}`, {\n params: name ? { name } : undefined,\n });\n return data;\n }\n\n /**\n * Retrieves the hook catalog, optionally scoped by module.\n * @param module - The optional module identifier used by the Integrations API filter.\n * @returns The hook catalog items, filtered by module when provided.\n */\n async getHooksCatalog({ module }: GetIntegrationHooksCatalogRequest = {}): Promise<HookCatalogItem[]> {\n const { data } = await this.httpClient.get<HookCatalogItem[]>(`${this.baseUrl}/hooks`, {\n params: module ? { module } : undefined,\n });\n return data;\n }\n\n /**\n * Creates an integration partner.\n * @param payload - The partner creation payload.\n * @returns The created integration partner.\n */\n async createPartner(payload: CreateIntegrationPartnerRequest): Promise<IntegrationPartner> {\n const { data } = await this.httpClient.post<IntegrationPartner>(`${this.baseUrl}/partner`, payload);\n return data;\n }\n\n /**\n * Deletes an integration partner.\n * @param partnerId - The partner identifier.\n * @returns A promise that resolves when the partner is deleted.\n */\n async deletePartner({ partnerId }: DeleteIntegrationPartnerParams): Promise<void> {\n await this.httpClient.delete(`${this.baseUrl}/partner/${partnerId}`);\n }\n\n /**\n * Creates an integration action.\n * @param payload - The action creation payload.\n * @returns The created integration action.\n */\n async createAction(payload: CreateIntegrationActionRequest): Promise<IntegrationAction> {\n const { data } = await this.httpClient.post<IntegrationAction>(`${this.baseUrl}/action`, {\n ...payload,\n actionName: payload.actionName ?? payload.hook,\n });\n return data;\n }\n\n /**\n * Updates an integration action.\n * @param actionId - The action identifier.\n * @param payload - The action update payload.\n * @returns The updated integration action.\n */\n async updateAction({ actionId, payload }: UpdateIntegrationActionParams): Promise<IntegrationAction> {\n const { data } = await this.httpClient.patch<IntegrationAction>(`${this.baseUrl}/action/${actionId}`, payload);\n return data;\n }\n\n /**\n * Creates an integration action field/header.\n * @param payload - The field creation payload.\n * @returns The created integration field.\n */\n async createField(payload: CreateIntegrationFieldRequest): Promise<IntegrationField> {\n const { data } = await this.httpClient.post<IntegrationField>(`${this.baseUrl}/field`, payload);\n return data;\n }\n\n /**\n * Updates an integration action field/header.\n * @param fieldId - The field identifier.\n * @param payload - The field update payload.\n * @returns The updated integration field response.\n */\n async updateField({ fieldId, payload }: UpdateIntegrationFieldParams): Promise<IntegrationField | number[]> {\n const { data } = await this.httpClient.put<IntegrationField | number[]>(`${this.baseUrl}/field/${fieldId}`, payload);\n return data;\n }\n\n /**\n * Deletes an integration action field/header.\n * @param fieldId - The field identifier.\n * @returns A promise that resolves when the field is deleted.\n */\n async deleteField({ fieldId }: DeleteIntegrationFieldParams): Promise<void> {\n await this.httpClient.delete(`${this.baseUrl}/field/${fieldId}`);\n }\n\n /**\n * Deletes an integration action.\n * @param actionId - The action identifier.\n * @returns A promise that resolves when the action is deleted.\n */\n async deleteAction({ actionId }: DeleteIntegrationActionParams): Promise<void> {\n await this.httpClient.delete(`${this.baseUrl}/action/${actionId}`);\n }\n}\n\nexport type {\n CreateIntegrationActionRequest,\n CreateIntegrationFieldRequest,\n CreateIntegrationPartnerRequest,\n DeleteIntegrationActionParams,\n DeleteIntegrationFieldParams,\n DeleteIntegrationPartnerParams,\n GetIntegrationHooksCatalogRequest,\n GetIntegrationPartnersByCompanyRequest,\n HookCatalogItem,\n IntegrationAction,\n IntegrationField,\n IntegrationPartner,\n UpdateIntegrationActionParams,\n UpdateIntegrationActionRequest,\n UpdateIntegrationFieldParams,\n UpdateIntegrationFieldRequest,\n} from './contracts';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AssetsGateway } from '../assets';\nimport { ContactListGateway } from '../contact-list';\nimport { IntegrationsGateway } from '../integrations';\nimport axios, { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n 'chat-adapter': ChatAdapterGateway;\n 'assets': AssetsGateway;\n 'contact-list': ContactListGateway;\n 'integrations': IntegrationsGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n integrations: IntegrationsGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n contactList: ContactListGateway | null;\n integrations: IntegrationsGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n assets: AssetsGateway | null,\n contactList: ContactListGateway | null,\n integrations: IntegrationsGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n this.assets = assets;\n this.contactList = contactList;\n this.integrations = integrations;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests (optional). */\n axiosClient?: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n chatAdapter?: {\n baseUrl: string;\n };\n assets?: {\n baseUrl: string;\n };\n contactList?: {\n baseUrl: string;\n };\n integrations?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient || axios.create({\n headers: {\n Authorization: `Bearer ${params.apiToken}`,\n },\n });\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n const chatAdapter = params.services.chatAdapter\n ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl)\n : null;\n const assets = params.services.assets\n ? new AssetsGateway(httpClient, params.services.assets.baseUrl)\n : null;\n const contactList = params.services.contactList\n ? new ContactListGateway(httpClient, params.services.contactList.baseUrl)\n : null;\n const integrations = params.services.integrations\n ? new IntegrationsGateway(httpClient, params.services.integrations.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n CHAT_ADAPTER: 'chat-adapter',\n ASSETS: 'assets',\n CONTACT_LIST: 'contact-list',\n INTEGRATIONS: 'integrations',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n","import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n case SERVICE_GATEWAYS.CHAT_ADAPTER:\n if (!sdk.client.chatAdapter)\n throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatAdapter;\n case SERVICE_GATEWAYS.ASSETS:\n if (!sdk.client.assets)\n throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.assets;\n case SERVICE_GATEWAYS.CONTACT_LIST:\n if (!sdk.client.contactList)\n throw new Error(`Service 'contact-list' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.contactList;\n case SERVICE_GATEWAYS.INTEGRATIONS:\n if (!sdk.client.integrations)\n throw new Error(`Service 'integrations' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.integrations;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\nexport * from './chat-adapter/contracts';\nexport * from './assets/contracts';\nexport * from './contact-list/contracts';\nexport * from './integrations/contracts';\n"],"mappings":";AAgBO,IAAM,yBAAN,MAA6B;AAAA,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AAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Action configured for an integration partner webhook. */
|
|
2
|
+
interface IntegrationAction {
|
|
3
|
+
id: number;
|
|
4
|
+
hook: string;
|
|
5
|
+
actionName: string;
|
|
6
|
+
api: string | null;
|
|
7
|
+
apiMethod: string | null;
|
|
8
|
+
fields?: IntegrationField[];
|
|
9
|
+
}
|
|
10
|
+
/** Field/header configured for an integration action webhook. */
|
|
11
|
+
interface IntegrationField {
|
|
12
|
+
id: number;
|
|
13
|
+
key: string | null;
|
|
14
|
+
keyReplacement: string | null;
|
|
15
|
+
valueReplacement: string | null;
|
|
16
|
+
defaultValue: string | null;
|
|
17
|
+
type: string | null;
|
|
18
|
+
modifierId: number;
|
|
19
|
+
integrationId?: number | null;
|
|
20
|
+
actionId: number;
|
|
21
|
+
}
|
|
22
|
+
/** Partner response returned by the Integrations API. */
|
|
23
|
+
interface IntegrationPartner {
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
companyId: string;
|
|
27
|
+
baseUrl: string | null;
|
|
28
|
+
actions: IntegrationAction[];
|
|
29
|
+
}
|
|
30
|
+
/** Hook catalog item returned by the Integrations API. */
|
|
31
|
+
interface HookCatalogItem {
|
|
32
|
+
hook: string;
|
|
33
|
+
keys: string[];
|
|
34
|
+
}
|
|
35
|
+
/** Request payload for creating an integration partner. */
|
|
36
|
+
interface CreateIntegrationPartnerRequest {
|
|
37
|
+
name: string;
|
|
38
|
+
companyId: string;
|
|
39
|
+
baseUrl: string;
|
|
40
|
+
}
|
|
41
|
+
/** Request parameters for retrieving company integration partners. */
|
|
42
|
+
interface GetIntegrationPartnersByCompanyRequest {
|
|
43
|
+
companyId: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Request parameters for retrieving the hooks catalog. */
|
|
47
|
+
interface GetIntegrationHooksCatalogRequest {
|
|
48
|
+
module?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Request payload for creating an integration action. */
|
|
51
|
+
interface CreateIntegrationActionRequest {
|
|
52
|
+
partnerId: number;
|
|
53
|
+
hook: string;
|
|
54
|
+
api: string;
|
|
55
|
+
apiMethod: string;
|
|
56
|
+
actionName?: string;
|
|
57
|
+
fields?: CreateIntegrationFieldRequest[];
|
|
58
|
+
}
|
|
59
|
+
/** Request payload for updating an integration action. */
|
|
60
|
+
type UpdateIntegrationActionRequest = Partial<Omit<CreateIntegrationActionRequest, 'partnerId' | 'fields'>>;
|
|
61
|
+
/** Request parameters for updating an integration action. */
|
|
62
|
+
interface UpdateIntegrationActionParams {
|
|
63
|
+
actionId: number;
|
|
64
|
+
payload: UpdateIntegrationActionRequest;
|
|
65
|
+
}
|
|
66
|
+
/** Request parameters for deleting an integration partner. */
|
|
67
|
+
interface DeleteIntegrationPartnerParams {
|
|
68
|
+
partnerId: number;
|
|
69
|
+
}
|
|
70
|
+
/** Request payload for creating an integration action field/header. */
|
|
71
|
+
interface CreateIntegrationFieldRequest {
|
|
72
|
+
actionId?: number;
|
|
73
|
+
integrationId?: number | null;
|
|
74
|
+
key: string;
|
|
75
|
+
keyReplacement?: string | null;
|
|
76
|
+
valueReplacement?: string | null;
|
|
77
|
+
defaultValue?: string | null;
|
|
78
|
+
type?: string | null;
|
|
79
|
+
modifierId: number;
|
|
80
|
+
}
|
|
81
|
+
/** Request payload for updating an integration action field/header. */
|
|
82
|
+
type UpdateIntegrationFieldRequest = Partial<CreateIntegrationFieldRequest>;
|
|
83
|
+
/** Request parameters for updating an integration action field/header. */
|
|
84
|
+
interface UpdateIntegrationFieldParams {
|
|
85
|
+
fieldId: number;
|
|
86
|
+
payload: UpdateIntegrationFieldRequest;
|
|
87
|
+
}
|
|
88
|
+
/** Request parameters for deleting an integration action field/header. */
|
|
89
|
+
interface DeleteIntegrationFieldParams {
|
|
90
|
+
fieldId: number;
|
|
91
|
+
}
|
|
92
|
+
/** Request parameters for deleting an integration action. */
|
|
93
|
+
interface DeleteIntegrationActionParams {
|
|
94
|
+
actionId: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type { CreateIntegrationActionRequest, CreateIntegrationFieldRequest, CreateIntegrationPartnerRequest, DeleteIntegrationActionParams, DeleteIntegrationFieldParams, DeleteIntegrationPartnerParams, GetIntegrationHooksCatalogRequest, GetIntegrationPartnersByCompanyRequest, HookCatalogItem, IntegrationAction, IntegrationField, IntegrationPartner, UpdateIntegrationActionParams, UpdateIntegrationActionRequest, UpdateIntegrationFieldParams, UpdateIntegrationFieldRequest };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Action configured for an integration partner webhook. */
|
|
2
|
+
interface IntegrationAction {
|
|
3
|
+
id: number;
|
|
4
|
+
hook: string;
|
|
5
|
+
actionName: string;
|
|
6
|
+
api: string | null;
|
|
7
|
+
apiMethod: string | null;
|
|
8
|
+
fields?: IntegrationField[];
|
|
9
|
+
}
|
|
10
|
+
/** Field/header configured for an integration action webhook. */
|
|
11
|
+
interface IntegrationField {
|
|
12
|
+
id: number;
|
|
13
|
+
key: string | null;
|
|
14
|
+
keyReplacement: string | null;
|
|
15
|
+
valueReplacement: string | null;
|
|
16
|
+
defaultValue: string | null;
|
|
17
|
+
type: string | null;
|
|
18
|
+
modifierId: number;
|
|
19
|
+
integrationId?: number | null;
|
|
20
|
+
actionId: number;
|
|
21
|
+
}
|
|
22
|
+
/** Partner response returned by the Integrations API. */
|
|
23
|
+
interface IntegrationPartner {
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
companyId: string;
|
|
27
|
+
baseUrl: string | null;
|
|
28
|
+
actions: IntegrationAction[];
|
|
29
|
+
}
|
|
30
|
+
/** Hook catalog item returned by the Integrations API. */
|
|
31
|
+
interface HookCatalogItem {
|
|
32
|
+
hook: string;
|
|
33
|
+
keys: string[];
|
|
34
|
+
}
|
|
35
|
+
/** Request payload for creating an integration partner. */
|
|
36
|
+
interface CreateIntegrationPartnerRequest {
|
|
37
|
+
name: string;
|
|
38
|
+
companyId: string;
|
|
39
|
+
baseUrl: string;
|
|
40
|
+
}
|
|
41
|
+
/** Request parameters for retrieving company integration partners. */
|
|
42
|
+
interface GetIntegrationPartnersByCompanyRequest {
|
|
43
|
+
companyId: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Request parameters for retrieving the hooks catalog. */
|
|
47
|
+
interface GetIntegrationHooksCatalogRequest {
|
|
48
|
+
module?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Request payload for creating an integration action. */
|
|
51
|
+
interface CreateIntegrationActionRequest {
|
|
52
|
+
partnerId: number;
|
|
53
|
+
hook: string;
|
|
54
|
+
api: string;
|
|
55
|
+
apiMethod: string;
|
|
56
|
+
actionName?: string;
|
|
57
|
+
fields?: CreateIntegrationFieldRequest[];
|
|
58
|
+
}
|
|
59
|
+
/** Request payload for updating an integration action. */
|
|
60
|
+
type UpdateIntegrationActionRequest = Partial<Omit<CreateIntegrationActionRequest, 'partnerId' | 'fields'>>;
|
|
61
|
+
/** Request parameters for updating an integration action. */
|
|
62
|
+
interface UpdateIntegrationActionParams {
|
|
63
|
+
actionId: number;
|
|
64
|
+
payload: UpdateIntegrationActionRequest;
|
|
65
|
+
}
|
|
66
|
+
/** Request parameters for deleting an integration partner. */
|
|
67
|
+
interface DeleteIntegrationPartnerParams {
|
|
68
|
+
partnerId: number;
|
|
69
|
+
}
|
|
70
|
+
/** Request payload for creating an integration action field/header. */
|
|
71
|
+
interface CreateIntegrationFieldRequest {
|
|
72
|
+
actionId?: number;
|
|
73
|
+
integrationId?: number | null;
|
|
74
|
+
key: string;
|
|
75
|
+
keyReplacement?: string | null;
|
|
76
|
+
valueReplacement?: string | null;
|
|
77
|
+
defaultValue?: string | null;
|
|
78
|
+
type?: string | null;
|
|
79
|
+
modifierId: number;
|
|
80
|
+
}
|
|
81
|
+
/** Request payload for updating an integration action field/header. */
|
|
82
|
+
type UpdateIntegrationFieldRequest = Partial<CreateIntegrationFieldRequest>;
|
|
83
|
+
/** Request parameters for updating an integration action field/header. */
|
|
84
|
+
interface UpdateIntegrationFieldParams {
|
|
85
|
+
fieldId: number;
|
|
86
|
+
payload: UpdateIntegrationFieldRequest;
|
|
87
|
+
}
|
|
88
|
+
/** Request parameters for deleting an integration action field/header. */
|
|
89
|
+
interface DeleteIntegrationFieldParams {
|
|
90
|
+
fieldId: number;
|
|
91
|
+
}
|
|
92
|
+
/** Request parameters for deleting an integration action. */
|
|
93
|
+
interface DeleteIntegrationActionParams {
|
|
94
|
+
actionId: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type { CreateIntegrationActionRequest, CreateIntegrationFieldRequest, CreateIntegrationPartnerRequest, DeleteIntegrationActionParams, DeleteIntegrationFieldParams, DeleteIntegrationPartnerParams, GetIntegrationHooksCatalogRequest, GetIntegrationPartnersByCompanyRequest, HookCatalogItem, IntegrationAction, IntegrationField, IntegrationPartner, UpdateIntegrationActionParams, UpdateIntegrationActionRequest, UpdateIntegrationFieldParams, UpdateIntegrationFieldRequest };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/integrations/contracts/index.ts
|
|
17
|
+
var contracts_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(contracts_exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/integrations/contracts/index.ts"],"sourcesContent":["export * from './integration';\n\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED