RTSDK
    Preparing search index...

    Class Asset

    Create an instance of Asset class with a given asset id and optional attributes and session credentials.

    import { Asset } from "utils/topiaInit.ts";

    const asset = await Asset.create(assetId, {
    attributes: { assetName: "My Asset", isPublic: false },
    credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
    });

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    credentials: undefined | InteractiveCredentials
    id?: string
    jwt?: string
    requestOptions: object
    topia: Topia

    Methods

    • Standardized error handler for all SDK operations.

      Parameters

      • __namedParameters: { error?: unknown; message?: string; params?: object; sdkMethod?: string }

      Returns {
          data: {};
          message: string;
          method: string;
          params: object;
          sdkMethod: undefined | string;
          stack: string;
          stackTrace: Error;
          status: number;
          success: boolean;
          url: string;
      }

      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:

      • HTTP status codes and response data
      • Error messages from API responses
      • Stack traces for debugging
      • Request details (URL, method, parameters)

      All errors thrown by SDK methods flow through this handler to ensure consistent error format.

      error, exception, handler, debugging, api error, http error

    • Retrieves platform asset details and assigns response data to the instance.

      Returns Promise<object | ResponseType>

      Returns the asset details or an error response.

      get, fetch, retrieve, load, details, info, information

      await asset.fetchAssetById();
      const { assetName } = asset;
    • Returns the configured Axios instance for making API calls to Topia's Public API.

      Returns AxiosInstance

      The configured Axios client instance with authentication headers.

      All HTTP requests to the Topia API should use this method to ensure proper authentication headers and base URL configuration are applied.

      api, axios, http, request, client, public api

    • Updates platform asset details.

      Parameters

      • __namedParameters: {
            assetName: string;
            bottomLayerURL?: string;
            creatorTags: object;
            isPublic: boolean;
            shouldUploadImages?: boolean;
            tagJson: string;
            topLayerURL?: string;
        }

      Returns Promise<object | ResponseType>

      update, modify, change, edit, alter, transform

      await asset.updateAsset({
      assetName: "exampleAsset",
      bottomLayerURL: null,
      creatorTags: { "decorations": true },
      isPublic: true,
      shouldUploadImages: true,
      tagJson: "[{"label":"decorations","value":"decorations"}]",
      topLayerURL: "https://example.topLayerURL"
      });
      const { assetName } = asset;