Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RestClient

HTTP Client for REST requests. Send and receive JSON data. Sign request with AWS credentials if available Usage:

const restClient = new RestClient();
restClient.get('...')
.then(function(data) {
console.log(data);
})
.catch(err => console.log(err));

Hierarchy

  • RestClient

Index

Constructors

Methods

Constructors

constructor

Methods

ajax

  • ajax(url: string, method: string, init: any): Promise<any>
  • Basic HTTP request. Customizable

    Parameters

    • url: string

      Full request URL

    • method: string

      Request HTTP method

    • init: any

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.

del

  • del(url: string, init: any): Promise<any>
  • DELETE HTTP request

    Parameters

    • url: string

      Full request URL

    • init: any

      Request extra params

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.

endpoint

  • endpoint(apiName: string): string
  • Getting endpoint for API

    Parameters

    • apiName: string

      The name of the api

    Returns string

    • The endpoint of the api

get

  • get(url: string, init: any): Promise<any>
  • GET HTTP request

    Parameters

    • url: string

      Full request URL

    • init: any

      Request extra params

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.

head

  • head(url: string, init: any): Promise<any>
  • HEAD HTTP request

    Parameters

    • url: string

      Full request URL

    • init: any

      Request extra params

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.

patch

  • patch(url: string, init: any): Promise<any>
  • PATCH HTTP request

    Parameters

    • url: string

      Full request URL

    • init: any

      Request extra params

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.

post

  • post(url: string, init: any): Promise<any>
  • POST HTTP request

    Parameters

    • url: string

      Full request URL

    • init: any

      Request extra params

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.

put

  • put(url: string, init: any): Promise<any>
  • PUT HTTP request

    Parameters

    • url: string

      Full request URL

    • init: any

      Request extra params

    Returns Promise<any>

    • A promise that resolves to an object with response status and JSON data, if successful.