Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OnmsHTTPOptionsBuilder

A builder for OnmsHTTPOptions. Create a new one with OnmsHTTPOptions.newBuilder.

Hierarchy

  • OnmsHTTPOptionsBuilder

Index

Constructors

constructor

  • Construct a new builder from an existing options object, if provided.

    NOTE: server, auth, headers, and parameters are cloned, but data is left alone and assumed to be mutable autside of the builder or elsewhere.

    Parameters

    Returns OnmsHTTPOptionsBuilder

Methods

addParameter

  • addParameter(parameter: string, value?: string | string[] | number | boolean): this
  • A parameter to add or append to the request.

    If undefined is passed, that parameter will be reset to defaults. If the value is a string array, the existing value in the builder will be replaced. Otherwise, if the parameter already exists in the builder, the parameter will be converted to an array if necessary and this parameter will be added to it.

    Parameters

    • parameter: string

      the parameter name

    • Optional value: string | string[] | number | boolean

      the value of the parameter to add (or undefined)

    Returns this

build

merge

  • Merge the contents of the provided OnmsHTTPOptions object, additively. Timeout, server, auth, and data will be replaced only if set, and headers and parameters will be overlayed on top of existing.

    Parameters

    • Optional options: OnmsHTTPOptions

      the options to merge with this builder's current values

    Returns this

setAuth

  • The authentication config to use when connecting.

    If undefined is passed, the default authentication settings will be used.

    Parameters

    Returns this

setData

  • setData(data?: any): this
  • The data to use in the request.

    If undefined is passed, the data will be cleared.

    Parameters

    • Optional data: any

      the data

    Returns this

setDefaultHeader

  • setDefaultHeader(header: string, value: string | number | boolean): this
  • A header to set in the request only if it is not already set.

    Parameters

    • header: string

      the header name

    • value: string | number | boolean

      the value of the header

    Returns this

setHeader

  • setHeader(header: string, value?: string | number | boolean): this
  • A header to set in the request.

    If undefined is passed, that header will be reset to defaults.

    Parameters

    • header: string

      the header name

    • Optional value: string | number | boolean

      the value of the header

    Returns this

setHeaders

  • setHeaders(headers?: IHash<string>): this
  • The headers to set in the request.

    If undefined is passed, all headers in the builder will be reset and the default headers will be used.

    Parameters

    • Optional headers: IHash<string>

      the headers to use (or undefined)

    Returns this

setParameters

  • setParameters(parameters?: IHash<string | string[]>): this
  • The parameters to pass to the request.

    If undefined is passed, all parameters in the builder will be reset.

    Parameters

    • Optional parameters: IHash<string | string[]>

      the parameters to use (or undefined)

    Returns this

setServer

setTimeout

  • setTimeout(timeout?: number): this
  • The connection timeout for the request.

    If undefined is passed, the default timeout will be used.

    Parameters

    • Optional timeout: number

      the new timeout

    Returns this

Generated using TypeDoc