//native
type Square = {
token: string;
};
/**
* BatchRetrieveCatalogObjects
* Returns a set of objects based on the provided ID.
Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its
child information including: all of its
[CatalogItemVariation]($m/CatalogItemVariation) objects, references to
its [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
any [CatalogTax]($m/CatalogTax) objects that apply to it.
*/
export async function main(
auth: Square,
body: {
object_ids: string[];
include_related_objects?: false | true;
catalog_version?: number;
include_deleted_objects?: false | true;
include_category_path_to_root?: false | true;
},
) {
const url = new URL(`https://connect.squareup.com/v2/catalog/batch-retrieve`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
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