Skip to content

Commit

Permalink
feat(bamboohr): add BambooHR piece with custom api call action
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSelene committed Dec 3, 2024
1 parent 88508b5 commit 8474919
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 1 deletion.
37 changes: 37 additions & 0 deletions packages/pieces/community/bamboohr/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": [
"../../../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {},
"extends": [
"plugin:prettier/recommended"
],
"plugins": ["prettier"]
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions packages/pieces/community/bamboohr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pieces-bamboohr

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build pieces-bamboohr` to build the library.
4 changes: 4 additions & 0 deletions packages/pieces/community/bamboohr/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@activepieces/piece-bamboohr",
"version": "0.0.1"
}
45 changes: 45 additions & 0 deletions packages/pieces/community/bamboohr/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "pieces-bamboohr",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/bamboohr/src",
"projectType": "library",
"release": {
"version": {
"generatorOptions": {
"packageRoot": "dist/{projectRoot}",
"currentVersionResolver": "git-tag"
}
}
},
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/packages/pieces/community/bamboohr",
"tsConfig": "packages/pieces/community/bamboohr/tsconfig.lib.json",
"packageJson": "packages/pieces/community/bamboohr/package.json",
"main": "packages/pieces/community/bamboohr/src/index.ts",
"assets": [
"packages/pieces/community/bamboohr/*.md"
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true
}
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
}
}
}
50 changes: 50 additions & 0 deletions packages/pieces/community/bamboohr/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
createPiece,
PieceAuth,
Property,
} from '@activepieces/pieces-framework';
import { createCustomApiCallAction } from '@activepieces/pieces-common';

export const bambooHrAuth = PieceAuth.CustomAuth({
required: true,
description:
'Follow [these instructions](https://documentation.bamboohr.com/docs/getting-started#authentication) to get your API key',
props: {
companyDomain: Property.ShortText({
displayName: 'Company domain',
description:
'The subdomain used to access BambooHR. If you access BambooHR at https://mycompany.bamboohr.com, then the companyDomain is "mycompany"',
required: true,
}),
apiKey: PieceAuth.SecretText({
displayName: 'API key',
required: true,
}),
},
});

export const bambooHr = createPiece({
displayName: 'BambooHR',
auth: bambooHrAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/bamboohr.png',
authors: ['AdamSelene'],
actions: [
createCustomApiCallAction({
baseUrl: (auth) =>
`https://api.bamboohr.com/api/gateway.php/${
(auth as { companyDomain: string }).companyDomain
}/v1/`,
auth: bambooHrAuth,
authMapping: async (auth) => {
const { apiKey } = auth as { apiKey: string };
return {
Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString(
'base64'
)}`,
};
},
}),
],
triggers: [],
});
19 changes: 19 additions & 0 deletions packages/pieces/community/bamboohr/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
11 changes: 11 additions & 0 deletions packages/pieces/community/bamboohr/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}
5 changes: 4 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
"@activepieces/piece-azure-openai": [
"packages/pieces/community/azure-openai/src/index.ts"
],
"@activepieces/piece-bamboohr": [
"packages/pieces/community/bamboohr/src/index.ts"
],
"@activepieces/piece-bannerbear": [
"packages/pieces/community/bannerbear/src/index.ts"
],
Expand Down Expand Up @@ -622,7 +625,7 @@
"@activepieces/piece-twilio": [
"packages/pieces/community/twilio/src/index.ts"
],
"@activepieces/piece-twin-labs":[
"@activepieces/piece-twin-labs": [
"packages/pieces/community/twin-labs/src/index.ts"
],
"@activepieces/piece-twitter": [
Expand Down

0 comments on commit 8474919

Please sign in to comment.