Open SteveRedka opened 4 years ago
Currently I do it like this:
class EntityClient < ApiStruct::Client
rest_api 'entities'
def index
response = get(path: 'entities/', headers: SimpleAuthenticationHeader.call)
response.fmap { |i| i[:results] }
end
end
However, README.md didn't say anything that I am supposed to know anything about monads. Either I do it wrong or it should be mentioned in docs.
Let's assume we have an API that returns a list of entities. But list is paginated; so it has several helpful fields, and entity data itself is stored in separate key, say,
results
. It could look like this:What is the proper way for writing index for this?