Edits history of script submission #21064 for ' Waitlist Status of the business (yelp)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Yelp = {
      apiKey: string;
    };
    /**
     * Waitlist Status of the business
     * This endpoint returns waitlist status about a specific business by querying the encryped Yelp business id.
     */
    export async function main(auth: Yelp, business_id: string) {
      const url = new URL(
        `https://api.yelp.com/v3/businesses/${business_id}/waitlist/status`,
      );
    
      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