RTSDK
    Preparing search index...

    Class WorldFactory

    Factory for creating World instances. Use this factory to interact with Topia worlds.

    This factory should be instantiated once per application and reused across your codebase. The World controller provides methods to manage world settings, retrieve world details, and perform world-level operations.

    world, factory, create, virtual space, environment, room, topia

    // In your initialization file (e.g., utils/topiaInit.ts)
    import { Topia, WorldFactory } from "@rtsdk/topia";
    const topia = new Topia({ config });
    export const World = new WorldFactory(topia);

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

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

    Methods

    • Instantiate a new instance of World class for interacting with a specific Topia world.

      Parameters

      Returns World

      Returns a new World object for interacting with the specified world.

      This method creates a controller instance for a world identified by its URL slug. The world controller can be used to fetch details, update world settings, and perform other world-level operations.

      create, instantiate, world, initialize, virtual space, environment, room

      // Import the pre-initialized factory from your app's initialization file
      import { World } from "utils/topiaInit.ts";

      // Create a World instance with credentials
      const worldInstance = World.create(
      "my-world-slug",
      {
      credentials: {
      interactiveNonce,
      interactivePublicKey,
      assetId,
      urlSlug,
      visitorId
      }
      }
      );

      // Fetch world details
      await worldInstance.fetchDetails();
      console.log(worldInstance.name);
    • Deletes multiple dropped assets from a world in a single operation.

      Parameters

      • urlSlug: string
      • droppedAssetIds: string[]
      • interactiveSecret: string
      • credentials: {
            apiKey?: string;
            interactiveNonce?: string;
            interactivePublicKey: string;
            visitorId?: number;
        }

      Returns Promise<{ success: boolean }>

      Returns { success: true } if all assets were deleted successfully.

      This method provides a convenient way to delete multiple dropped assets at once rather than deleting them one by one. Requires appropriate permissions via interactive credentials.

      delete, remove, dropped assets, multiple, batch, cleanup, world

      // Import the pre-initialized factory from your app's initialization file
      import { World } from "utils/topiaInit.ts";

      // Delete multiple dropped assets from a world
      const result = await World.deleteDroppedAssets(
      "my-world-slug",
      ["asset-id-123", "asset-id-456", "asset-id-789"],
      "your-interactive-secret",
      {
      apiKey: "your-api-key",
      interactivePublicKey: "your-public-key",
      visitorId: 12345
      }
      );

      if (result.success) {
      console.log("Assets successfully deleted");
      }
    • 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;
      }

    • Returns AxiosInstance