//native
type Yelp = {
apiKey: string;
};
/**
* Join queue
* Join the queue for a restaurant.
*/
export async function main(
auth: Yelp,
business_id: string,
body: {
phone: string;
party_size: number;
name: string;
seating_area_preference?: string;
party_notes?: string;
idempotency_token?: string;
},
) {
const url = new URL(
`https://api.yelp.com/v3/businesses/${business_id}/waitlist/visits`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
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