//native
type Square = {
token: string;
};
/**
* EnableEvents
* Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
*/
export async function main(auth: Square) {
const url = new URL(`https://connect.squareup.com/v2/events/enable`);
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago