AbstractProtectedfailBuilds a failed response.
Reserved for outcomes the caller asked for and did not get — a missing
row, an absent object. Faults the caller cannot act on should throw
instead, so they surface as a 500 rather than a well-formed false.
Human-readable description of what went wrong.
Payload returned to the caller.
The response, with success set to false.
ProtectedokBuilds a successful response.
Human-readable description of what happened.
Payload returned to the caller.
The response, with success set to true.
Base class for every service — an adapter's and an application's alike.
A service holds no per-request state: the runtime handle arrives as an argument to each method, so one instance can be created at module scope and reused. What this base contributes is the response contract — every method returns an APIResponse, built through Service.ok or Service.fail rather than assembled by hand, so a caller can map
successonto a status code without reading each service.Example
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0