Edits history of script submission #1260 for ' Remove an existing API key (resend)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Resend = {
      token: string;
    };
    /**
     * Remove an existing API key
     *
     */
    export async function main(auth: Resend, api_key_id: string) {
      const url = new URL(`https://api.resend.com/api-keys/${api_key_id}`);
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 399 days ago

  • nativets
    type Resend = {
      token: string;
    };
    /**
     * Remove an existing API key
     *
     */
    export async function main(auth: Resend, api_key_id: string) {
      const url = new URL(`https://api.resend.com/api-keys/${api_key_id}`);
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 960 days ago

  • nativets
    export type Resend = {
      token: string;
    };
    /**
     * Remove an existing API key
     *
     */
    export async function main(auth: Resend, api_key_id: string) {
      const url = new URL(`https://api.resend.com/api-keys/${api_key_id}`);
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      return await response.text();
    }
    

    Submitted by rubenfiszel 961 days ago