-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - kiwihr #16504
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
New Components - kiwihr #16504
Changes from all commits
75f1423
9856c12
e535fbb
b47e4ce
bbbeffd
ee0dbd0
d24b541
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,192 @@ | ||
import { ConfigurationError } from "@pipedream/platform"; | ||
import { parseError } from "../../common/utils.mjs"; | ||
import kiwihr from "../../kiwihr.app.mjs"; | ||
|
||
export default { | ||
key: "kiwihr-create-employee", | ||
name: "Create Employee", | ||
description: "Add a new employee to kiwiHR. [See the documentation](https://api.kiwihr.com/api/docs/mutation.doc.html)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
kiwihr, | ||
firstName: { | ||
propDefinition: [ | ||
kiwihr, | ||
"firstName", | ||
], | ||
}, | ||
lastName: { | ||
propDefinition: [ | ||
kiwihr, | ||
"lastName", | ||
], | ||
}, | ||
email: { | ||
propDefinition: [ | ||
kiwihr, | ||
"email", | ||
], | ||
}, | ||
workPhones: { | ||
propDefinition: [ | ||
kiwihr, | ||
"workPhones", | ||
], | ||
optional: true, | ||
}, | ||
employmentStartDate: { | ||
propDefinition: [ | ||
kiwihr, | ||
"employmentStartDate", | ||
], | ||
optional: true, | ||
}, | ||
aboutMe: { | ||
propDefinition: [ | ||
kiwihr, | ||
"aboutMe", | ||
], | ||
optional: true, | ||
}, | ||
gender: { | ||
propDefinition: [ | ||
kiwihr, | ||
"gender", | ||
], | ||
optional: true, | ||
}, | ||
managerId: { | ||
propDefinition: [ | ||
kiwihr, | ||
"managerId", | ||
], | ||
optional: true, | ||
}, | ||
nationality: { | ||
propDefinition: [ | ||
kiwihr, | ||
"nationality", | ||
], | ||
optional: true, | ||
}, | ||
teamIds: { | ||
propDefinition: [ | ||
kiwihr, | ||
"teamIds", | ||
], | ||
optional: true, | ||
}, | ||
positionId: { | ||
propDefinition: [ | ||
kiwihr, | ||
"positionId", | ||
], | ||
optional: true, | ||
}, | ||
locationId: { | ||
propDefinition: [ | ||
kiwihr, | ||
"locationId", | ||
], | ||
optional: true, | ||
}, | ||
birthDate: { | ||
propDefinition: [ | ||
kiwihr, | ||
"birthDate", | ||
], | ||
optional: true, | ||
}, | ||
personalPhone: { | ||
propDefinition: [ | ||
kiwihr, | ||
"personalPhone", | ||
], | ||
optional: true, | ||
}, | ||
personalEmail: { | ||
propDefinition: [ | ||
kiwihr, | ||
"personalEmail", | ||
], | ||
optional: true, | ||
}, | ||
addressStreet: { | ||
propDefinition: [ | ||
kiwihr, | ||
"addressStreet", | ||
], | ||
optional: true, | ||
}, | ||
addressCity: { | ||
propDefinition: [ | ||
kiwihr, | ||
"addressCity", | ||
], | ||
optional: true, | ||
}, | ||
addressState: { | ||
propDefinition: [ | ||
kiwihr, | ||
"addressState", | ||
], | ||
optional: true, | ||
}, | ||
addressPostalCode: { | ||
propDefinition: [ | ||
kiwihr, | ||
"addressPostalCode", | ||
], | ||
optional: true, | ||
}, | ||
addressCountry: { | ||
propDefinition: [ | ||
kiwihr, | ||
"addressCountry", | ||
], | ||
optional: true, | ||
}, | ||
pronouns: { | ||
propDefinition: [ | ||
kiwihr, | ||
"pronouns", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
try { | ||
const { | ||
kiwihr, | ||
addressStreet, | ||
addressCity, | ||
addressState, | ||
addressPostalCode, | ||
addressCountry, | ||
...user | ||
} = this; | ||
|
||
const address = {}; | ||
if (addressStreet) address.street = addressStreet; | ||
if (addressCity) address.city = addressCity; | ||
if (addressState) address.state = addressState; | ||
if (addressPostalCode) address.postalCode = addressPostalCode; | ||
if (addressCountry) address.country = addressCountry; | ||
|
||
if (Object.keys(address).length > 0) { | ||
user.address = address; | ||
} | ||
|
||
const response = await kiwihr.createEmployee({ | ||
user, | ||
}); | ||
|
||
$.export("$summary", `Successfully created employee ${this.firstName} ${this.lastName}`); | ||
return response; | ||
} catch ({ response }) { | ||
const error = parseError(response); | ||
throw new ConfigurationError(error); | ||
} | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,196 @@ | ||||||
import { ConfigurationError } from "@pipedream/platform"; | ||||||
import { parseError } from "../../common/utils.mjs"; | ||||||
import kiwihr from "../../kiwihr.app.mjs"; | ||||||
|
||||||
export default { | ||||||
key: "kiwihr-update-employee-record", | ||||||
name: "Update Employee Record", | ||||||
description: "Update an existing employee's record in kiwiHR. [See the documentation](https://api.kiwihr.it/api/docs/mutation.doc.html)", | ||||||
version: "0.0.1", | ||||||
type: "action", | ||||||
props: { | ||||||
kiwihr, | ||||||
employeeId: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"employeeId", | ||||||
], | ||||||
}, | ||||||
firstName: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"firstName", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
lastName: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"lastName", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
workPhones: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"workPhones", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
employmentStartDate: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"employmentStartDate", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
aboutMe: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"aboutMe", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
gender: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"gender", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
managerId: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"managerId", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
nationality: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"nationality", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
teamIds: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"teamIds", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
positionId: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"positionId", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
locationId: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"locationId", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
birthDate: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"birthDate", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
personalPhone: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"personalPhone", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
personalEmail: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"personalEmail", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
addressStreet: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"addressStreet", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
addressCity: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"addressCity", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
addressState: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"addressState", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
addressPostalCode: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"addressPostalCode", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
addressCountry: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"addressCountry", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
pronouns: { | ||||||
propDefinition: [ | ||||||
kiwihr, | ||||||
"pronouns", | ||||||
], | ||||||
optional: true, | ||||||
}, | ||||||
}, | ||||||
async run({ $ }) { | ||||||
try { | ||||||
const { | ||||||
kiwihr, | ||||||
employeeId, | ||||||
addressStreet, | ||||||
addressCity, | ||||||
addressState, | ||||||
addressPostalCode, | ||||||
addressCountry, | ||||||
...user | ||||||
} = this; | ||||||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
const address = {}; | ||||||
if (addressStreet) address.street = addressStreet; | ||||||
if (addressCity) address.city = addressCity; | ||||||
if (addressState) address.state = addressState; | ||||||
if (addressPostalCode) address.postalCode = addressPostalCode; | ||||||
if (addressCountry) address.country = addressCountry; | ||||||
|
||||||
if (Object.keys(address).length > 0) { | ||||||
user.address = address; | ||||||
} | ||||||
|
||||||
const response = await kiwihr.updateEmployee({ | ||||||
id: employeeId, | ||||||
user, | ||||||
}); | ||||||
|
||||||
$.export("$summary", `Successfully updated employee record for ID: ${this.employeeId}`); | ||||||
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
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. It's not necessary, since I already got it on line 164 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. That was my point. 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'll move to QA since it doesn't affect functionality. |
||||||
return response; | ||||||
} catch ({ response }) { | ||||||
const error = parseError(response); | ||||||
throw new ConfigurationError(error); | ||||||
} | ||||||
}, | ||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const LIMIT = 100; | ||
|
||
export const GENDER_OPTIONS = [ | ||
"MALE", | ||
"FEMALE", | ||
"DIVERSE", | ||
]; |
Uh oh!
There was an error while loading. Please reload this page.