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.6 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, processPathParameters } from '../../../common/utils';
import { InvoiceReadResponse } from '../../../models/responses';

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

// Endpoint: GET /public-api/resources/invoices/v1.0/{invoice}

export const invoiceReadAction = createAction({
  auth: ampecoAuth,
  name: 'invoiceRead',
  displayName: 'Resources - Invoices - Read',
  description: 'Invoice / Read.',
  audience: 'both',
  aiMetadata: { description: 'Fetch the details of a single AMPECO invoice by its ID. Read-only and idempotent. Pick this when you already have an invoice ID; to search invoices by issue date or browse them, use the invoices listing action.', idempotent: true },
  props: {
        
  invoice: Property.ShortText({
    displayName: 'Invoice',
    description: '',
    required: true,
  }),
  },
  async run(context): Promise<InvoiceReadResponse> {
    try {
      const url = processPathParameters('/public-api/resources/invoices/v1.0/{invoice}', context.propsValue);
      
      const queryParams = prepareQueryParams(context.propsValue, []);
      
      const body = undefined;

      
      return await makeAmpecoApiCall(
        context.auth,
        url,
        HttpMethod.GET,
        body,
        queryParams
      ) as InvoiceReadResponse;

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