Converter that will be used to generate intermediate Representation.
Content-type of the intermediate Representation.
Content-type in case a new resource gets created.
Checks if the input data can be handled by this class. Throws an error if it can't handle the data.
Input data that could potentially be handled.
A promise resolving if the input can be handled, rejecting with an Error if not.
Handles the given input. This should only be done if the canHandle function returned true
.
Therefore, consider using the handleSafe function instead.
A promise resolving when the handling is finished. Return value depends on the given type.
Input data that will be handled if it can be handled.
A promise resolving if the input can be handled, rejecting with an Error if not. Return value depends on the given type.
Patch the given representation based on the patch arguments. In case representation is not defined a new Representation should be created.
Arguments that were passed to the initial handle
call.
Representation acquired from the source and converted to the intermediate type.
Acquires the resource from the source and converts it to the intermediate type if it was found. Also returns the contentType that should be used when converting back before setting the representation.
An abstract patch handler.
A
ConvertingPatchHandler
converts a document to itsintermediateType
, handles the patch operation, and then converts back to its original type. This abstract class covers all of the above except of handling the patch operation, for which the abstractpatch
function has to be implemented.In case there is no resource yet and a new one needs to be created, the
patch
function will be called without a Representation and the result will be converted to thedefaultType
.