fn(request$0) =>
let hash$1 = @definy.string-trim(
value: match @definy.json-get-string(value: $0, key: "eventHash") {
#some(text$2) =>
$2,
#none(_) =>
""
}
);
match @core.equal(left: $1, right: "") {
true =>
@definy.rpc-error(code: "invalid_argument", message: "eventHash is required"),
false =>
@definy.store-read-events(
event_hashes: [$1],
then: fn(events$3) =>
match @core.list-get(list: $3, index: 0) {
#none(_) =>
@definy.rpc-error(
code: "not_found",
message: @core.string-concat(left: @core.string-concat(left: "Event '", right: $1), right: "' not found")
),
#some(element$2005) =>
match $2005 {
#none(_) =>
@definy.rpc-error(
code: "not_found",
message: @core.string-concat(left: @core.string-concat(left: "Event '", right: $1), right: "' not found")
),
#some(event$4) =>
@definy.json-response(
status: 200,
body: #object<@definy.json>([{key: "event", value: @definy.stored-event-json(event: $4)}])
)
}
}
)
}