Implements: IConfigurable, IReferenceable
Description
The RestOperations class allows you to handle REST services' operations.
Fields
Instance methods
configure
Configures a component by passing its configuration parameters.
publicconfigure(config: ConfigParams): void
- config: ConfigParams - configuration parameters to be set.
getCorrelationId
Returns a correlationId from a request
protectedgetCorrelationId(req: any): any
- req: any - an HTTP request
- returns: any - correlationId from a request
getFilterParams
Gets the filter parameters.
protectedgetFilterParams(req: any): FilterParams
- req: any - an HTTP request
- returns: FilterParams - filter paramters
getPagingParams
Gets the paging parameters.
protectedgetPagingParams(req: any): PagingParams
- req: any - an HTTP request
- returns: PagingParams - paging paramters
invoke
Invokes an operation.
publicinvoke(operation: string): (req: any, res: any) => void
- operation: string - operation to be invoked
- returns: (req: any, res: any) => void - operation
sendBadRequest
Sends a bad request error message.
protectedsendBadRequest(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: string - message
sendConflict
Sends a conflict error messge
protectedsendConflict(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: string - message
sendCreatedResult
Sends a JSON object with the created result.
protectedsendCreatedResult(req: any, res: any, result: any): void
- req: any - an HTTP request
- res: any - an HTTP response
- result: any - result to be sent.
sendDeletedResult
Sends the deleted result in JSON format.
protectedsendDeletedResult(req: any, res: any, result: any): void
- req: any - an HTTP request
- res: any - an HTTP response
- result: any - execution result or a promise with execution result.
sendEmptyResult
Send an empty result with 204 status code.
protectedsendEmptyResult(req: any, res: any): void
- req: any - an HTTP request
- res: any - an HTTP response
sendError
Sends an error serialized as ErrorDescription object and appropriate HTTP status code.
protectedsendError(req: any, res: any, error: any): void
- req: any - an HTTP request
- res: any - an HTTP response
- error: any - error
sendInternalError
Sends an internal error message
protectedsendInternalError(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: any - message
sendNotFound
Sends a not found error message.
protectedsendNotFound(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: any - message
sendResult
Sends a result as a JSON object.
protectedsendResult(req: any, res: any, result: any): void
- req: any - an HTTP request
- res: any - an HTTP response
- result: any - result
sendServerUnavailable
Sends a server unavailable error message (Status code 503).
protectedsendServerUnavailable(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: string - message
sendSessionExpired
Sends a session expired error message (Status code 440).
protectedsendSessionExpired(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: string - message
sendUnauthorized
Sends an unauthorized error message.
protectedsendUnauthorized(req: any, res: any, message: string): void
- req: any - an HTTP request
- res: any - an HTTP response
- message: string - message
setReferences
Sets the specified references.
publicsetReferences(references: IReferences): void
- references: IReferences - specified references