Maps API for JavaScript Developer's Guide

H.service.xyz.Service

Class Summary

Extends: H.util.EventTarget

This class encapsulates the HERE XYZ API in a service stub, providing methods to access its resources.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

static CONFIG_KEY : {string}

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

Method Summary

Table 2. Methods
Methods

getSpaces (onResult, onError, opt_serviceParams) : {H.util.ICancelable}

To retrieve spaces that are accessible with current authentication token. By default, only custom spaces are returned, not the common ones (e.g. "Chicago buildings"). It is possible to supply the owner service parameter to filter spaces by ownership, e.g. owner: "*" to retrieve all spaces the user has access to. See XYZ Hub API Reference - List spaces.

getSpace (spaceId, onResult, onError) : {H.util.ICancelable}

To retrieve a single space data. See XYZ Hub API Reference - Get a space by ID.

Class Description

This class encapsulates the HERE XYZ API in a service stub, providing methods to access its resources.

It's not allowed to call the constructor directly (an IllegalOperationError is thrown). Instead an instance of this Service can be retrieved by calling the factory method H.service.Platform#getXYZService on a platform instance.

Example

// Assumption: the platform is instantiated
var xyzService = platform.getXYZService({
  token: 'authentication_token_goes_here'
});

xyzService.getSpaces(console.log, console.error);

Constructor Details

H.service.xyz.Service(options)

Parameters:
 
options:
{H.service.xyz.Service.Options}
 
Configuration options for XYZ service.
Throws:
 
{H.lang.InvalidArgumentError}
 
If `"token"` is not supplied in options.
{H.lang.IllegalOperationError}
 
If instantiated directly.

Property Details

static CONFIG_KEY: {string}

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

Method Details

getSpaces (onResult, onError, opt_serviceParams) : {H.util.ICancelable}

To retrieve spaces that are accessible with current authentication token. By default, only custom spaces are returned, not the common ones (e.g. "Chicago buildings"). It is possible to supply the owner service parameter to filter spaces by ownership, e.g. owner: "*" to retrieve all spaces the user has access to. See XYZ Hub API Reference - List spaces.

Parameters:
 
onResult:
{function(H.service.ServiceResult)}
 
A callback function to be called with an array of spaces as an argument when request succeeds. Each space is represented as an object with the properties "id", "title", "description", "owner" and "cid".
onError:
{Function}
 
A callback function to be called in case of failed request.
opt_serviceParams:
{H.service.ServiceParameters=} [optional]
 
Optional service parameters see XYZ Hub API Reference – Read Space – Query Parameters for more details.
Returns:
 
{H.util.ICancelable}
A handle that allows to cancel the request.
Throws:
 
{H.lang.InvalidArgumentError}
 
If at least one of params is not supplied.

getSpace (spaceId, onResult, onError) : {H.util.ICancelable}

To retrieve a single space data. See XYZ Hub API Reference - Get a space by ID.

Parameters:
 
spaceId:
{string}
 
Space ID that defines a given "space" resource.
onResult:
{function(H.service.ServiceResult)}
 
A callback function to be called with an object describing the "space" resource.
onError:
{Function}
 
A callback function to be called in case of failed request.
Returns:
 
{H.util.ICancelable}
A handle that allows to cancel the request.
Throws:
 
{H.lang.InvalidArgumentError}
 
If at least one of params is not supplied.