-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[ACTION] Toggl Client & Project Creation #8973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8f3740b
aafa491
9a6bbb4
1c75d1e
269e4d4
0ccb484
8013b58
8f1d1d1
4dee90d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||
| import toggl from "../../toggl.app.mjs"; | ||||||||
|
|
||||||||
| export default { | ||||||||
| name: "Create a new client", | ||||||||
| version: "0.0.1", | ||||||||
| description: "Create a new Client [See docs here.](https://developers.track.toggl.com/docs/api/clients/index.html#post-create-client)", | ||||||||
| type: "action", | ||||||||
| key: "toggle-create-new-client", | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| props: { | ||||||||
| toggl, | ||||||||
| name: { | ||||||||
| type: "string", | ||||||||
| label: "Name", | ||||||||
| }, | ||||||||
| workspace_id: { | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use camelCase for prop names
Comment on lines
+11
to
+15
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add descriptions, even if very brief, to these props if possible |
||||||||
| type: "integer", | ||||||||
| label: "Workspace ID", | ||||||||
| } | ||||||||
| }, | ||||||||
| async run({ $ }) { | ||||||||
| const response = await this.toggl.createNewClient({ | ||||||||
| name: this.name, | ||||||||
| workspace_id: this.workspace_id, | ||||||||
| }) | ||||||||
|
|
||||||||
| response && $.export("$summary", "Successfully created new client"); | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the response should be the return value of the step
Suggested change
|
||||||||
| } | ||||||||
| } | ||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,138 @@ | ||||||||
| import toggl from "../../toggl.app.mjs"; | ||||||||
|
|
||||||||
| export default { | ||||||||
| name: "Create a new Project", | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| version: "0.0.1", | ||||||||
| description: "Create project for given workspace. [See docs here.](https://developers.track.toggl.com/docs/api/projects#post-workspaceprojects)", | ||||||||
| type: "action", | ||||||||
| key: "toggle-create-new-project", | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| props: { | ||||||||
| toggl, | ||||||||
| name: { | ||||||||
| type: "string", | ||||||||
| label: "Name", | ||||||||
| description: 'unique for client and workspace' | ||||||||
| }, | ||||||||
| workspace_id: { | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is the same as the prop in the previous action, they should be a propDefinition in the app file to be used by both
Suggested change
|
||||||||
| type: "integer", | ||||||||
| label: "Workspace ID", | ||||||||
| description: "Numeric ID of the workspace" | ||||||||
| }, | ||||||||
| client_id: { | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| type: 'integer', | ||||||||
| label: 'client ID', | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| optional: true, | ||||||||
| }, | ||||||||
| client_name: { | ||||||||
| type: 'string', | ||||||||
| label: 'client Name', | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| optional: true, | ||||||||
| }, | ||||||||
| active: { | ||||||||
| type: 'boolean', | ||||||||
| label: 'Active', | ||||||||
| optional: true, | ||||||||
| description: ' Whether the project is archived or not', | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| }, | ||||||||
| is_private: { | ||||||||
| type: 'boolean', | ||||||||
| label: 'Is Private', | ||||||||
| optional: true, | ||||||||
| description: 'Whether project is accessible for only project users or for all workspace users', | ||||||||
| }, | ||||||||
| template: { | ||||||||
| type: 'boolean', | ||||||||
| label: 'Template', | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Template" doesn't sound like a boolean
Suggested change
|
||||||||
| optional: true, | ||||||||
| description: 'Whether the project can be used as a template', | ||||||||
| }, | ||||||||
| template_id: { | ||||||||
| type: 'integer', | ||||||||
| label: 'Template ID', | ||||||||
| description: "Id of the template project used on current project's creation", | ||||||||
| optional: true, | ||||||||
| }, | ||||||||
| billable: { | ||||||||
| type: 'boolean', | ||||||||
| label: 'Billable', | ||||||||
| description: "Whether the project is billable or no (available only for pro workspaces)", | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is available only for pro workspaces, shouldn't it be an optional prop?
Suggested change
|
||||||||
| }, | ||||||||
| auto_estimates: { | ||||||||
| type: 'boolean', | ||||||||
| label: 'Auto Estimates', | ||||||||
| optional: true, | ||||||||
| description: "whether the estimated hours are automatically calculated based on task estimations or manually fixed based on the value of 'estimated_hours' (premium functionality) ", | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| }, | ||||||||
| estimated_hours: { | ||||||||
| type: 'boolean', | ||||||||
| label: 'Estimated Hours', | ||||||||
| optional: true, | ||||||||
| description: "if auto_estimates is true then the sum of task estimations is returned, otherwise user inserted hours (premium functionality)" | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| }, | ||||||||
| color: { | ||||||||
| type: 'string', | ||||||||
| label: 'Color', | ||||||||
| description: 'Project color (hex value in the form of #[0-9a-f]{6}.)', | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| }, | ||||||||
| rate: { | ||||||||
| type: 'integer', | ||||||||
| label: 'Rate', | ||||||||
| description: 'Hourly Rate. premium feature', | ||||||||
| optional: true, | ||||||||
| }, | ||||||||
| fixed_fee: { | ||||||||
| type: 'integer', | ||||||||
| label: 'Rate', | ||||||||
| description: 'Project fixed fee. premium feature', | ||||||||
| optional: true, | ||||||||
| }, | ||||||||
| currency: { | ||||||||
| type: 'string', | ||||||||
| label: 'Currency', | ||||||||
| description: 'Project currency. premium feature', | ||||||||
| optional: true, | ||||||||
| }, | ||||||||
| start_date: { | ||||||||
| type: 'string', | ||||||||
| label: 'Start Date', | ||||||||
| description: 'Start date of a project timeframe', | ||||||||
| }, | ||||||||
| end_date: { | ||||||||
| type: 'string', | ||||||||
| label: 'End Date', | ||||||||
| description: 'End date of a project timeframe', | ||||||||
| }, | ||||||||
|
Comment on lines
+78
to
+105
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. camelCase and capitalization after periods |
||||||||
| }, | ||||||||
| async run({ $ }) { | ||||||||
| const { | ||||||||
| name, workspace_id,client_id,client_name, active, | ||||||||
| is_private, template, template_id, billable, auto_estimates, | ||||||||
| estimated_hours, color, rate, fixed_fee, currency, start_date, end_date} = this; | ||||||||
| const payload = { | ||||||||
| name, | ||||||||
| workspace_id, | ||||||||
| client_id, | ||||||||
| client_name, | ||||||||
| active, | ||||||||
| is_private, | ||||||||
| template, | ||||||||
| template_id, | ||||||||
| billable, | ||||||||
| auto_estimates, | ||||||||
| estimated_hours, | ||||||||
| color, | ||||||||
| rate, | ||||||||
| fixed_fee, | ||||||||
| currency, | ||||||||
| start_date, | ||||||||
| end_date | ||||||||
| } | ||||||||
| const response = await this.toggl.createProject({ | ||||||||
| workspace_id: this.workspace_id, | ||||||||
| payload, | ||||||||
| }) | ||||||||
|
|
||||||||
| response && $.export("$summary", `Successfully created new project, ${response.name}`); | ||||||||
| } | ||||||||
| } | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import toggl from "../../toggl.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Update new client", | ||
| version: "0.0.1", | ||
| description: "Upate a Client [See docs here.](https://developers.track.toggl.com/docs/api/clients/index.html#put-change-client)", | ||
| type: "action", | ||
| key: "toggle-update-client", | ||
| props: { | ||
| toggl, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| }, | ||
| workspace_id: { | ||
| type: "integer", | ||
| label: "Workspace ID", | ||
| }, | ||
| client_id: { | ||
| type: "integer", | ||
| label: "Client ID", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.toggl.updateClient({ | ||
| name: this.name, | ||
| workspace_id: this.workspace_id, | ||
| client_id: this.client_id | ||
| }) | ||
|
|
||
| response && $.export("$summary", "Successfully updated client info."); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,144 @@ | ||||||
| import toggl from "../../toggl.app.mjs"; | ||||||
|
|
||||||
| export default { | ||||||
| name: "Update a Project", | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| version: "0.0.1", | ||||||
| description: "Update project for given workspace. [See docs here.](https://developers.track.toggl.com/docs/api/projects#post-workspaceprojects)", | ||||||
| type: "action", | ||||||
| key: "toggle-update-project", | ||||||
| props: { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These props also need to be updated with camelCase and proper capitalization |
||||||
| toggl, | ||||||
| workspace_id: { | ||||||
| type: "integer", | ||||||
| label: "Workspace ID", | ||||||
| description: "Numeric ID of the workspace" | ||||||
| }, | ||||||
| project_id: { | ||||||
| type: "integer", | ||||||
| label: "Project ID", | ||||||
| description: "Numeric ID of the project" | ||||||
| }, | ||||||
| name: { | ||||||
| type: "string", | ||||||
| label: "Name", | ||||||
| description: 'unique for client and workspace' | ||||||
| }, | ||||||
| client_id: { | ||||||
| type: 'integer', | ||||||
| label: 'client ID', | ||||||
| optional: true, | ||||||
| }, | ||||||
| client_name: { | ||||||
| type: 'string', | ||||||
| label: 'client Name', | ||||||
| optional: true, | ||||||
| }, | ||||||
| active: { | ||||||
| type: 'boolean', | ||||||
| label: 'Active', | ||||||
| optional: true, | ||||||
| description: ' Whether the project is archived or not', | ||||||
| }, | ||||||
| is_private: { | ||||||
| type: 'boolean', | ||||||
| label: 'Is Private', | ||||||
| optional: true, | ||||||
| description: 'Whether project is accessible for only project users or for all workspace users', | ||||||
| }, | ||||||
| template: { | ||||||
| type: 'boolean', | ||||||
| label: 'Template', | ||||||
| optional: true, | ||||||
| description: 'Whether the project can be used as a template', | ||||||
| }, | ||||||
| template_id: { | ||||||
| type: 'integer', | ||||||
| label: 'Template ID', | ||||||
| description: "Id of the template project used on current project's creation", | ||||||
| optional: true, | ||||||
| }, | ||||||
| billable: { | ||||||
| type: 'boolean', | ||||||
| label: 'Billable', | ||||||
| description: "Whether the project is billable or no (available only for pro workspaces)", | ||||||
| }, | ||||||
| auto_estimates: { | ||||||
| type: 'boolean', | ||||||
| label: 'Auto Estimates', | ||||||
| optional: true, | ||||||
| description: "whether the estimated hours are automatically calculated based on task estimations or manually fixed based on the value of 'estimated_hours' (premium functionality) ", | ||||||
| }, | ||||||
| estimated_hours: { | ||||||
| type: 'boolean', | ||||||
| label: 'Estimated Hours', | ||||||
| optional: true, | ||||||
| description: "if auto_estimates is true then the sum of task estimations is returned, otherwise user inserted hours (premium functionality)" | ||||||
|
|
||||||
| }, | ||||||
| color: { | ||||||
| type: 'string', | ||||||
| label: 'Color', | ||||||
| description: 'Project color', | ||||||
| }, | ||||||
| rate: { | ||||||
| type: 'integer', | ||||||
| label: 'Rate', | ||||||
| description: 'Hourly Rate. premium feature', | ||||||
| optional: true, | ||||||
| }, | ||||||
| fixed_fee: { | ||||||
| type: 'integer', | ||||||
| label: 'Rate', | ||||||
| description: 'Project fixed fee. premium feature', | ||||||
| optional: true, | ||||||
| }, | ||||||
| currency: { | ||||||
| type: 'string', | ||||||
| label: 'Currency', | ||||||
| description: 'Project currency. premium feature', | ||||||
| optional: true, | ||||||
| }, | ||||||
| start_date: { | ||||||
| type: 'string', | ||||||
| label: 'Start Date', | ||||||
| description: 'Start date of a project timeframe', | ||||||
| }, | ||||||
| end_date: { | ||||||
| type: 'string', | ||||||
| label: 'End Date', | ||||||
| description: 'End date of a project timeframe', | ||||||
| }, | ||||||
| }, | ||||||
| async run({ $ }) { | ||||||
| const { | ||||||
| name, workspace_id,client_id,client_name, active, | ||||||
| is_private, template, template_id, billable, auto_estimates, | ||||||
| estimated_hours, color, rate, fixed_fee, currency, start_date, end_date} = this; | ||||||
| const data = { | ||||||
| name, | ||||||
| workspace_id, | ||||||
| client_id, | ||||||
| client_name, | ||||||
| active, | ||||||
| is_private, | ||||||
| template, | ||||||
| template_id, | ||||||
| billable, | ||||||
| auto_estimates, | ||||||
| estimated_hours, | ||||||
| color, | ||||||
| rate, | ||||||
| fixed_fee, | ||||||
| currency, | ||||||
| start_date, | ||||||
| end_date | ||||||
| } | ||||||
| const response = await this.toggl.updateProject({ | ||||||
| workspace_id: this.workspace_id, | ||||||
| project_id: this.project_id, | ||||||
| payload: data, | ||||||
| }) | ||||||
|
|
||||||
| response && $.export("$summary", `Successfully created updated the ${response.name} project`); | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.