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.5 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { makeRequest } from '../common/client';
import { cryptolensAuth } from '../common/auth';
import { HttpMethod } from '@activepieces/pieces-common';
import { blockKeyActionOutputSchema } from '../output-schemas';

export const blockKey = createAction({
  auth: cryptolensAuth,
  name: 'blockKey',
  displayName: 'Block Key',
  description: 'Block a license key to prevent it from being accessible by most Web API methods',
  audience: 'both',
  aiMetadata: {
    description: 'Blocks a specific license key for a product so it is rejected by most Cryptolens Web API methods (e.g. activation/validation). Use to revoke or suspend a license. Requires the product ID and the serial key string. Blocking is a state change, but re-blocking an already-blocked key has no additional effect.',
    idempotent: true,
  },
  outputSchema: blockKeyActionOutputSchema,
  props: {
    productId: Property.Number({
      displayName: 'Product ID',
      description: 'The product ID',
      required: true,
    }),
    key: Property.ShortText({
      displayName: 'License Key',
      description: 'The serial key string to block',
      required: true,
    }),
  },
  async run(context) {
    const params = new URLSearchParams({
      ProductId: String(context.propsValue.productId),
      Key: context.propsValue.key,
    });

    const response = await makeRequest(
      context.auth.secret_text,
      HttpMethod.POST,
      `/key/BlockKey?${params.toString()}`
    );

    return response;
  },
});