- Notifications
You must be signed in to change notification settings - Fork 110
Feature/additional space and message type fields#153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:master
Are you sure you want to change the base?
Feature/additional space and message type fields #153
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Uh oh!
There was an error while loading. Please reload this page.
ce4d004 to 1109fadCompare64eb34a to 6c2e89aCompareFix tests for native sync publish Fix leaky serializer
6c2e89a to 00e1b16Comparecleanup + add acceptance test action
00e1b16 to 4b4776eCompareUh oh!
There was an error while loading. Please reload this page.
pubnub/endpoints/fetch_messages.py Outdated
| params={'max': int(self._count)} | ||
| params={ | ||
| 'max': int(self._count), | ||
| 'include_type': 'true'ifself._include_message_typeelse'false', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'include_type': str(self._include_message_type).lower()
| params={ | ||
| 'max': int(self._count), | ||
| 'include_type': 'true'ifself._include_message_typeelse'false', | ||
| 'include_message_type': 'true'ifself._include_message_typeelse'false', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'include_type': str(self._include_message_type).lower()
| ifself._include_message_typeisnotNone: | ||
| params['include_message_type'] ="true"ifself._include_message_typeelse"false" | ||
| ifself._include_space_idisnotNone: | ||
| params['include_space_id'] ="true"ifself._include_space_idelse"false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params['include_space_id'] = str(self. _include_space_id).lower()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space_id can be null and in this case the parameter should not be added, that's why there's if statement
Uh oh!
There was an error while loading. Please reload this page.
| @@ -0,0 +1,27 @@ | |||
| classPNMessageType: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class look like a good example of enum class:
https://docs.python.org/3/library/enum.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well Enum is a closed set of values - this is more like a wrapper around two independent message types:
- One is user-defined and can be any string (with some constrains on server side)
- Second is our own internal message type, which is numeric
In both cases we want to deliver to client a string. If he didn't defined his own message type, we return "mapped" version of our internal message type.
Either way we also allow access to "raw" values usingPNMessageType.message_typeandPNMessageType.pn_message_typeproperties. And i guess enum doesn't have such possibilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time we need to explain this I'm wondering if that's actually a good decision. Especially when you put it like that:
wrapper around two independent message types.
Uh oh!
There was an error while loading. Please reload this page.
52774ec to da677baCompare| @@ -0,0 +1,27 @@ | |||
| classPNMessageType: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time we need to explain this I'm wondering if that's actually a good decision. Especially when you put it like that:
wrapper around two independent message types.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d443f63 to c35ba87Compare
kleewho left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good
No description provided.