//native
type Basistheory = {
apiKey: string;
};
/**
* Tokens Update
* Tokens Update
*/
export async function main(
auth: Basistheory,
id: string,
body: {
containers?: string[];
data?: { nullable?: false | true };
deduplicate_token?: string;
expires_at?: string;
fingerprint_expression?: string;
mask?: { nullable?: false | true };
metadata?: { aliquip_882?: string; dolore_0c?: string };
privacy?: { impact_level?: string; restriction_policy?: string };
search_indexes?: string[];
},
) {
const url = new URL(`https://api.basistheory.com/tokens/${id}`);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"BT-API-KEY": auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago