Edits history of script submission #11698 for ' GET a group details (brevo)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Brevo = {
      apiKey: string;
    };
    /**
     * GET a group details
     * This endpoint allows you to retrieve a specific group’s information such as the list of sub-organizations and the user associated with the group.
     */
    export async function main(auth: Brevo, id: string) {
      const url = new URL(`https://api.brevo.com/v3/corporate/group/${id}`);
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          "api-key": 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 428 days ago