Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

709 B
Raw Blame
import { AuthenticationType, HttpMethod, httpClient, QueryParams } from '@activepieces/pieces-common';

async function sendRequest<T>({
  auth,
  method,
  path,
  body,
  queryParams,
  headers,
}: {
  auth: string;
  method: HttpMethod;
  path: string;
  body?: unknown;
  queryParams?: QueryParams;
  headers?: Record<string, string>;
}): Promise<T> {
  const response = await httpClient.sendRequest<T>({
    method,
    url: `${RESEND_BASE_URL}${path}`,
    authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth },
    body,
    queryParams,
    headers,
  });
  return response.body;
}

export const resendClient = { sendRequest };
export const RESEND_BASE_URL = 'https://api.resend.com';