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.1 KB
Raw Blame
import { HttpMethod } from '@activepieces/pieces-common';
import { Property, createAction } from '@activepieces/pieces-framework';
import { tapfiliateAuth } from '../common/auth';
import { tapfiliateApiCall } from '../common/tapfiliate.client';

export const getAffiliateAction = createAction({
  auth: tapfiliateAuth,
  name: 'get_affiliate',
  displayName: 'Get Affiliate',
  description: 'Retrieves a Tapfiliate affiliate by ID.',
  audience: 'both',
  aiMetadata: { description: 'Fetches a single Tapfiliate affiliate by its unique affiliate ID. Use it to look up an affiliate\'s details when you already have its ID. Read-only and idempotent.', idempotent: true },
  props: {
    affiliateId: Property.ShortText({
      displayName: 'Affiliate ID',
      description: 'The unique Tapfiliate affiliate ID. Find it on the affiliate detail page in your Tapfiliate dashboard.',
      required: true,
    }),
  },
  async run(context) {
    return await tapfiliateApiCall({
      method: HttpMethod.GET,
      path: `/affiliates/${context.propsValue.affiliateId}/`,
      apiKey: context.auth.secret_text,
    });
  },
});