Edits history of script submission #14573 for ' Create a new receipt match (brex)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Brex = {
      token: string;
    };
    /**
     * Create a new receipt match
     * 
    The `uri` will be a pre-signed S3 URL allowing you to upload the receipt securely.
     */
    export async function main(auth: Brex, body: { receipt_name: string }) {
      const url = new URL(
        `https://platform.brexapis.com/v1/expenses/card/receipt_match`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        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 217 days ago