Edits history of script submission #14266 for ' Reactor Formulas Update (basis_theory)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Basistheory = {
      apiKey: string;
    };
    /**
     * Reactor Formulas Update
     * Reactor Formulas Update
     */
    export async function main(
      auth: Basistheory,
      id: string,
      body: {
        code?: string;
        configuration?: { description?: string; name?: string; type?: string }[];
        description?: string;
        icon?: string;
        name?: string;
        request_parameters?: {
          description?: string;
          name?: string;
          optional?: string;
          type?: string;
        }[];
        type?: string;
      },
    ) {
      const url = new URL(`https://api.basistheory.com/reactor-formulas/${id}`);
    
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          "Content-Type": "application/json",
          "BT-API-KEY": auth.apiKey,
        },
        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