Edits history of script submission #14271 for ' Reactors Patch (basis_theory)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Basistheory = {
      apiKey: string;
    };
    /**
     * Reactors Patch
     * Reactors Patch
     */
    export async function main(
      auth: Basistheory,
      id: string,
      body: {
        application?: {
          created_at?: string;
          created_by?: string;
          id?: string;
          key?: string;
          keys?: {
            created_at?: string;
            created_by?: string;
            id?: string;
            key?: string;
            version?: string;
          }[];
          modified_at?: string;
          modified_by?: string;
          name?: string;
          permissions?: string[];
          rules?: {
            conditions?: {
              attribute?: string;
              operator?: string;
              value?: string;
            }[];
            container?: string;
            description?: string;
            permissions?: string[];
            priority?: string;
            transform?: string;
          }[];
          tenant_id?: string;
          type?: string;
        };
        code?: string;
        configuration?: { dolore_4c?: string; est_f?: string; labore_4?: string };
        name?: string;
      },
    ) {
      const url = new URL(`https://api.basistheory.com/reactors/${id}`);
    
      const response = await fetch(url, {
        method: "PATCH",
        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.text();
    }
    

    Submitted by hugo697 235 days ago