-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] onbee_app #13861 #14339
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
Changes from all commits
Commits
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
59 changes: 59 additions & 0 deletions
59
components/onbee_app/actions/create-employee/create-employee.mjs
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,59 @@ | ||
| import app from "../../onbee_app.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "onbee_app-create-employee", | ||
| name: "Create Employee", | ||
| description: "Adds an employee to the system. [See the documentation](https://docs.onboardee.io/api/#tag/Employees/paths/~1employees~1add/post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| firstname: { | ||
| propDefinition: [ | ||
| app, | ||
| "firstname", | ||
| ], | ||
| }, | ||
| surname: { | ||
| propDefinition: [ | ||
| app, | ||
| "surname", | ||
| ], | ||
| }, | ||
| privateEmail: { | ||
| propDefinition: [ | ||
| app, | ||
| "privateEmail", | ||
| ], | ||
| }, | ||
| workEmail: { | ||
| propDefinition: [ | ||
| app, | ||
| "workEmail", | ||
| ], | ||
| }, | ||
| dateOfBirth: { | ||
| propDefinition: [ | ||
| app, | ||
| "dateOfBirth", | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| const response = await this.app.createEmployee({ | ||
| $, | ||
| data: { | ||
| firstname: this.firstname, | ||
| surname: this.surname, | ||
| privateEmail: this.privateEmail, | ||
| workEmail: this.workEmail, | ||
| dateOfBirth: this.dateOfBirth, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created Employee with ID '${response.payload._id}'`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
29 changes: 29 additions & 0 deletions
29
components/onbee_app/actions/delete-employee/delete-employee.mjs
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,29 @@ | ||
| import app from "../../onbee_app.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "onbee_app-delete-employee", | ||
| name: "Delete Employee", | ||
| description: "Delete an employee with the specified ID. [See the documentation](https://docs.onboardee.io/api/#tag/Employees/paths/~1employees~1edit~1{id}/post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| employeeId: { | ||
| propDefinition: [ | ||
| app, | ||
| "employeeId", | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| const response = await this.app.deleteEmployee({ | ||
| $, | ||
| employeeId: this.employeeId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted Employee with ID '${this.employeeId}'`); | ||
|
|
||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
68 changes: 68 additions & 0 deletions
68
components/onbee_app/actions/update-employee/update-employee.mjs
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,68 @@ | ||
| import app from "../../onbee_app.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "onbee_app-update-employee", | ||
| name: "Update Employee", | ||
| description: "Update an employee with the specified ID. [See the documentation](https://docs.onboardee.io/api/#tag/Employees/paths/~1employees~1edit~1{id}/post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| employeeId: { | ||
| propDefinition: [ | ||
| app, | ||
| "employeeId", | ||
| ], | ||
| }, | ||
| firstname: { | ||
| propDefinition: [ | ||
| app, | ||
| "firstname", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| surname: { | ||
| propDefinition: [ | ||
| app, | ||
| "surname", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| privateEmail: { | ||
| propDefinition: [ | ||
| app, | ||
| "privateEmail", | ||
| ], | ||
| }, | ||
| workEmail: { | ||
| propDefinition: [ | ||
| app, | ||
| "workEmail", | ||
| ], | ||
| }, | ||
| dateOfBirth: { | ||
| propDefinition: [ | ||
| app, | ||
| "dateOfBirth", | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| const response = await this.app.updateEmployee({ | ||
| $, | ||
| employeeId: this.employeeId, | ||
| data: { | ||
| firstname: this.firstname, | ||
| surname: this.surname, | ||
| privateEmail: this.privateEmail, | ||
| workEmail: this.workEmail, | ||
| dateOfBirth: this.dateOfBirth, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", `Successfully updated Employee with ID '${response.payload._id}'`); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 |
|---|---|---|
| @@ -1,11 +1,104 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "onbee_app", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| employeeId: { | ||
| type: "string", | ||
| label: "Employee ID", | ||
| description: "ID of the Employee", | ||
| async options() { | ||
| const response = await this.getEmployees(); | ||
|
|
||
| const employeeIds = response.payload; | ||
|
|
||
| return employeeIds.map(({ | ||
| _id, firstname, surname, | ||
| }) => ({ | ||
| value: _id, | ||
| label: `${firstname} ${surname}`, | ||
| })); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| firstname: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "First name of the employee", | ||
| }, | ||
| surname: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "Last name of the employee", | ||
| }, | ||
| privateEmail: { | ||
| type: "string", | ||
| label: "Private Email", | ||
| description: "Private email of the employee", | ||
| optional: true, | ||
| }, | ||
| workEmail: { | ||
| type: "string", | ||
| label: "Work Email", | ||
| description: "Work email of the employee", | ||
| optional: true, | ||
| }, | ||
| dateOfBirth: { | ||
| type: "string", | ||
| label: "Date of Birth", | ||
| description: "Date of birth of the employee, i.e.: `1997-12-03`", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return `https://${this.$auth.workspace_name}.onbee.app/api`; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| ...headers, | ||
| Authorization: `Bearer ${this.$auth.api_token}`, | ||
| }, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async createEmployee(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/employees/add", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async updateEmployee({ | ||
| employeeId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/employees/edit/${employeeId}`, | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async deleteEmployee({ | ||
| employeeId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/employee-delete/${employeeId}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async getEmployees(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/employee-list/", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/onbee_app", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Onbee.app Components", | ||
| "main": "onbee_app.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.