@pipedream/jira_service_desk 0.2.0 → 0.3.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/actions/create-comment-on-request/create-comment-on-request.mjs +1 -1
- package/actions/create-incident/create-incident.mjs +107 -0
- package/actions/create-request/create-request.mjs +1 -1
- package/actions/get-current-user/get-current-user.mjs +28 -0
- package/actions/get-request/get-request.mjs +60 -0
- package/actions/get-request-status/get-request-status.mjs +44 -0
- package/actions/list-cloud-id-options/list-cloud-id-options.mjs +1 -1
- package/actions/list-my-requests/list-my-requests.mjs +68 -0
- package/actions/list-request-transitions/list-request-transitions.mjs +43 -0
- package/actions/list-sites/list-sites.mjs +28 -0
- package/actions/transition-request/transition-request.mjs +67 -0
- package/actions/update-issue-fields/update-issue-fields.mjs +64 -0
- package/jira_service_desk.app.mjs +83 -2
- package/package.json +1 -1
- package/sources/new-request-created/new-request-created.mjs +1 -1
- package/sources/request-status-updated/request-status-updated.mjs +1 -1
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "jira_service_desk-create-comment-on-request",
|
|
5
5
|
name: "Create Comment on Request",
|
|
6
6
|
description: "Create a comment on a customer request. [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-comment-post)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-create-incident",
|
|
5
|
+
name: "Create Incident",
|
|
6
|
+
description:
|
|
7
|
+
"Creates a new incident request in a Jira Service Desk."
|
|
8
|
+
+ " Auto-discovers the best-matching request type (prefers types named 'incident' or 'problem') and, if `serviceDeskId` is omitted, auto-discovers it from the user's existing requests."
|
|
9
|
+
+ " Use **List Sites** first to obtain the required `cloudId`."
|
|
10
|
+
+ " `serviceDeskId` is optional — if not provided, the tool calls **List My Requests** to discover it automatically."
|
|
11
|
+
+ " Returns the new request including its `issueKey` and `issueId`."
|
|
12
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-post)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: false,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
app,
|
|
22
|
+
cloudId: {
|
|
23
|
+
propDefinition: [
|
|
24
|
+
app,
|
|
25
|
+
"cloudId",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
serviceDeskId: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "Service Desk ID",
|
|
31
|
+
description: "The numeric ID of the service desk (e.g. `2`). If omitted, the tool auto-discovers it from your existing requests. You can also find it in your Jira Service Management project settings.",
|
|
32
|
+
optional: true,
|
|
33
|
+
},
|
|
34
|
+
summary: {
|
|
35
|
+
type: "string",
|
|
36
|
+
label: "Summary",
|
|
37
|
+
description: "The title/summary of the incident.",
|
|
38
|
+
},
|
|
39
|
+
description: {
|
|
40
|
+
type: "string",
|
|
41
|
+
label: "Description",
|
|
42
|
+
description: "A detailed description of the incident.",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
async run({ $ }) {
|
|
46
|
+
// Auto-discover serviceDeskId if not provided — extract from existing requests
|
|
47
|
+
let serviceDeskId = this.serviceDeskId;
|
|
48
|
+
if (!serviceDeskId) {
|
|
49
|
+
const existingRequests = await this.app.listMyRequests({
|
|
50
|
+
$,
|
|
51
|
+
cloudId: this.cloudId,
|
|
52
|
+
});
|
|
53
|
+
if (!existingRequests?.length) {
|
|
54
|
+
throw new Error("No existing requests found to auto-discover serviceDeskId. Please provide serviceDeskId explicitly.");
|
|
55
|
+
}
|
|
56
|
+
const uniqueIds = [
|
|
57
|
+
...new Set(existingRequests.map((r) => r.serviceDeskId)),
|
|
58
|
+
];
|
|
59
|
+
if (uniqueIds.length > 1) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`Multiple service desks found (${uniqueIds.join(", ")}). Please provide serviceDeskId explicitly.`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
serviceDeskId = uniqueIds[0];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Auto-discover the best-matching request type for an incident.
|
|
68
|
+
// Prefers types named "incident" or "problem"; falls back to first available.
|
|
69
|
+
const requestTypes = await this.app.getRequestTypes({
|
|
70
|
+
$,
|
|
71
|
+
cloudId: this.cloudId,
|
|
72
|
+
serviceDeskId,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!requestTypes?.length) {
|
|
76
|
+
throw new Error(`No request types found in service desk ${serviceDeskId}.`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const INCIDENT_KEYWORDS = [
|
|
80
|
+
"incident",
|
|
81
|
+
"problem",
|
|
82
|
+
"system problem",
|
|
83
|
+
"issue",
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const incidentType = requestTypes.find(({ name }) =>
|
|
87
|
+
INCIDENT_KEYWORDS.some((kw) => name?.toLowerCase().includes(kw))) || requestTypes[0];
|
|
88
|
+
|
|
89
|
+
const requestFieldValues = {
|
|
90
|
+
summary: this.summary,
|
|
91
|
+
description: this.description,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const response = await this.app.createCustomerRequest({
|
|
95
|
+
$,
|
|
96
|
+
cloudId: this.cloudId,
|
|
97
|
+
data: {
|
|
98
|
+
serviceDeskId,
|
|
99
|
+
requestTypeId: incidentType.id,
|
|
100
|
+
requestFieldValues,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
$.export("$summary", `Created ${incidentType.name} ${response.issueKey}: ${this.summary}`);
|
|
105
|
+
return response;
|
|
106
|
+
},
|
|
107
|
+
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Create Request",
|
|
6
6
|
description:
|
|
7
7
|
"Creates a new customer request. [See the documentation](https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-createCustomerRequest)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.2",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-get-current-user",
|
|
5
|
+
name: "Get Current User",
|
|
6
|
+
description:
|
|
7
|
+
"Returns the authenticated user's `account_id`, `display_name`, and `email` from Atlassian."
|
|
8
|
+
+ " Use this to identify who is logged in, or to filter requests by the current user's `account_id`."
|
|
9
|
+
+ " No `cloudId` required — this uses the Atlassian Identity API directly."
|
|
10
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/)",
|
|
11
|
+
version: "0.0.1",
|
|
12
|
+
type: "action",
|
|
13
|
+
annotations: {
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
openWorldHint: true,
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
app,
|
|
20
|
+
},
|
|
21
|
+
async run({ $ }) {
|
|
22
|
+
const user = await this.app.getCurrentUser({
|
|
23
|
+
$,
|
|
24
|
+
});
|
|
25
|
+
$.export("$summary", `Current user: ${user.name || user.account_id}`);
|
|
26
|
+
return user;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-get-request",
|
|
5
|
+
name: "Get Request",
|
|
6
|
+
description:
|
|
7
|
+
"Fetches the full details of a Jira Service Desk request including its field values and complete comment thread in a single response."
|
|
8
|
+
+ " Use this to summarize a ticket without needing follow-up calls."
|
|
9
|
+
+ " Use **List Sites** first to obtain the required `cloudId`."
|
|
10
|
+
+ " Use **List My Requests** to find the `issueKey` of a request (e.g. `IT-42`)."
|
|
11
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-get)",
|
|
12
|
+
version: "0.0.1",
|
|
13
|
+
type: "action",
|
|
14
|
+
annotations: {
|
|
15
|
+
destructiveHint: false,
|
|
16
|
+
openWorldHint: true,
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
app,
|
|
21
|
+
cloudId: {
|
|
22
|
+
propDefinition: [
|
|
23
|
+
app,
|
|
24
|
+
"cloudId",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
issueIdOrKey: {
|
|
28
|
+
propDefinition: [
|
|
29
|
+
app,
|
|
30
|
+
"issueIdOrKey",
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
async run({ $ }) {
|
|
35
|
+
const [
|
|
36
|
+
request,
|
|
37
|
+
comments,
|
|
38
|
+
] = await Promise.all([
|
|
39
|
+
this.app.getRequest({
|
|
40
|
+
$,
|
|
41
|
+
cloudId: this.cloudId,
|
|
42
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
43
|
+
}),
|
|
44
|
+
this.app.getRequestComments({
|
|
45
|
+
$,
|
|
46
|
+
cloudId: this.cloudId,
|
|
47
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
48
|
+
}),
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
const summary = request.requestFieldValues?.find?.(({ fieldId }) => fieldId === "summary")?.value
|
|
52
|
+
|| this.issueIdOrKey;
|
|
53
|
+
|
|
54
|
+
$.export("$summary", `Request ${request.issueKey}: ${summary} (${comments?.length ?? 0} comment(s))`);
|
|
55
|
+
return {
|
|
56
|
+
...request,
|
|
57
|
+
comments,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-get-request-status",
|
|
5
|
+
name: "Get Request Status",
|
|
6
|
+
description:
|
|
7
|
+
"Returns the status history of a Jira Service Desk request — the current status plus all previous states with timestamps."
|
|
8
|
+
+ " Use this to understand how a request has progressed through the workflow."
|
|
9
|
+
+ " Use **List Sites** first to obtain the required `cloudId`."
|
|
10
|
+
+ " Use **List My Requests** to find the `issueKey` (e.g. `IT-42`)."
|
|
11
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-status-get)",
|
|
12
|
+
version: "0.0.1",
|
|
13
|
+
type: "action",
|
|
14
|
+
annotations: {
|
|
15
|
+
destructiveHint: false,
|
|
16
|
+
openWorldHint: true,
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
app,
|
|
21
|
+
cloudId: {
|
|
22
|
+
propDefinition: [
|
|
23
|
+
app,
|
|
24
|
+
"cloudId",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
issueIdOrKey: {
|
|
28
|
+
propDefinition: [
|
|
29
|
+
app,
|
|
30
|
+
"issueIdOrKey",
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
async run({ $ }) {
|
|
35
|
+
const statuses = await this.app.getRequestStatus({
|
|
36
|
+
$,
|
|
37
|
+
cloudId: this.cloudId,
|
|
38
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
39
|
+
});
|
|
40
|
+
const current = statuses?.[0]?.status || "unknown";
|
|
41
|
+
$.export("$summary", `Status history for ${this.issueIdOrKey}: current status is "${current}" (${statuses?.length ?? 0} entries)`);
|
|
42
|
+
return statuses;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "jira_service_desk-list-cloud-id-options",
|
|
5
5
|
name: "List Cloud ID Options",
|
|
6
6
|
description: "Retrieves available options for the Cloud ID field.",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.2",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-list-my-requests",
|
|
5
|
+
name: "List My Requests",
|
|
6
|
+
description:
|
|
7
|
+
"Lists Jira Service Desk requests owned or participated in by the current user."
|
|
8
|
+
+ " Defaults to open requests owned by the current user."
|
|
9
|
+
+ " Use **List Sites** first to obtain the required `cloudId`."
|
|
10
|
+
+ " Each result includes `issueKey`, `issueId`, and request field values (summary, status)."
|
|
11
|
+
+ " `requestStatus`: `OPEN_REQUESTS` (default), `CLOSED_REQUESTS`, or `ALL_REQUESTS`."
|
|
12
|
+
+ " `requestOwnership`: `OWNED_REQUESTS` (default) or `PARTICIPATED_REQUESTS`."
|
|
13
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-get)",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
type: "action",
|
|
16
|
+
annotations: {
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
openWorldHint: true,
|
|
19
|
+
readOnlyHint: true,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
app,
|
|
23
|
+
cloudId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
app,
|
|
26
|
+
"cloudId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
serviceDeskId: {
|
|
30
|
+
type: "string",
|
|
31
|
+
label: "Service Desk ID",
|
|
32
|
+
description: "Filter results to a specific service desk. Omit to return requests from all service desks.",
|
|
33
|
+
optional: true,
|
|
34
|
+
},
|
|
35
|
+
requestStatus: {
|
|
36
|
+
type: "string",
|
|
37
|
+
label: "Request Status",
|
|
38
|
+
description: "Filter by request status. `OPEN_REQUESTS` (default), `CLOSED_REQUESTS`, or `ALL_REQUESTS`.",
|
|
39
|
+
options: [
|
|
40
|
+
"OPEN_REQUESTS",
|
|
41
|
+
"CLOSED_REQUESTS",
|
|
42
|
+
"ALL_REQUESTS",
|
|
43
|
+
],
|
|
44
|
+
optional: true,
|
|
45
|
+
},
|
|
46
|
+
requestOwnership: {
|
|
47
|
+
type: "string",
|
|
48
|
+
label: "Request Ownership",
|
|
49
|
+
description: "Filter by ownership. `OWNED_REQUESTS` (default) returns requests created by the current user. `PARTICIPATED_REQUESTS` includes requests the user commented on.",
|
|
50
|
+
options: [
|
|
51
|
+
"OWNED_REQUESTS",
|
|
52
|
+
"PARTICIPATED_REQUESTS",
|
|
53
|
+
],
|
|
54
|
+
optional: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
async run({ $ }) {
|
|
58
|
+
const requests = await this.app.listMyRequests({
|
|
59
|
+
$,
|
|
60
|
+
cloudId: this.cloudId,
|
|
61
|
+
serviceDeskId: this.serviceDeskId,
|
|
62
|
+
requestStatus: this.requestStatus,
|
|
63
|
+
requestOwnership: this.requestOwnership,
|
|
64
|
+
});
|
|
65
|
+
$.export("$summary", `Found ${requests?.length ?? 0} request(s)`);
|
|
66
|
+
return requests;
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-list-request-transitions",
|
|
5
|
+
name: "List Request Transitions",
|
|
6
|
+
description:
|
|
7
|
+
"Lists the available workflow transitions for a Jira Service Desk request — returns each transition's `id` and `name`."
|
|
8
|
+
+ " **Call this before `Transition Request`** to obtain valid `transitionId` values."
|
|
9
|
+
+ " Use **List Sites** first to obtain the required `cloudId`."
|
|
10
|
+
+ " Use **List My Requests** or **Get Request** to find the `issueKey` (e.g. `IT-42`)."
|
|
11
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-transition-get)",
|
|
12
|
+
version: "0.0.1",
|
|
13
|
+
type: "action",
|
|
14
|
+
annotations: {
|
|
15
|
+
destructiveHint: false,
|
|
16
|
+
openWorldHint: true,
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
app,
|
|
21
|
+
cloudId: {
|
|
22
|
+
propDefinition: [
|
|
23
|
+
app,
|
|
24
|
+
"cloudId",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
issueIdOrKey: {
|
|
28
|
+
propDefinition: [
|
|
29
|
+
app,
|
|
30
|
+
"issueIdOrKey",
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
async run({ $ }) {
|
|
35
|
+
const transitions = await this.app.getRequestTransitions({
|
|
36
|
+
$,
|
|
37
|
+
cloudId: this.cloudId,
|
|
38
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
39
|
+
});
|
|
40
|
+
$.export("$summary", `Found ${transitions?.length ?? 0} available transition(s) for ${this.issueIdOrKey}`);
|
|
41
|
+
return transitions;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-list-sites",
|
|
5
|
+
name: "List Sites",
|
|
6
|
+
description:
|
|
7
|
+
"Returns all Atlassian cloud sites accessible to the authenticated user."
|
|
8
|
+
+ " **Call this tool first** to obtain the `cloudId` (returned as `id`) required by every other Jira Service Desk tool."
|
|
9
|
+
+ " Each site includes its `id` (cloudId), `name`, and `url`."
|
|
10
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/#3-1-get-the-cloudid-for-your-site)",
|
|
11
|
+
version: "0.0.1",
|
|
12
|
+
type: "action",
|
|
13
|
+
annotations: {
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
openWorldHint: true,
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
app,
|
|
20
|
+
},
|
|
21
|
+
async run({ $ }) {
|
|
22
|
+
const sites = await this.app.getSites({
|
|
23
|
+
$,
|
|
24
|
+
});
|
|
25
|
+
$.export("$summary", `Found ${sites?.length ?? 0} accessible Atlassian site(s)`);
|
|
26
|
+
return sites;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-transition-request",
|
|
5
|
+
name: "Transition Request",
|
|
6
|
+
description:
|
|
7
|
+
"Transitions a Jira Service Desk request to a new workflow status."
|
|
8
|
+
+ " Use **List Request Transitions** first to get valid `transitionId` values for the request."
|
|
9
|
+
+ " Use **List Sites** to obtain the required `cloudId`."
|
|
10
|
+
+ " Use **List My Requests** or **Get Request** to find the `issueKey` (e.g. `IT-42`)."
|
|
11
|
+
+ " Optionally include a comment to explain the transition."
|
|
12
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-transition-post)",
|
|
13
|
+
version: "0.0.1",
|
|
14
|
+
type: "action",
|
|
15
|
+
annotations: {
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
openWorldHint: true,
|
|
18
|
+
readOnlyHint: false,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
app,
|
|
22
|
+
cloudId: {
|
|
23
|
+
propDefinition: [
|
|
24
|
+
app,
|
|
25
|
+
"cloudId",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
issueIdOrKey: {
|
|
29
|
+
propDefinition: [
|
|
30
|
+
app,
|
|
31
|
+
"issueIdOrKey",
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
transitionId: {
|
|
35
|
+
type: "string",
|
|
36
|
+
label: "Transition ID",
|
|
37
|
+
description: "The ID of the transition to perform. Use **List Request Transitions** to retrieve available transition IDs and names.",
|
|
38
|
+
},
|
|
39
|
+
additionalComment: {
|
|
40
|
+
type: "string",
|
|
41
|
+
label: "Additional Comment",
|
|
42
|
+
description: "Optional comment to add when performing the transition.",
|
|
43
|
+
optional: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
async run({ $ }) {
|
|
47
|
+
const body = {
|
|
48
|
+
id: this.transitionId,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (this.additionalComment) {
|
|
52
|
+
body.additionalComment = {
|
|
53
|
+
body: this.additionalComment,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const response = await this.app.transitionRequest({
|
|
58
|
+
$,
|
|
59
|
+
cloudId: this.cloudId,
|
|
60
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
61
|
+
data: body,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$.export("$summary", `Transitioned request ${this.issueIdOrKey} using transition ID ${this.transitionId}`);
|
|
65
|
+
return response;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import app from "../../jira_service_desk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "jira_service_desk-update-issue-fields",
|
|
5
|
+
name: "Update Issue Fields",
|
|
6
|
+
description:
|
|
7
|
+
"Updates fields on an existing Jira Service Desk request via the Jira platform API."
|
|
8
|
+
+ " Use this to change the summary, priority, description, or other fields after a request has been created."
|
|
9
|
+
+ " Use **List Sites** first to obtain the required `cloudId`."
|
|
10
|
+
+ " Use **List My Requests** or **Get Request** to find the `issueKey` (e.g. `IT-42`)."
|
|
11
|
+
+ " `fields` is a JSON object of field name-value pairs."
|
|
12
|
+
+ " Example: `{\"summary\": \"Updated title\", \"priority\": {\"name\": \"High\"}}`."
|
|
13
|
+
+ " [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put)",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
type: "action",
|
|
16
|
+
annotations: {
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
openWorldHint: true,
|
|
19
|
+
readOnlyHint: false,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
app,
|
|
23
|
+
cloudId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
app,
|
|
26
|
+
"cloudId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
issueIdOrKey: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
app,
|
|
32
|
+
"issueIdOrKey",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
fields: {
|
|
36
|
+
type: "string",
|
|
37
|
+
label: "Fields",
|
|
38
|
+
description: "JSON object of Jira field name-value pairs to update."
|
|
39
|
+
+ " Example: `{\"summary\": \"New title\", \"priority\": {\"name\": \"High\"}}`."
|
|
40
|
+
+ " Use **Get Request** to see current field values.",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
async run({ $ }) {
|
|
44
|
+
const fields = JSON.parse(this.fields);
|
|
45
|
+
if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
|
|
46
|
+
throw new Error("`fields` must be a JSON object (e.g. `{\"summary\": \"New title\"}`), not an array or primitive.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
await this.app.updateIssueFields({
|
|
50
|
+
$,
|
|
51
|
+
cloudId: this.cloudId,
|
|
52
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
53
|
+
data: {
|
|
54
|
+
fields,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
$.export("$summary", `Updated fields on issue ${this.issueIdOrKey}`);
|
|
59
|
+
return {
|
|
60
|
+
issueIdOrKey: this.issueIdOrKey,
|
|
61
|
+
updatedFields: Object.keys(fields),
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -72,6 +72,11 @@ export default {
|
|
|
72
72
|
}));
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
|
+
issueIdOrKey: {
|
|
76
|
+
type: "string",
|
|
77
|
+
label: "Issue ID or Key",
|
|
78
|
+
description: "The ID or key of the Jira Service Desk request (e.g. `IT-42` or `10001`). Use **List My Requests** to find the `issueKey` of a request.",
|
|
79
|
+
},
|
|
75
80
|
},
|
|
76
81
|
methods: {
|
|
77
82
|
_baseUrl() {
|
|
@@ -89,8 +94,9 @@ export default {
|
|
|
89
94
|
},
|
|
90
95
|
});
|
|
91
96
|
},
|
|
92
|
-
async getSites() {
|
|
97
|
+
async getSites({ $ } = {}) {
|
|
93
98
|
return this._makeRequest({
|
|
99
|
+
$,
|
|
94
100
|
path: "/oauth/token/accessible-resources",
|
|
95
101
|
});
|
|
96
102
|
},
|
|
@@ -101,9 +107,10 @@ export default {
|
|
|
101
107
|
return response.values;
|
|
102
108
|
},
|
|
103
109
|
async getRequestTypes({
|
|
104
|
-
cloudId, serviceDeskId,
|
|
110
|
+
$, cloudId, serviceDeskId,
|
|
105
111
|
}) {
|
|
106
112
|
const response = await this._makeRequest({
|
|
113
|
+
$,
|
|
107
114
|
path: `/ex/jira/${cloudId}/rest/servicedeskapi/servicedesk/${serviceDeskId}/requesttype`,
|
|
108
115
|
});
|
|
109
116
|
return response.values;
|
|
@@ -140,5 +147,79 @@ export default {
|
|
|
140
147
|
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request/${requestId}/comment`,
|
|
141
148
|
});
|
|
142
149
|
},
|
|
150
|
+
async getCurrentUser({ $ } = {}) {
|
|
151
|
+
return this._makeRequest({
|
|
152
|
+
$,
|
|
153
|
+
path: "/me",
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
async listMyRequests({
|
|
157
|
+
$, cloudId, serviceDeskId, requestStatus, requestOwnership,
|
|
158
|
+
}) {
|
|
159
|
+
const params = {
|
|
160
|
+
requestStatus: requestStatus || "OPEN_REQUESTS",
|
|
161
|
+
requestOwnership: requestOwnership || "OWNED_REQUESTS",
|
|
162
|
+
};
|
|
163
|
+
if (serviceDeskId) params.serviceDeskId = serviceDeskId;
|
|
164
|
+
const response = await this._makeRequest({
|
|
165
|
+
$,
|
|
166
|
+
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request`,
|
|
167
|
+
params,
|
|
168
|
+
});
|
|
169
|
+
return response.values;
|
|
170
|
+
},
|
|
171
|
+
async getRequest({
|
|
172
|
+
$, cloudId, issueIdOrKey,
|
|
173
|
+
}) {
|
|
174
|
+
return this._makeRequest({
|
|
175
|
+
$,
|
|
176
|
+
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request/${issueIdOrKey}`,
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
async getRequestComments({
|
|
180
|
+
$, cloudId, issueIdOrKey,
|
|
181
|
+
}) {
|
|
182
|
+
const response = await this._makeRequest({
|
|
183
|
+
$,
|
|
184
|
+
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request/${issueIdOrKey}/comment`,
|
|
185
|
+
});
|
|
186
|
+
return response.values;
|
|
187
|
+
},
|
|
188
|
+
async getRequestStatus({
|
|
189
|
+
$, cloudId, issueIdOrKey,
|
|
190
|
+
}) {
|
|
191
|
+
const response = await this._makeRequest({
|
|
192
|
+
$,
|
|
193
|
+
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request/${issueIdOrKey}/status`,
|
|
194
|
+
});
|
|
195
|
+
return response.values;
|
|
196
|
+
},
|
|
197
|
+
async getRequestTransitions({
|
|
198
|
+
$, cloudId, issueIdOrKey,
|
|
199
|
+
}) {
|
|
200
|
+
const response = await this._makeRequest({
|
|
201
|
+
$,
|
|
202
|
+
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request/${issueIdOrKey}/transition`,
|
|
203
|
+
});
|
|
204
|
+
return response.values;
|
|
205
|
+
},
|
|
206
|
+
async transitionRequest({
|
|
207
|
+
cloudId, issueIdOrKey, ...opts
|
|
208
|
+
}) {
|
|
209
|
+
return this._makeRequest({
|
|
210
|
+
...opts,
|
|
211
|
+
method: "POST",
|
|
212
|
+
path: `/ex/jira/${cloudId}/rest/servicedeskapi/request/${issueIdOrKey}/transition`,
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
async updateIssueFields({
|
|
216
|
+
cloudId, issueIdOrKey, ...opts
|
|
217
|
+
}) {
|
|
218
|
+
return this._makeRequest({
|
|
219
|
+
...opts,
|
|
220
|
+
method: "PUT",
|
|
221
|
+
path: `/ex/jira/${cloudId}/rest/api/3/issue/${issueIdOrKey}`,
|
|
222
|
+
});
|
|
223
|
+
},
|
|
143
224
|
},
|
|
144
225
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "New Request Created",
|
|
7
7
|
description:
|
|
8
8
|
"Emit new event when a customer request is created. [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-rest-servicedeskapi-request-get)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.2",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Request Status Updated",
|
|
7
7
|
description:
|
|
8
8
|
"Emit new event when a customer request is updated. [See the documentation](https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-rest-servicedeskapi-request-get)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.2",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|