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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Ihre Zertifikate, einfach gemacht",
|
||||
"API key acquired from your Certopus profile": "API-Schlüssel von Ihrem Certopus-Profil übernommen",
|
||||
"Create Credential": "Anmeldeinformationen erstellen",
|
||||
"Custom API Call": "Eigener API-Aufruf",
|
||||
"Create a credential": "Anmeldeinformationen erstellen",
|
||||
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
|
||||
"Organisations": "Organisationen",
|
||||
"Event": "Ereignis",
|
||||
"Category": "Kategorie",
|
||||
"Generate": "Generieren",
|
||||
"Publish": "Veröffentlichen",
|
||||
"Recipient Email": "Empfänger E-Mail",
|
||||
"Recipient Data": "Empfängerdaten",
|
||||
"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)",
|
||||
"Automatically generate the crentials": "Automatisch die Krentials generieren",
|
||||
"Automatically publish the crentials": "Automatisch die Krentials veröffentlichen",
|
||||
"Email address of the recipient": "E-Mail-Adresse des Empfängers",
|
||||
"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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Tus certificados, simplificados",
|
||||
"API key acquired from your Certopus profile": "Clave API adquirida de tu perfil de Certopus",
|
||||
"Create Credential": "Crear credencial",
|
||||
"Custom API Call": "Llamada API personalizada",
|
||||
"Create a credential": "Crear una credencial",
|
||||
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
|
||||
"Organisations": "Organizaciones",
|
||||
"Event": "Evento",
|
||||
"Category": "Categoría",
|
||||
"Generate": "Generar",
|
||||
"Publish": "Publicar",
|
||||
"Recipient Email": "Email del destinatario",
|
||||
"Recipient Data": "Datos del destinatario",
|
||||
"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)",
|
||||
"Automatically generate the crentials": "Generar automáticamente los crentiales",
|
||||
"Automatically publish the crentials": "Publicar automáticamente los crentiales",
|
||||
"Email address of the recipient": "Dirección de correo del destinatario",
|
||||
"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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Vos certificats, simplifiés",
|
||||
"API key acquired from your Certopus profile": "Clé API acquise à partir de votre profil Certopus",
|
||||
"Create Credential": "Créer un mot de passe",
|
||||
"Custom API Call": "Appel API personnalisé",
|
||||
"Create a credential": "Créer un identifiant",
|
||||
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
|
||||
"Organisations": "Organisations",
|
||||
"Event": "Evénement",
|
||||
"Category": "Catégorie",
|
||||
"Generate": "Générer",
|
||||
"Publish": "Publier",
|
||||
"Recipient Email": "E-mail du destinataire",
|
||||
"Recipient Data": "Données du destinataire",
|
||||
"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)",
|
||||
"Automatically generate the crentials": "Générer automatiquement les crentiels",
|
||||
"Automatically publish the crentials": "Publier automatiquement les crentiels",
|
||||
"Email address of the recipient": "Adresse e-mail du destinataire",
|
||||
"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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "証明書をシンプルにしました",
|
||||
"API key acquired from your Certopus profile": "Certopusプロファイルから取得したAPIキー",
|
||||
"Create Credential": "証明書を作成",
|
||||
"Custom API Call": "カスタムAPI通話",
|
||||
"Create a credential": "資格情報を作成",
|
||||
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
|
||||
"Organisations": "組織",
|
||||
"Event": "イベント",
|
||||
"Category": "カテゴリ",
|
||||
"Generate": "生成",
|
||||
"Publish": "公開する",
|
||||
"Recipient Email": "受信者メールアドレス",
|
||||
"Recipient Data": "受信者データ",
|
||||
"Method": "方法",
|
||||
"Headers": "ヘッダー",
|
||||
"Query Parameters": "クエリパラメータ",
|
||||
"Body": "本文",
|
||||
"Response is Binary ?": "応答はバイナリですか?",
|
||||
"No Error on Failure": "失敗時にエラーはありません",
|
||||
"Timeout (in seconds)": "タイムアウト(秒)",
|
||||
"Automatically generate the crentials": "自動的にcrentialsを生成します",
|
||||
"Automatically publish the crentials": "自動的にcrentialsを公開します",
|
||||
"Email address of the recipient": "受信者のメールアドレス",
|
||||
"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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Uw certificaten, eenvoudig gemaakt",
|
||||
"API key acquired from your Certopus profile": "API-sleutel verkregen vanuit je Certopus profiel",
|
||||
"Create Credential": "Creeër referenties",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Create a credential": "Creëer een inloggegevens",
|
||||
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
|
||||
"Organisations": "Organisaties",
|
||||
"Event": "Gebeurtenis",
|
||||
"Category": "categorie",
|
||||
"Generate": "Genereren",
|
||||
"Publish": "Publiceer",
|
||||
"Recipient Email": "E-mailadres ontvanger",
|
||||
"Recipient Data": "Ontvanger gegevens",
|
||||
"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)",
|
||||
"Automatically generate the crentials": "Genereer de crentials automatisch",
|
||||
"Automatically publish the crentials": "Publiceer automatisch de crentials",
|
||||
"Email address of the recipient": "E-mailadres van de ontvanger",
|
||||
"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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Seus certificados, feitos simples",
|
||||
"API key acquired from your Certopus profile": "Chave da API adquirida do seu perfil Certopus",
|
||||
"Create Credential": "Criar Credencial",
|
||||
"Custom API Call": "Chamada de API personalizada",
|
||||
"Create a credential": "Criar uma credencial",
|
||||
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
|
||||
"Organisations": "Organizações",
|
||||
"Event": "Evento",
|
||||
"Category": "categoria",
|
||||
"Generate": "Gerar",
|
||||
"Publish": "Publicar",
|
||||
"Recipient Email": "Destinatário Email",
|
||||
"Recipient Data": "Dados do Destinatário",
|
||||
"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)",
|
||||
"Automatically generate the crentials": "Gere automaticamente os crentials",
|
||||
"Automatically publish the crentials": "Publicar automaticamente as crentials",
|
||||
"Email address of the recipient": "Endereço de email do destinatário",
|
||||
"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,32 @@
|
||||
{
|
||||
"Certopus": "Certopus",
|
||||
"Your certificates, made simple": "Ваши сертификаты, сделанные простым",
|
||||
"API key acquired from your Certopus profile": "Ключ API приобретенный из вашего Certopus профиля",
|
||||
"Create Credential": "Создать учетные данные",
|
||||
"Custom API Call": "Пользовательский вызов API",
|
||||
"Create a credential": "Создать учетные данные",
|
||||
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
|
||||
"Organisations": "Организации",
|
||||
"Event": "Событие",
|
||||
"Category": "Категория",
|
||||
"Generate": "Сгенерировать",
|
||||
"Publish": "Publish",
|
||||
"Recipient Email": "Email получателя",
|
||||
"Recipient Data": "Данные получателя",
|
||||
"Method": "Метод",
|
||||
"Headers": "Заголовки",
|
||||
"Query Parameters": "Параметры запроса",
|
||||
"Body": "Тело",
|
||||
"No Error on Failure": "Нет ошибок при ошибке",
|
||||
"Timeout (in seconds)": "Таймаут (в секундах)",
|
||||
"Automatically generate the crentials": "Автоматически сгенерировать прокаты",
|
||||
"Automatically publish the crentials": "Автоматически публиковать аренды",
|
||||
"Email address of the recipient": "Электронный адрес получателя",
|
||||
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
|
||||
"GET": "ПОЛУЧИТЬ",
|
||||
"POST": "ПОСТ",
|
||||
"PATCH": "ПАТЧ",
|
||||
"PUT": "ПОКУПИТЬ",
|
||||
"DELETE": "УДАЛИТЬ",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Your certificates, made simple",
|
||||
"API key acquired from your Certopus profile": "API key acquired from your Certopus profile",
|
||||
"Create Credential": "Create Credential",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Create a credential": "Create a credential",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Organisations": "Organisations",
|
||||
"Event": "Event",
|
||||
"Category": "Category",
|
||||
"Generate": "Generate",
|
||||
"Publish": "Publish",
|
||||
"Recipient Email": "Recipient Email",
|
||||
"Recipient Data": "Recipient Data",
|
||||
"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)",
|
||||
"Automatically generate the crentials": "Automatically generate the crentials",
|
||||
"Automatically publish the crentials": "Automatically publish the crentials",
|
||||
"Email address of the recipient": "Email address of the recipient",
|
||||
"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,32 @@
|
||||
{
|
||||
"Certopus": "Certopus",
|
||||
"Your certificates, made simple": "Your certificates, made simple",
|
||||
"API key acquired from your Certopus profile": "API key acquired from your Certopus profile",
|
||||
"Create Credential": "Create Credential",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Create a credential": "Create a credential",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Organisations": "Organisations",
|
||||
"Event": "Event",
|
||||
"Category": "Category",
|
||||
"Generate": "Generate",
|
||||
"Publish": "Publish",
|
||||
"Recipient Email": "Recipient Email",
|
||||
"Recipient Data": "Recipient Data",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"Automatically generate the crentials": "Automatically generate the crentials",
|
||||
"Automatically publish the crentials": "Automatically publish the crentials",
|
||||
"Email address of the recipient": "Email address of the recipient",
|
||||
"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,33 @@
|
||||
{
|
||||
"Your certificates, made simple": "Your certificates, made simple",
|
||||
"API key acquired from your Certopus profile": "API key acquired from your Certopus profile",
|
||||
"Create Credential": "Create Credential",
|
||||
"Custom API Call": "自定义 API 呼叫",
|
||||
"Create a credential": "Create a credential",
|
||||
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
|
||||
"Organisations": "Organisations",
|
||||
"Event": "Event",
|
||||
"Category": "Category",
|
||||
"Generate": "Generate",
|
||||
"Publish": "重新上架",
|
||||
"Recipient Email": "Recipient Email",
|
||||
"Recipient Data": "Recipient Data",
|
||||
"Method": "方法",
|
||||
"Headers": "信头",
|
||||
"Query Parameters": "查询参数",
|
||||
"Body": "正文内容",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "失败时没有错误",
|
||||
"Timeout (in seconds)": "超时(秒)",
|
||||
"Automatically generate the crentials": "Automatically generate the crentials",
|
||||
"Automatically publish the crentials": "Automatically publish the crentials",
|
||||
"Email address of the recipient": "Email address of the recipient",
|
||||
"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,31 @@
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
|
||||
import { createCredential } from './lib/actions/create-credential';
|
||||
import { certopusCommon } from './lib/common';
|
||||
|
||||
export const certopusAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Key',
|
||||
required: true,
|
||||
description: 'API key acquired from your Certopus profile',
|
||||
});
|
||||
|
||||
export const certopus = createPiece({
|
||||
displayName: 'Certopus',
|
||||
description: 'Your certificates, made simple',
|
||||
minimumSupportedRelease: '0.30.0',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/certopus.png',
|
||||
categories: [],
|
||||
authors: ["VrajGohil","kishanprmr","MoShizzle","khaledmashaly","abuaboud"],
|
||||
auth: certopusAuth,
|
||||
actions: [
|
||||
createCredential,
|
||||
createCustomApiCallAction({
|
||||
baseUrl: () => certopusCommon.baseUrl, // Replace with the actual base URL
|
||||
auth: certopusAuth,
|
||||
authMapping: async (auth) => ({
|
||||
'x-api-key': `${auth}`,
|
||||
}),
|
||||
}),
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,210 @@
|
||||
import {
|
||||
DynamicPropsValue,
|
||||
Property,
|
||||
createAction,
|
||||
} from '@activepieces/pieces-framework';
|
||||
|
||||
import { certopusCommon, makeClient } from '../common';
|
||||
import {
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
HttpRequest,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { Organisation } from '../common/models/oranisation';
|
||||
import { Event } from '../common/models/event';
|
||||
import { Category } from '../common/models/category';
|
||||
import { RecipientField } from '../common/models/recipient-field';
|
||||
import { certopusAuth } from '../../';
|
||||
|
||||
export const createCredential = createAction({
|
||||
auth: certopusAuth,
|
||||
name: 'create_credential',
|
||||
displayName: 'Create Credential',
|
||||
description: 'Create a credential',
|
||||
props: {
|
||||
organisation: Property.Dropdown({
|
||||
auth: certopusAuth,
|
||||
displayName: 'Organisations',
|
||||
refreshers: [],
|
||||
required: true,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please enter your API key first.',
|
||||
};
|
||||
}
|
||||
const client = makeClient(auth.secret_text);
|
||||
const res = await client.listOrganisations();
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: res.map((x: Organisation) => ({
|
||||
label: x.name,
|
||||
value: x.id,
|
||||
})),
|
||||
};
|
||||
},
|
||||
}),
|
||||
event: Property.Dropdown({
|
||||
auth: certopusAuth,
|
||||
displayName: 'Event',
|
||||
refreshers: ['organisation'],
|
||||
required: true,
|
||||
options: async ({ auth, organisation }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please enter your API key first.',
|
||||
};
|
||||
}
|
||||
if (!organisation) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please select an organisation first.',
|
||||
};
|
||||
}
|
||||
const client = makeClient(auth.secret_text);
|
||||
const res = await client.listEvents(organisation as string);
|
||||
console.log(res);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: res.map((x: Event) => ({
|
||||
label: x.title,
|
||||
value: x.id,
|
||||
})),
|
||||
};
|
||||
},
|
||||
}),
|
||||
category: Property.Dropdown({
|
||||
auth: certopusAuth,
|
||||
displayName: 'Category',
|
||||
refreshers: ['organisation', 'event'],
|
||||
required: true,
|
||||
options: async ({ auth, organisation, event }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please enter your API key first.',
|
||||
};
|
||||
}
|
||||
if (!organisation) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please select an organisation first.',
|
||||
};
|
||||
}
|
||||
if (!event) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: 'Please select an event first.',
|
||||
};
|
||||
}
|
||||
const client = makeClient(auth.secret_text);
|
||||
const res = await client.listCategories(
|
||||
organisation as string,
|
||||
event as string
|
||||
);
|
||||
console.log(res);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: res.map((x: Category) => ({
|
||||
label: x.title,
|
||||
value: x.id,
|
||||
})),
|
||||
};
|
||||
},
|
||||
}),
|
||||
generate: Property.Checkbox({
|
||||
displayName: 'Generate',
|
||||
description: 'Automatically generate the crentials',
|
||||
defaultValue: false,
|
||||
required: true,
|
||||
}),
|
||||
publish: Property.Checkbox({
|
||||
displayName: 'Publish',
|
||||
description: 'Automatically publish the crentials',
|
||||
defaultValue: false,
|
||||
required: true,
|
||||
}),
|
||||
email: Property.ShortText({
|
||||
displayName: 'Recipient Email',
|
||||
description: 'Email address of the recipient',
|
||||
required: true,
|
||||
}),
|
||||
fields: Property.DynamicProperties({
|
||||
auth: certopusAuth,
|
||||
displayName: 'Recipient Data',
|
||||
required: true,
|
||||
refreshers: ['organisation', 'event', 'category'],
|
||||
|
||||
props: async ({ auth, organisation, event, category }) => {
|
||||
if (!auth) return {};
|
||||
if (!organisation) return {};
|
||||
if (!event) return {};
|
||||
if (!category) return {};
|
||||
|
||||
const fields: DynamicPropsValue = {};
|
||||
try {
|
||||
const client = makeClient(auth.secret_text);
|
||||
const recipientFields: RecipientField[] =
|
||||
await client.listRecipientFields(
|
||||
organisation.toString(),
|
||||
event.toString(),
|
||||
category.toString()
|
||||
);
|
||||
recipientFields.forEach((field: RecipientField) => {
|
||||
//skil email field as it already included
|
||||
if (field.key !== 'email') {
|
||||
const params = {
|
||||
displayName: field.label,
|
||||
description: `Enter data for the ${field.label} field`,
|
||||
required: true,
|
||||
};
|
||||
fields[field.key] = Property.ShortText(params);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.debug(e);
|
||||
}
|
||||
|
||||
return fields;
|
||||
},
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { organisation, event, category, publish, generate, email, fields } =
|
||||
context.propsValue;
|
||||
const request: HttpRequest = {
|
||||
method: HttpMethod.POST,
|
||||
url: `${certopusCommon.baseUrl}/certificates`,
|
||||
body: {
|
||||
organisationId: organisation,
|
||||
eventId: event,
|
||||
categoryId: category,
|
||||
publish: publish,
|
||||
generate: generate,
|
||||
recipients: [
|
||||
{
|
||||
email: email,
|
||||
data: fields,
|
||||
},
|
||||
],
|
||||
},
|
||||
headers: {
|
||||
'x-api-key': context.auth.secret_text,
|
||||
},
|
||||
queryParams: {},
|
||||
};
|
||||
const res = await httpClient.sendRequest(request);
|
||||
return res.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
import {
|
||||
HttpMessageBody,
|
||||
HttpMethod,
|
||||
QueryParams,
|
||||
httpClient,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { Organisation } from './models/oranisation';
|
||||
import { Event } from './models/event';
|
||||
import { Category } from './models/category';
|
||||
import { RecipientField } from './models/recipient-field';
|
||||
import { certopusCommon } from '.';
|
||||
|
||||
export class CertopusClient {
|
||||
constructor(private token: string) {}
|
||||
|
||||
async makeRequest<T extends HttpMessageBody = any>(
|
||||
method: HttpMethod,
|
||||
url: string,
|
||||
query?: QueryParams,
|
||||
body?: object
|
||||
): Promise<T> {
|
||||
const res = await httpClient.sendRequest({
|
||||
method,
|
||||
url: certopusCommon.baseUrl + url,
|
||||
queryParams: query,
|
||||
body,
|
||||
headers: {
|
||||
'x-api-key': this.token,
|
||||
},
|
||||
});
|
||||
return res.body.data;
|
||||
}
|
||||
|
||||
listOrganisations(): Promise<Organisation[]> {
|
||||
return this.makeRequest<Organisation[]>(HttpMethod.GET, '/organisations');
|
||||
}
|
||||
|
||||
listEvents(organisationId: string): Promise<Event[]> {
|
||||
return this.makeRequest<Event[]>(
|
||||
HttpMethod.GET,
|
||||
`/events/${organisationId}`
|
||||
);
|
||||
}
|
||||
|
||||
listCategories(organisationId: string, eventId: string): Promise<Category[]> {
|
||||
return this.makeRequest<Category[]>(HttpMethod.GET, '/categories', {
|
||||
organisationId,
|
||||
eventId,
|
||||
});
|
||||
}
|
||||
|
||||
listRecipientFields(
|
||||
organisationId: string,
|
||||
eventId: string,
|
||||
categoryId: string
|
||||
): Promise<RecipientField[]> {
|
||||
return this.makeRequest<RecipientField[]>(
|
||||
HttpMethod.GET,
|
||||
'/recipient_fields',
|
||||
{
|
||||
organisationId,
|
||||
eventId,
|
||||
categoryId,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { CertopusClient } from './client';
|
||||
|
||||
export function makeClient(apiKey: string): CertopusClient {
|
||||
return new CertopusClient(apiKey);
|
||||
}
|
||||
|
||||
export const certopusCommon = {
|
||||
baseUrl: 'https://api.certopus.com/v1',
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface Category {
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface Event {
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface Organisation {
|
||||
id: string;
|
||||
imageUrl: string;
|
||||
name: string;
|
||||
integrationAllowed: boolean;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface RecipientField {
|
||||
key: string;
|
||||
label: string;
|
||||
type: string;
|
||||
}
|
||||
Reference in New Issue
Block a user