Skip to main content
Glama

mcp-google-sheets

move-content-object.ts2.17 kB
import { createAction } from '@activepieces/pieces-framework'; import { HttpMethod } from '@activepieces/pieces-common'; import { ibmCognoseAuth } from '../../index'; import { CognosClient } from '../common/cognos-client'; import { contentObjectDropdown } from '../common/content-object-dropdown'; export const moveContentObjectAction = createAction({ auth: ibmCognoseAuth, name: 'move_content_object', displayName: 'Move Content Object', description: 'Move an object with all its descendants', props: { sourceId: contentObjectDropdown, destinationId: { ...contentObjectDropdown, displayName: 'Destination Container', description: 'Destination container where the object will be moved', }, }, async run({ auth, propsValue }) { const { sourceId, destinationId } = propsValue; if (sourceId === destinationId) { throw new Error('Source and destination cannot be the same object'); } try { const client = new CognosClient(auth); const moveRequest = { source_id: sourceId, destination_id: destinationId, }; const response = await client.makeAuthenticatedRequest( '/content/move', HttpMethod.PUT, moveRequest ); if (response.status === 204) { return { success: true, message: `Content object moved successfully`, }; } else if (response.status === 400) { throw new Error(`Bad request: ${response.body?.message || 'Invalid move operation'}`); } else if (response.status === 401) { throw new Error('Authentication failed. Check your credentials.'); } else if (response.status === 403) { throw new Error('Permission denied. Insufficient permissions to move this object.'); } else if (response.status === 404) { throw new Error('Object or parent object not found.'); } else { throw new Error(`Failed to move: ${response.status} ${response.body}`); } } catch (error) { throw new Error( `Failed to move content object: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }, });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/activepieces/activepieces'

If you have feedback or need assistance with the MCP directory API, please join our Discord server