Skip to main content
resources/invoices.InvoiceClient The InvoiceClient handles operations related to invoices, which are records of sales or usage of licensed assets. Invoices are typically imported from external platforms (e.g., Roblox sales data) and are used as the basis for calculating and distributing royalties to rights holders. This client can import, fetch, and even generate mock invoice data for testing.

Table of contents

Methods

constructor

new InvoiceClient(client): InvoiceClient

Parameters

Returns

InvoiceClient

Methods

import

import(params): Promise<ImportInvoicesResponse> Import invoices from a CSV file into the Directus database This method uploads a CSV file to the backend and processes it to create invoice records in the database. It can be used in preview mode to validate the data before actual import.

Parameters

Returns

Promise<ImportInvoicesResponse> Promise resolving to import results Example

generateMockInvoiceData

generateMockInvoiceData(options?): Promise<GeneratedInvoiceCSV> Generates mock Roblox invoice data for testing purposes This method creates realistic-looking invoice data distributed across quarters with randomized revenue and pricing data suitable for testing royalty calculations.

Parameters

Returns

Promise<GeneratedInvoiceCSV> Promise resolving to generated CSV data and metadata Example

generateMockCSVFile

generateMockCSVFile(filename?, options?): Promise<{ file: File ; metadata: Omit<GeneratedInvoiceCSV, "csvContent"> }> Generates a File object containing mock CSV data This is a convenience method that combines generateMockInvoiceData with File creation for direct use with file upload APIs.

Parameters

Returns

Promise<{ file: File ; metadata: Omit<GeneratedInvoiceCSV, "csvContent"> }> Promise resolving to a File object and metadata Example

getAll

getAll(params?): Promise<Invoice[]> Fetch invoices from the backend with optional filtering This method retrieves invoice records from the database with support for various filters including product ID, date ranges, and status.

Parameters

Returns

Promise<Invoice[]> Promise resolving to array of invoices Example