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, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { freshserviceAuth } from '../../';
import { freshserviceApiCall } from '../common/client';
import { freshserviceCommon } from '../common/props';

export const deleteChangeTask = createAction({
  auth: freshserviceAuth,
  name: 'delete_change_task',
  classification: 'DESTRUCTIVE',
  displayName: 'Delete Change Task',
  description: 'Deletes a task from a change request in Freshservice.',
  audience: 'both',
  aiMetadata: {
    description: 'Permanently deletes a task from a Freshservice change request, identified by change id and task id. Use to remove a task that should no longer exist. Idempotent in effect — once deleted the task stays deleted, though repeat calls on an already-removed id may return a not-found error.',
    idempotent: true,
  },
  props: {
    change_id: freshserviceCommon.change(true),
    task_id: Property.Number({
      displayName: 'Task ID',
      description: 'The ID of the task to delete.',
      required: true,
    }),
  },
  async run(context) {
    await freshserviceApiCall({
      method: HttpMethod.DELETE,
      endpoint: `changes/${context.propsValue.change_id}/tasks/${context.propsValue.task_id}`,
      auth: context.auth,
    });

    return { success: true };
  },
});