feat(mysendinbox): piece added (#11367)
Co-authored-by: Theo dammaretz <theo@dammaretz.fr>
This commit is contained in:
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
@@ -5,4 +5,4 @@
|
||||
"firsttris.vscode-jest-runner",
|
||||
"rvest.vs-code-prettier-eslint"
|
||||
]
|
||||
}
|
||||
}
|
||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -16,4 +16,4 @@
|
||||
"autoAttachChildProcesses": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
33
packages/pieces/community/mysendingbox/.eslintrc.json
Normal file
33
packages/pieces/community/mysendingbox/.eslintrc.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
7
packages/pieces/community/mysendingbox/README.md
Normal file
7
packages/pieces/community/mysendingbox/README.md
Normal file
@@ -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.
|
||||
13
packages/pieces/community/mysendingbox/package.json
Normal file
13
packages/pieces/community/mysendingbox/package.json
Normal file
@@ -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:*"
|
||||
}
|
||||
}
|
||||
59
packages/pieces/community/mysendingbox/src/index.ts
Normal file
59
packages/pieces/community/mysendingbox/src/index.ts
Normal file
@@ -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: [],
|
||||
});
|
||||
20
packages/pieces/community/mysendingbox/tsconfig.json
Normal file
20
packages/pieces/community/mysendingbox/tsconfig.json
Normal file
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
12
packages/pieces/community/mysendingbox/tsconfig.lib.json
Normal file
12
packages/pieces/community/mysendingbox/tsconfig.lib.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"baseUrl": ".",
|
||||
"paths": {},
|
||||
"outDir": "../../../../dist/packages/pieces/community/mysendingbox",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
@@ -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"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user