new Root(url, http, extensions, defaultOptionsopt)
Entrypoint to an API.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | The URL of the root of the API |
|
http |
The ES6 promise based HTTP abstraction (e.g. AngularJS $http, or axios |
||
extensions |
Array | The extensions to use for processing responses |
|
defaultOptions |
Object |
<optional> |
Default options used when following links. See Context#withDefaults and WebLink#follow |
Extends
Methods
follow(optionsopt)
Dereference the link, returning an asynchronously populated Resource.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The options for the request. Properties
|
- Inherited From:
- Source:
- Tutorials:
resolvedUrl(data)
The resolvedUrl
function of a HyRes.WebLink
can be used to see what the final resolved URL will be for the link once processing:
- URI Template parameters passed in the
data
argument. - Converting any relative URLs to absolute ones given the context of the web link, i.e. the URL of the response that contained the link.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The values to optionally insert into any URI template used for the |
- Inherited From:
- Source: