Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IRESTClient<RT, ERT>

Type parameters

  • RT

  • ERT

Hierarchy

  • IRESTClient

Index

Methods

go

  • go(): Promise<default<RT>>
  • Run the request and return a promise. This promise will resolve if the request is successful and reject otherwise.

    Returns Promise<default<RT>>

withAuthorization

  • Sets the authorization header using a key

    Parameters

    • key: string

      The value of the authorization header.

    Returns IRESTClient<RT, ERT>

withCredentials

  • withCredentials(value: RequestCredentials): IRESTClient<RT, ERT>
  • Sets request's credentials.

    Parameters

    • value: RequestCredentials

      A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.

    Returns IRESTClient<RT, ERT>

withErrorResponseHandler

  • Sets the error response handler. Error response handlers have a generic but due to typescript limitations, this value will not be propagated to the Promise catch statement

    Parameters

    Returns IRESTClient<RT, ERT>

withFormData

  • withFormData(body: URLSearchParams): IRESTClient<RT, ERT>
  • Sets the body of the client request.

    Parameters

    • body: URLSearchParams

      The object to be written to the request body as form data.

    Returns IRESTClient<RT, ERT>

withHeader

  • withHeader(key: string, value: string): IRESTClient<RT, ERT>
  • Adds a header to the request.

    Parameters

    • key: string

      The name of the header.

    • value: string

      The value of the header.

    Returns IRESTClient<RT, ERT>

withJSONBody

  • Sets the body of the client request.

    Parameters

    • body: object

      The object to be written to the request body as JSON.

    Returns IRESTClient<RT, ERT>

withMethod

  • Sets the http method for the request

    Parameters

    • method: string

    Returns IRESTClient<RT, ERT>

withParameter

  • withParameter(name: string, value: any): IRESTClient<RT, ERT>
  • Adds parameters to the request.

    Parameters

    • name: string

      The name of the parameter.

    • value: any

      The value of the parameter, may be a string, object or number.

    Returns IRESTClient<RT, ERT>

withResponseHandler

  • Sets the response handler. This could do processing before the ClientResponse is returned depending on the APIs expected response.

    Parameters

    Returns IRESTClient<RT, ERT>

withUri

  • Sets the uri of the request

    Parameters

    • uri: string

    Returns IRESTClient<RT, ERT>

withUriSegment

  • withUriSegment(segment: string | number): IRESTClient<RT, ERT>
  • Adds a segment to the request uri

    Parameters

    • segment: string | number

    Returns IRESTClient<RT, ERT>

Generated using TypeDoc