Edits history of script submission #15682 for ' Account Update Details (deep_infra)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Deepinfra = {
      token: string;
    };
    /**
     * Account Update Details
     *
     */
    export async function main(
      auth: Deepinfra,
      body: {
        name?: string;
        email?: string;
        is_business_account?: false | true;
        company?: string;
        website?: string;
        display_name?: string;
      },
    ) {
      const url = new URL(`https://api.deepinfra.com/v1/me`);
    
      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 235 days ago