Skip to content

Commit 3cd73dc

Browse files
committed
Migration is complete with tested components
1 parent 9c95ddb commit 3cd73dc

File tree

22 files changed

+999
-638
lines changed

22 files changed

+999
-638
lines changed
Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,75 @@
1-
import onedesk from "../../onedesk.app.mjs";
1+
import app from "../../onedesk.app.mjs";
22

33
export default {
44
key: "onedesk-create-item",
55
name: "Create Item",
66
description: "Creates a new item. [See the docs](https://www.onedesk.com/developers/#_create_work_item)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
10-
onedesk,
10+
app,
11+
name: {
12+
propDefinition: [
13+
app,
14+
"itemName",
15+
],
16+
},
1117
type: {
1218
propDefinition: [
13-
onedesk,
19+
app,
1420
"itemType",
1521
],
1622
},
17-
name: {
18-
type: "string",
19-
label: "Name",
20-
description: "Name of the item",
21-
},
2223
description: {
23-
type: "string",
24-
label: "Description",
25-
description: "Description of the item",
26-
optional: true,
24+
propDefinition: [
25+
app,
26+
"itemDescription",
27+
],
2728
},
28-
spaceId: {
29+
projectExternalId: {
2930
propDefinition: [
30-
onedesk,
31-
"spaceId",
31+
app,
32+
"projectId",
3233
],
3334
},
3435
priority: {
3536
propDefinition: [
36-
onedesk,
37+
app,
3738
"priority",
3839
],
3940
},
4041
},
42+
methods: {
43+
createItem(args = {}) {
44+
return this.app.post({
45+
path: "/items/",
46+
...args,
47+
});
48+
},
49+
},
4150
async run({ $ }) {
42-
const { data } = await this.onedesk.createItem({
51+
const {
52+
createItem,
53+
name,
54+
type,
55+
description,
56+
projectExternalId,
57+
priority,
58+
} = this;
59+
60+
const response = await createItem({
61+
$,
4362
data: {
44-
type: this.type,
45-
name: this.name,
46-
description: this.description,
47-
spaceId: this.spaceId,
48-
priority: this.priority,
63+
name,
64+
type,
65+
description,
66+
projectExternalId,
67+
priority,
4968
},
50-
$,
5169
});
5270

53-
$.export("$summary", `Successfully created item with ID ${data.id}.`);
71+
$.export("$summary", `Successfully created item with ID \`${response.data}\`.`);
5472

55-
return data;
73+
return response;
5674
},
5775
};
Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
1-
import onedesk from "../../onedesk.app.mjs";
1+
import app from "../../onedesk.app.mjs";
22

33
export default {
44
key: "onedesk-create-message",
55
name: "Create Message",
66
description: "Creates a message or comment. [See the docs](https://www.onedesk.com/developers/#_create_comment)",
7-
version: "0.0.1",
7+
version: "0.0.6",
88
type: "action",
99
props: {
10-
onedesk,
11-
itemId: {
10+
app,
11+
conversationExternalId: {
1212
propDefinition: [
13-
onedesk,
14-
"itemId",
13+
app,
14+
"conversationExternalId",
1515
],
1616
},
17-
description: {
17+
content: {
1818
type: "string",
19-
label: "Description",
20-
description: "Content of the message",
19+
label: "Content",
20+
description: "Content of the conversation message",
2121
},
22-
postType: {
23-
propDefinition: [
24-
onedesk,
25-
"postType",
26-
],
22+
},
23+
methods: {
24+
createMessage(args = {}) {
25+
return this.app.post({
26+
path: "/conversation-messages/",
27+
...args,
28+
});
2729
},
2830
},
2931
async run({ $ }) {
30-
const { data } = await this.onedesk.createComment({
32+
const {
33+
createMessage,
34+
conversationExternalId,
35+
content,
36+
} = this;
37+
38+
const response = await createMessage({
39+
$,
3140
data: {
32-
itemId: this.itemId,
33-
description: this.description,
34-
postType: this.postType,
35-
token: this.onedesk._authToken(),
41+
conversationExternalId,
42+
content,
3643
},
37-
$,
3844
});
3945

40-
$.export("$summary", `Successfully created comment with ID ${data}.`);
46+
$.export("$summary", `Successfully created message with ID \`${response.data}\`.`);
4147

42-
return data;
48+
return response;
4349
},
4450
};
Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,68 @@
1-
import onedesk from "../../onedesk.app.mjs";
1+
import app from "../../onedesk.app.mjs";
22

33
export default {
44
key: "onedesk-create-project",
55
name: "Create Project",
66
description: "Creates a project/space. [See the docs](https://www.onedesk.com/developers/#_create_space)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
10-
onedesk,
10+
app,
11+
name: {
12+
type: "string",
13+
label: "Name",
14+
description: "Name of the project.",
15+
},
1116
type: {
17+
label: "Project Type",
18+
description: "Type of the project.",
1219
propDefinition: [
13-
onedesk,
20+
app,
1421
"containerType",
1522
],
1623
},
17-
name: {
18-
type: "string",
19-
label: "Name",
20-
description: "Name of the project/space",
21-
},
2224
description: {
2325
type: "string",
2426
label: "Description",
25-
description: "Description of the project/space",
27+
description: "Description of the project",
2628
optional: true,
2729
},
28-
parentIds: {
30+
parentPortfolioExternalIds: {
2931
propDefinition: [
30-
onedesk,
31-
"parentIds",
32+
app,
33+
"parentPortfolioExternalIds",
3234
],
3335
},
3436
},
37+
methods: {
38+
createProject(args = {}) {
39+
return this.app.post({
40+
path: "/projects/",
41+
...args,
42+
});
43+
},
44+
},
3545
async run({ $ }) {
36-
const { data } = await this.onedesk.createSpace({
46+
const {
47+
createProject,
48+
type,
49+
name,
50+
description,
51+
parentPortfolioExternalIds,
52+
} = this;
53+
54+
const response = await createProject({
55+
$,
3756
data: {
38-
containerType: this.type,
39-
name: this.name,
40-
description: this.description,
41-
parentIds: this.parentIds,
57+
type,
58+
name,
59+
description,
60+
parentPortfolioExternalIds,
4261
},
43-
$,
4462
});
4563

46-
$.export("$summary", `Successfully created project with ID ${data.id}.`);
64+
$.export("$summary", `Successfully created project with ID \`${response.data}\`.`);
4765

48-
return data;
66+
return response;
4967
},
5068
};
Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,84 @@
1-
import onedesk from "../../onedesk.app.mjs";
1+
import app from "../../onedesk.app.mjs";
22

33
export default {
44
key: "onedesk-create-user",
55
name: "Create User",
66
description: "Creates a user or a customer. [See the docs](https://www.onedesk.com/developers/#_create_user)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
10-
onedesk,
10+
app,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The new user email",
15+
},
1116
firstName: {
1217
type: "string",
1318
label: "First Name",
1419
description: "The first name of the new user",
20+
optional: true,
1521
},
1622
lastName: {
1723
type: "string",
1824
label: "Last Name",
1925
description: "The last name of the new user",
20-
},
21-
email: {
22-
type: "string",
23-
label: "Email",
24-
description: "The new user email",
26+
optional: true,
2527
},
2628
type: {
2729
propDefinition: [
28-
onedesk,
30+
app,
2931
"userType",
3032
],
3133
},
32-
teamId: {
34+
teams: {
35+
type: "string[]",
36+
label: "Team IDs",
3337
propDefinition: [
34-
onedesk,
38+
app,
3539
"teamId",
3640
],
3741
},
38-
isAdministrator: {
42+
isAdmin: {
3943
type: "boolean",
4044
label: "Is Administrator",
4145
description: "Set to `true` if the new user should be an administrator",
4246
optional: true,
4347
},
4448
},
49+
methods: {
50+
createUser(args = {}) {
51+
return this.app.post({
52+
path: "/users/",
53+
...args,
54+
});
55+
},
56+
},
4557
async run({ $ }) {
46-
const { data } = await this.onedesk.createUser({
58+
const {
59+
createUser,
60+
email,
61+
firstName,
62+
lastName,
63+
type,
64+
teams,
65+
isAdmin,
66+
} = this;
67+
68+
const response = await createUser({
69+
$,
4770
data: {
48-
firstName: this.firstName,
49-
lastName: this.lastName,
50-
email: this.email,
51-
type: this.type,
52-
teamId: this.teamId,
53-
isAdministrator: this.isAdministrator,
71+
email,
72+
firstName,
73+
lastName,
74+
type,
75+
teams,
76+
isAdmin,
5477
},
55-
$,
5678
});
5779

58-
$.export("$summary", `Successfully created user with ID ${data.id}.`);
80+
$.export("$summary", `Successfully created user with ID \`${response.data}\`.`);
5981

60-
return data;
82+
return response;
6183
},
6284
};

0 commit comments

Comments
 (0)