Skip to content

The open-source app everyone uses to manage agents at work

942 B
Raw Blame
import type {
  ConnectionIntentInteraction,
  ConnectionIntentSetupOptions,
} from "@paperclipai/shared";
import { api } from "./client";

export const connectionIntentsApi = {
  setupOptions: (interactionId: string) =>
    api.get<ConnectionIntentSetupOptions>(
      `/connection-intents/${interactionId}/setup-options`,
    ),
  setPhase: (
    interactionId: string,
    phase: ConnectionIntentInteraction["payload"]["phase"],
  ) =>
    api.post<ConnectionIntentInteraction>(
      `/connection-intents/${interactionId}/phase`,
      { phase },
    ),
  complete: (interactionId: string, connectionId: string) =>
    api.post<ConnectionIntentInteraction>(
      `/connection-intents/${interactionId}/complete`,
      { connectionId },
    ),
  decline: (interactionId: string, reason?: string) =>
    api.post<ConnectionIntentInteraction>(
      `/connection-intents/${interactionId}/decline`,
      reason ? { reason } : {},
    ),
};