Skip to content

feat(data): Implement movie search data layer with Retrofit

AGHARAHIMOV AGHASALIM requested to merge feature/search-data-layer into main

What does this MR do?

This MR builds the complete networking and repository layer required to search for movies using the TMDB API. It provides a clean, testable, and robust data source for the upcoming search feature.

Key Components Implemented:

  • Retrofit: Sets up RetrofitClient, TmdbApiService interface, and GsonConverterFactory.
  • DTOs: Defines MovieDto and MovieSearchResponse to accurately parse the JSON from the TMDB /search/movie endpoint.
  • Repository: Implements the MovieRepository interface with MovieRepositoryImpl, which handles API calls, error catching, and mapping from network DTOs to the app's Movie domain model.
  • Build Config: Includes a robust fix to correctly and reliably load the TMDB_API_KEY from local.properties into the BuildConfig.

How has this been tested?

This data layer is verified by two types of tests:

  1. Unit Test (MovieRepositoryImplTest): Uses MockWebServer to test the repository's logic (JSON parsing, mapping, and error handling) in a fast, offline environment.
  2. Instrumented Test (LiveMovieApiTest): Performs a live API call on a device/emulator to validate the entire chain, from the API key to the final data model, against the real TMDB server.

Why was this change needed?

This is a foundational piece of the application's core functionality. With this data layer in place, we can now proceed with building the SearchViewModel and connecting it to the UI.

Merge request reports