-
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.
ActiTime: New action and source components (#13798)
- Loading branch information
Showing
15 changed files
with
710 additions
and
8 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
components/actitime/actions/create-customer/create-customer.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import app from "../../actitime.app.mjs"; | ||
|
||
export default { | ||
key: "actitime-create-customer", | ||
name: "Create Customer", | ||
description: "Creates a new customer. [See the documentation](https://online.actitime.com/pipedream/api/v1/swagger).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "The name of the customer.", | ||
}, | ||
description: { | ||
type: "string", | ||
label: "Description", | ||
description: "Details about the customer.", | ||
optional: true, | ||
}, | ||
}, | ||
methods: { | ||
createCustomer(args = {}) { | ||
return this.app.post({ | ||
path: "/customers", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
createCustomer, | ||
name, | ||
description, | ||
} = this; | ||
|
||
const response = await createCustomer({ | ||
$, | ||
data: { | ||
name, | ||
description, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created customer with ID \`${response.id}\`.`); | ||
return response; | ||
}, | ||
}; |
107 changes: 107 additions & 0 deletions
107
components/actitime/actions/create-task/create-task.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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import { ConfigurationError } from "@pipedream/platform"; | ||
import app from "../../actitime.app.mjs"; | ||
|
||
export default { | ||
key: "actitime-create-task", | ||
name: "Create Task", | ||
description: "Creates a new task. [See the documentation](https://online.actitime.com/pipedream/api/v1/swagger).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
projectId: { | ||
propDefinition: [ | ||
app, | ||
"projectId", | ||
], | ||
}, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "The name of the task.", | ||
}, | ||
description: { | ||
type: "string", | ||
label: "Description", | ||
description: "Details about the task.", | ||
optional: true, | ||
}, | ||
typeOfWorkId: { | ||
propDefinition: [ | ||
app, | ||
"typeOfWorkId", | ||
], | ||
}, | ||
deadline: { | ||
type: "string", | ||
label: "Deadline", | ||
description: "The deadline for the task. Eg. `2024-12-31`.", | ||
optional: true, | ||
}, | ||
estimatedTime: { | ||
type: "integer", | ||
label: "Estimated Time", | ||
description: "The estimated time for the task in minutes.", | ||
optional: true, | ||
}, | ||
status: { | ||
type: "string", | ||
label: "Status", | ||
description: "The status of the task. This field is mutually exclusive with **Workflow Status ID**.", | ||
optional: true, | ||
options: [ | ||
"open", | ||
"completed", | ||
], | ||
}, | ||
workflowStatusId: { | ||
description: "The ID of the workflow status. This field is mutually exclusive with **Status**.", | ||
propDefinition: [ | ||
app, | ||
"workflowStatusId", | ||
], | ||
}, | ||
}, | ||
methods: { | ||
createTask(args = {}) { | ||
return this.app.post({ | ||
path: "/tasks", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
createTask, | ||
name, | ||
description, | ||
status, | ||
workflowStatusId, | ||
typeOfWorkId, | ||
deadline, | ||
estimatedTime, | ||
projectId, | ||
} = this; | ||
|
||
if (status && workflowStatusId) { | ||
throw new ConfigurationError("The **Status** and **Workflow Status ID** fields are mutually exclusive. Please provide only one of them."); | ||
} | ||
|
||
const response = await createTask({ | ||
$, | ||
data: { | ||
name, | ||
description, | ||
status, | ||
workflowStatusId, | ||
typeOfWorkId, | ||
deadline, | ||
estimatedTime, | ||
projectId, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created task with ID \`${response.id}\`.`); | ||
return response; | ||
}, | ||
}; |
67 changes: 67 additions & 0 deletions
67
components/actitime/actions/modify-leave-time/modify-leave-time.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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import app from "../../actitime.app.mjs"; | ||
|
||
export default { | ||
key: "actitime-modify-leave-time", | ||
name: "Modify Leave Time", | ||
description: "Changes the existing leave time record with a given value in actiTIME. [See the documentation](https://online.actitime.com/pipedream/api/v1/swagger).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
userId: { | ||
propDefinition: [ | ||
app, | ||
"userId", | ||
], | ||
}, | ||
date: { | ||
type: "string", | ||
label: "Date", | ||
description: "The date of the leave record. Date in following format: `YYYY-MM-DD` OR `today`.", | ||
}, | ||
leaveTypeId: { | ||
propDefinition: [ | ||
app, | ||
"leaveTypeId", | ||
], | ||
}, | ||
leaveTime: { | ||
type: "integer", | ||
label: "Leave Time", | ||
description: "The leave time in minutes.", | ||
}, | ||
}, | ||
methods: { | ||
updateLeaveTime({ | ||
userId, date, leaveTypeId, ...args | ||
} = {}) { | ||
return this.app.patch({ | ||
path: `/leavetime/${userId}/${date}/${leaveTypeId}`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
updateLeaveTime, | ||
userId, | ||
date, | ||
leaveTypeId, | ||
leaveTime, | ||
} = this; | ||
|
||
const response = await updateLeaveTime({ | ||
$, | ||
userId, | ||
date, | ||
leaveTypeId, | ||
data: { | ||
leaveTime, | ||
}, | ||
}); | ||
|
||
$.export("$summary", "Successfully modified leave time record."); | ||
|
||
return response; | ||
}, | ||
}; |
Oops, something went wrong.