Make Client methods parameters more intuitive#65
Conversation
For types where Default is obvious it has been implemented, for types that have one required argument From has been implemented.
16e37e0 to
7bfc158
Compare
Remove arguments which only have a single valid state, instead initialize these in the function body. Accept Into<Request<_, _>> to broaden the allowed parameters.
7bfc158 to
b003964
Compare
There was a problem hiding this comment.
Looks good to me, thanks for making these changes. Just needs the board::seek fixing and the other suggestion and I'm happy to merge it. It's also got me thinking about how we can improve this further though. I think being able to construct the requests from just mandatory data, or mandatory and optional data would be the next step. Not necessary for this PR though. If you have any thoughts, let me know.
Previously this function did not accept any options despite the internal state representing the query parameters.
Considering types with one non optional parameter I think I got all of the At this point a named type would be easier to read, and if the user has to name that type they might as well name the request type. I think the only real alternative would be just be accepting the number of arguments into the functions or keeping it as is. |
Improves the types used in
Clientmethods and makes the API of these methods easier by:Defaultimplementations forRequest<_ , _>where it makes sense.Fromfor someRequest<_ , _>and acceptsimpl Into<Request<_ , _>>inClientmethods.There is a question which came up while writing this PR,
model::board::seek::PostRequesthas options which couldn't be set before, I leftPostRequest::newas is but did implementFrom<PostQuery>. I thinkPostRequest::newshould accept aPostQuery, though I may be missing something.Closes #64