open, interoperable sandbox platform for agents and humans 📦 ✨ pocketenv.io
claude-code atproto sandbox openclaw agent
at main 84 lines 1.7 kB view raw
1import { client } from "."; 2import type { Variable } from "../types/variable"; 3 4export const addVariable = (sandboxId: string, name: string, value: string) => 5 client.post( 6 "/xrpc/io.pocketenv.variable.addVariable", 7 { 8 variable: { 9 sandboxId, 10 name, 11 value, 12 }, 13 }, 14 { 15 headers: { 16 Authorization: `Bearer ${localStorage.getItem("token")}`, 17 }, 18 }, 19 ); 20 21export const deleteVariable = (id: string) => 22 client.post(`/xrpc/io.pocketenv.variable.deleteVariable`, undefined, { 23 params: { 24 id, 25 }, 26 headers: { 27 Authorization: `Bearer ${localStorage.getItem("token")}`, 28 }, 29 }); 30 31export const getVariables = ( 32 sandboxId?: string, 33 offset?: number, 34 limit?: number, 35) => 36 client.get<{ variables: Variable[]; total: number }>( 37 `/xrpc/io.pocketenv.variable.getVariables`, 38 { 39 params: { 40 sandboxId, 41 offset: offset ?? 0, 42 limit: limit ?? 30, 43 }, 44 headers: { 45 Authorization: `Bearer ${localStorage.getItem("token")}`, 46 }, 47 }, 48 ); 49 50export const getVariable = (id: string) => 51 client.get<{ variable: Variable }>( 52 `/xrpc/io.pocketenv.variable.getVariable`, 53 { 54 params: { 55 id, 56 }, 57 headers: { 58 Authorization: `Bearer ${localStorage.getItem("token")}`, 59 }, 60 }, 61 ); 62 63export const updateVariable = ( 64 id: string, 65 name: string, 66 value: string, 67 sandboxId: string, 68) => 69 client.post( 70 "/xrpc/io.pocketenv.variable.updateVariable", 71 { 72 id, 73 variable: { 74 name, 75 value, 76 sandboxId, 77 }, 78 }, 79 { 80 headers: { 81 Authorization: `Bearer ${localStorage.getItem("token")}`, 82 }, 83 }, 84 );