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 { TopUpPackageReadResponse } from '../../../models/responses';

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

// Endpoint: GET /public-api/resources/top-up-packages/v2.0/{topUpPackage}

export const topUpPackageReadAction = createAction({
  auth: ampecoAuth,
  name: 'topUpPackageRead',
  displayName: 'Resources - Top Up Packages - Read',
  description: 'Get a Top-Up Package.',
  audience: 'both',
  aiMetadata: { description: 'Fetches a single top-up package from AMPECO by its numeric ID. Use to look up the details of one known package; requires the package ID. Read-only and idempotent.', idempotent: true },
  props: {
        
  topUpPackage: Property.Number({
    displayName: 'Top Up Package',
    description: '',
    required: true,
  }),
  },
  async run(context): Promise<TopUpPackageReadResponse> {
    try {
      const url = processPathParameters('/public-api/resources/top-up-packages/v2.0/{topUpPackage}', context.propsValue);
      
      const queryParams = prepareQueryParams(context.propsValue, []);
      
      const body = undefined;

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

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