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.8 KB
Raw Blame
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { ampecoAuth } from '../../../common/auth';
import { handleApiError, makeAmpecoApiCall, prepareQueryParams, prepareRequestBody, processPathParameters } from '../../../common/utils';
import { TaxIdentificationNumberCreateResponse } from '../../../models/responses';

/**
 * Generated from API version: 3.96.4
 */

// Endpoint: POST /public-api/resources/tax-identification-numbers/v2.0

export const taxIdentificationNumberCreateAction = createAction({
  auth: ampecoAuth,
  name: 'taxIdentificationNumberCreate',
  displayName: 'Resources - Tax Identification Numbers - Create',
  description: 'Create new Tax Identification Number.',
  audience: 'both',
  aiMetadata: { description: 'Create a new tax identification number record with the given name. Use when registering a new TIN; to change an existing one use the update action instead. Not idempotent — each call creates a new record.', idempotent: false },
  props: {
        
  name: Property.ShortText({
    displayName: 'Name',
    description: '',
    required: true,
  }),
  },
  async run(context): Promise<TaxIdentificationNumberCreateResponse> {
    try {
      const url = processPathParameters('/public-api/resources/tax-identification-numbers/v2.0', context.propsValue);
      
      const queryParams = prepareQueryParams(context.propsValue, []);
      
      const body = prepareRequestBody(context.propsValue,
        ['name']
      );

      
      return await makeAmpecoApiCall(
        context.auth,
        url,
        HttpMethod.POST,
        body,
        queryParams
      ) as TaxIdentificationNumberCreateResponse;

    } catch (error) {
      handleApiError(error);
    }
  },
});