Add endpoint for getting room state
Hello!
I had the need for getting a room's state so I started working on it (I followed your way of adding an endpoint!)
I'd be happy to also write tests but I think you may want to discuss how the API should be. Right now I just modeled it (in a pretty dirty way) after the server API: you can have the whole list of state events or the content of one state event if you provide both its type and its state key; I think a client library should at least provide a way to get all events of one type and any state key, and maybe have a way to get a whole event by its (type, state key).
Maybe this asks for get_state_events(client, room, type \\ "", state_key \\ nil)
and get_state_contents(client, room, type \\ "", state_key \\ nil)
(where state_key = nil
means "any state key" and state key = ""
means "with no state key")? which maybe should always return a list, even for one element?
Additionally, it may also be nice to have functions to get some specific state events, for instance matrix-js-sdk
has getMembers(room)
or maySendMessage(room, user)
.