Edits history of script submission #5883 for ' Update an existing domain (resend)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Resend = {
      token: string;
    };
    /**
     * Update an existing domain
     *
     */
    export async function main(
      auth: Resend,
      domain_id: string,
      body: {
        click_tracking?: boolean;
        open_tracking?: boolean;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.resend.com/domains/${domain_id}`);
    
      const response = await fetch(url, {
        method: "PATCH",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        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 399 days ago

  • nativets
    type Resend = {
      token: string;
    };
    /**
     * Update an existing domain
     *
     */
    export async function main(
      auth: Resend,
      domain_id: string,
      body: {
        click_tracking?: boolean;
        open_tracking?: boolean;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.resend.com/domains/${domain_id}`);
    
      const response = await fetch(url, {
        method: "PATCH",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        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 826 days ago