Class: HttpSearchConfig

searchMenuServiceClient.HttpSearchConfig()

new HttpSearchConfig()

Configures and builds the module:searchMenuServiceClient.HttpClient. DescribedDataField is the main element of the restructured data and therefore considered "public".

Source:

Members

config

HTTP Search Configuration.

Properties:
Name Type Attributes Default Description
searchUrlTemplate string

URL that is called for every search request. It may include variables in double curly brackets like {{searchtext}}.

searchMethod string <optional>
"POST"

HTTP Method, that is used for every search request.

searchContentType string <optional>
"application/json"

HTTP MIME-Type of the body, that is used for every search request.

searchBodyTemplate string

HTTP body template, that is used for every search request. It may include variables in double curly brackets like {{jsonSearchParameters}}.

httpRequest XMLHttpRequest <optional>
new XMLHttpRequest()

Contains the XMLHttpRequest that is used to handle HTTP requests and responses. Defaults to XMLHttpRequest.

debugMode boolean <optional>
false

Adds detailed logging for development and debugging.

Source:

Methods

build() → {module:searchMenuServiceClient.HttpClient}

Uses the configuration to build the http client that provides the function "search" (parameters: searchParameters, onSuccess callback).

Source:
Returns:
Type
module:searchMenuServiceClient.HttpClient

debugMode(value) → {module:searchMenuServiceClient.HttpSearchConfig}

Sets the debug mode, that prints some more info to the console.

Parameters:
Name Type Description
value boolean
Source:
Returns:
Type
module:searchMenuServiceClient.HttpSearchConfig

httpRequest(value) → {module:searchMenuServiceClient.HttpSearchConfig}

Sets the HTTP-Request-Object. Defaults to XMLHttpRequest if not set.

Parameters:
Name Type Description
value String
Source:
Returns:
Type
module:searchMenuServiceClient.HttpSearchConfig

searchBodyTemplate(value) → {module:searchMenuServiceClient.HttpSearchConfig}

Sets the HTTP request body template that may contain variables (e.g. {{searchParameters}}) in double curly brackets, or null if there is none.

Parameters:
Name Type Description
value String
Source:
Returns:
Type
module:searchMenuServiceClient.HttpSearchConfig

searchContentType(value) → {module:searchMenuServiceClient.HttpSearchConfig}

Sets the HTTP content type of the request body. Defaults to "application/json".

Parameters:
Name Type Description
value String
Source:
Returns:
Type
module:searchMenuServiceClient.HttpSearchConfig

searchMethod(value) → {module:searchMenuServiceClient.HttpSearchConfig}

Sets the HTTP method for the search. Defaults to "POST".

Parameters:
Name Type Description
value String
Source:
Returns:
Type
module:searchMenuServiceClient.HttpSearchConfig

searchUrlTemplate(value) → {module:searchMenuServiceClient.HttpSearchConfig}

Sets the url for the HTTP request for the search. It may include variables in double curly brackets like {{searchtext}}.

Parameters:
Name Type Description
value String
Source:
Returns:
Type
module:searchMenuServiceClient.HttpSearchConfig

(protected, static) resolveTemplate(template, parameterSourceObject, debugMode)

Resolves variables in the template based on the given search parameters object. The variable {{jsonSearchParameters}} will be replaced by the JSON of all search parameters.

Parameters:
Name Type Description
template String

contains variables in double curly brackets that should be replaced by the values of the parameterSourceObject.

parameterSourceObject Object

object properties will be used to replace the variables of the template

debugMode boolean

enables/disables extended logging for debugging

Source: