Constructor
new WsHelper()
Methods
buildException(error) → {OKMException}
Build OKMException from standard request error
Parameters:
Name | Type | Description |
---|---|---|
error |
The error |
Returns:
The OKMException
- Type
- OKMException
buildException(error) → {OKMException}
Build OKMException from standard request error
Parameters:
Name | Type | Description |
---|---|---|
error |
The error |
Returns:
The OKMException
- Type
- OKMException
downloadFile(url, contentType, fileName, params, token) → {Promise.<*>}
Download file request ( might be used for small and large files because it use streaming either browser OS memory )
Parameters:
Name | Type | Description |
---|---|---|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
fileName |
The filename |
|
params |
The body params |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
downloadFile(url, contentType, fileName, params, token) → {Promise.<*>}
Download file request ( might be used for small and large files because it use streaming either browser OS memory )
Parameters:
Name | Type | Description |
---|---|---|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
fileName |
The filename |
|
params |
The body params |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
multipartPostRequest(url, formData, token) → {Promise.<*>}
Standard multipart post request usable for small and medium sized documents
Parameters:
Name | Type | Description |
---|---|---|
url |
The url of the call |
|
formData |
The body data |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
multipartPostRequest(url, formData, token) → {Promise.<*>}
Standard multipart post request usable for small and medium sized documents
Parameters:
Name | Type | Description |
---|---|---|
url |
The url of the call |
|
formData |
The body data |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
request(method, url, contentType, params, token) → {Promise.<*>}
Standard request
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( Usually GET ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
params |
The body params |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
request(method, url, contentType, params, token) → {Promise.<*>}
Standard request
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( Usually GET ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
params |
The body params |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
requestBinaryStream(method, url, contentType, params, token) → {Promise.<*>}
Standard request for small binary stream
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( GET, POST, PUT ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
params |
The body params |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
requestBinaryStream(method, url, contentType, params, token) → {Promise.<*>}
Standard request for small binary stream
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( GET, POST, PUT ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
params |
The body params |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
requestBinaryStreamFormUrlEncoded(method, url, contentType, formData, token) → {Promise.<*>}
Standard request for small binary stream
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( GET, POST, PUT ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
formData |
The body formData |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
requestBinaryStreamFormUrlEncoded(method, url, contentType, formData, token) → {Promise.<*>}
Standard request for small binary stream
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( GET, POST, PUT ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
formData |
The body formData |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
requestFormUrlEncoded(method, url, contentType, formData, token) → {Promise.<*>}
Standard request form url encoded
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( Usually POST and PUT ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
formData |
The body formData |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>
requestFormUrlEncoded(method, url, contentType, formData, token) → {Promise.<*>}
Standard request form url encoded
Parameters:
Name | Type | Description |
---|---|---|
method |
Method type ( Usually POST and PUT ) |
|
url |
The url of the call |
|
contentType |
The content type of the request usually "application/json" |
|
formData |
The body formData |
|
token |
The authorization token |
Returns:
- The returned data
- Type
- Promise.<*>