Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[ECO-4962] feat: add
ChatApi
implementation #9[ECO-4962] feat: add
ChatApi
implementation #9Changes from all commits
727b8d2
783cd4a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 use lightweight version of
PaginatedResult
, not sure we actually needfirst()
andisLast()
methodsThere 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.
when would
EmptyPaginatedResult()
get returned?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.
Right now when there is no body, core Java SDK return
null
. I don't like this because we already return container, that can be empty, so I returnEmptyPaginatedResult
instead. For end user there is no difference between empty list and empty body, the same behavior we have in js.The other case is when we invoke
next()
andhasNext()
isfalse
. I personally would throw exception in this case, but decided not to do this, because we don't throw exception in core SDK, and silently returnnull
. Once again don't want to returnnull
, because you definitely don't want to do null-checks here.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.
Interesting - I personally think returning null makes more sense when looking at the code but I am coming from an optional-centric (and crazy) language in Swift. This will likely be one of the points in which we deviate between Kotlin and Swift due to platform best practices
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.
Not sure it's Kotlin best practice, the best practice probably would be throwing exceptions, but I decide to silence them as Ably Java does. This will be an extremely small change.
And about optional-centricity: from the SDK user’s perspective, I personally don’t think
PaginatedResult#next()
should return a nullable result, both for Swift and Kotlin—I’ve never seen this before, except in Ably Java. :) Users will have to handle this nullability on their own, but there is no reason for that.