Edits history of script submission #14260 for ' Proxies Patch (basis_theory)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Basistheory = {
      apiKey: string;
    };
    /**
     * Proxies Patch
     * Proxies 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;
        };
        configuration?: { sit898?: string; sunt133?: string };
        destination_url?: string;
        name?: string;
        request_transform?: {
          code?: string;
          expression?: string;
          matcher?: string;
          replacement?: string;
          type?: string;
        };
        require_auth?: string;
        response_transform?: {
          code?: string;
          expression?: string;
          matcher?: string;
          replacement?: string;
          type?: string;
        };
      },
    ) {
      const url = new URL(`https://api.basistheory.com/proxies/${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