//native
type Yelp = {
apiKey: string;
};
/**
* Event Details
* This endpoint returns the detailed information of a Yelp event.
You can get the event ID from /events or /events/featured.
*/
export async function main(
auth: Yelp,
event_id: string,
locale: string | undefined,
) {
const url = new URL(`https://api.yelp.com//v3/events/${event_id}`);
for (const [k, v] of [["locale", locale]]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
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