RequestsService

RequestsService

Class to implement HTTP Requests as a Service.

Extends

Members

MESSAGES :Object

Description:
  • The error messages.

Source:
Properties:
Name Type Description
e200 string

The message for business logic error.

The error messages.

Type:
  • Object

Methods

checkServerResult(data) → {boolean}

Description:
  • Check if the response of the requests is a valid response.

Source:
Parameters:
Name Type Description
data Object

The response data.

Returns:
Type
boolean

destroy()

Description:
  • Called when the service is destroyed. Generally used to cleanup.

Source:
Inherited From:

(async) get(url, cache) → {Any}

Description:
  • GET Fetch data.

Source:
Parameters:
Name Type Default Description
url string
cache string default
Returns:
Type
Any

getHeaders(custom_headers) → {Object}

Description:
  • Get the HTTP Requests headers.

Source:
Parameters:
Name Type Description
custom_headers Object

The http headers.

Returns:
Type
Object

getJSON(url, cache_name) → {Promise}

Source:
Parameters:
Name Type Description
url string

The URL.

cache_name string

The cache name.

Returns:
Type
Promise

(async) post(url, data, cache) → {Any}

Description:
  • POST Fetch data.

Source:
Parameters:
Name Type Default Description
url string

The URL.

data Object

The payload.

cache string default

The cache store name.

Returns:
Type
Any

postJSON(url, data, cache_name) → {Promise}

Description:
  • POST Fetch JSON data.

Source:
Parameters:
Name Type Description
url string

The URL.

data Object

The payload.

cache_name string

The cache name.

Returns:
Type
Promise

(async) queryJSON(url, data, method) → {Promise}

Description:
  • Fetch JSON data.

Source:
Parameters:
Name Type Description
url string

The URL.

data Object

The payload.

method RequestsMethodEnum

The HTTP Request method.

Returns:
Type
Promise