securedrop-client
securedrop-client copied to clipboard
Split objects into Request/Response entities
For example, if I send a reply to a source, I can use the Reply
object. I also will get back a Reply
object from the API on entity creation. Additionally, if I query all replies, I will get a Reply
object back.
In each of these three cases, these really are not the same object. These should be ReplyRequest
, ReplyResponse
, and Reply
respectively.
We should not overload the classes like this because it complicates type checking, especially for consumers of the library who (if they wanted strict type checking), would have to wrap all accesses to the attributes with if reply.some_attr is not None
etc etc.
This sounds like a good idea.