//native
type Yelp = {
apiKey: string;
};
/**
* Get Monthly Report
* Fetch the monthly report associated with {report_id}.
*/
export async function main(auth: Yelp, report_id: string) {
const url = new URL(
`https://api.yelp.com/v3/reporting//businesses/monthly/${report_id}`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
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