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

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

// Endpoint: GET /public-api/resources/firmware-versions/v1.0/{firmwareVersion}

export const firmwareVersionReadAction = createAction({
  auth: ampecoAuth,
  name: 'firmwareVersionRead',
  displayName: 'Resources - Firmware Versions - Read',
  description: 'Get a Firmware Version.',
  audience: 'both',
  aiMetadata: { description: 'Fetch a single AMPECO firmware version by its numeric ID, optionally including its attached charge-point models. Use when you already know the firmware version ID; to discover IDs use the firmware versions listing action. Read-only and idempotent.', idempotent: true },
  props: {
        
  firmwareVersion: Property.Number({
    displayName: 'Firmware Version',
    description: '',
    required: true,
  }),

  include: Property.StaticMultiSelectDropdown({
    displayName: 'Include',
    description: '',
    required: false,
    options: {
      options: [
      { label: 'models', value: 'models' }
      ],
    },
  }),
  },
  async run(context): Promise<FirmwareVersionReadResponse> {
    try {
      const url = processPathParameters('/public-api/resources/firmware-versions/v1.0/{firmwareVersion}', context.propsValue);
      
      const queryParams = prepareQueryParams(context.propsValue, ['include']);
      
      const body = undefined;

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

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