API Docs for: 1.5.0
Show:

DiscoveryService Class

Creates an instance of discovery service. Discovery service is used internally to discover resources URI and media type provided in the root resource.

Constructor

DiscoveryService

(
  • rootPath
  • connectionManager
)

Parameters:

Methods

_copyToCache

(
  • object
)
protected

Copy all the properties of the target object into the cache

Parameters:

  • object Object

    the object to cache

_discoverRoot

(
  • rootPath
  • callback
)
protected

Load the REST root resource

Parameters:

  • rootPath String

    path to Root resource

  • callback Function

    callback executed after performing the request

    • error Boolean | CAPIError

      false or CAPIError object if an error occurred

    • response Boolean | Response

      true if the root was successfully loaded, the Response otherwise

getInfoObject

(
  • name
  • callback
)

Get the information for given object name (located under the root). The information is provided as the second argument of the callback unless there's a network issue while loading the REST root resource or if there's no resource associated with the given name.

Parameters:

  • name String

    name of the target object (located under the root, e.g. "Trash")

  • callback Function
    • error Boolean | CAPIError

      false or CAPIError object if an error occurred

    • response Object | Response | Boolean

      the target object if it was found, the Response object if an error occurred while loading the REST root or false if the name does not match any object.