SDK reference · Node SDK

prov.mandate.policies.listVersions

prov.mandate.policies.listVersions in Node SDK. Version history, newest first.

Signature

prov.mandate.policies.listVersions(opts?: DomainOpts & { draftGroup?: string }): Promise<PolicyVersionMeta[]>

Parameters

optsDomainOpts & { draftGroup?: string }

Request fields

draft_groupstringquery
Sandbox. Also list the drafts waiting in this draft group (a rules embed session minted with rules.draft_group, the live demo's per-visitor drafts). Without it, the groups' unpublished drafts are left out. 1 to 64 characters.

Returns

Promise<PolicyVersionMeta[]> The policy versions, newest first.

HTTP operation

GET /v1/mandate/policies/versions: List policy versions

Errors

Example

const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "note": "cap wires at 10k",
    "document": {
      "rules": [
        {
          "label": "Wires over 10k denied",
          "when": [
            {
              "fact": "action_type",
              "op": "eq",
              "value": "wire"
            },
            {
              "fact": "transaction_amount",
              "op": "gt",
              "value": 10000
            }
          ],
          "require": {
            "deny": true
          }
        }
      ]
    }
  }),
})).json();
const policyVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.