-
Notifications
You must be signed in to change notification settings - Fork 15
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
Move Gson serialization into MastodonClient #51
Comments
Here's how the above call might look in practice, using the suggested
I think that this is a much cleaner call - with some caveats, though:
Here's an example of the changes necessary to make Account work as before. I think this is still better overall. @andregasser What do you think? Should I go forward with this? |
I like your approach. I have added one comment to bocops@15d7a44 regarding parameter default value. It is just a minor improvement. Feel free to continue. 👍 |
We should make sure we do not expose the |
Regarding Yes, |
Replace direct use of DELETE/GET/PATCH/POST functions with getMastodonRequest() and related functions where possible, reducing exposure of Gson serializer. Some special cases remain: - Media.kt - Streaming.kt - postUserNameAndPassword() in sample apps After cleanup of those and related tests, Gson instance no longer needs to be exposed via MastodonClient.getSerializer, and andregasser#51 can be closed.
I've sent PR #73 to deal with most of this, including the changes requested above. As mentioned in the PR, some special cases remain:
After cleanup of those and related tests, Gson instance no longer needs to be exposed via We already have issues opend to rewrite Media.kt (#62) and to redo the sample apps (#68), so it would be best to do this cleanup at the same time. I currently don't know how to deal with Streaming.kt. |
Replace direct use of DELETE/GET/PATCH/POST functions with getMastodonRequest() and related functions where possible, reducing exposure of Gson serializer. Some special cases remain: - Media.kt - Streaming.kt - postUserNameAndPassword() in sample apps After cleanup of those and related tests, Gson instance no longer needs to be exposed via MastodonClient.getSerializer, and andregasser#51 can be closed.
Media and Streaming are actually not a problem - they are a part of the same module, so can continue to access an internal getSerializer(). Since postUserNameAndPassword() in sample apps is using undocumented functionality and thus probably is a lost cause anyway, I believe it is better to create a new Gson() instance there so that we can at least close this issue. |
Originally posted to #5:
Currently, basically every API method looks like this:
with the Gson instance being exposed via
MastodonClient.getSerializer()
. It is probably cleaner to change this into something like a call toclient.getMastodonRequest(...)
, which would deal with the necessary serialization in our MastodonClient instead.The text was updated successfully, but these errors were encountered: