RTSDK
    Preparing search index...

    Class DroppedAsset

    Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.

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

    const droppedAsset = await DroppedAsset.get(exampleDroppedAssetId, exampleUrlSlug, {
    credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
    });

    Hierarchy (View Summary)

    Implements

    Index

    Data Objects

    • Retrieves the data object for a dropped asset.

      Parameters

      • OptionalappPublicKey: string
      • OptionalappJWT: string
      • OptionalsharedAppPublicKey: string
      • OptionalsharedAppJWT: string

      Returns Promise<void | ResponseType>

      Returns the data object or an error response.

      get, fetch, retrieve, load, data, object, state

      const dataObject = await droppedAsset.fetchDataObject();
      
    • Increments a specific value in the data object for a dropped asset by the amount specified. Must have valid interactive credentials from a visitor in the world.

      Parameters

      • path: string
      • amount: number
      • options: {
            analytics?: AnalyticType[];
            appJWT?: string;
            appPublicKey?: string;
            lock?: { lockId: string; releaseLock?: boolean };
            sharedAppJWT?: string;
            sharedAppPublicKey?: string;
        } = {}

      Returns Promise<void | ResponseType>

      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

      increment, increase, add, count, data, object, state

      await droppedAsset.incrementDataObjectValue("key", 1);
      
    • Sets the data object for a dropped asset and assigns the response data to the instance.

      Parameters

      • dataObject: object
      • options: {
            analytics?: AnalyticType[];
            appJWT?: string;
            appPublicKey?: string;
            lock?: { lockId: string; releaseLock?: boolean };
            sharedAppJWT?: string;
            sharedAppPublicKey?: string;
        } = {}

      Returns Promise<void | ResponseType>

      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

      set, assign, store, save, data, object, state

      await droppedAsset.setDataObject(
      { resetCount: 0 },
      {
      analytics: [{ analyticName: "resets"} ],
      lock: { lockId: `${assetId}-${resetCount}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` },
      },
      );

      const { resetCount } = droppedAsset.dataObject;
    • Updates the data object for a dropped asset and assigns the response data to the instance.

      Parameters

      • dataObject: object
      • options: {
            analytics?: AnalyticType[];
            appJWT?: string;
            appPublicKey?: string;
            lock?: { lockId: string; releaseLock?: boolean };
            sharedAppJWT?: string;
            sharedAppPublicKey?: string;
        } = {}

      Returns Promise<void | ResponseType>

      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

      update, modify, change, edit, alter, data, object, state

      await droppedAsset.updateDataObject({
      [`profiles.${profileId}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
      [`profileMapper.${profileId}`]: username,
      });

      const { profiles } = droppedAsset.dataObject;

    Other

    credentials: undefined | InteractiveCredentials
    dataObject?: null | object
    id?: string
    interactivePublicKey?: null | string
    isInteractive?: null | boolean
    jwt?: string
    position: { x: number; y: number }
    requestOptions: object
    text?: null | string
    topia: Topia
    urlSlug: string
    • Add a webhook to a dropped asset

      Parameters

      • __namedParameters: {
            dataObject: object;
            description: string;
            isUniqueOnly: boolean;
            shouldSetClickType?: boolean;
            shouldSetIsInteractive?: boolean;
            title: string;
            type: string;
            url: string;
        }

      Returns Promise<void | AxiosResponse<any, any>>

      Returns the new webhookId or an error.

      webhook, dropped asset settings

      await droppedAsset.addWebhook({
      dataObject: {},
      description: "Webhook desc",
      enteredBy: "you",
      isUniqueOnly: false,
      title: "title",
      type: "type",
      url: "https://url.com",
      });
    • Checks if this dropped asset exists with the current app's public key installed.

      Returns Promise<{ exists: boolean }>

      Returns whether the asset exists with the app's public key.

      check, exists, verify, validate, lookup

      const { exists } = await droppedAsset.checkExists();
      
    • Deletes the dropped asset (removes it from the world).

      Returns Promise<void | ResponseType>

      remove, delete, erase, destroy, eliminate

      await droppedAsset.deleteDroppedAsset();
      
    • 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;
    • Retrieve analytics for a dropped asset by day, week, month, quarter, or year

      Parameters

      • __namedParameters: {
            dateValue: number;
            periodType: "week" | "month" | "quarter" | "year";
            year: number;
        }

      Returns Promise<void | ResponseType>

      Returns the analytics data or an error.

      get, fetch, retrieve, load, analytics

      const analytics = await droppedAsset.fetchDroppedAssetAnalytics({
      periodType: "quarter",
      dateValue: 3,
      year: 2023,
      });
    • Retrieves dropped asset details and assigns response data to the instance.

      Returns Promise<void | ResponseType>

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

      await droppedAsset.fetchDroppedAssetById();
      const { assetName } = droppedAsset;
    • Flip an dropped asset.

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      flip, layout, dropped asset settings

      await droppedAsset.flip(.5);
      
    • Adds an array of links to an asset. Maximum is 20 links.

      Parameters

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      links, multiple, clickable, urls, hyperlinks, dropped asset settings

      await droppedAsset.setClickableLinkMulti({
      clickableLinks: [
      {
      clickableLink: "https://example_one.com",
      clickableLinkTitle: "Example One Link",
      isForceLinkInIframe: true,
      isOpenLinkInDrawer: false,
      },
      {
      clickableLink: "https://example two.com",
      clickableLinkTitle: "Example Two Link",
      isForceLinkInIframe: false,
      isOpenLinkInDrawer: false,
      },
      ],
      });
    • Set the interactive settings on a dropped asset

      Parameters

      • __namedParameters: { interactivePublicKey: string; isInteractive?: boolean }

      Returns Promise<void | ResponseType>

      interactive, dropped asset settings

      await droppedAsset.setInteractiveSettings({
      isInteractive: true,
      interactivePublicKey: "xyz"
      });
    • 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;
    • Updates broadcast options for a dropped asset.

      Parameters

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      broadcast, dropped asset settings

      await droppedAsset.updateBroadcast({
      assetBroadcast: true,
      assetBroadcastAll: true,
      broadcasterEmail: "example@email.com"
      });
    • Updates multiple clickable links for a dropped asset.

      Parameters

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      Pass in an 'existingLinkId' to edit an existing link.

      links, multiple, clickable, urls, dropped asset settings

      await droppedAsset.updateClickableLinkMulti({
      clickableLink: "https://example.com",
      clickableLinkTitle: "Example Link",
      isForceLinkInIframe: true,
      isOpenLinkInDrawer: false,
      existingLinkId: "abcd"
      });
    • Updates click options for a dropped asset.

      Parameters

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      click, link, interaction, url, dropped asset settings

      await droppedAsset.updateClickType({
      "clickType": "portal",
      "clickableLink": "https://topia.io",
      "clickableLinkTitle": "My awesome link!",
      "clickableDisplayTextDescription": "Description",
      "clickableDisplayTextHeadline": "Title",
      "position": {
      "x": 0,
      "y": 0
      },
      "portalName": "community"
      });
    • Updates text and style of a dropped asset.

      Parameters

      • style: undefined | null | object
      • text: undefined | null | string

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      text, style, dropped asset settings

      const style = {
      "textColor": "#abc123",
      "textFontFamily": "Arial",
      "textSize": 40,
      "textWeight": "normal",
      "textWidth": 200
      };
      await droppedAsset.updateCustomTextAsset(style, "hello world");
    • Updates dropped asset details and assigns the response data to the instance. Requires Public Key to have the canUpdateDroppedAssets permission.

      Parameters

      Returns Promise<void | ResponseType>

      update, modify, change, edit, alter, transform

      const payload = {
      assetScale: 1,
      clickType: "link",
      clickableDisplayTextDescription: "Description",
      clickableDisplayTextHeadline: "Headline",
      clickableLink: "https://topia.io",
      clickableLinkTitle: "Topia",
      flipped: false,
      isTextTopLayer: false,
      layer0: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
      layer1: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
      position: { x: 0, y: 0 },
      specialType: "webImage",
      text: "My Asset",
      textColor: "#000000",
      textSize: 20,
      textWeight: "normal",
      textWidth: 200,
      uniqueName: "example",
      yOrderAdjust: 0,
      }
      await droppedAsset.updateDroppedAsset();
      const { assetName } = droppedAsset;
    • Updates landmark zone options for a dropped asset.

      Parameters

      • __namedParameters: {
            isLandmarkZoneEnabled: boolean;
            landmarkZoneIsVisible?: boolean;
            landmarkZoneName?: string;
        }

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      landmark, zone, dropped asset settings

      await droppedAsset.updateLandmarkZone({
      isLandmarkZoneEnabled: true,
      landmarkZoneName: "Example",
      landmarkZoneIsVisible: true,
      });
    • Updates media options for a dropped asset.

      Parameters

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      media, video, audio, dropped asset settings

      await droppedAsset.updateMediaType({
      "mediaType": "link",
      "mediaLink": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "isVideo": true,
      "syncUserMedia": true,
      "audioSliderVolume: 30"
      "portalName": "community",
      "audioRadius": 0,
      "mediaName": "string"
      });
    • Updates mute zone options for a dropped asset.

      Parameters

      • isMutezone: boolean

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      mute, zone, dropped asset settings

      await droppedAsset.updateMuteZone(true);
      
    • Moves a dropped asset to specified coordinates.

      Parameters

      • x: number
      • y: number
      • OptionalyOrderAdjust: number

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      position, dropped asset settings

      await droppedAsset.updatePosition(100, 200, 100);
      
    • Updates private zone options for a dropped asset.

      Parameters

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      private, zone, dropped asset settings

      await droppedAsset.updatePrivateZone({
      "isPrivateZone": false,
      "isPrivateZoneChatDisabled": true,
      "privateZoneUserCap": 10
      });
    • Updates the size of a dropped asset.

      Parameters

      • assetScale: number

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      size, scale, dropped asset settings

      await droppedAsset.assetScale(.5);
      
    • Change or remove media embedded in a dropped asset.

      Parameters

      • mediaId: string

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      media, update, dropped asset settings

      await droppedAsset.updateUploadedMediaSelected("LVWyxwNxI96eLjnXWwYO");
      
    • Updates webhook zone options for a dropped asset.

      Parameters

      • isWebhookZoneEnabled: boolean

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      webhook, zone, dropped asset settings

      await droppedAsset.updateWebhookZone(true);
      
    • Change or remove top and bottom layers of a dropped asset.

      Parameters

      • bottom: string
      • top: string

      Returns Promise<void | ResponseType>

      Returns the updated dropped asset or an error.

      layers, images, urls, dropped asset settings

      await droppedAsset.updateWebImageLayers("","https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg");