-
Notifications
You must be signed in to change notification settings - Fork 16
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
Hide implementation details from library users #5
Comments
For some progress here, I have a patch at https://github.com/bocops/mastodon4j/tree/patch_mastodonclient_1 that changes the GET/DELETE/PATCH/PUT methods in MastodonClient to mostly accept Parameter lists instead of having to expose OkHttp's RequestBody. Should this be added to main directly, or do we want to have a separate branch for that? |
Hello @bocops, maybe we should start using feature branches for issues in general, and create PR's for merging them into master when they are ready? Would make reviewing code easier, right? |
@bocops : Looking at the |
Definitely, we shouldn't expose implementation details to users like that, the I think we can go one step further. Currently, basically every API method looks like this:
with the Gson instance being exposed via |
Yes, sounds good to me. Classes like |
Reposted the above as separate issue #51. |
including API method classes using MastodonClient and related functionality to achieve the following: - remove OkHttp3 and Gson instances from MastodonClient.Builder as unnecessary exposure of implementation details (closes andregasser#5) - build all endpoint URLs using OkHttp3.HttpUrl instead of string concatenation (closes andregasser#48) - remove the MastodonClient.postUrl() special case after endpoint path prefix is no longer hardcoded (closes andregasser#49).
including API method classes using MastodonClient and related functionality to achieve the following: - remove OkHttp3 and Gson instances from MastodonClient.Builder as unnecessary exposure of implementation details (closes andregasser#5) - build all endpoint URLs using OkHttp3.HttpUrl instead of string concatenation (closes andregasser#48) - remove the MastodonClient.postUrl() special case after endpoint path prefix is no longer hardcoded (closes andregasser#49).
OkHttp3 and Gson leak through the client-side API. Check if really necessary and change if needed. Leaking details to the library users makes it difficult to change implementation details without breaking the API.
The text was updated successfully, but these errors were encountered: