resgateio / resgate

A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.
https://resgate.io
MIT License
685 stars 67 forks source link

Resource response on query request #127

Closed jirenius closed 4 years ago

jirenius commented 4 years ago

Issue

A query request can currently only be responded to with an array of events.

It is a complex task to produce these events based on the state when the query event was sent.

To make it easier for service development, the service should have the option to respond with a resource instead. The resource response would then be compared to the cached version of the resource in order to produce the events leading up to the new state.

Notes

The RES Service Protocol - Query Request should be extended with the description below:

Result

events
An array of events for the query resource.
MUST be an array of event query objects
May be omitted if there are no events.
Must be omitted if model or collection is provided.

model
An object containing the named properties and values of the model.
Must be omitted if events or collection is provided. Must be omitted if the query resource is not a model.

collection
An ordered array containing the values of the collection.
Must be omitted if events or model is provided. Must be omitted if the query resource is not a collection.

Compatibility

jirenius commented 4 years ago

Resolved in #131