Edits history of script submission #11305 for ' Get lead form questions (pinterest)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Pinterest = {
      token: string;
    };
    /**
     * Get lead form questions
     * Get a list of all lead form question type names. Some questions might not be used.
    
    This endpoint is currently in beta and not available to all apps. Learn more.
     */
    export async function main(auth: Pinterest) {
      const url = new URL(
        `https://api.pinterest.com/v5/resources/lead_form_questions`,
      );
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 536 days ago