RTSDK
    Preparing search index...

    Class Ecosystem

    Create an instance of Ecosystem class with optional session credentials

    const ecosystem =await new Ecosystem(topia, {
    credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
    });

    Hierarchy (View Summary)

    Index

    Data Objects

    • Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.

      Parameters

      • OptionalappPublicKey: string
      • OptionalappJWT: string

      Returns Promise<void | ResponseType>

      Returns the data object or an error response.

      const dataObject = await ecosystem.fetchDataObject("exampleAppPublicKey", "exampleAppPublicKeyJWT");
      
    • 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.

      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>

      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

      await ecosystem.incrementDataObjectValue("key", 1, {
      sharedAppPublicKey: "exampleAppPublicKey",
      sharedAppJWT: "exampleAppPublicKeyJWT",}
      });
    • Sets the data object for a Topia ecosystem.

      Parameters

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

      Returns Promise<void | ResponseType>

      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

      await ecosystem.setDataObject({ "exampleKey": "exampleValue" }, {
      sharedAppPublicKey: "exampleAppPublicKey",
      sharedAppJWT: "exampleAppPublicKeyJWT",}
      });
      const { exampleKey } = ecosystem.dataObject;
    • Updates the data object for a Topia ecosystem.

      Parameters

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

      Returns Promise<void | ResponseType>

      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;

    Other

    credentials: undefined | InteractiveCredentials
    dataObject?: null | object
    jwt?: string
    requestOptions: object
    topia: Topia
    • 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