Table of contents
Methods
constructor
• new InvoiceClient(client): InvoiceClient
Parameters
| Name | Type |
|---|---|
client | SpaceportSDK |
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
| Name | Type | Description |
|---|---|---|
params | ImportInvoicesParams | Import parameters including CSV file and options |
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
| Name | Type | Description |
|---|---|---|
options | GenerateInvoiceCSVOptions | Configuration options for CSV generation |
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
| Name | Type | Default value | Description |
|---|---|---|---|
filename | string | 'mock-invoices.csv' | The filename for the generated file |
options | GenerateInvoiceCSVOptions | {} | Configuration options for CSV generation |
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
| Name | Type | Description |
|---|---|---|
params | FetchInvoicesParams | Fetch parameters for filtering invoices |
Returns
Promise<Invoice[]>
Promise resolving to array of invoices
Example

