Edits history of script submission #1258 for ' Create a new domain (resend)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Resend = {
      token: string;
    };
    /**
     * Create a new domain
     *
     */
    export async function main(
      auth: Resend,
      body: {
        name: string;
        region?: "us-east-1" | "eu-west-1" | "sa-east-1";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.resend.com/domains`);
    
      const response = await fetch(url, {
        method: "POST",
        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;
    };
    /**
     * Create a new domain
     *
     */
    export async function main(
      auth: Resend,
      body: {
        name: string;
        region?: "us-east-1" | "eu-west-1" | "sa-east-1";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.resend.com/domains`);
    
      const response = await fetch(url, {
        method: "POST",
        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 960 days ago

  • nativets
    export type Resend = {
      token: string;
    };
    /**
     * Create a new domain
     *
     */
    export async function main(
      auth: Resend,
      body: {
        /**   * The name of the domain you want to create.   */ name: string;
        /**   * The region where emails will be sent from. Possible values are us-east-1' | 'eu-west-1' | 'sa-east-1   */ region?:
          | "us-east-1"
          | "eu-west-1"
          | "sa-east-1";
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.resend.com/domains`);
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        body: JSON.stringify(body),
      });
      return await response.json();
    }
    

    Submitted by rubenfiszel 961 days ago