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.7 KB
Raw Blame
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { wedofAuth } from '../../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { wedofCommon } from '../../common/wedof';

export const deletePartnership = createAction({
  auth: wedofAuth,
  name: 'deletePartnership',
  classification: 'DESTRUCTIVE',
  displayName: "Supprimer un partenariat",
  description: "Supprime un partenariat à l'état Demande à compléter",
  audience: 'both',
  aiMetadata: {
    description:
      "Permanently delete a certification partnership (identified by certification certifInfo and partner SIRET). The API only allows deletion while the partnership is in the 'request to complete' state, so it may fail otherwise. Destructive and not idempotent; use the get action to inspect a partnership and the reset action to revert its state instead.",
    idempotent: false,
  },
  props: {
    certifInfo: Property.ShortText({
      displayName: 'N° certifInfo',
      description: 'Sélectionner le {certifInfo} de la certification considérée',
      required: true,
    }),
    siret: Property.ShortText({
      displayName: 'N° Siret',
      description: 'Sélectionner le {siret} du partenaire',
      required: true,
    }),
  },
  async run(context) {
    return (
      await httpClient.sendRequest({
        method: HttpMethod.DELETE,
        url:
          wedofCommon.baseUrl +
          '/certifications/' +
          context.propsValue.certifInfo +
          '/partners/' +
          context.propsValue.siret,
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': context.auth.secret_text,
        },
      })
    ).body;
  },
});