Constructor
new OpenSearchUrl(type, url, parameters, methodopt, enctypeopt, indexOffsetopt, pageOffsetopt, relationsopt)
Create an OpenSearchUrl object
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | The mime-type for the content the URL is referring to | ||
url |
string | The URL template or base URL | ||
parameters |
Array.<OpenSearchParameter> | The template/request parameters of the URL | ||
method |
string |
<optional> |
'GET' | The HTTP method |
enctype |
string |
<optional> |
'application/x-www-form-urlencoded' | The encoding type |
indexOffset |
Number |
<optional> |
1 | The index offset of this URL |
pageOffset |
Number |
<optional> |
1 | The page offset of this URL |
relations |
Array.<string> |
<optional> |
['results'] | The relations of this URL. |
Properties:
Name | Type | Description |
---|---|---|
type |
string | The mime-type for the content the URL is referring to |
url |
string | The URL template or base URL |
parameters |
array | The template/request parameters of the URL |
method |
string | The HTTP method |
enctype |
string | The encoding type |
indexOffset |
Number | the index offset of this URL |
pageOffset |
Number | the page offset of this URL |
Members
(readonly) enctype
The encoding type
(readonly) indexOffset
The index offset of this URL
(readonly) method
The HTTP method
(readonly) pageOffset
The page offset of this URL
(readonly) parameters
The template/request parameters of the URL
(readonly) relations
The page offset of this URL
(readonly) type
The mime-type for the content the URL is referring to
(readonly) url
The URL template or base URL
Methods
(static) deserialize(values) → {OpenSearchUrl}
Deserialize a parameter from a simple object.
Parameters:
Name | Type | Description |
---|---|---|
values |
object | The serialized URL |
Returns:
The deserialized URL
- Type
- OpenSearchUrl
(static) fromNode(node) → {OpenSearchUrl}
Construct a OpenSearchUrl from a DOMNode
Parameters:
Name | Type | Description |
---|---|---|
node |
DOMNode | The DOM node from the OpenSearchDescription XML document |
Returns:
The constructed OpenSearchUrl object
- Type
- OpenSearchUrl
(static) fromTemplateUrl(type, templateUrl, methodopt, enctypeopt) → {OpenSearchUrl}
Construct a OpenSearchUrl from a template URL
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | The mime-type | ||
templateUrl |
string | The template URL string. | ||
method |
string |
<optional> |
'GET' | The HTTP method |
enctype |
string |
<optional> |
'application/x-www-form-urlencoded' | The encoding type |
Returns:
The constructed OpenSearchUrl object
- Type
- OpenSearchUrl
getParameter(type) → {OpenSearchParameter}
Get the parameter of the specified type, if available
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The parameter type to check |
Returns:
The parameter of the given type or null
- Type
- OpenSearchParameter
hasParameter(type) → {boolean}
Returns whether the URL has a template parameter of the given type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The parameter type to check |
Returns:
Whether the URL has a parameter of that type
- Type
- boolean
isCompatible(parameters) → {boolean}
Checks whether this URL is compatible with the given parameters
Parameters:
Name | Type | Description |
---|---|---|
parameters |
object | An object mapping the name or type to the value |
Returns:
Whether or not the URL is compatible with the given parameters
- Type
- boolean
serialize() → {object}
Serialize the URL to a simple object.
Returns:
The serialized URL
- Type
- object