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 { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
import { createAction } from '@activepieces/pieces-framework';
import { clickupAuth } from '../../auth';
import { callClickUpApi, clickupCommon } from '../../common';
import { timeEntryOutputSchema } from '../../output-schemas';

export const clickupStopTimeEntry = createAction({
  auth: clickupAuth,
  name: 'clickup_stop_time_entry',
  classification: 'WRITE',
  displayName: 'Stop Time Entry',
  description: 'Stop the currently running timer in a ClickUp workspace.',
  audience: 'ai',
  aiMetadata: {
    description:
      'Stop the timer that is currently running for the authenticated user in a workspace, finalizing it into a completed time entry. Pick this to end a timer previously begun with Start Time Entry; call Get Running Time Entry first to confirm a timer is active, since stopping when none is running errors (not idempotent).',
    idempotent: false,
  },
  outputSchema: timeEntryOutputSchema,
  props: {
    workspace_id: clickupCommon.workspace_id(true),
  },
  async run(context) {
    const { workspace_id } = context.propsValue;
    const auth = getAccessTokenOrThrow(context.auth);

    const response = await callClickUpApi(
      HttpMethod.POST,
      `team/${workspace_id}/time_entries/stop`,
      auth,
      {}
    );

    return response.body;
  },
});