-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migration is complete with tested components
- Loading branch information
Showing
22 changed files
with
1,000 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,75 @@ | ||
import onedesk from "../../onedesk.app.mjs"; | ||
import app from "../../onedesk.app.mjs"; | ||
|
||
export default { | ||
key: "onedesk-create-item", | ||
name: "Create Item", | ||
description: "Creates a new item. [See the docs](https://www.onedesk.com/developers/#_create_work_item)", | ||
version: "0.0.1", | ||
version: "0.0.2", | ||
type: "action", | ||
props: { | ||
onedesk, | ||
app, | ||
name: { | ||
propDefinition: [ | ||
app, | ||
"itemName", | ||
], | ||
}, | ||
type: { | ||
propDefinition: [ | ||
onedesk, | ||
app, | ||
"itemType", | ||
], | ||
}, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the item", | ||
}, | ||
description: { | ||
type: "string", | ||
label: "Description", | ||
description: "Description of the item", | ||
optional: true, | ||
propDefinition: [ | ||
app, | ||
"itemDescription", | ||
], | ||
}, | ||
spaceId: { | ||
projectExternalId: { | ||
propDefinition: [ | ||
onedesk, | ||
"spaceId", | ||
app, | ||
"projectId", | ||
], | ||
}, | ||
priority: { | ||
propDefinition: [ | ||
onedesk, | ||
app, | ||
"priority", | ||
], | ||
}, | ||
}, | ||
methods: { | ||
createItem(args = {}) { | ||
return this.app.post({ | ||
path: "/items/", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { data } = await this.onedesk.createItem({ | ||
const { | ||
createItem, | ||
name, | ||
type, | ||
description, | ||
projectExternalId, | ||
priority, | ||
} = this; | ||
|
||
const response = await createItem({ | ||
$, | ||
data: { | ||
type: this.type, | ||
name: this.name, | ||
description: this.description, | ||
spaceId: this.spaceId, | ||
priority: this.priority, | ||
name, | ||
type, | ||
description, | ||
projectExternalId, | ||
priority, | ||
}, | ||
$, | ||
}); | ||
|
||
$.export("$summary", `Successfully created item with ID ${data.id}.`); | ||
$.export("$summary", `Successfully created item with ID \`${response.data}\`.`); | ||
|
||
return data; | ||
return response; | ||
}, | ||
}; |
50 changes: 28 additions & 22 deletions
50
components/onedesk/actions/create-message/create-message.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,50 @@ | ||
import onedesk from "../../onedesk.app.mjs"; | ||
import app from "../../onedesk.app.mjs"; | ||
|
||
export default { | ||
key: "onedesk-create-message", | ||
name: "Create Message", | ||
description: "Creates a message or comment. [See the docs](https://www.onedesk.com/developers/#_create_comment)", | ||
version: "0.0.1", | ||
version: "0.0.6", | ||
type: "action", | ||
props: { | ||
onedesk, | ||
itemId: { | ||
app, | ||
conversationExternalId: { | ||
propDefinition: [ | ||
onedesk, | ||
"itemId", | ||
app, | ||
"conversationExternalId", | ||
], | ||
}, | ||
description: { | ||
content: { | ||
type: "string", | ||
label: "Description", | ||
description: "Content of the message", | ||
label: "Content", | ||
description: "Content of the conversation message", | ||
}, | ||
postType: { | ||
propDefinition: [ | ||
onedesk, | ||
"postType", | ||
], | ||
}, | ||
methods: { | ||
createMessage(args = {}) { | ||
return this.app.post({ | ||
path: "/conversation-messages/", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { data } = await this.onedesk.createComment({ | ||
const { | ||
createMessage, | ||
conversationExternalId, | ||
content, | ||
} = this; | ||
|
||
const response = await createMessage({ | ||
$, | ||
data: { | ||
itemId: this.itemId, | ||
description: this.description, | ||
postType: this.postType, | ||
token: this.onedesk._authToken(), | ||
conversationExternalId, | ||
content, | ||
}, | ||
$, | ||
}); | ||
|
||
$.export("$summary", `Successfully created comment with ID ${data}.`); | ||
$.export("$summary", `Successfully created message with ID \`${response.data}\`.`); | ||
|
||
return data; | ||
return response; | ||
}, | ||
}; |
60 changes: 39 additions & 21 deletions
60
components/onedesk/actions/create-project/create-project.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,68 @@ | ||
import onedesk from "../../onedesk.app.mjs"; | ||
import app from "../../onedesk.app.mjs"; | ||
|
||
export default { | ||
key: "onedesk-create-project", | ||
name: "Create Project", | ||
description: "Creates a project/space. [See the docs](https://www.onedesk.com/developers/#_create_space)", | ||
version: "0.0.1", | ||
version: "0.0.2", | ||
type: "action", | ||
props: { | ||
onedesk, | ||
app, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the project.", | ||
}, | ||
type: { | ||
label: "Project Type", | ||
description: "Type of the project.", | ||
propDefinition: [ | ||
onedesk, | ||
app, | ||
"containerType", | ||
], | ||
}, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the project/space", | ||
}, | ||
description: { | ||
type: "string", | ||
label: "Description", | ||
description: "Description of the project/space", | ||
description: "Description of the project", | ||
optional: true, | ||
}, | ||
parentIds: { | ||
parentPortfolioExternalIds: { | ||
propDefinition: [ | ||
onedesk, | ||
"parentIds", | ||
app, | ||
"parentPortfolioExternalIds", | ||
], | ||
}, | ||
}, | ||
methods: { | ||
createProject(args = {}) { | ||
return this.app.post({ | ||
path: "/projects/", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { data } = await this.onedesk.createSpace({ | ||
const { | ||
createProject, | ||
type, | ||
name, | ||
description, | ||
parentPortfolioExternalIds, | ||
} = this; | ||
|
||
const response = await createProject({ | ||
$, | ||
data: { | ||
containerType: this.type, | ||
name: this.name, | ||
description: this.description, | ||
parentIds: this.parentIds, | ||
type, | ||
name, | ||
description, | ||
parentPortfolioExternalIds, | ||
}, | ||
$, | ||
}); | ||
|
||
$.export("$summary", `Successfully created project with ID ${data.id}.`); | ||
$.export("$summary", `Successfully created project with ID \`${response.data}\`.`); | ||
|
||
return data; | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,84 @@ | ||
import onedesk from "../../onedesk.app.mjs"; | ||
import app from "../../onedesk.app.mjs"; | ||
|
||
export default { | ||
key: "onedesk-create-user", | ||
name: "Create User", | ||
description: "Creates a user or a customer. [See the docs](https://www.onedesk.com/developers/#_create_user)", | ||
version: "0.0.1", | ||
version: "0.0.2", | ||
type: "action", | ||
props: { | ||
onedesk, | ||
app, | ||
email: { | ||
type: "string", | ||
label: "Email", | ||
description: "The new user email", | ||
}, | ||
firstName: { | ||
type: "string", | ||
label: "First Name", | ||
description: "The first name of the new user", | ||
optional: true, | ||
}, | ||
lastName: { | ||
type: "string", | ||
label: "Last Name", | ||
description: "The last name of the new user", | ||
}, | ||
email: { | ||
type: "string", | ||
label: "Email", | ||
description: "The new user email", | ||
optional: true, | ||
}, | ||
type: { | ||
propDefinition: [ | ||
onedesk, | ||
app, | ||
"userType", | ||
], | ||
}, | ||
teamId: { | ||
teams: { | ||
type: "string[]", | ||
label: "Team IDs", | ||
propDefinition: [ | ||
onedesk, | ||
app, | ||
"teamId", | ||
], | ||
}, | ||
isAdministrator: { | ||
isAdmin: { | ||
type: "boolean", | ||
label: "Is Administrator", | ||
description: "Set to `true` if the new user should be an administrator", | ||
optional: true, | ||
}, | ||
}, | ||
methods: { | ||
createUser(args = {}) { | ||
return this.app.post({ | ||
path: "/users/", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { data } = await this.onedesk.createUser({ | ||
const { | ||
createUser, | ||
email, | ||
firstName, | ||
lastName, | ||
type, | ||
teams, | ||
isAdmin, | ||
} = this; | ||
|
||
const response = await createUser({ | ||
$, | ||
data: { | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
email: this.email, | ||
type: this.type, | ||
teamId: this.teamId, | ||
isAdministrator: this.isAdministrator, | ||
email, | ||
firstName, | ||
lastName, | ||
type, | ||
teams, | ||
isAdmin, | ||
}, | ||
$, | ||
}); | ||
|
||
$.export("$summary", `Successfully created user with ID ${data.id}.`); | ||
$.export("$summary", `Successfully created user with ID \`${response.data}\`.`); | ||
|
||
return data; | ||
return response; | ||
}, | ||
}; |
Oops, something went wrong.