Skip to content

Introduce ExperimentRestClient and basic domain models#237

Merged
wzieba merged 19 commits intotrunkfrom
experimentation_without_fluxc_remote_layer
Aug 21, 2024
Merged

Introduce ExperimentRestClient and basic domain models#237
wzieba merged 19 commits intotrunkfrom
experimentation_without_fluxc_remote_layer

Conversation

@wzieba
Copy link
Member

@wzieba wzieba commented Aug 20, 2024

Description

This PR is a first one of a few that aim to remove FluxC as a dependency for experimantation project.

In this PR I introduce ExperimentRestClient with logic of parsing fetched JSON and mapping it to domain models.

I decided to not introduce a feature branch to keep things simpler: newly introduced classes are not visible to consumers (except domain models, which are useless on its own) so it shouldn't cause confusion.

The logic is based on FluxC implementation, especially org.wordpress.android.fluxc.network.rest.wpcom.experiments.ExperimentRestClient

How to test?

At this moment, testing is not required or possible due to lack of an entry point. The testing is covered with unit tests, and in next PRs I'll prepare some test scenarios.

wzieba added 13 commits August 20, 2024 12:26
`okhttp` and `moshi` are used by possible consumers. Code generation is faster and safer in the runtime, hence `moshi-codegen`
So we can use a double in tests
Usually, using `data class` in a public contract is not the best idea, but I think it's fine with this internal-only library. We don't have to be *that* strict with backward compatibility
So it can be replaced with a double in tests
To match to the current project's convention
It doesn't have to be exposed to library consumer
@wzieba wzieba requested a review from ParaskP7 August 20, 2024 13:46
Base automatically changed from bump_ktlint_to_0_50_0 to trunk August 21, 2024 10:56
Copy link
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @wzieba !

I have reviewed this PR as per the instructions, everything LGTM, good job! 🌟

FYI: I also traversed the FluxC related repo and its ExperimentRestClient + AssignmentsModel implementation and everything seems to be mapped 1-to-1 with your Moshi solution here, well done. 🥇

I decided to not introduce a feature branch to keep things simpler: newly introduced classes are not visible to consumers (except domain models, which are useless on its own) so it shouldn't cause confusion.

👍

At this moment, testing is not required or possible due to lack of an entry point. The testing is covered with unit tests, and in next PRs I'll prepare some test scenarios.

👍


I have left one question (❓), a suggestion (💡) and some minor (🔍) comments for you to consider. I am going to approve this PR anyway, since none is blocking. I am NOT going to merge this PR yet to give you some time to apply any of my suggestions. However, feel free to ignore them and merge the PR yourself.

@wzieba
Copy link
Member Author

wzieba commented Aug 21, 2024

Thank you for the review @ParaskP7 ! I've applied your suggestions, see you in next PRs 🙌

@wzieba wzieba enabled auto-merge August 21, 2024 14:51
@wzieba wzieba merged commit f650272 into trunk Aug 21, 2024
@wzieba wzieba deleted the experimentation_without_fluxc_remote_layer branch August 21, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants