Manta Developers
GitHub
Menu

List plans

Read the action plans in a datastore.

useActionPlans lists action plans for the datastore the Manta providers are connected to.

What it is

The hook returns one page of plans and how many match the filters. While any plan on the page is RUNNING, it refetches every three seconds, unless you pass your own refetchInterval.

Import

import { useActionPlans } from "@manta-eu/react/hooks/useActionPlans";

Example

const { plans, count, isLoading, error } = useActionPlans(client, { limit: 20 });

Request

useActionPlans(client, variables?, options?)

client is a GraphQLClient. The hook accepts it and leaves it unused. Plans are read through the providers’ SPARQL connection.

variables:

  • search
  • orderBy, with field (STATE or MANTA_PRIORITY) and direction (ASC or DESC)
  • limit
  • offset
  • states: DRAFT, RUNNING, COMPLETED, FAILED, or TIMED_OUT
  • graphIris
  • integrations: META, GOOGLE, LINKEDIN, SHOPIFY, SNAPCHAT, WOOCOMMERCE, or NONE
  • lastRunFrom and lastRunTo
  • approval: NEEDS_APPROVAL or NO_PENDING
  • availability: CURRENT, PAST_RUNS_ONLY, or ALL

options: enabled, and refetchInterval as a number of milliseconds or false.

Response

  • plans
  • count
  • isLoading
  • isPlaceholderData
  • error, a string or null

Each plan has iri, hasCurrentFacts, state, statements, subjects, updatedAt, lastRunAt, dryRun, description, duration, primaryIntegration, actionCount, completedActionCount, and actionCountByType (typeName and count). updatedAt is always null.