Hierarchy (view full)

Constructors

Accessors

Methods

  • A helper function to ensure that API calls are successful and return a valid status code.

    Type Parameters

    • T

    Parameters

    • call: (() => Promise<AxiosResponse<T, any>>)

      The API call to guard for exceptions and bad return codes.

        • (): Promise<AxiosResponse<T, any>>
        • Returns Promise<AxiosResponse<T, any>>

    Returns Promise<T>

    A promise of the type returned by Axios in the data field.

  • Parameters

    • invoiceId: string

      Downloads an invoice by it's invoiceId. The invoiceId can be found on a payment cycle that has been completed as well as other areas of the Mozaic SDK.

    Returns Promise<ArrayBuffer>

    an ArrayBuffer containing the bytes of an Invoice PDF. It can be saved using:

    fs.writeFileSync(fileName, Buffer.from(arrayBuffer));

  • A helper function that will either return the variable's value or throw an exception if the value is null or undefined. Unit testing is simplified by avoiding ??

    Type Parameters

    • T

    Parameters

    • name: string

      The name of the variable being checked

    • value: undefined | null | T

      The value of the variable being checked

    Returns T

    The value of the variable if it is available, otherwise an exception is thrown.