Files
smoothschedule/activepieces-fork/packages/pieces/community/clearout/src/lib/api.ts
poduck 3aa7199503 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>
2025-12-18 22:59:37 -05:00

55 lines
1.2 KiB
TypeScript

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);
}