YIR: adds more data needed for native yir#807
Merged
Conversation
11 tasks
vladjerca
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Wires the newly-merged Year in Review / Month in Review data expansion into the
@trakt/apits-rest contracts.Same endpoints (
GET /users/:id/yir/:yearandGET /users/:id/mir/:year/:month), but the API now surfaces four sections that already existed in the web experience and weren't exposed over the API. The contract'syearInReviewResponseSchemawas aliased tomonthInReviewResponseSchema, which only modeledstats/images/first_watched/last_watched— so typed clients would never see the new data. This adds them.New sections
countriesshows/movies):country_count+countries[]of{ country, count }trends{ month, month_name, watchers, watched, show | movie }thanks{ show }/{ movie }(popular titles the user hasn't watched)streaming_services{ country, services[] }with per-service{ source, name, shows, movies, all }trends.watchersis the global play count;trends.watchedis whether this user watched it.trends/thankselements carry a nestedshow/moviemedia object with notypediscriminator (thetypefield is only emitted forfirst_watched/last_watched), so they wrapshowResponseSchema/movieResponseSchemadirectly rather than thetyped*variants.streaming_servicesis Month-in-Review only — its catalog scan is bounded to a single month — so it must not appear on the Year in Review shape.Implementation
countries,trends,thanks,streaming_services. Split out an exportedreviewBaseSchema(shared fields +countries/trends/thanks);monthInReviewResponseSchema = reviewBaseSchema + streaming_services.= reviewBaseSchema(drops the previous plain alias so it excludesstreaming_services).statsSchema,watchedItemSchema, …).traktContract.ts, orsrc/index.tschanges — the existingMonthInReviewResponse/YearInReviewResponsetype aliases pick up the new fields automatically.@trakt/apito0.4.15.Testing
deno check src/index.ts— passes.deno lint+deno fmt --check— clean.generate+validate— pass; the generated spec confirms the per-endpoint shapes:GET /users/{id}/mir/{year}/{month}stats, images, first_watched, last_watched, countries, trends, thanks, streaming_servicesGET /users/{id}/yir/{year}stats, images, first_watched, last_watched, countries, trends, thanksChecklist
deno fmt/deno lintclean)