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

1.5 KB
Raw Blame
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
import {
  createCustomApiCallAction,
  HttpMethod,
} from '@activepieces/pieces-common';
import { PieceCategory } from '@activepieces/pieces-framework';
import { BASE_URL, makeRequest } from './lib/common';
import { runWorkflow } from './lib/actions/run-workflow';
import { runWorkflowAsync } from './lib/actions/run-workflow-async';
import { getExecution } from './lib/actions/get-execution';

export const airOpsAuth = PieceAuth.SecretText({
  displayName: 'API Key',
  description:
    'Your API key can be found in the **Workspace Settings** section of your AirOps account.',
  required: true,
  validate: async ({ auth }) => {
    try {
      await makeRequest(auth, HttpMethod.GET, '/public_api/airops_apps');
      return {
        valid: true,
      };
    } catch (e) {
      return {
        valid: false,
        error: 'Invalid API Key.',
      };
    }
  },
});

export const airOps = createPiece({
  displayName: 'AirOps',
  description: 'Build and deploy AI-powered workflows and agents.',
  auth: airOpsAuth,
  minimumSupportedRelease: '0.36.1',
  logoUrl: 'https://cdn.activepieces.com/pieces/air-ops.png',
  categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
  authors: ['onyedikachi-david'],
  actions: [
    runWorkflow,
    runWorkflowAsync,
    getExecution,
    createCustomApiCallAction({
      auth: airOpsAuth,
      baseUrl: () => BASE_URL,
      authMapping: async (auth) => ({
        Authorization: `Bearer ${auth.secret_text}`,
      }),
    }),
  ],
  triggers: [],
});