Class: OpenSearchUrl

opensearch/url.OpenSearchUrl(type, url, parameters, methodopt, enctypeopt, indexOffsetopt, pageOffsetopt, relationsopt)

Class to parse a single URL of an OpenSearchDescription XML document and to create HTTP requests for searches.

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
Source:

Members

(readonly) enctype

The encoding type
Source:

(readonly) indexOffset

The index offset of this URL
Source:

(readonly) method

The HTTP method
Source:

(readonly) pageOffset

The page offset of this URL
Source:

(readonly) parameters

The template/request parameters of the URL
Source:

(readonly) relations

The page offset of this URL
Source:

(readonly) type

The mime-type for the content the URL is referring to
Source:

(readonly) url

The URL template or base URL
Source:

Methods

(static) deserialize(values) → {OpenSearchUrl}

Deserialize a parameter from a simple object.
Parameters:
Name Type Description
values object The serialized URL
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
Returns:
Whether or not the URL is compatible with the given parameters
Type
boolean

serialize() → {object}

Serialize the URL to a simple object.
Source:
Returns:
The serialized URL
Type
object