Class: Connection

Connection


new Connection(urlOrObject, options)

Creates a Connection object that can parse objects or url string to a number of different formats.
Parameters:
Name Type Description
urlOrObject UnifiedConnectionSchema | String The values used to init both the solr and seal clients.
options Object
Properties
Name Type Description
secureProtocols Array.<String> An array of strings to be used to determine if a protocol is marked as secure.

Methods


getAuthString()

Returns an encodedURICompenent version auth string of username + : + password. If username and password are not present returns an empty string.
Returns:
Type
String
Example
connection.getAuthString()
// returns ''

hasAuth()

Returns true if both a username and password are present.
Returns:
Type
Boolean
Example
connection.hasAuth()
// returns true or false

hasPassword()

Returns true if a password is present.
Returns:
Type
Boolean
Example
connection.hasPassword()
// returns true or false

hasUsername()

Returns true if a username is present.
Returns:
Type
Boolean
Example
connection.hasUsername()
// returns true or false

password( [password])

Returns a URI encoded string of the password of this connection.
Parameters:
Name Type Argument Description
password String <optional>
If a string is provided it will encode the password and assign it to the current connection and return the encoded result.
Returns:
Type
String

toHttpUrl()

Returns a string representation of this connection if the protocol is either http or https.
Returns:
Type
String

toKnexConnection()

Returns an object that conforms to the knexjs connection format.
Returns:
Type
Object

toSolrConnection()

Returns an object that conforms to the solr connection format.
Returns:
Type
Object

toStandardConnection()

Returns a string representation of this connection.
Returns:
connection
Type
Object

toUrl()

Returns a string representation of this connection.
Returns:
Type
String

username( [username])

Returns a URI encoded string of the username of this connection.
Parameters:
Name Type Argument Description
username String <optional>
If a string is provided it will encode the username and assign it to the current connection and return the encoded result.
Returns:
Type
String