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.3 KB
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import { pinterestAuth } from '../common/auth';
import { getAccessTokenOrThrow } from '@activepieces/pieces-common';
import { pinterestOperations } from '../common/operations';
import { adAccountIdDropdown, pinIdDropdown } from '../common/props';
import { deletePinActionOutputSchema } from '../output-schemas';

export const deletePin = createAction({
  auth: pinterestAuth,
  name: 'deletePin',
  classification: 'DESTRUCTIVE',
  outputSchema: deletePinActionOutputSchema,
  displayName: 'Delete Pin',
  description: 'Permanently delete a specific Pin.',
  audience: 'human',
  aiMetadata: {
    description:
      'Permanently deletes a single Pin identified by its pin_id. Use to remove published content from Pinterest; this is destructive and cannot be undone. Repeating the call after the Pin is gone returns an error rather than re-deleting, so treat it as not idempotent.',
    idempotent: false,
  },
  props: {
    pin_id: pinIdDropdown,
    ad_account_id: adAccountIdDropdown,
  },
  async run({ auth, propsValue }) {
    return await pinterestOperations.deletePin({
      accessToken: getAccessTokenOrThrow(auth),
      pin_id: propsValue.pin_id,
      ad_account_id: propsValue.ad_account_id,
    });
  },
});