Skip to content

OrderExport

ClassAssetInventoryAssetInventory.Editor
public static class OrderExport

Explicit account-scoped financial exports. JSON retains source strings; CSV protects spreadsheet text without removing delimiters or line breaks.

public static OrderExport.Snapshot Capture(OrderQuery query, CancellationToken cancellationToken = default)

Captures every matching cached order and its lines. This never logs in or contacts Unity.

Parameters

Name Type
query AssetInventory.OrderQuery
cancellationToken System.Threading.CancellationToken

Returns

AssetInventory.OrderExport.Snapshot

CreateSnapshot(string, IEnumerable, IEnumerable, OrderAccountInfo)

Section titled “CreateSnapshot(string, IEnumerable, IEnumerable, OrderAccountInfo)”
public static OrderExport.Snapshot CreateSnapshot(string accountId, IEnumerable<AssetStoreOrder> orders, IEnumerable<AssetStoreOrderItem> items, OrderAccountInfo account = null)

Creates an export from supplied rows, preserving repeated acquisitions and refusing cross-account data.

Parameters

Name Type
accountId System.String
orders System.Collections.Generic.IEnumerable{AssetInventory.AssetStoreOrder}
items System.Collections.Generic.IEnumerable{AssetInventory.AssetStoreOrderItem}
account AssetInventory.OrderAccountInfo

Returns

AssetInventory.OrderExport.Snapshot

public static string BuildJson(OrderExport.Snapshot snapshot)

Renders the captured snapshot as indented JSON while retaining its original source strings.

Parameters

Name Type
snapshot AssetInventory.OrderExport.Snapshot

Returns

System.String

public static string BuildCsv(OrderExport.Snapshot snapshot, bool acquisitions = false)

Renders order rows or acquisition rows as quoted CSV with spreadsheet-safe text handling.

Parameters

Name Type
snapshot AssetInventory.OrderExport.Snapshot
acquisitions System.Boolean

Returns

System.String

public static string EncodeCsvValue(string value, bool preserveText = false)

CSV escaping preserves delimiters and line breaks. Spreadsheet text prefixes are intentional and reversible; JSON retains the exact original text.

Parameters

Name Type
value System.String
preserveText System.Boolean

Returns

System.String

WriteAsync(Snapshot, string, OrderExportMode, CancellationToken)

Section titled “WriteAsync(Snapshot, string, OrderExportMode, CancellationToken)”
public static Task WriteAsync(OrderExport.Snapshot snapshot, string filePath, OrderExportMode mode, CancellationToken cancellationToken = default)

Writes the captured dataset without querying or authenticating again.

Parameters

Name Type
snapshot AssetInventory.OrderExport.Snapshot
filePath System.String
mode AssetInventory.OrderExportMode
cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task