@orchesty/connector-zendesk 1.0.0
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/CHANGELOG.md +7 -0
- package/LICENSE +190 -0
- package/coverage/clover.xml +241 -0
- package/coverage/coverage-final.json +11 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/Batch/ZendeskCreateWebhookConnector.ts.html +373 -0
- package/coverage/lcov-report/src/Batch/ZendeskDeleteWebhookConnector.ts.html +202 -0
- package/coverage/lcov-report/src/Batch/ZendeskListTicketsBatch.ts.html +337 -0
- package/coverage/lcov-report/src/Batch/ZendeskListUsersBatch.ts.html +247 -0
- package/coverage/lcov-report/src/Batch/index.html +161 -0
- package/coverage/lcov-report/src/Connector/ZendeskCreateTicketConnector.ts.html +319 -0
- package/coverage/lcov-report/src/Connector/ZendeskCreateTriggerConnector.ts.html +226 -0
- package/coverage/lcov-report/src/Connector/ZendeskCreateUserConnector.ts.html +265 -0
- package/coverage/lcov-report/src/Connector/ZendeskDeleteTriggerConnector.ts.html +223 -0
- package/coverage/lcov-report/src/Connector/index.html +161 -0
- package/coverage/lcov-report/src/ZendeskApplication.ts.html +448 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +307 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +389 -0
- package/dist/Batch/ZendeskCreateWebhookConnector.d.ts +16 -0
- package/dist/Batch/ZendeskCreateWebhookConnector.js +62 -0
- package/dist/Batch/ZendeskDeleteWebhookConnector.d.ts +7 -0
- package/dist/Batch/ZendeskDeleteWebhookConnector.js +37 -0
- package/dist/Batch/ZendeskListTicketsBatch.d.ts +46 -0
- package/dist/Batch/ZendeskListTicketsBatch.js +27 -0
- package/dist/Batch/ZendeskListUsersBatch.d.ts +11 -0
- package/dist/Batch/ZendeskListUsersBatch.js +27 -0
- package/dist/Connector/ZendeskCreateTicketConnector.d.ts +57 -0
- package/dist/Connector/ZendeskCreateTicketConnector.js +22 -0
- package/dist/Connector/ZendeskCreateTriggerConnector.d.ts +16 -0
- package/dist/Connector/ZendeskCreateTriggerConnector.js +27 -0
- package/dist/Connector/ZendeskCreateUserConnector.d.ts +36 -0
- package/dist/Connector/ZendeskCreateUserConnector.js +23 -0
- package/dist/Connector/ZendeskDeleteTriggerConnector.d.ts +13 -0
- package/dist/Connector/ZendeskDeleteTriggerConnector.js +29 -0
- package/dist/ZendeskApplication.d.ts +27 -0
- package/dist/ZendeskApplication.js +124 -0
- package/dist/package.json +23 -0
- package/dist/types/trigger.types.d.ts +21 -0
- package/dist/types/trigger.types.js +2 -0
- package/dist/types/webhook.types.d.ts +19 -0
- package/dist/types/webhook.types.js +2 -0
- package/jest.config.js +13 -0
- package/package.json +23 -0
- package/src/Batch/ZendeskCreateWebhookConnector.ts +96 -0
- package/src/Batch/ZendeskDeleteWebhookConnector.ts +39 -0
- package/src/Batch/ZendeskListTicketsBatch.ts +84 -0
- package/src/Batch/ZendeskListUsersBatch.ts +54 -0
- package/src/Batch/__tests__/Data/ZendeskListTicketsBatch/1-mock.json +57 -0
- package/src/Batch/__tests__/Data/ZendeskListTicketsBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/ZendeskListTicketsBatch/mock.json +106 -0
- package/src/Batch/__tests__/Data/ZendeskListTicketsBatch/output.json +18 -0
- package/src/Batch/__tests__/Data/ZendeskListTicketsBatch/output1.json +12 -0
- package/src/Batch/__tests__/Data/ZendeskListUsersBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/ZendeskListUsersBatch/mock.json +161 -0
- package/src/Batch/__tests__/Data/ZendeskListUsersBatch/output.json +19 -0
- package/src/Batch/__tests__/ZendeskListTicketsBatch.ts +17 -0
- package/src/Batch/__tests__/ZendeskListUsersBatch.ts +17 -0
- package/src/Connector/ZendeskCreateTicketConnector.ts +78 -0
- package/src/Connector/ZendeskCreateTriggerConnector.ts +47 -0
- package/src/Connector/ZendeskCreateUserConnector.ts +60 -0
- package/src/Connector/ZendeskDeleteTriggerConnector.ts +46 -0
- package/src/Connector/__tests__/Data/ZendeskCreateTicketConnector/input.json +14 -0
- package/src/Connector/__tests__/Data/ZendeskCreateTicketConnector/mock.json +194 -0
- package/src/Connector/__tests__/Data/ZendeskCreateTicketConnector/output.json +194 -0
- package/src/Connector/__tests__/Data/ZendeskCreateTriggerConnector/input.json +11 -0
- package/src/Connector/__tests__/Data/ZendeskCreateTriggerConnector/mock.json +31 -0
- package/src/Connector/__tests__/Data/ZendeskCreateTriggerConnector/output.json +29 -0
- package/src/Connector/__tests__/Data/ZendeskCreateUserConnector/input.json +25 -0
- package/src/Connector/__tests__/Data/ZendeskCreateUserConnector/mock.json +45 -0
- package/src/Connector/__tests__/Data/ZendeskCreateUserConnector/output.json +44 -0
- package/src/Connector/__tests__/ZendeskCreateTicketConnector.ts +17 -0
- package/src/Connector/__tests__/ZendeskCreateTriggerConnector.ts +17 -0
- package/src/Connector/__tests__/ZendeskCreateUserConnector.ts +17 -0
- package/src/ZendeskApplication.ts +121 -0
- package/src/types/trigger.types.ts +19 -0
- package/src/types/webhook.types.ts +20 -0
- package/test/dataProvider.ts +74 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
2
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
+
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
4
|
+
import ZendeskApplication from '../ZendeskApplication';
|
|
5
|
+
|
|
6
|
+
export const NAME = 'zendesk-list-users-batch';
|
|
7
|
+
|
|
8
|
+
export default class ZendeskListUsersBatch extends ABatchNode {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return NAME;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
|
|
15
|
+
const offset = dto.getBatchCursor('1');
|
|
16
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
17
|
+
const req = await this.getApplication<ZendeskApplication>().getRequestDto(
|
|
18
|
+
dto,
|
|
19
|
+
appInstall,
|
|
20
|
+
HttpMethods.GET,
|
|
21
|
+
`/users.json?per_page=100&page=${offset}`,
|
|
22
|
+
);
|
|
23
|
+
const resp = await this.getSender().send<IResponse>(req, [200]);
|
|
24
|
+
const response = resp.getJsonBody();
|
|
25
|
+
|
|
26
|
+
dto.setItemList(response.users ?? []);
|
|
27
|
+
if (response.meta.has_more) {
|
|
28
|
+
dto.setBatchCursor((Number(offset) + 1).toString());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return dto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
37
|
+
interface IResponse {
|
|
38
|
+
users: IOutput[];
|
|
39
|
+
meta: {
|
|
40
|
+
has_more: boolean;
|
|
41
|
+
before_cursor: string;
|
|
42
|
+
};
|
|
43
|
+
links: {
|
|
44
|
+
next: string;
|
|
45
|
+
prev: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IOutput {
|
|
50
|
+
id: number;
|
|
51
|
+
name: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://hbtest8393.zendesk.com/api/v2/tickets.json?per_page=100&page=2",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"tickets": [
|
|
6
|
+
{
|
|
7
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/tickets/3.json",
|
|
8
|
+
"id": 3,
|
|
9
|
+
"external_id": null,
|
|
10
|
+
"via": {
|
|
11
|
+
"channel": "api",
|
|
12
|
+
"source": {
|
|
13
|
+
"from": {},
|
|
14
|
+
"to": {},
|
|
15
|
+
"rel": null
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"created_at": "2022-08-16T11:16:20Z",
|
|
19
|
+
"updated_at": "2022-08-16T11:16:20Z",
|
|
20
|
+
"type": null,
|
|
21
|
+
"subject": "My printer is on fire!",
|
|
22
|
+
"raw_subject": "My printer is on fire!",
|
|
23
|
+
"description": "The smoke is very colorful.",
|
|
24
|
+
"priority": "urgent",
|
|
25
|
+
"status": "open",
|
|
26
|
+
"recipient": null,
|
|
27
|
+
"requester_id": 6279089898141,
|
|
28
|
+
"submitter_id": 6279089898141,
|
|
29
|
+
"assignee_id": 6279089898141,
|
|
30
|
+
"organization_id": 6279167768093,
|
|
31
|
+
"group_id": 6279167766941,
|
|
32
|
+
"collaborator_ids": [],
|
|
33
|
+
"follower_ids": [],
|
|
34
|
+
"email_cc_ids": [],
|
|
35
|
+
"forum_topic_id": null,
|
|
36
|
+
"problem_id": null,
|
|
37
|
+
"has_incidents": false,
|
|
38
|
+
"is_public": true,
|
|
39
|
+
"due_at": null,
|
|
40
|
+
"tags": [],
|
|
41
|
+
"custom_fields": [],
|
|
42
|
+
"satisfaction_rating": null,
|
|
43
|
+
"sharing_agreement_ids": [],
|
|
44
|
+
"fields": [],
|
|
45
|
+
"followup_ids": [],
|
|
46
|
+
"ticket_form_id": 6279120591901,
|
|
47
|
+
"brand_id": 6279120605853,
|
|
48
|
+
"allow_channelback": false,
|
|
49
|
+
"allow_attachments": true
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"next_page": null,
|
|
53
|
+
"links": {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://hbtest8393.zendesk.com/api/v2/tickets.json?per_page=100&page=1",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"tickets": [
|
|
6
|
+
{
|
|
7
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/tickets/1.json",
|
|
8
|
+
"id": 1,
|
|
9
|
+
"external_id": null,
|
|
10
|
+
"via": {
|
|
11
|
+
"channel": "sample_ticket",
|
|
12
|
+
"source": {
|
|
13
|
+
"from": {},
|
|
14
|
+
"to": {},
|
|
15
|
+
"rel": null
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"created_at": "2022-08-11T11:35:32Z",
|
|
19
|
+
"updated_at": "2022-08-11T11:35:32Z",
|
|
20
|
+
"type": "incident",
|
|
21
|
+
"subject": "Sample ticket: Meet the ticket",
|
|
22
|
+
"raw_subject": "Sample ticket: Meet the ticket",
|
|
23
|
+
"description": "Hi there,\n\nI’m sending an email because I’m having a problem setting up your new product. Can you help me troubleshoot?\n\nThanks,\n The Customer\n\n",
|
|
24
|
+
"priority": "normal",
|
|
25
|
+
"status": "open",
|
|
26
|
+
"recipient": null,
|
|
27
|
+
"requester_id": 6279106989085,
|
|
28
|
+
"submitter_id": 6279089898141,
|
|
29
|
+
"assignee_id": 6279089898141,
|
|
30
|
+
"organization_id": null,
|
|
31
|
+
"group_id": 6279167766941,
|
|
32
|
+
"collaborator_ids": [],
|
|
33
|
+
"follower_ids": [],
|
|
34
|
+
"email_cc_ids": [],
|
|
35
|
+
"forum_topic_id": null,
|
|
36
|
+
"problem_id": null,
|
|
37
|
+
"has_incidents": false,
|
|
38
|
+
"is_public": true,
|
|
39
|
+
"due_at": null,
|
|
40
|
+
"tags": [
|
|
41
|
+
"sample",
|
|
42
|
+
"support",
|
|
43
|
+
"zendesk"
|
|
44
|
+
],
|
|
45
|
+
"custom_fields": [],
|
|
46
|
+
"satisfaction_rating": null,
|
|
47
|
+
"sharing_agreement_ids": [],
|
|
48
|
+
"fields": [],
|
|
49
|
+
"followup_ids": [],
|
|
50
|
+
"ticket_form_id": 6279120591901,
|
|
51
|
+
"brand_id": 6279120605853,
|
|
52
|
+
"allow_channelback": false,
|
|
53
|
+
"allow_attachments": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/tickets/2.json",
|
|
57
|
+
"id": 2,
|
|
58
|
+
"external_id": null,
|
|
59
|
+
"via": {
|
|
60
|
+
"channel": "api",
|
|
61
|
+
"source": {
|
|
62
|
+
"from": {},
|
|
63
|
+
"to": {},
|
|
64
|
+
"rel": null
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"created_at": "2022-08-16T11:14:59Z",
|
|
68
|
+
"updated_at": "2022-08-16T11:14:59Z",
|
|
69
|
+
"type": null,
|
|
70
|
+
"subject": "My printer is on fire!",
|
|
71
|
+
"raw_subject": "My printer is on fire!",
|
|
72
|
+
"description": "The smoke is very colorful.",
|
|
73
|
+
"priority": "urgent",
|
|
74
|
+
"status": "open",
|
|
75
|
+
"recipient": null,
|
|
76
|
+
"requester_id": 6279089898141,
|
|
77
|
+
"submitter_id": 6279089898141,
|
|
78
|
+
"assignee_id": 6279089898141,
|
|
79
|
+
"organization_id": 6279167768093,
|
|
80
|
+
"group_id": 6279167766941,
|
|
81
|
+
"collaborator_ids": [],
|
|
82
|
+
"follower_ids": [],
|
|
83
|
+
"email_cc_ids": [],
|
|
84
|
+
"forum_topic_id": null,
|
|
85
|
+
"problem_id": null,
|
|
86
|
+
"has_incidents": false,
|
|
87
|
+
"is_public": true,
|
|
88
|
+
"due_at": null,
|
|
89
|
+
"tags": [],
|
|
90
|
+
"custom_fields": [],
|
|
91
|
+
"satisfaction_rating": null,
|
|
92
|
+
"sharing_agreement_ids": [],
|
|
93
|
+
"fields": [],
|
|
94
|
+
"followup_ids": [],
|
|
95
|
+
"ticket_form_id": 6279120591901,
|
|
96
|
+
"brand_id": 6279120605853,
|
|
97
|
+
"allow_channelback": false,
|
|
98
|
+
"allow_attachments": true
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"next_page": "1",
|
|
102
|
+
"links": {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser",
|
|
4
|
+
"cursor": "2",
|
|
5
|
+
"result-code": "1010",
|
|
6
|
+
"result-message": "Message will be used as a iterator with cursor [2]. Data will be send to follower(s)."
|
|
7
|
+
},
|
|
8
|
+
"data": [
|
|
9
|
+
{
|
|
10
|
+
"body": "{\"url\":\"https://hbtest8393.zendesk.com/api/v2/tickets/1.json\",\"id\":1,\"external_id\":null,\"via\":{\"channel\":\"sample_ticket\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2022-08-11T11:35:32Z\",\"updated_at\":\"2022-08-11T11:35:32Z\",\"type\":\"incident\",\"subject\":\"Sample ticket: Meet the ticket\",\"raw_subject\":\"Sample ticket: Meet the ticket\",\"description\":\"Hi there,\\n\\nI’m sending an email because I’m having a problem setting up your new product. Can you help me troubleshoot?\\n\\nThanks,\\n The Customer\\n\\n\",\"priority\":\"normal\",\"status\":\"open\",\"recipient\":null,\"requester_id\":6279106989085,\"submitter_id\":6279089898141,\"assignee_id\":6279089898141,\"organization_id\":null,\"group_id\":6279167766941,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[\"sample\",\"support\",\"zendesk\"],\"custom_fields\":[],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"fields\":[],\"followup_ids\":[],\"ticket_form_id\":6279120591901,\"brand_id\":6279120605853,\"allow_channelback\":false,\"allow_attachments\":true}",
|
|
11
|
+
"headers": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"body": "{\"url\":\"https://hbtest8393.zendesk.com/api/v2/tickets/2.json\",\"id\":2,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2022-08-16T11:14:59Z\",\"updated_at\":\"2022-08-16T11:14:59Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":6279089898141,\"submitter_id\":6279089898141,\"assignee_id\":6279089898141,\"organization_id\":6279167768093,\"group_id\":6279167766941,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"fields\":[],\"followup_ids\":[],\"ticket_form_id\":6279120591901,\"brand_id\":6279120605853,\"allow_channelback\":false,\"allow_attachments\":true}",
|
|
15
|
+
"headers": {}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser",
|
|
4
|
+
"cursor": "2"
|
|
5
|
+
},
|
|
6
|
+
"data": [
|
|
7
|
+
{
|
|
8
|
+
"body": "{\"url\":\"https://hbtest8393.zendesk.com/api/v2/tickets/3.json\",\"id\":3,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2022-08-16T11:16:20Z\",\"updated_at\":\"2022-08-16T11:16:20Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":6279089898141,\"submitter_id\":6279089898141,\"assignee_id\":6279089898141,\"organization_id\":6279167768093,\"group_id\":6279167766941,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"fields\":[],\"followup_ids\":[],\"ticket_form_id\":6279120591901,\"brand_id\":6279120605853,\"allow_channelback\":false,\"allow_attachments\":true}",
|
|
9
|
+
"headers": {}
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://hbtest8393.zendesk.com/api/v2/users.json?per_page=100&page=1",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"users": [
|
|
6
|
+
{
|
|
7
|
+
"id": 6279106989085,
|
|
8
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/users/6279106989085.json",
|
|
9
|
+
"name": "The Customer",
|
|
10
|
+
"email": "customer@example.com",
|
|
11
|
+
"created_at": "2022-08-11T11:35:31Z",
|
|
12
|
+
"updated_at": "2022-08-11T11:35:33Z",
|
|
13
|
+
"time_zone": "Europe/Prague",
|
|
14
|
+
"iana_time_zone": "Europe/Prague",
|
|
15
|
+
"phone": null,
|
|
16
|
+
"shared_phone_number": null,
|
|
17
|
+
"photo": {
|
|
18
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/attachments/6279107039645.json",
|
|
19
|
+
"id": 6279107039645,
|
|
20
|
+
"file_name": "profile_image_6279106989085_14593940.png",
|
|
21
|
+
"content_url": "https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940.png",
|
|
22
|
+
"mapped_content_url": "https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940.png",
|
|
23
|
+
"content_type": "image/png",
|
|
24
|
+
"size": 10183,
|
|
25
|
+
"width": 80,
|
|
26
|
+
"height": 80,
|
|
27
|
+
"inline": false,
|
|
28
|
+
"deleted": false,
|
|
29
|
+
"thumbnails": [
|
|
30
|
+
{
|
|
31
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/attachments/6279153134365.json",
|
|
32
|
+
"id": 6279153134365,
|
|
33
|
+
"file_name": "profile_image_6279106989085_14593940_thumb.png",
|
|
34
|
+
"content_url": "https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940_thumb.png",
|
|
35
|
+
"mapped_content_url": "https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940_thumb.png",
|
|
36
|
+
"content_type": "image/png",
|
|
37
|
+
"size": 2331,
|
|
38
|
+
"width": 32,
|
|
39
|
+
"height": 32,
|
|
40
|
+
"inline": false,
|
|
41
|
+
"deleted": false
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"locale_id": 1,
|
|
46
|
+
"locale": "en-US",
|
|
47
|
+
"organization_id": null,
|
|
48
|
+
"role": "end-user",
|
|
49
|
+
"verified": false,
|
|
50
|
+
"external_id": null,
|
|
51
|
+
"tags": [],
|
|
52
|
+
"alias": null,
|
|
53
|
+
"active": true,
|
|
54
|
+
"shared": false,
|
|
55
|
+
"shared_agent": false,
|
|
56
|
+
"last_login_at": null,
|
|
57
|
+
"two_factor_auth_enabled": false,
|
|
58
|
+
"signature": null,
|
|
59
|
+
"details": null,
|
|
60
|
+
"notes": null,
|
|
61
|
+
"role_type": null,
|
|
62
|
+
"custom_role_id": null,
|
|
63
|
+
"moderator": false,
|
|
64
|
+
"ticket_restriction": "requested",
|
|
65
|
+
"only_private_comments": false,
|
|
66
|
+
"restricted_agent": true,
|
|
67
|
+
"suspended": false,
|
|
68
|
+
"default_group_id": null,
|
|
69
|
+
"report_csv": false,
|
|
70
|
+
"user_fields": {}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": 6279089898141,
|
|
74
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/users/6279089898141.json",
|
|
75
|
+
"name": "Test Test",
|
|
76
|
+
"email": "test.hanaboso@gmail.com",
|
|
77
|
+
"created_at": "2022-08-11T11:35:23Z",
|
|
78
|
+
"updated_at": "2022-08-16T12:19:02Z",
|
|
79
|
+
"time_zone": "Europe/Prague",
|
|
80
|
+
"iana_time_zone": "Europe/Prague",
|
|
81
|
+
"phone": null,
|
|
82
|
+
"shared_phone_number": null,
|
|
83
|
+
"photo": null,
|
|
84
|
+
"locale_id": 1,
|
|
85
|
+
"locale": "en-US",
|
|
86
|
+
"organization_id": 6279167768093,
|
|
87
|
+
"role": "admin",
|
|
88
|
+
"verified": true,
|
|
89
|
+
"external_id": null,
|
|
90
|
+
"tags": [],
|
|
91
|
+
"alias": null,
|
|
92
|
+
"active": true,
|
|
93
|
+
"shared": false,
|
|
94
|
+
"shared_agent": false,
|
|
95
|
+
"last_login_at": "2022-08-16T12:19:02Z",
|
|
96
|
+
"two_factor_auth_enabled": null,
|
|
97
|
+
"signature": null,
|
|
98
|
+
"details": null,
|
|
99
|
+
"notes": null,
|
|
100
|
+
"role_type": 4,
|
|
101
|
+
"custom_role_id": 6279152989725,
|
|
102
|
+
"moderator": true,
|
|
103
|
+
"ticket_restriction": null,
|
|
104
|
+
"only_private_comments": false,
|
|
105
|
+
"restricted_agent": false,
|
|
106
|
+
"suspended": false,
|
|
107
|
+
"default_group_id": 6279167766941,
|
|
108
|
+
"report_csv": true,
|
|
109
|
+
"user_fields": {}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": 6340897501085,
|
|
113
|
+
"url": "https://hbtest8393.zendesk.com/api/v2/users/6340897501085.json",
|
|
114
|
+
"name": "g",
|
|
115
|
+
"email": "garel.g@exanple.com",
|
|
116
|
+
"created_at": "2022-08-16T11:33:02Z",
|
|
117
|
+
"updated_at": "2022-08-16T11:33:02Z",
|
|
118
|
+
"time_zone": "Europe/Prague",
|
|
119
|
+
"iana_time_zone": "Europe/Prague",
|
|
120
|
+
"phone": null,
|
|
121
|
+
"shared_phone_number": null,
|
|
122
|
+
"photo": null,
|
|
123
|
+
"locale_id": 1,
|
|
124
|
+
"locale": "en-US",
|
|
125
|
+
"organization_id": null,
|
|
126
|
+
"role": "end-user",
|
|
127
|
+
"verified": false,
|
|
128
|
+
"external_id": null,
|
|
129
|
+
"tags": [],
|
|
130
|
+
"alias": null,
|
|
131
|
+
"active": true,
|
|
132
|
+
"shared": false,
|
|
133
|
+
"shared_agent": false,
|
|
134
|
+
"last_login_at": null,
|
|
135
|
+
"two_factor_auth_enabled": false,
|
|
136
|
+
"signature": null,
|
|
137
|
+
"details": null,
|
|
138
|
+
"notes": null,
|
|
139
|
+
"role_type": null,
|
|
140
|
+
"custom_role_id": null,
|
|
141
|
+
"moderator": false,
|
|
142
|
+
"ticket_restriction": "requested",
|
|
143
|
+
"only_private_comments": false,
|
|
144
|
+
"restricted_agent": true,
|
|
145
|
+
"suspended": false,
|
|
146
|
+
"default_group_id": null,
|
|
147
|
+
"report_csv": false,
|
|
148
|
+
"user_fields": {}
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"meta": {
|
|
152
|
+
"has_more": false,
|
|
153
|
+
"before_cursor": "0"
|
|
154
|
+
},
|
|
155
|
+
"links": {
|
|
156
|
+
"next": "https://test_subdomain.zendesk.com/api/v2/users.json?page[size]=100&page[after]=100",
|
|
157
|
+
"prev": "https://test_subdomain.zendesk.com/api/v2/users.json?page[size]=100&page[after]=0"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"body": "{\"id\":6279106989085,\"url\":\"https://hbtest8393.zendesk.com/api/v2/users/6279106989085.json\",\"name\":\"The Customer\",\"email\":\"customer@example.com\",\"created_at\":\"2022-08-11T11:35:31Z\",\"updated_at\":\"2022-08-11T11:35:33Z\",\"time_zone\":\"Europe/Prague\",\"iana_time_zone\":\"Europe/Prague\",\"phone\":null,\"shared_phone_number\":null,\"photo\":{\"url\":\"https://hbtest8393.zendesk.com/api/v2/attachments/6279107039645.json\",\"id\":6279107039645,\"file_name\":\"profile_image_6279106989085_14593940.png\",\"content_url\":\"https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940.png\",\"mapped_content_url\":\"https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940.png\",\"content_type\":\"image/png\",\"size\":10183,\"width\":80,\"height\":80,\"inline\":false,\"deleted\":false,\"thumbnails\":[{\"url\":\"https://hbtest8393.zendesk.com/api/v2/attachments/6279153134365.json\",\"id\":6279153134365,\"file_name\":\"profile_image_6279106989085_14593940_thumb.png\",\"content_url\":\"https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940_thumb.png\",\"mapped_content_url\":\"https://hbtest8393.zendesk.com/system/photos/6279107039645/profile_image_6279106989085_14593940_thumb.png\",\"content_type\":\"image/png\",\"size\":2331,\"width\":32,\"height\":32,\"inline\":false,\"deleted\":false}]},\"locale_id\":1,\"locale\":\"en-US\",\"organization_id\":null,\"role\":\"end-user\",\"verified\":false,\"external_id\":null,\"tags\":[],\"alias\":null,\"active\":true,\"shared\":false,\"shared_agent\":false,\"last_login_at\":null,\"two_factor_auth_enabled\":false,\"signature\":null,\"details\":null,\"notes\":null,\"role_type\":null,\"custom_role_id\":null,\"moderator\":false,\"ticket_restriction\":\"requested\",\"only_private_comments\":false,\"restricted_agent\":true,\"suspended\":false,\"default_group_id\":null,\"report_csv\":false,\"user_fields\":{}}",
|
|
8
|
+
"headers": {}
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"body": "{\"id\":6279089898141,\"url\":\"https://hbtest8393.zendesk.com/api/v2/users/6279089898141.json\",\"name\":\"Test Test\",\"email\":\"test.hanaboso@gmail.com\",\"created_at\":\"2022-08-11T11:35:23Z\",\"updated_at\":\"2022-08-16T12:19:02Z\",\"time_zone\":\"Europe/Prague\",\"iana_time_zone\":\"Europe/Prague\",\"phone\":null,\"shared_phone_number\":null,\"photo\":null,\"locale_id\":1,\"locale\":\"en-US\",\"organization_id\":6279167768093,\"role\":\"admin\",\"verified\":true,\"external_id\":null,\"tags\":[],\"alias\":null,\"active\":true,\"shared\":false,\"shared_agent\":false,\"last_login_at\":\"2022-08-16T12:19:02Z\",\"two_factor_auth_enabled\":null,\"signature\":null,\"details\":null,\"notes\":null,\"role_type\":4,\"custom_role_id\":6279152989725,\"moderator\":true,\"ticket_restriction\":null,\"only_private_comments\":false,\"restricted_agent\":false,\"suspended\":false,\"default_group_id\":6279167766941,\"report_csv\":true,\"user_fields\":{}}",
|
|
12
|
+
"headers": {}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"body": "{\"id\":6340897501085,\"url\":\"https://hbtest8393.zendesk.com/api/v2/users/6340897501085.json\",\"name\":\"g\",\"email\":\"garel.g@exanple.com\",\"created_at\":\"2022-08-16T11:33:02Z\",\"updated_at\":\"2022-08-16T11:33:02Z\",\"time_zone\":\"Europe/Prague\",\"iana_time_zone\":\"Europe/Prague\",\"phone\":null,\"shared_phone_number\":null,\"photo\":null,\"locale_id\":1,\"locale\":\"en-US\",\"organization_id\":null,\"role\":\"end-user\",\"verified\":false,\"external_id\":null,\"tags\":[],\"alias\":null,\"active\":true,\"shared\":false,\"shared_agent\":false,\"last_login_at\":null,\"two_factor_auth_enabled\":false,\"signature\":null,\"details\":null,\"notes\":null,\"role_type\":null,\"custom_role_id\":null,\"moderator\":false,\"ticket_restriction\":\"requested\",\"only_private_comments\":false,\"restricted_agent\":true,\"suspended\":false,\"default_group_id\":null,\"report_csv\":false,\"user_fields\":{}}",
|
|
16
|
+
"headers": {}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import init from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as ZENDESK_LIST_TICKETS_BATCH } from '../ZendeskListTicketsBatch';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for ZendeskListTicketsBatch', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testBatch(ZENDESK_LIST_TICKETS_BATCH);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
+
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
+
import init from '../../../test/dataProvider';
|
|
4
|
+
import { NAME as ZENDESK_LIST_USERS_BATCH } from '../ZendeskListUsersBatch';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for ZendeskListUsersBatch', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testBatch(ZENDESK_LIST_USERS_BATCH);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
+
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
4
|
+
|
|
5
|
+
export const NAME = 'zendesk-create-ticket-connector';
|
|
6
|
+
|
|
7
|
+
export default class ZendeskCreateTicketConnector extends AConnector {
|
|
8
|
+
|
|
9
|
+
public getName(): string {
|
|
10
|
+
return NAME;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
14
|
+
const body = dto.getJsonData();
|
|
15
|
+
|
|
16
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
17
|
+
const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods.POST, '/tickets.json', body);
|
|
18
|
+
const resp = await this.getSender().send<IOutput>(req, [201]);
|
|
19
|
+
|
|
20
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
26
|
+
export interface IInput {
|
|
27
|
+
ticket: {
|
|
28
|
+
comment: {
|
|
29
|
+
body: string;
|
|
30
|
+
};
|
|
31
|
+
priority: string;
|
|
32
|
+
subject: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface IOutput {
|
|
37
|
+
ticket: {
|
|
38
|
+
assignee_id: number;
|
|
39
|
+
collaborator_ids: number[];
|
|
40
|
+
created_at: string;
|
|
41
|
+
custom_fields: [
|
|
42
|
+
{
|
|
43
|
+
id: number;
|
|
44
|
+
value: string;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
];
|
|
48
|
+
description: string;
|
|
49
|
+
external_id: string;
|
|
50
|
+
follower_ids: number[];
|
|
51
|
+
group_id: number;
|
|
52
|
+
has_incidents: boolean;
|
|
53
|
+
id: number;
|
|
54
|
+
organization_id: number;
|
|
55
|
+
priority: string;
|
|
56
|
+
problem_id: number;
|
|
57
|
+
raw_subject: string;
|
|
58
|
+
recipient: string;
|
|
59
|
+
requester_id: number;
|
|
60
|
+
satisfaction_rating: {
|
|
61
|
+
comment: string;
|
|
62
|
+
id: number;
|
|
63
|
+
score: string;
|
|
64
|
+
};
|
|
65
|
+
sharing_agreement_ids: number[];
|
|
66
|
+
status: string;
|
|
67
|
+
subject: string;
|
|
68
|
+
submitter_id: number;
|
|
69
|
+
tags: string[];
|
|
70
|
+
type: string;
|
|
71
|
+
updated_at: string;
|
|
72
|
+
url: string;
|
|
73
|
+
via: {
|
|
74
|
+
channel: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
78
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
+
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
4
|
+
import { ZendeskTrigger } from '../types/trigger.types';
|
|
5
|
+
|
|
6
|
+
export const ZENDESK_CREATE_TRIGGER = 'zendesk-create-trigger-connector';
|
|
7
|
+
|
|
8
|
+
export default class ZendeskCreateTriggerConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return ZENDESK_CREATE_TRIGGER;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(
|
|
15
|
+
dto: ProcessDto<ZendeskCreateTriggerInput>,
|
|
16
|
+
): Promise<ProcessDto<ZendeskCreateTriggerOutput>> {
|
|
17
|
+
const data = this.getData(dto);
|
|
18
|
+
|
|
19
|
+
const req = await this.getApplication().getRequestDto(
|
|
20
|
+
dto,
|
|
21
|
+
await this.getApplicationInstallFromProcess(dto),
|
|
22
|
+
HttpMethods.POST,
|
|
23
|
+
'/triggers',
|
|
24
|
+
data,
|
|
25
|
+
);
|
|
26
|
+
const resp = await this.getSender().send<Response>(req);
|
|
27
|
+
|
|
28
|
+
return this.setResponse(dto, resp.getJsonBody());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected getData(dto: ProcessDto<ZendeskCreateTriggerInput>): ZendeskCreateTriggerInput {
|
|
32
|
+
return dto.getJsonData();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected setResponse(dto: ProcessDto, data: Response): ProcessDto<ZendeskCreateTriggerOutput> {
|
|
36
|
+
return dto.setNewJsonData(data.trigger);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Response {
|
|
42
|
+
trigger: ZendeskTrigger;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ZendeskCreateTriggerInput = Pick<ZendeskTrigger, 'actions' | 'category_id' | 'conditions' | 'title'>
|
|
46
|
+
|
|
47
|
+
export type ZendeskCreateTriggerOutput = ZendeskTrigger;
|