Edits history of script submission #21047 for ' Get Quota (yelp)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Yelp = {
      apiKey: string;
    };
    /**
     * Get Quota
     * Get quota information for the given subscription type.
    This includes the maximum number of subscriptions that can be active this month, the current total number of active subscriptions and the remaining amount that can be created this month.
    To get quota information regarding the deletion of subscriptions, please reach out to partner-support@yelp.com
    
     */
    export async function main(
      auth: Yelp,
      quota_subscription_type: "YELP_KNOWLEDGE",
    ) {
      const url = new URL(
        `https://api.yelp.com/v3/businesses//subscriptions/${quota_subscription_type}/quota`,
      );
    
      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