//native
type Square = {
token: string;
};
/**
* DeleteCatalogObject
* Deletes a single [CatalogObject]($m/CatalogObject) based on the
provided ID and returns the set of successfully deleted IDs in the response.
*/
export async function main(auth: Square, object_id: string) {
const url = new URL(
`https://connect.squareup.com/v2/catalog/object/${object_id}`,
);
const response = await fetch(url, {
method: "DELETE",
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