diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 109c930803..999eb07a42 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,4 +5,4 @@ "firsttris.vscode-jest-runner", "rvest.vs-code-prettier-eslint" ] -} +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 64f1cde597..5e389014ef 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,4 +16,4 @@ "autoAttachChildProcesses": false } ] -} +} \ No newline at end of file diff --git a/packages/pieces/community/mysendingbox/.eslintrc.json b/packages/pieces/community/mysendingbox/.eslintrc.json new file mode 100644 index 0000000000..4a4e695c54 --- /dev/null +++ b/packages/pieces/community/mysendingbox/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": [ + "../../../../.eslintrc.base.json" + ], + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts", + "*.tsx", + "*.js", + "*.jsx" + ], + "rules": {} + }, + { + "files": [ + "*.ts", + "*.tsx" + ], + "rules": {} + }, + { + "files": [ + "*.js", + "*.jsx" + ], + "rules": {} + } + ] +} \ No newline at end of file diff --git a/packages/pieces/community/mysendingbox/README.md b/packages/pieces/community/mysendingbox/README.md new file mode 100644 index 0000000000..4c41a9cbde --- /dev/null +++ b/packages/pieces/community/mysendingbox/README.md @@ -0,0 +1,7 @@ +# pieces-mysendingbox + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build pieces-mysendingbox` to build the library. diff --git a/packages/pieces/community/mysendingbox/package.json b/packages/pieces/community/mysendingbox/package.json new file mode 100644 index 0000000000..b855c77147 --- /dev/null +++ b/packages/pieces/community/mysendingbox/package.json @@ -0,0 +1,13 @@ +{ + "name": "@activepieces/piece-mysendingbox", + "version": "0.0.1", + "scripts": { + "build": "tsc -p tsconfig.lib.json", + "lint": "eslint 'src/**/*.ts'" + }, + "dependencies": { + "@activepieces/pieces-common": "workspace:*", + "@activepieces/pieces-framework": "workspace:*", + "@activepieces/shared": "workspace:*" + } +} diff --git a/packages/pieces/community/mysendingbox/src/index.ts b/packages/pieces/community/mysendingbox/src/index.ts new file mode 100644 index 0000000000..00d1b1aca9 --- /dev/null +++ b/packages/pieces/community/mysendingbox/src/index.ts @@ -0,0 +1,59 @@ +import { createPiece, PieceAuth } from '@activepieces/pieces-framework'; +import { + createCustomApiCallAction, + httpClient, + HttpMethod, +} from '@activepieces/pieces-common'; + +const markdown = ` +MySendingBox API keyis available under the developer portal. +(https://app.mysendingbox.fr/account/keys)`; + +export const mySendingBoxPieceAuth = PieceAuth.CustomAuth({ + description: markdown, + required: true, + props: { + apiKey: PieceAuth.SecretText({ + displayName: 'API Key', + required: true, + }), + }, + validate: async ({ auth }) => { + if (auth) { + await httpClient.sendRequest({ + method: HttpMethod.GET, + url: 'https://api.mysendingbox.fr/', + headers: { + Authorization: `Basic ${btoa(`${auth.apiKey}:`)}`, + }, + }); + return { + valid: true, + }; + } + return { + valid: false, + error: 'Invalid Api Key', + }; + }, +}); + +export const mysendingbox = createPiece({ + displayName: 'Mysendingbox', + auth: mySendingBoxPieceAuth, + minimumSupportedRelease: '0.78.0', + logoUrl: 'https://cdn.activepieces.com/pieces/mysendingbox.png', + authors: ['Blightwidow'], + actions: [ + createCustomApiCallAction({ + baseUrl: () => { + return 'https://api.mysendingbox.fr'; + }, + auth: mySendingBoxPieceAuth, + authMapping: async (auth) => ({ + Authorization: `Basic ${btoa(`${auth.props.apiKey}:`)}`, + }), + }), + ], + triggers: [], +}); diff --git a/packages/pieces/community/mysendingbox/tsconfig.json b/packages/pieces/community/mysendingbox/tsconfig.json new file mode 100644 index 0000000000..eff240ac14 --- /dev/null +++ b/packages/pieces/community/mysendingbox/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "importHelpers": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noPropertyAccessFromIndexSignature": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/packages/pieces/community/mysendingbox/tsconfig.lib.json b/packages/pieces/community/mysendingbox/tsconfig.lib.json new file mode 100644 index 0000000000..e6defdd450 --- /dev/null +++ b/packages/pieces/community/mysendingbox/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "baseUrl": ".", + "paths": {}, + "outDir": "../../../../dist/packages/pieces/community/mysendingbox", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index d61087ef11..0caf5b820b 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -746,6 +746,9 @@ "@activepieces/piece-murf-api": [ "packages/pieces/community/murf-api/src/index.ts" ], + "@activepieces/piece-mysendingbox": [ + "packages/pieces/community/mysendingbox/src/index.ts" + ], "@activepieces/piece-mysql": [ "packages/pieces/community/mysql/src/index.ts" ],