Common functions and utilities for tasks related to endpoint badges.
- Source:
Members
(inner, constant) endpointSchema :Joi
Joi schema for validating endpoint.
Type:
- Joi
- Source:
Methods
(async, inner) fetchEndpointData(serviceInstance, attrs) → {object}
Fetches data from the endpoint and validates the data.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
serviceInstance |
object | Instance of Endpoint class |
|||||||||||||||
attrs |
object | Refer to individual attributes Properties
|
- Source:
Returns:
Data fetched from endpoint
- Type
- object
(inner) validateEndpointData(data, attrs) → {object}
Strictly validate the data according to the endpoint schema. This rejects unknown/invalid keys. Optionally it prints those keys in the message to provide detailed feedback.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
object | Object containing the data for validation |
||||||||||||
attrs |
object | Refer to individual attributes Properties
|
- Source:
Throws:
-
Error if Joi validation fails due to invalid or no schema
- Type
- InvalidResponse | Error
Returns:
Value if Joi validation is success
- Type
- object