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.4 KB
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { mastodonAuth } from '../..';
import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
import { statusPageOutputSchema } from '../output-schemas';

export const listBookmarks = createAction({
  auth: mastodonAuth,
  name: 'list_bookmarks',
  classification: 'SEARCH',
  displayName: 'List Bookmarks',
  description: 'List the statuses you have bookmarked.',
  audience: 'ai',
  aiMetadata: {
    description:
      'Returns one page of statuses bookmarked by the connected account, newest bookmark first, with Link-header cursors for further pages. Read-only and safe to retry.',
    idempotent: true,
  },
  outputSchema: statusPageOutputSchema,
  props: {
    limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
    max_id: mastodonProps.maxId(),
    since_id: mastodonProps.sinceId(),
    min_id: mastodonProps.minId(),
  },
  async run(context) {
    const { limit, max_id, since_id, min_id } = context.propsValue;
    const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
      auth: context.auth.props,
      method: HttpMethod.GET,
      path: '/api/v1/bookmarks',
      operation: 'List Bookmarks',
      scope: 'read:bookmarks',
      query: { limit, max_id, since_id, min_id },
    });
    return { statuses: items, ...cursors };
  },
});