Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": ["../../../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*", "package.json"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-clearout
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-clearout` to build the library.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@activepieces/piece-clearout",
|
||||
"version": "0.0.10"
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "pieces-clearout",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/clearout/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/clearout",
|
||||
"tsConfig": "packages/pieces/community/clearout/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/clearout/package.json",
|
||||
"main": "packages/pieces/community/clearout/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/clearout/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/clearout/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"prebuild"
|
||||
]
|
||||
},
|
||||
"publish": {
|
||||
"command": "node tools/scripts/publish.mjs pieces-clearout {args.ver} {args.tag}",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
},
|
||||
"prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/clearout",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Massene-Mail-Validierung und -Überprüfung",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "Das API Token für Ihr Clearout Konto",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Authentifizieren Sie sich mit Ihrem Clearout-Konto. Holen Sie sich Ihr API-Token von Ihrem Clearout-Konto unter Einstellungen > API.",
|
||||
"Instant Verify": "Sofort überprüfen",
|
||||
"Custom API Call": "Eigener API-Aufruf",
|
||||
"Instant Verify an email address": "Sofort eine E-Mail-Adresse verifizieren",
|
||||
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
|
||||
"Email": "E-Mail",
|
||||
"Method": "Methode",
|
||||
"Headers": "Kopfzeilen",
|
||||
"Query Parameters": "Abfrageparameter",
|
||||
"Body": "Körper",
|
||||
"Response is Binary ?": "Antwort ist binär?",
|
||||
"No Error on Failure": "Kein Fehler bei Fehler",
|
||||
"Timeout (in seconds)": "Timeout (in Sekunden)",
|
||||
"Email address to verify": "Zu überprüfende E-Mail-Adresse",
|
||||
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
|
||||
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
|
||||
"GET": "ERHALTEN",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "LÖSCHEN",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Validación y verificación masiva de correo electrónico",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "El token de API para tu cuenta de Clear out",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Autenticar con tu cuenta de Clear out. Obtén tu token API de tu cuenta de Clear out en Ajustes > API.",
|
||||
"Instant Verify": "Verificar instantáneamente",
|
||||
"Custom API Call": "Llamada API personalizada",
|
||||
"Instant Verify an email address": "Verifique al instante una dirección de correo electrónico",
|
||||
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
|
||||
"Email": "E-mail",
|
||||
"Method": "Método",
|
||||
"Headers": "Encabezados",
|
||||
"Query Parameters": "Parámetros de consulta",
|
||||
"Body": "Cuerpo",
|
||||
"Response is Binary ?": "¿Respuesta es binaria?",
|
||||
"No Error on Failure": "No hay ningún error en fallo",
|
||||
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
|
||||
"Email address to verify": "Dirección de email para verificar",
|
||||
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
|
||||
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
|
||||
"GET": "RECOGER",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "BORRAR",
|
||||
"HEAD": "LIMPIO"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Validation et vérification en masse des emails",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "Le jeton API pour votre compte Clearout",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Authentifiez-vous avec votre compte Clearout. Obtenez votre jeton API depuis votre compte Clearout dans Paramètres > API.",
|
||||
"Instant Verify": "Vérification instantanée",
|
||||
"Custom API Call": "Appel API personnalisé",
|
||||
"Instant Verify an email address": "Vérifier instantanément une adresse e-mail",
|
||||
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
|
||||
"Email": "Courriel",
|
||||
"Method": "Méthode",
|
||||
"Headers": "En-têtes",
|
||||
"Query Parameters": "Paramètres de requête",
|
||||
"Body": "Corps",
|
||||
"Response is Binary ?": "La réponse est Binaire ?",
|
||||
"No Error on Failure": "Aucune erreur en cas d'échec",
|
||||
"Timeout (in seconds)": "Délai d'attente (en secondes)",
|
||||
"Email address to verify": "Adresse e-mail à vérifier",
|
||||
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
|
||||
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
|
||||
"GET": "OBTENIR",
|
||||
"POST": "POSTER",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "EFFACER",
|
||||
"DELETE": "SUPPRIMER",
|
||||
"HEAD": "TÊTE"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "一括メールアドレスの検証と認証",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "ClearoutアカウントのAPIトークン",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Clearoutアカウントで認証します。設定>APIからClearoutアカウントからAPIトークンを取得します。",
|
||||
"Instant Verify": "インスタント認証",
|
||||
"Custom API Call": "カスタムAPI通話",
|
||||
"Instant Verify an email address": "メールアドレスを即座に確認する",
|
||||
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
|
||||
"Email": "Eメールアドレス",
|
||||
"Method": "方法",
|
||||
"Headers": "ヘッダー",
|
||||
"Query Parameters": "クエリパラメータ",
|
||||
"Body": "本文",
|
||||
"Response is Binary ?": "応答はバイナリですか?",
|
||||
"No Error on Failure": "失敗時にエラーはありません",
|
||||
"Timeout (in seconds)": "タイムアウト(秒)",
|
||||
"Email address to verify": "確認するメールアドレス",
|
||||
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
|
||||
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
|
||||
"GET": "取得",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "削除",
|
||||
"HEAD": "頭"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Bulk e-mail validatie en verificatie",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "De API-sleutel voor uw Clearout account",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Verifieer met uw Clearout account. Haal uw API-sleutel op via uw Clearout account onder Instellingen > API.",
|
||||
"Instant Verify": "Direct verifiëren",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Instant Verify an email address": "Direct een e-mailadres verifiëren",
|
||||
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
|
||||
"Email": "E-mail",
|
||||
"Method": "Methode",
|
||||
"Headers": "Kopteksten",
|
||||
"Query Parameters": "Query parameters",
|
||||
"Body": "Lichaam",
|
||||
"Response is Binary ?": "Antwoord is binair?",
|
||||
"No Error on Failure": "Geen fout bij fout",
|
||||
"Timeout (in seconds)": "Time-out (in seconden)",
|
||||
"Email address to verify": "E-mailadres om te verifiëren",
|
||||
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
|
||||
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
|
||||
"GET": "KRIJG",
|
||||
"POST": "POSTE",
|
||||
"PATCH": "BEKIJK",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "VERWIJDEREN",
|
||||
"HEAD": "HOOFD"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Validação e verificação de e-mail em massa",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "O token de API para sua conta Clearout",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Autenticar com sua conta do Clearout. Obtenha sua token de API de sua conta Clearout em Configurações > API.",
|
||||
"Instant Verify": "Verificação Instantânea",
|
||||
"Custom API Call": "Chamada de API personalizada",
|
||||
"Instant Verify an email address": "Verifique um endereço de e-mail instantâneo",
|
||||
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
|
||||
"Email": "e-mail",
|
||||
"Method": "Método",
|
||||
"Headers": "Cabeçalhos",
|
||||
"Query Parameters": "Parâmetros da consulta",
|
||||
"Body": "Conteúdo",
|
||||
"Response is Binary ?": "A resposta é binária ?",
|
||||
"No Error on Failure": "Nenhum erro no Failure",
|
||||
"Timeout (in seconds)": "Tempo limite (em segundos)",
|
||||
"Email address to verify": "Endereço de email para verificar",
|
||||
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
|
||||
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
|
||||
"GET": "OBTER",
|
||||
"POST": "POSTAR",
|
||||
"PATCH": "COMPRAR",
|
||||
"PUT": "COLOCAR",
|
||||
"DELETE": "EXCLUIR",
|
||||
"HEAD": "CABEÇA"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"Clearout": "Очистка",
|
||||
"Bulk email validation and verification": "Массовая проверка и проверка электронной почты",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "Ключ API для вашего аккаунта Clearout",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Аутентифицироваться с вашим Clearout аккаунтом. Получите ваш API токен с вашего Clearout аккаунта в меню Settings > API.",
|
||||
"Instant Verify": "Мгновенная проверка",
|
||||
"Custom API Call": "Пользовательский вызов API",
|
||||
"Instant Verify an email address": "Мгновенная проверка адреса электронной почты",
|
||||
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
|
||||
"Email": "Почта",
|
||||
"Method": "Метод",
|
||||
"Headers": "Заголовки",
|
||||
"Query Parameters": "Параметры запроса",
|
||||
"Body": "Тело",
|
||||
"No Error on Failure": "Нет ошибок при ошибке",
|
||||
"Timeout (in seconds)": "Таймаут (в секундах)",
|
||||
"Email address to verify": "Адрес электронной почты для проверки",
|
||||
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
|
||||
"GET": "ПОЛУЧИТЬ",
|
||||
"POST": "ПОСТ",
|
||||
"PATCH": "ПАТЧ",
|
||||
"PUT": "ПОКУПИТЬ",
|
||||
"DELETE": "УДАЛИТЬ",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Bulk email validation and verification",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "The API token for your Clearout account",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.",
|
||||
"Instant Verify": "Instant Verify",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Instant Verify an email address": "Instant Verify an email address",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Email": "Email",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"Email address to verify": "Email address to verify",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"Clearout": "Clearout",
|
||||
"Bulk email validation and verification": "Bulk email validation and verification",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "The API token for your Clearout account",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.",
|
||||
"Instant Verify": "Instant Verify",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Instant Verify an email address": "Instant Verify an email address",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Email": "Email",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"Email address to verify": "Email address to verify",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Bulk email validation and verification": "Bulk email validation and verification",
|
||||
"API Token": "API Token",
|
||||
"The API token for your Clearout account": "The API token for your Clearout account",
|
||||
"Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.": "Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.",
|
||||
"Instant Verify": "Instant Verify",
|
||||
"Custom API Call": "自定义 API 呼叫",
|
||||
"Instant Verify an email address": "Instant Verify an email address",
|
||||
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
|
||||
"Email": "电子邮件地址",
|
||||
"Method": "方法",
|
||||
"Headers": "信头",
|
||||
"Query Parameters": "查询参数",
|
||||
"Body": "正文内容",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "失败时没有错误",
|
||||
"Timeout (in seconds)": "超时(秒)",
|
||||
"Email address to verify": "Email address to verify",
|
||||
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GET": "获取",
|
||||
"POST": "帖子",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "弹出",
|
||||
"DELETE": "删除",
|
||||
"HEAD": "黑色"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { instantVerifyAction } from './lib/actions/instant-verify';
|
||||
import { clearoutAuth } from './lib/auth';
|
||||
|
||||
export const clearout = createPiece({
|
||||
displayName: 'Clearout',
|
||||
description: 'Bulk email validation and verification',
|
||||
auth: clearoutAuth,
|
||||
minimumSupportedRelease: '0.30.0',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/clearout.png',
|
||||
categories: [PieceCategory.SALES_AND_CRM],
|
||||
authors: ["joeworkman","kishanprmr","MoShizzle","abuaboud"],
|
||||
actions: [
|
||||
instantVerifyAction,
|
||||
createCustomApiCallAction({
|
||||
baseUrl: () => 'https://api.clearout.io/v2', // Replace with the actual base URL
|
||||
auth: clearoutAuth,
|
||||
authMapping: async (auth) => ({
|
||||
Authorization: `${auth.props.apiKey}`,
|
||||
}),
|
||||
}),
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
|
||||
// Clearout API Docs https://docs.clearout.io/api.html
|
||||
@@ -0,0 +1,22 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { instantVerify } from '../api';
|
||||
import { clearoutAuth } from '../auth';
|
||||
|
||||
export const instantVerifyAction = createAction({
|
||||
name: 'instant_verify',
|
||||
auth: clearoutAuth,
|
||||
displayName: 'Instant Verify',
|
||||
description: 'Instant Verify an email address',
|
||||
props: {
|
||||
email: Property.ShortText({
|
||||
displayName: 'Email',
|
||||
description: 'Email address to verify',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
return await instantVerify(context.auth.props, {
|
||||
email: context.propsValue.email,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
import {
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
HttpRequest,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { ClearoutAuthType } from './auth';
|
||||
|
||||
export type KeyValuePair = {
|
||||
[key: string]: string | boolean | object | undefined;
|
||||
};
|
||||
|
||||
const clearoutAPI = async (
|
||||
api: string,
|
||||
auth: ClearoutAuthType,
|
||||
method: HttpMethod = HttpMethod.GET,
|
||||
body: KeyValuePair = {}
|
||||
) => {
|
||||
const baseUrl = 'https://api.clearout.io/v2/';
|
||||
const request: HttpRequest = {
|
||||
body: body,
|
||||
method: method,
|
||||
url: `${baseUrl}${api}`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `${auth.apiKey}`,
|
||||
},
|
||||
};
|
||||
const response = await httpClient.sendRequest(request);
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Bonjoro API error: ${response.status} ${response.body}`);
|
||||
}
|
||||
|
||||
let data = [];
|
||||
data = response.body['data'];
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: data,
|
||||
};
|
||||
};
|
||||
|
||||
export async function getCredits(auth: ClearoutAuthType) {
|
||||
const api = 'email_verify/getcredits';
|
||||
return clearoutAPI(api, auth);
|
||||
}
|
||||
|
||||
export async function instantVerify(
|
||||
auth: ClearoutAuthType,
|
||||
data: KeyValuePair
|
||||
) {
|
||||
const api = 'email_verify/instant';
|
||||
return clearoutAPI(api, auth, HttpMethod.POST, data);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
import { getCredits } from './api';
|
||||
import { z } from 'zod';
|
||||
import { propsValidation } from '@activepieces/pieces-common';
|
||||
|
||||
export type ClearoutAuthType = { apiKey: string };
|
||||
|
||||
export const clearoutAuth = PieceAuth.CustomAuth({
|
||||
description:
|
||||
'Authenticate with your Clearout account. Get your API token from your Clearout account under Settings > API.',
|
||||
props: {
|
||||
apiKey: PieceAuth.SecretText({
|
||||
displayName: 'API Token',
|
||||
description: 'The API token for your Clearout account',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
validate: async ({ auth }) => {
|
||||
try {
|
||||
await validateAuth(auth);
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
valid: false,
|
||||
error: (e as Error)?.message,
|
||||
};
|
||||
}
|
||||
},
|
||||
required: true,
|
||||
});
|
||||
|
||||
const validateAuth = async (auth: ClearoutAuthType) => {
|
||||
await propsValidation.validateZod(auth, {
|
||||
apiKey: z.string().min(1),
|
||||
});
|
||||
|
||||
const response = await getCredits(auth);
|
||||
if (response.success !== true) {
|
||||
throw new Error(
|
||||
'Authentication failed. Please check your domain and API key and try again.'
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"]
|
||||
}
|
||||
Reference in New Issue
Block a user