Options
All
  • Public
  • Public/Protected
  • All
Menu

Class URLBuilder

Package version

A class that handles creating, modifying, and parsing URLs.

Hierarchy

  • URLBuilder

Index

Methods

appendPath

  • appendPath(path: string | undefined): void
  • Append the provided path to this URL's existing path. If the provided path contains a query, then it will be added to this URL as well.

    Parameters

    • path: string | undefined

    Returns void

getHost

  • getHost(): string | undefined
  • Get the host that has been set in this URL.

    Returns string | undefined

getPath

  • getPath(): string | undefined
  • Get the path that has been set in this URL.

    Returns string | undefined

getPort

  • getPort(): string | undefined
  • Get the port that has been set in this URL.

    Returns string | undefined

getQuery

  • getQuery(): string | undefined
  • Get the query in this URL.

    Returns string | undefined

getQueryParameterValue

  • getQueryParameterValue(queryParameterName: string): string | string[] | undefined
  • Get the value of the query parameter with the provided query parameter name. If no query parameter exists with the provided name, then undefined will be returned.

    Parameters

    • queryParameterName: string

    Returns string | string[] | undefined

getScheme

  • getScheme(): string | undefined
  • Get the scheme that has been set in this URL.

    Returns string | undefined

replaceAll

  • replaceAll(searchValue: string, replaceValue: string): void
  • If the provided searchValue is found in this URLBuilder, then replace it with the provided replaceValue.

    Parameters

    • searchValue: string
    • replaceValue: string

    Returns void

setHost

  • setHost(host: string | undefined): void
  • Set the host for this URL. If the provided host contains other parts of a URL (such as a port, path, or query), those parts will be added to this URL as well.

    Parameters

    • host: string | undefined

    Returns void

setPath

  • setPath(path: string | undefined): void
  • Set the path for this URL. If the provided path contains a query, then it will be added to this URL as well.

    Parameters

    • path: string | undefined

    Returns void

setPort

  • setPort(port: number | string | undefined): void
  • Set the port for this URL. If the provided port contains other parts of a URL (such as a path or query), those parts will be added to this URL as well.

    Parameters

    • port: number | string | undefined

    Returns void

setQuery

  • setQuery(query: string | undefined): void
  • Set the query in this URL.

    Parameters

    • query: string | undefined

    Returns void

setQueryParameter

  • setQueryParameter(queryParameterName: string, queryParameterValue: any): void
  • Set a query parameter with the provided name and value in this URL's query. If the provided query parameter value is undefined or empty, then the query parameter will be removed if it existed.

    Parameters

    • queryParameterName: string
    • queryParameterValue: any

    Returns void

setScheme

  • setScheme(scheme: string | undefined): void
  • Set the scheme/protocol for this URL. If the provided scheme contains other parts of a URL (such as a host, port, path, or query), those parts will be added to this URL as well.

    Parameters

    • scheme: string | undefined

    Returns void

toString

  • toString(): string
  • Returns string

Static parse

  • Parameters

    • text: string

    Returns URLBuilder

Generated using TypeDoc