securedrop-client icon indicating copy to clipboard operation
securedrop-client copied to clipboard

Split objects into Request/Response entities

Open heartsucker opened this issue 6 years ago • 1 comments

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.

heartsucker avatar Jan 31 '19 20:01 heartsucker

This sounds like a good idea.

kushaldas avatar Feb 06 '19 14:02 kushaldas