Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
OptionalappPublicKey: stringOptionalappJWT: stringOptionalsharedAppPublicKey: stringOptionalsharedAppJWT: stringPopulates the dataObject property with ecosystem-wide data, or returns an error response.
Increments a specific value in the data object for a Topia ecosystem by the amount specified. Must have valid interactive credentials from a visitor in the world.
Returns success or an error response.
This method also allows you to increment a data object value on behalf of another Public Key. It requires canUpdateEcosystemDataObjects permission to be set to true for the Public Key.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
Sets the data object for a Topia ecosystem.
Returns success or an error response.
This method also allows you to set a data object on behalf of another Public Key. It requires canUpdateEcosystemDataObjects permission to be set to true for the Public Key.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
Updates the data object for a Topia ecosystem.
Returns success or an error response.
This method also allows you to update a data object on behalf of another Public Key. It requires canUpdateEcosystemDataObjects permission to be set to true for the Public Key.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await ecosystem.updateDataObject({
[`profiles.${profileId}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
[`profileMapper.${profileId}`]: username,
}, {
sharedAppPublicKey: "exampleAppPublicKey",
sharedAppJWT: "exampleAppPublicKeyJWT",
analytics: [{ analyticName: "itemCollected", profileId, uniqueKey: profileId, urlSlug } ],
lock: { lockId: `${assetId}-${resetCount}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` },
}
});
const { exampleKey } = ecosystem.dataObject;
Retrieves all inventory items for a given keyholder (app public key).
Populates the inventoryItems property with an array of InventoryItem objects.
OptionaldataOptionaljwtStandardized error handler for all SDK operations.
Standardized error object with properties: data, message, method, params, sdkMethod, stack, status, success, url
This method processes errors from API calls and formats them consistently across the SDK. It extracts relevant error information including:
All errors thrown by SDK methods flow through this handler to ensure consistent error format.
Returns the configured Axios instance for making API calls to Topia's Public API.
The configured Axios client instance with authentication headers.
Create an instance of Ecosystem class with optional session credentials
Example