Hey,
as already talked about on the stream, I would love if you could get all transactions that were executed after another transaction. This would allow clients to get all unknown transcations without having to go through all days/months manually. Also, if I was to check multiple times a day if a new transacation took place, I wouldn't have to request the entire day all the time, but could instead call "after" with the latest known transaction.
When first discussed on the stream, you meant that you would probably do this offstream, since this would require you to restructure the database for you to be able to query this efficiently.
Example:
https://s200.etm.dev/transaction/[UserName]/after/[TransactionId]
called as https://s200.etm.dev/transaction/125m125/after/GVDLYD0P could return
{
latest: true, // false, if for example more than 100 transactions took place after the requested transactionid and the limit is 100. If false, the client would have to request the next "page" by calling the after-api with the last entry from the array. If there is no limit, only the entries-array could be returned.
entries: [ // sorted ascending by timestamp, so starts with the one closest to the requested transaction and stops with the closest to the current date
{
transactionId: "X1JR928V", // first transaction after GVDLYD0P
timestamp: 1600682900486
...
},
{
transactionId: "Y1QJ49XV",
timestamp: 1600682991008,
...
},
...
]
}
Display More
Bonus points, if the API supported long-polling requests, which don't return an empty array but instead block until a new transaction arrives, if the requested one is currently the latest one. This should then probably be configurable with a query parameter, for example https://s200.etm.dev/transaction/125m125/after/GVDLYD0P?longpolling=true