Skip to content

Conversation

@adamayoung
Copy link
Owner

Summary

Add a new KeywordService to the TMDb Swift Package that provides access to TMDb's keyword endpoints. This enables users to fetch keyword details and discover movies associated with specific keywords.

Changes

New Model:

  • Keyword - Simple model with id and name properties, conforming to Codable, Equatable, Hashable, Identifiable, and Sendable

New Service:

  • KeywordService protocol with details(forKeyword:) and movies(forKeyword:page:language:) methods
  • TMDbKeywordService implementation
  • Convenience method movies(forKeyword:) without page/language parameters

Request Classes:

  • KeywordRequest - Fetches keyword details from /keyword/{id}
  • KeywordMoviesRequest - Fetches movies for a keyword from /keyword/{id}/movies with optional page and language parameters

Integration:

  • Updated TMDbClient to expose keywords property for the KeywordService

Tests:

  • Unit tests for Keyword model JSON decoding
  • Unit tests for TMDbKeywordService with mocked API client
  • Unit tests for KeywordRequest and KeywordMoviesRequest
  • Integration tests against live TMDb API
  • JSON fixtures based on real API responses

Benefits

  • Complete API Coverage: Users can now access TMDb's keyword endpoints
  • Type Safety: Strongly-typed Keyword model provides better IDE support
  • Flexible Querying: Support for pagination and language filtering when fetching movies
  • Consistent Patterns: Follows established service patterns in the codebase
  • Comprehensive Testing: Both unit and integration tests ensure reliability

Generated with Claude Code

- Add Keyword model with id and name properties
- Add KeywordService protocol with details and movies methods
- Add TMDbKeywordService implementation
- Add KeywordRequest and KeywordMoviesRequest classes
- Expose keywords service via TMDbClient
- Add comprehensive unit tests with JSON fixtures
- Add integration tests against live TMDb API

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings January 23, 2026 20:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive support for TMDb's keyword endpoints by introducing a new KeywordService with methods to fetch keyword details and discover associated movies.

Changes:

  • Introduced Keyword model with id and name properties
  • Added KeywordService protocol and TMDbKeywordService implementation for keyword operations
  • Created API request classes (KeywordRequest, KeywordMoviesRequest) for keyword endpoints
  • Integrated keyword service into TMDbClient as the keywords property

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Sources/TMDb/Domain/Models/Keyword.swift Defines the Keyword model with id and name properties
Sources/TMDb/Domain/Services/Keywords/KeywordService.swift Protocol defining keyword service interface with details and movies methods
Sources/TMDb/Domain/Services/Keywords/TMDbKeywordService.swift Implementation of KeywordService using APIClient
Sources/TMDb/Domain/Services/Keywords/Requests/KeywordRequest.swift Request for fetching keyword details by id
Sources/TMDb/Domain/Services/Keywords/Requests/KeywordMoviesRequest.swift Request for fetching movies associated with a keyword
Sources/TMDb/TMDBClient.swift Adds keywords property exposing KeywordService
Tests/TMDbTests/Domain/Models/KeywordTests.swift Unit tests for Keyword model JSON decoding
Tests/TMDbTests/Domain/Services/Keywords/TMDbKeywordServiceTests.swift Unit tests for TMDbKeywordService methods
Tests/TMDbTests/Domain/Services/Keywords/Requests/KeywordRequestTests.swift Unit tests for KeywordRequest properties
Tests/TMDbTests/Domain/Services/Keywords/Requests/KeywordMoviesRequestTests.swift Unit tests for KeywordMoviesRequest with various parameter combinations
Tests/TMDbIntegrationTests/KeywordIntegrationTests.swift Integration tests against live TMDb API
Tests/TMDbTests/Mocks/Models/Keyword+Mocks.swift Mock factory methods for Keyword model
Tests/TMDbTests/Resources/json/keyword.json JSON fixture for keyword details response
Tests/TMDbTests/Resources/json/keyword-movies.json JSON fixture for keyword movies response
Tests/TMDbTests/TestUtils/Tags.swift Adds keyword tag for test organization
Tests/TMDbIntegrationTests/TestUtils/Tags.swift Adds keyword tag for integration test organization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adamayoung adamayoung changed the title Add KeywordService for keyword details and movie discovery ✨ Add KeywordService for keyword details and movie discovery Jan 23, 2026
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.53%. Comparing base (9644920) to head (2cb5256).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...TMDb/Domain/Services/Keywords/KeywordService.swift 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #252      +/-   ##
==========================================
- Coverage   97.56%   97.53%   -0.03%     
==========================================
  Files         249      254       +5     
  Lines        3936     3973      +37     
==========================================
+ Hits         3840     3875      +35     
- Misses         96       98       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamayoung adamayoung enabled auto-merge (squash) January 23, 2026 21:58
@adamayoung adamayoung disabled auto-merge January 23, 2026 22:11
@adamayoung adamayoung merged commit ea5b2a4 into main Jan 23, 2026
10 of 14 checks passed
@adamayoung adamayoung deleted the feature/keyword-service branch January 23, 2026 22:11
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