First pass at options builder#212
First pass at options builder#212LGraber wants to merge 1 commit intodevelopmenttableau/server-client-python:developmentfrom
Conversation
t8y8
left a comment
There was a problem hiding this comment.
Overall I think I like the way it reads, would need more time to play with it.
The one thing I don't like is the .build() part of the API. It feels very Java.
Is there a way for it to always be ready to send (builds after every update or the endpoint logic calls build on the 'requestmodel' for you?
|
|
||
| class Builder: | ||
| def __init__(self): | ||
| self.__pagenumber = 1 |
There was a problem hiding this comment.
I'm not sure the __ is necessary (it invokes name mangling to avoid inheritance problems but here I think you can just make it the _... it's more 'polite' form :P
There was a problem hiding this comment.
The double underscore was needed to disambiguate with the call to _pagenumber that I was specifically handling. If I don't do this, it actually fails
|
How about the contract for the Filters/Request Options/etc is that we call |
|
@RussTheAerialist I like that contract |
|
I think I am a bit confused. If I don't call _build() and so still have a Builder object, what do I call to actually get a RequestOptions object? I need to call something, right? Also, if we don't have a "build" method, then why did I call it a Builder? |
|
I think @RussTheAerialist is proposing you just create a Then, the contract for endpoints is to call |
|
Closing for inactivity |
Not ready to actually submit this but I find our current syntax for building a filter / sort set ... yucky. I implemented a simple builder pattern. "_" prefixed methods have special meaning. For all other methods, the name is the property you are filtering on and the 2 params are an operator and value. I just accept simple strings that actually look like the operator. I imagine later I can add "_include" when we expose fields. You can see in the sample that it makes it much easier to read. All of our samples only have one filter so it isn't so bad but it would get bad quickly if you did any more