Class PolyverseServiceAbstract

The PolyverseService class provides access to the Polyverse API.

Constructors

Properties

defaultAssetTypeFilter: (
    | "Mesh"
    | "Material"
    | "Image"
    | "Json"
    | "Environment"
    | "Data"
    | "RSXDeployment"
    | "Audio"
    | "Video"
    | "InstaMATPackage")[]

The default asset type filter

tokenCostCurrency = 0.05

The token cost in the tokenCurrency

tokenCurrency = "$ USD"

The token currency

Methods

  • Articulates a backend route using routeParams and queryParams.

    Parameters

    • route: string
    • OptionalrouteParams: {
          [key: string]: string | number | boolean;
      }
      • [key: string]: string | number | boolean

    Returns string

    The routeParams will substitue url encoded the key/value pairs with route templates. e.g. /user/:userID will substitute the :userID with the key userID

  • Performs an authenticated fetch. If the user is not authenticated, this API will throw.

    Parameters

    • url: string

      The url to fetch.

    • OptionalisAuthOptional: boolean

    Returns Promise<AsyncHTTPRequest>

    A promise for the fetch

  • Performs an authenticated post. If the user is not authenticated, this API will throw.

    Parameters

    Returns Promise<AsyncHTTPRequest>

    A promise for the post

  • Fetches the asset from the Polyverse backend.

    Parameters

    • libraryID: string

      The library ID to fetch the asset from.

    • assetID: string

      The asset ID to fetch.

    Returns Promise<PolyverseAssetObject>

    A promise for the asset object.

  • Fetches the asset list from the Polyverse backend. This API is used to fetch assets from the Polyverse backend. The assets can be fetched from the global library, user subscriptions, a channel or a library.

    Parameters

    • sortType: PolyverseAssetLibrarySortType

      The sort type to use.

    • contentsLimit: number

      The number of contents to fetch.

    • contentsOffset: number

      The offset to fetch the contents from.

    • fetchType:
          | "Global"
          | "Subscriptions"
          | "Channel"
          | "Library"

      The type of fetch to perform.

    • fetchObjectID: string

      The object ID to fetch the contents from.

    • categories: string[]

      The categories to fetch the assets from.

    • includeAssetTypeFilters: (
          | "Mesh"
          | "Material"
          | "Image"
          | "Json"
          | "Environment"
          | "Data"
          | "RSXDeployment"
          | "Audio"
          | "Video"
          | "InstaMATPackage")[]

      The asset type filters to include.

    • OptionalignoreAssetTypeFilters: (
          | "Mesh"
          | "Material"
          | "Image"
          | "Json"
          | "Environment"
          | "Data"
          | "RSXDeployment"
          | "Audio"
          | "Video"
          | "InstaMATPackage")[]

      The asset type filters to ignore.

    • OptionalincludeCategories: boolean

      Whether to include categories in the fetch.

    • OptionalsearchQuery: string

      The search query to use.

    Returns Promise<PolyverseLibraryAssetContents>

    A promise for the library asset contents.

    This is only used for channel and library fetch types.

  • Fetches the Polytron Object from the Polyverse backend.

    Parameters

    • identifier: string

      The identifier of the object to fetch.

    • objectID: string

      The ID of the object to fetch.

    Returns Promise<PolytronObjectInfo>

    The PolytronTask object.

  • Fetches the Polytron task status from the Polyverse backend.

    Parameters

    • taskID: string

      The task ID to fetch.

    Returns Promise<PolytronTask>

    The PolytronTask object.

  • Fetches the Polytron task status from the Polyverse backend.

    Parameters

    • Optionalquery: string

    Returns Promise<PolytronUserTasks>

    The PolytronTask object.

  • Formats the token cost in the current PolyverseService.tokenCurrency.

    Parameters

    • tokenCost: number

      The token cost to format.

    Returns string

    The formatted token cost.

  • Open the Polyverse library or asset in the browser.

    Parameters

    • libraryID: string

      The library ID to open.

    • OptionalassetID: string

      The optional asset ID to open.

    Returns void

  • Open the Polytron in the browser.

    Parameters

    • objectIdentifier: String

      The object identifier to open.

    • objectID: string

      The object ID to open.

    Returns void

  • Open the Polytron Task in the browser.

    Parameters

    • taskID: string

      The task ID to open.

    Returns void