Constructor
(abstract) new BaseRepositoryClient(repositoryClientConfig)
Constructs a repository client with the provided configuration.
Parameters:
Name | Type | Description |
---|---|---|
repositoryClientConfig |
RepositoryClientConfig |
Methods
(protected) execute(requestBuilder) → {Promise.<(HttpResponse|Error)>}
Executor for http requests. It passes the provided HTTP request builder to a HTTP client for executing requests.
If the request was unsuccessful it will be retried with another endpoint
HTTP client in case the request's status is one of
RETRIABLE_STATUSES
or if the host is currently unreachable.
If all of the endpoints are unsuccessful then the execution will fail with promise rejection.
Parameters:
Name | Type | Description |
---|---|---|
requestBuilder |
HttpRequestBuilder | the http request data to be passed to a http client |
Returns:
a promise which resolves to response wrapper or rejects with error if thrown during execution.
- Type
- Promise.<(HttpResponse|Error)>
(protected) getLogPayload(response, paramsopt) → {object}
Creates an object from the provided HTTP response that is suitable for structured logging.
Any additional key-value entries from params
will be assigned
in the created payload object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
response |
HttpResponse | the HTTP response. Used to get the execution time and the base URL |
|
params |
object |
<optional> |
additional parameters to be appended |
Returns:
the constructed payload object for logging
- Type
- object
getLoggedUser() → {User}
Logged user getter.
Returns:
user
- Type
- User
getLogger() → {Logger}
Gets a logger instance.
Returns:
the logger instance
- Type
- Logger
(protected) parse(content, responseType, parserConfigopt) → {string|Term|Array.<Term>}
Parses provided content with registered parser if there is one. Otherwise
returns the content untouched. If contentType
is provided it
should be an instance of RDFMimeType
enum and is used as a key
for selecting appropriate parser from the parsers registry.
Parsing is done synchronously!
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
content |
string | ||
responseType |
string | ||
parserConfig |
Object |
<optional> |
optional parser configuration |
Returns:
- Type
- string | Term | Array.<Term>
registerParser(parser)
Register provided parser in the internal parser registry.
Parameters:
Name | Type | Description |
---|---|---|
parser |
ContentParser | implementation wrapper. |
setLoggedUser(user) → {BaseRepositoryClient}
User setter
Parameters:
Name | Type | Description |
---|---|---|
user |
User |
Returns:
- Type
- BaseRepositoryClient