0

Reactors Update

by
Published Oct 17, 2025

Reactors Update

Script basis_theory Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Basistheory = {
3
  apiKey: string;
4
};
5
/**
6
 * Reactors Update
7
 * Reactors Update
8
 */
9
export async function main(
10
  auth: Basistheory,
11
  id: string,
12
  body: {
13
    application?: {
14
      created_at?: string;
15
      created_by?: string;
16
      id?: string;
17
      key?: string;
18
      keys?: {
19
        created_at?: string;
20
        created_by?: string;
21
        id?: string;
22
        key?: string;
23
        version?: string;
24
      }[];
25
      modified_at?: string;
26
      modified_by?: string;
27
      name?: string;
28
      permissions?: string[];
29
      rules?: {
30
        conditions?: {
31
          attribute?: string;
32
          operator?: string;
33
          value?: string;
34
        }[];
35
        container?: string;
36
        description?: string;
37
        permissions?: string[];
38
        priority?: string;
39
        transform?: string;
40
      }[];
41
      tenant_id?: string;
42
      type?: string;
43
    };
44
    code?: string;
45
    configuration?: { aliquip_3c5?: string };
46
    name?: string;
47
  },
48
) {
49
  const url = new URL(`https://api.basistheory.com/reactors/${id}`);
50

51
  const response = await fetch(url, {
52
    method: "PUT",
53
    headers: {
54
      "Content-Type": "application/json",
55
      "BT-API-KEY": auth.apiKey,
56
    },
57
    body: JSON.stringify(body),
58
  });
59
  if (!response.ok) {
60
    const text = await response.text();
61
    throw new Error(`${response.status} ${text}`);
62
  }
63
  return await response.json();
64
}
65