@activepieces/piece-freshservice 0.0.1
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/package.json +16 -0
- package/src/index.d.ts +9 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +88 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-note-to-ticket.d.ts +15 -0
- package/src/lib/actions/add-note-to-ticket.d.ts.map +1 -0
- package/src/lib/actions/add-note-to-ticket.js +45 -0
- package/src/lib/actions/add-note-to-ticket.js.map +1 -0
- package/src/lib/actions/create-requester.d.ts +20 -0
- package/src/lib/actions/create-requester.d.ts.map +1 -0
- package/src/lib/actions/create-requester.js +82 -0
- package/src/lib/actions/create-requester.js.map +1 -0
- package/src/lib/actions/create-ticket.d.ts +46 -0
- package/src/lib/actions/create-ticket.d.ts.map +1 -0
- package/src/lib/actions/create-ticket.js +105 -0
- package/src/lib/actions/create-ticket.js.map +1 -0
- package/src/lib/actions/request-ticket-approval.d.ts +21 -0
- package/src/lib/actions/request-ticket-approval.d.ts.map +1 -0
- package/src/lib/actions/request-ticket-approval.js +47 -0
- package/src/lib/actions/request-ticket-approval.js.map +1 -0
- package/src/lib/common/client.d.ts +14 -0
- package/src/lib/common/client.d.ts.map +1 -0
- package/src/lib/common/client.js +30 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +43 -0
- package/src/lib/common/props.d.ts.map +1 -0
- package/src/lib/common/props.js +215 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/triggers/new-requester.d.ts +15 -0
- package/src/lib/triggers/new-requester.d.ts.map +1 -0
- package/src/lib/triggers/new-requester.js +77 -0
- package/src/lib/triggers/new-requester.js.map +1 -0
- package/src/lib/triggers/new-ticket.d.ts +15 -0
- package/src/lib/triggers/new-ticket.d.ts.map +1 -0
- package/src/lib/triggers/new-ticket.js +81 -0
- package/src/lib/triggers/new-ticket.js.map +1 -0
- package/src/lib/triggers/updated-requester.d.ts +15 -0
- package/src/lib/triggers/updated-requester.d.ts.map +1 -0
- package/src/lib/triggers/updated-requester.js +77 -0
- package/src/lib/triggers/updated-requester.js.map +1 -0
- package/src/lib/triggers/updated-ticket.d.ts +15 -0
- package/src/lib/triggers/updated-ticket.d.ts.map +1 -0
- package/src/lib/triggers/updated-ticket.js +81 -0
- package/src/lib/triggers/updated-ticket.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-freshservice",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
8
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"tslib": "2.6.2",
|
|
12
|
+
"@activepieces/pieces-common": "0.12.1",
|
|
13
|
+
"@activepieces/pieces-framework": "0.26.2",
|
|
14
|
+
"@activepieces/shared": "0.58.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const freshserviceAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const freshservice: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,gBAAgB;;;EA2C3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;GA4BvB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.freshservice = exports.freshserviceAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const buffer_1 = require("buffer");
|
|
9
|
+
const create_ticket_1 = require("./lib/actions/create-ticket");
|
|
10
|
+
const add_note_to_ticket_1 = require("./lib/actions/add-note-to-ticket");
|
|
11
|
+
const create_requester_1 = require("./lib/actions/create-requester");
|
|
12
|
+
const request_ticket_approval_1 = require("./lib/actions/request-ticket-approval");
|
|
13
|
+
const new_ticket_1 = require("./lib/triggers/new-ticket");
|
|
14
|
+
const updated_ticket_1 = require("./lib/triggers/updated-ticket");
|
|
15
|
+
const new_requester_1 = require("./lib/triggers/new-requester");
|
|
16
|
+
const updated_requester_1 = require("./lib/triggers/updated-requester");
|
|
17
|
+
const pieces_common_2 = require("@activepieces/pieces-common");
|
|
18
|
+
exports.freshserviceAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
19
|
+
description: `
|
|
20
|
+
To get your API key:
|
|
21
|
+
1. Log in to your **Freshservice** account as an agent.
|
|
22
|
+
2. Click your **profile picture** in the top-right corner.
|
|
23
|
+
3. Go to **Profile Settings**.
|
|
24
|
+
4. Your API key is displayed on the right side of the page.
|
|
25
|
+
|
|
26
|
+
For the domain, enter only the subdomain. For example, if your URL is **mycompany.freshservice.com**, enter **mycompany**.
|
|
27
|
+
`,
|
|
28
|
+
required: true,
|
|
29
|
+
props: {
|
|
30
|
+
domain: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Freshservice Domain',
|
|
32
|
+
description: 'Your Freshservice subdomain (e.g., "mycompany" from mycompany.freshservice.com).',
|
|
33
|
+
required: true,
|
|
34
|
+
}),
|
|
35
|
+
api_key: pieces_framework_1.PieceAuth.SecretText({
|
|
36
|
+
displayName: 'API Key',
|
|
37
|
+
description: 'Your Freshservice API key from Profile Settings.',
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
42
|
+
try {
|
|
43
|
+
yield pieces_common_2.httpClient.sendRequest({
|
|
44
|
+
method: pieces_common_2.HttpMethod.GET,
|
|
45
|
+
url: `https://${auth.domain}.freshservice.com/api/v2/agents/me`,
|
|
46
|
+
authentication: {
|
|
47
|
+
type: pieces_common_2.AuthenticationType.BASIC,
|
|
48
|
+
username: auth.api_key,
|
|
49
|
+
password: 'X',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return { valid: true };
|
|
53
|
+
}
|
|
54
|
+
catch (_b) {
|
|
55
|
+
return {
|
|
56
|
+
valid: false,
|
|
57
|
+
error: 'Invalid domain or API key. Please check your credentials.',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
exports.freshservice = (0, pieces_framework_1.createPiece)({
|
|
63
|
+
displayName: 'Freshservice',
|
|
64
|
+
description: 'IT service management software for ticketing, asset management, and IT operations.',
|
|
65
|
+
minimumSupportedRelease: '0.36.1',
|
|
66
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/freshservice.png',
|
|
67
|
+
categories: [shared_1.PieceCategory.CUSTOMER_SUPPORT],
|
|
68
|
+
authors: ['AhmadTash'],
|
|
69
|
+
auth: exports.freshserviceAuth,
|
|
70
|
+
actions: [
|
|
71
|
+
create_ticket_1.createTicket,
|
|
72
|
+
add_note_to_ticket_1.addNoteToTicket,
|
|
73
|
+
create_requester_1.createRequester,
|
|
74
|
+
request_ticket_approval_1.requestTicketApproval,
|
|
75
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
76
|
+
baseUrl: (auth) => { var _a; return `https://${(_a = auth === null || auth === void 0 ? void 0 : auth.props.domain) !== null && _a !== void 0 ? _a : ''}.freshservice.com/api/v2`; },
|
|
77
|
+
auth: exports.freshserviceAuth,
|
|
78
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
const encoded = buffer_1.Buffer.from(`${auth.props.api_key}:X`).toString('base64');
|
|
80
|
+
return {
|
|
81
|
+
Authorization: `Basic ${encoded}`,
|
|
82
|
+
};
|
|
83
|
+
}),
|
|
84
|
+
}),
|
|
85
|
+
],
|
|
86
|
+
triggers: [new_ticket_1.newTicket, updated_ticket_1.updatedTicket, new_requester_1.newRequester, updated_requester_1.updatedRequester],
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAkF;AAClF,+DAAwE;AACxE,iDAAqD;AACrD,mCAAgC;AAChC,+DAA2D;AAC3D,yEAAmE;AACnE,qEAAiE;AACjE,mFAA8E;AAC9E,0DAAsD;AACtD,kEAA8D;AAC9D,gEAA4D;AAC5D,wEAAoE;AACpE,+DAAyF;AAE5E,QAAA,gBAAgB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACnD,WAAW,EAAE;;;;;;;;GAQZ;IACD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,qBAAqB;YAClC,WAAW,EACT,kFAAkF;YACpF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,4BAAS,CAAC,UAAU,CA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E;gBAC1B,MAAM,OAAO,GAAG,eAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAC7D,QAAQ,CACT,CAAC;gBACF,OAAO;oBACL,aAAa,EAAE,SAAS,OAAO,EAAE;iBAClC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,sBAAS,EAAE,8BAAa,EAAE,4BAAY,EAAE,oCAAgB,CAAC;CACrE,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const addNoteToTicket: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
ticket_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>>;
|
|
12
|
+
body: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
13
|
+
private: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=add-note-to-ticket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-note-to-ticket.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-note-to-ticket.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;;;;;;;;;EAgC1B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addNoteToTicket = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.addNoteToTicket = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.freshserviceAuth,
|
|
12
|
+
name: 'add_note_to_ticket',
|
|
13
|
+
displayName: 'Add Note to Ticket',
|
|
14
|
+
description: 'Adds a private or public note to an existing ticket.',
|
|
15
|
+
props: {
|
|
16
|
+
ticket_id: props_1.freshserviceCommon.ticket(true),
|
|
17
|
+
body: pieces_framework_1.Property.LongText({
|
|
18
|
+
displayName: 'Note Content',
|
|
19
|
+
description: 'The content of the note. HTML is supported.',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
private: pieces_framework_1.Property.Checkbox({
|
|
23
|
+
displayName: 'Private Note',
|
|
24
|
+
description: 'If checked, the note is only visible to agents. If unchecked, the requester can also see it.',
|
|
25
|
+
required: false,
|
|
26
|
+
defaultValue: true,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
var _a;
|
|
32
|
+
const response = yield (0, client_1.freshserviceApiCall)({
|
|
33
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
34
|
+
endpoint: `tickets/${context.propsValue.ticket_id}/notes`,
|
|
35
|
+
auth: context.auth,
|
|
36
|
+
body: {
|
|
37
|
+
body: context.propsValue.body,
|
|
38
|
+
private: (_a = context.propsValue.private) !== null && _a !== void 0 ? _a : true,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return response.body.conversation;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=add-note-to-ticket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-note-to-ticket.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-note-to-ticket.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,8BAA0C;AAC1C,6CAAuD;AACvD,2CAAqD;AAExC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,oBAAgB;IACtB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE;QACL,SAAS,EAAE,0BAAkB,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1C,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,8FAA8F;YAC3G,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAA4C;gBACpF,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,WAAW,OAAO,CAAC,UAAU,CAAC,SAAS,QAAQ;gBACzD,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE;oBACJ,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;oBAC7B,OAAO,EAAE,MAAA,OAAO,CAAC,UAAU,CAAC,OAAO,mCAAI,IAAI;iBAC5C;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;QACpC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const createRequester: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
first_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
primary_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
job_title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
mobile_phone_number: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
department_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>>;
|
|
18
|
+
custom_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=create-requester.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-requester.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-requester.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAsE1B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRequester = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.createRequester = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.freshserviceAuth,
|
|
12
|
+
name: 'create_requester',
|
|
13
|
+
displayName: 'Create Requester',
|
|
14
|
+
description: 'Creates a new requester (end user) in Freshservice.',
|
|
15
|
+
props: {
|
|
16
|
+
first_name: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'First Name',
|
|
18
|
+
description: 'The first name of the requester.',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
primary_email: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Email',
|
|
23
|
+
description: 'The primary email address of the requester.',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
last_name: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Last Name',
|
|
28
|
+
description: 'The last name of the requester.',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
job_title: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Job Title',
|
|
33
|
+
description: 'The job title of the requester.',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
phone: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Work Phone',
|
|
38
|
+
description: 'The work phone number of the requester.',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
mobile_phone_number: pieces_framework_1.Property.ShortText({
|
|
42
|
+
displayName: 'Mobile Phone',
|
|
43
|
+
description: 'The mobile phone number of the requester.',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
department_id: props_1.freshserviceCommon.department(false),
|
|
47
|
+
custom_fields: pieces_framework_1.Property.Json({
|
|
48
|
+
displayName: 'Custom Fields',
|
|
49
|
+
description: 'A JSON object of custom field names and values.',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
run(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const props = context.propsValue;
|
|
56
|
+
const requesterBody = {
|
|
57
|
+
first_name: props.first_name,
|
|
58
|
+
primary_email: props.primary_email,
|
|
59
|
+
};
|
|
60
|
+
if (props.last_name)
|
|
61
|
+
requesterBody['last_name'] = props.last_name;
|
|
62
|
+
if (props.job_title)
|
|
63
|
+
requesterBody['job_title'] = props.job_title;
|
|
64
|
+
if (props.phone)
|
|
65
|
+
requesterBody['phone'] = props.phone;
|
|
66
|
+
if (props.mobile_phone_number)
|
|
67
|
+
requesterBody['mobile_phone_number'] = props.mobile_phone_number;
|
|
68
|
+
if (props.department_id)
|
|
69
|
+
requesterBody['department_ids'] = [props.department_id];
|
|
70
|
+
if (props.custom_fields)
|
|
71
|
+
requesterBody['custom_fields'] = props.custom_fields;
|
|
72
|
+
const response = yield (0, client_1.freshserviceApiCall)({
|
|
73
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
74
|
+
endpoint: 'requesters',
|
|
75
|
+
auth: context.auth,
|
|
76
|
+
body: requesterBody,
|
|
77
|
+
});
|
|
78
|
+
return response.body.requester;
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=create-requester.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-requester.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-requ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AAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjC,MAAM,aAAa,GAA4B;gBAC7C,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,aAAa,EAAE,KAAK,CAAC,aAAa;aACnC,CAAC;YAEF,IAAI,KAAK,CAAC,SAAS;gBAAE,aAAa,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;YAClE,IAAI,KAAK,CAAC,SAAS;gBAAE,aAAa,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;YAClE,IAAI,KAAK,CAAC,KAAK;gBAAE,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACtD,IAAI,KAAK,CAAC,mBAAmB;gBAC3B,aAAa,CAAC,qBAAqB,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC;YACnE,IAAI,KAAK,CAAC,aAAa;gBACrB,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC1D,IAAI,KAAK,CAAC,aAAa;gBACrB,aAAa,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;YAEvD,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAAyC;gBACjF,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,YAAY;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;QACjC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const createTicket: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
7
|
+
requester_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
+
}>>;
|
|
14
|
+
status: import("@activepieces/pieces-framework").StaticDropdownProperty<number, true>;
|
|
15
|
+
priority: import("@activepieces/pieces-framework").StaticDropdownProperty<number, true>;
|
|
16
|
+
source: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
|
|
17
|
+
urgency: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
|
|
18
|
+
impact: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
|
|
19
|
+
type: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
responder_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
21
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
22
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
24
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
26
|
+
}>>;
|
|
27
|
+
department_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
28
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
30
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
31
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
32
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
33
|
+
}>>;
|
|
34
|
+
group_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
35
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
36
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
37
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
38
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
39
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
40
|
+
}>>;
|
|
41
|
+
category: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
42
|
+
sub_category: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
43
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
44
|
+
custom_fields: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
45
|
+
}>;
|
|
46
|
+
//# sourceMappingURL=create-ticket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-ticket.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-ticket.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmFvB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTicket = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.createTicket = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.freshserviceAuth,
|
|
12
|
+
name: 'create_ticket',
|
|
13
|
+
displayName: 'Create Ticket',
|
|
14
|
+
description: 'Creates a new ticket in Freshservice.',
|
|
15
|
+
props: {
|
|
16
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Subject',
|
|
18
|
+
description: 'The subject of the ticket.',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
description: pieces_framework_1.Property.LongText({
|
|
22
|
+
displayName: 'Description',
|
|
23
|
+
description: 'HTML content of the ticket. You can use basic HTML tags for formatting.',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
requester_id: props_1.freshserviceCommon.requester(true),
|
|
27
|
+
status: props_1.freshserviceCommon.status,
|
|
28
|
+
priority: props_1.freshserviceCommon.priority,
|
|
29
|
+
source: props_1.freshserviceCommon.source,
|
|
30
|
+
urgency: props_1.freshserviceCommon.urgency,
|
|
31
|
+
impact: props_1.freshserviceCommon.impact,
|
|
32
|
+
type: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Type',
|
|
34
|
+
description: 'The type of ticket (e.g., Incident, Service Request).',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
responder_id: props_1.freshserviceCommon.agent(false),
|
|
38
|
+
department_id: props_1.freshserviceCommon.department(false),
|
|
39
|
+
group_id: props_1.freshserviceCommon.group(false),
|
|
40
|
+
category: pieces_framework_1.Property.ShortText({
|
|
41
|
+
displayName: 'Category',
|
|
42
|
+
description: 'The category of the ticket.',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
sub_category: pieces_framework_1.Property.ShortText({
|
|
46
|
+
displayName: 'Sub Category',
|
|
47
|
+
description: 'The sub-category of the ticket.',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
tags: pieces_framework_1.Property.Array({
|
|
51
|
+
displayName: 'Tags',
|
|
52
|
+
description: 'Tags to add to the ticket.',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
custom_fields: pieces_framework_1.Property.Json({
|
|
56
|
+
displayName: 'Custom Fields',
|
|
57
|
+
description: 'A JSON object of custom field names and values.',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
run(context) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const props = context.propsValue;
|
|
64
|
+
const ticketBody = {
|
|
65
|
+
subject: props.subject,
|
|
66
|
+
description: props.description,
|
|
67
|
+
requester_id: props.requester_id,
|
|
68
|
+
};
|
|
69
|
+
if (props.status)
|
|
70
|
+
ticketBody['status'] = props.status;
|
|
71
|
+
if (props.priority)
|
|
72
|
+
ticketBody['priority'] = props.priority;
|
|
73
|
+
if (props.source)
|
|
74
|
+
ticketBody['source'] = props.source;
|
|
75
|
+
if (props.urgency)
|
|
76
|
+
ticketBody['urgency'] = props.urgency;
|
|
77
|
+
if (props.impact)
|
|
78
|
+
ticketBody['impact'] = props.impact;
|
|
79
|
+
if (props.type)
|
|
80
|
+
ticketBody['type'] = props.type;
|
|
81
|
+
if (props.responder_id)
|
|
82
|
+
ticketBody['responder_id'] = props.responder_id;
|
|
83
|
+
if (props.department_id)
|
|
84
|
+
ticketBody['department_id'] = props.department_id;
|
|
85
|
+
if (props.group_id)
|
|
86
|
+
ticketBody['group_id'] = props.group_id;
|
|
87
|
+
if (props.category)
|
|
88
|
+
ticketBody['category'] = props.category;
|
|
89
|
+
if (props.sub_category)
|
|
90
|
+
ticketBody['sub_category'] = props.sub_category;
|
|
91
|
+
if (props.tags && props.tags.length > 0)
|
|
92
|
+
ticketBody['tags'] = props.tags;
|
|
93
|
+
if (props.custom_fields)
|
|
94
|
+
ticketBody['custom_fields'] = props.custom_fields;
|
|
95
|
+
const response = yield (0, client_1.freshserviceApiCall)({
|
|
96
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
97
|
+
endpoint: 'tickets',
|
|
98
|
+
auth: context.auth,
|
|
99
|
+
body: ticketBody,
|
|
100
|
+
});
|
|
101
|
+
return response.body.ticket;
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=create-ticket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-ticket.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-ticket.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,8BAA0C;AAC1C,6CAAuD;AACvD,2CAAqD;AAExC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,oBAAgB;IACtB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,0BAAkB,CAAC,SAAS,CAAC,IAAI,CAAC;QAChD,MAAM,EAAE,0BAAkB,CAAC,MAAM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C,aAAa,CAAC;YAE3E,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAAsC;gBAC9E,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;QAC9B,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const requestTicketApproval: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
ticket_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>>;
|
|
12
|
+
approver_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
13
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
+
}>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
16
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
+
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
18
|
+
}>>;
|
|
19
|
+
approval_type: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=request-ticket-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-ticket-approval.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/request-ticket-approval.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;EAkChC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestTicketApproval = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.requestTicketApproval = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.freshserviceAuth,
|
|
12
|
+
name: 'request_ticket_approval',
|
|
13
|
+
displayName: 'Request Ticket Approval',
|
|
14
|
+
description: 'Requests approval for a ticket from a specified agent.',
|
|
15
|
+
props: {
|
|
16
|
+
ticket_id: props_1.freshserviceCommon.ticket(true),
|
|
17
|
+
approver_id: props_1.freshserviceCommon.agent(true),
|
|
18
|
+
approval_type: pieces_framework_1.Property.StaticDropdown({
|
|
19
|
+
displayName: 'Approval Type',
|
|
20
|
+
description: 'How approval is determined when there are multiple approvers.',
|
|
21
|
+
required: false,
|
|
22
|
+
defaultValue: 2,
|
|
23
|
+
options: {
|
|
24
|
+
options: [
|
|
25
|
+
{ label: 'All must approve', value: 1 },
|
|
26
|
+
{ label: 'Any one can approve', value: 2 },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
var _a;
|
|
34
|
+
const response = yield (0, client_1.freshserviceApiCall)({
|
|
35
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
36
|
+
endpoint: `tickets/${context.propsValue.ticket_id}/approvals`,
|
|
37
|
+
auth: context.auth,
|
|
38
|
+
body: {
|
|
39
|
+
approver_ids: [context.propsValue.approver_id],
|
|
40
|
+
approval_type: (_a = context.propsValue.approval_type) !== null && _a !== void 0 ? _a : 2,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return response.body.approval;
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=request-ticket-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-ticket-approval.js","sourceRoot":"","sources":["../../../../src/lib/actions/request-ticket-approval.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,8BAA0C;AAC1C,6CAAuD;AACvD,2CAAqD;AAExC,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,oBAAgB;IACtB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,wDAAwD;IACrE,KAAK,EAAE;QACL,SAAS,EAAE,0BAAkB,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1C,WAAW,EAAE,0BAAkB,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3C,aAAa,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACrC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,+DAA+D;YAC5E,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,EAAE;oBACvC,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,EAAE;iBAC3C;aACF;SACF,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAAwC;gBAChF,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,WAAW,OAAO,CAAC,UAAU,CAAC,SAAS,YAAY;gBAC7D,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE;oBACJ,YAAY,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC;oBAC9C,aAAa,EAAE,MAAA,OAAO,CAAC,UAAU,CAAC,aAAa,mCAAI,CAAC;iBACrD;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpMethod, HttpResponse, HttpMessageBody } from '@activepieces/pieces-common';
|
|
2
|
+
import { freshserviceAuth } from '../../';
|
|
3
|
+
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
4
|
+
type FreshserviceAuth = AppConnectionValueForAuthProperty<typeof freshserviceAuth>;
|
|
5
|
+
declare function buildBaseUrl(domain: string): string;
|
|
6
|
+
export declare function freshserviceApiCall<T extends HttpMessageBody>({ method, endpoint, auth, body, queryParams, }: {
|
|
7
|
+
method: HttpMethod;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
auth: FreshserviceAuth;
|
|
10
|
+
body?: HttpMessageBody;
|
|
11
|
+
queryParams?: Record<string, string>;
|
|
12
|
+
}): Promise<HttpResponse<T>>;
|
|
13
|
+
export { buildBaseUrl };
|
|
14
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,YAAY,EACZ,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAEnF,KAAK,gBAAgB,GAAG,iCAAiC,CACvD,OAAO,gBAAgB,CACxB,CAAC;AAEF,iBAAS,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,eAAe,EAAE,EACnE,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAiB3B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.freshserviceApiCall = freshserviceApiCall;
|
|
4
|
+
exports.buildBaseUrl = buildBaseUrl;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
function buildBaseUrl(domain) {
|
|
8
|
+
return `https://${domain}.freshservice.com/api/v2`;
|
|
9
|
+
}
|
|
10
|
+
function freshserviceApiCall(_a) {
|
|
11
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ method, endpoint, auth, body, queryParams, }) {
|
|
12
|
+
const request = {
|
|
13
|
+
method,
|
|
14
|
+
url: `${buildBaseUrl(auth.props.domain)}/${endpoint}`,
|
|
15
|
+
authentication: {
|
|
16
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
17
|
+
username: auth.props.api_key,
|
|
18
|
+
password: 'X',
|
|
19
|
+
},
|
|
20
|
+
body,
|
|
21
|
+
queryParams,
|
|
22
|
+
headers: {
|
|
23
|
+
Accept: 'application/json',
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
return pieces_common_1.httpClient.sendRequest(request);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAmBA,kDA6BC;AAEQ,oCAAY;;AAlDrB,+DAOqC;AAQrC,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACrD,CAAC;AAED,SAAsB,mBAAmB;iEAA4B,EACnE,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,WAAW,GAOZ;QACC,MAAM,OAAO,GAAgB;YAC3B,MAAM;YACN,GAAG,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE;YACrD,cAAc,EAAE;gBACd,IAAI,EAAE,kCAAkB,CAAC,KAAK;gBAC9B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;gBAC5B,QAAQ,EAAE,GAAG;aACd;YACD,IAAI;YACJ,WAAW;YACX,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC;QACF,OAAO,0BAAU,CAAC,WAAW,CAAI,OAAO,CAAC,CAAC;IAC5C,CAAC;CAAA"}
|