-
Couldn't load subscription status.
- Fork 5.5k
New Components - hubstaff #13040
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
Merged
Merged
New Components - hubstaff #13040
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f520151
hubstaff init
luancazarine f271fb5
[Components] hubstaff #12406
luancazarine f804c06
Merge branch 'master' into issue-12406
luancazarine 20aacfe
pnpm update
luancazarine 9cdb7bf
Merge branch 'master' into issue-12406
luancazarine cbcf193
some adjuts
luancazarine 9e11923
Merge branch 'master' into issue-12406
luancazarine e30acde
Merge branch 'master' into issue-12406
luancazarine f36a007
some adjusts
luancazarine 1054bd9
Merge branch 'master' into issue-12406
luancazarine 49e0399
Merge branch 'master' into issue-12406
luancazarine a068e4c
Merge branch 'master' into issue-12406
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,64 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import hubstaff from "../../hubstaff.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubstaff-create-task", | ||
| name: "Create Task", | ||
| description: "Creates a new task on your Hubstaff organization. [See the documentation](https://developer.hubstaff.com/docs/hubstaff_v2#!/tasks/postV2ProjectsProjectIdTasks)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubstaff, | ||
| organizationId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "organizationId", | ||
| ], | ||
| }, | ||
| projectId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "projectId", | ||
| ({ organizationId }) => ({ | ||
| organizationId, | ||
| }), | ||
| ], | ||
| }, | ||
| summary: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "summary", | ||
| ], | ||
| }, | ||
| assigneeId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "userIds", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| type: "string", | ||
| label: "User ID", | ||
| description: "Assignee user ID for this task.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.hubstaff.createTask({ | ||
| $, | ||
| projectId: this.projectId, | ||
| data: { | ||
| summary: this.summary, | ||
| assignee_id: this.assigneeId, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created task with ID ${response.task.id}`); | ||
| return response; | ||
| } catch ({ message }) { | ||
| const { error } = JSON.parse(message); | ||
| throw new ConfigurationError(error); | ||
| } | ||
| }, | ||
| }; |
This file contains hidden or 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,71 @@ | ||
| import { INCLUDE_OPTIONS } from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import hubstaff from "../../hubstaff.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubstaff-list-tasks", | ||
| name: "List Tasks", | ||
| description: "Retrieves a list of all tasks from your Hubstaff organization. [See the documentation](https://developer.hubstaff.com/docs/hubstaff_v2#!/tasks/getV2OrganizationsOrganizationIdTasks)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubstaff, | ||
| organizationId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "organizationId", | ||
| ], | ||
| }, | ||
| projectId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "projectId", | ||
| ({ organizationId }) => ({ | ||
| organizationId, | ||
| }), | ||
| ], | ||
| type: "string[]", | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "status", | ||
| ], | ||
| type: "string[]", | ||
| optional: true, | ||
| }, | ||
| userIds: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "userIds", | ||
| (c) => ({ | ||
| organizationId: c.organizationId, | ||
| }), | ||
| ], | ||
| optional: true, | ||
| }, | ||
| include: { | ||
| type: "string[]", | ||
| label: "Include", | ||
| description: "Specify related data to side load.", | ||
| options: INCLUDE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hubstaff.listAllTasks({ | ||
| $, | ||
| organizationId: this.organizationId, | ||
| params: { | ||
| include: parseObject(this.include), | ||
| project_ids: parseObject(this.projectId), | ||
| user_ids: parseObject(this.userIds), | ||
| status: parseObject(this.status), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.tasks.length} task(s)`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or 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,95 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import hubstaff from "../../hubstaff.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubstaff-update-task", | ||
| name: "Update Task", | ||
| description: "Update a specific task within your Hubstaff organization. [See the documentation](https://developer.hubstaff.com/docs/hubstaff_v2#!/tasks/putV2TasksTaskId)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubstaff, | ||
| organizationId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "organizationId", | ||
| ], | ||
| }, | ||
| projectId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "projectId", | ||
| ({ organizationId }) => ({ | ||
| organizationId, | ||
| }), | ||
| ], | ||
| }, | ||
| taskId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "taskId", | ||
| ({ | ||
| organizationId, projectId, | ||
| }) => ({ | ||
| organizationId, | ||
| projectId, | ||
| }), | ||
| ], | ||
| }, | ||
| summary: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "summary", | ||
| ], | ||
| }, | ||
| assigneeId: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "userIds", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| type: "string", | ||
| label: "User ID", | ||
| description: "Assignee user ID for this task.", | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| hubstaff, | ||
| "status", | ||
| ], | ||
| options: [ | ||
| "active", | ||
| "completed", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| lockVersion: { | ||
| type: "integer", | ||
| label: "Lock Version", | ||
| description: "The lock version from the task fetch in order to update.", | ||
| default: 0, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.hubstaff.updateTask({ | ||
| $, | ||
| taskId: this.taskId, | ||
| data: { | ||
| summary: this.summary, | ||
| lock_version: this.lockVersion, | ||
| status: this.status, | ||
| assignee_id: this.assigneeId, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully updated task with ID ${this.taskId}`); | ||
| return response; | ||
| } catch ({ message }) { | ||
| const { error } = JSON.parse(message); | ||
| throw new ConfigurationError(error); | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
This file contains hidden or 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,41 @@ | ||
| export const INCLUDE_OPTIONS = [ | ||
| { | ||
| label: "Users", | ||
| value: "users", | ||
| }, | ||
| { | ||
| label: "Projects", | ||
| value: "projects", | ||
| }, | ||
| ]; | ||
|
|
||
| export const STATUS_OPTIONS = [ | ||
| { | ||
| value: "active", | ||
| label: "Active", | ||
| }, | ||
| { | ||
| value: "completed", | ||
| label: "Completed", | ||
| }, | ||
| { | ||
| value: "deleted", | ||
| label: "Deleted", | ||
| }, | ||
| { | ||
| value: "archived", | ||
| label: "Archived", | ||
| }, | ||
| { | ||
| value: "archived_native_active", | ||
| label: "Archived Native Active", | ||
| }, | ||
| { | ||
| value: "archived_native_completed", | ||
| label: "Archived Native Completed", | ||
| }, | ||
| { | ||
| value: "archived_native_deleted", | ||
| label: "Archived Native Deleted", | ||
| }, | ||
| ]; |
This file contains hidden or 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,24 @@ | ||
| export const parseObject = (obj) => { | ||
| if (!obj) return undefined; | ||
|
|
||
| if (Array.isArray(obj)) { | ||
| return obj.map((item) => { | ||
| if (typeof item === "string") { | ||
| try { | ||
| return JSON.parse(item); | ||
| } catch (e) { | ||
| return item; | ||
| } | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
| return obj; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.