Younify: adds all methods#803
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds missing v2 younify “Streaming Sync” management endpoints and introduces a new /users/syncs contract surface for listing/inspecting/undoing data sync runs (including paginated paused/skipped item views), wiring everything into the @trakt/api exports and top-level contract.
Changes:
- Add a new top-level
younifyrouter (/younify) with connection listing, connect URL minting, refresh, and disconnect routes. - Add a new
users.syncssub-router (/users/syncs) with list/filter/details, paused/skipped paginated items, and undo. - Register exports/contract wiring and bump package version + commitlint scope.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/api/src/index.ts | Re-exports the new younify contract module from the package entrypoint. |
| projects/api/src/contracts/younify/index.ts | Defines the new /younify contract router and route metadata. |
| projects/api/src/contracts/younify/schema/request/connectRequestSchema.ts | Request body schema for creating a streaming connection. |
| projects/api/src/contracts/younify/schema/request/serviceIdParamsSchema.ts | Shared service_id path params schema. |
| projects/api/src/contracts/younify/schema/request/refreshParamsSchema.ts | Path params schema for the “full refresh” variant including all_data. |
| projects/api/src/contracts/younify/schema/response/connectResponseSchema.ts | Response schema for the minted connect URL. |
| projects/api/src/contracts/younify/schema/response/connectionResponseSchema.ts | Response schema representing a connectable service + user connection state. |
| projects/api/src/contracts/users/index.ts | Adds syncs sub-router under /users, plus re-exports/types for new sync schemas/params. |
| projects/api/src/contracts/users/schema/response/syncResponseSchema.ts | Defines the syncSchema response model (counts-only sync run summary). |
| projects/api/src/contracts/users/schema/response/syncItemResponseSchema.ts | Defines syncItemSchema (+ traktItemSchema) for paused/skipped item payloads. |
| projects/api/src/contracts/users/schema/request/syncTypeParamsSchema.ts | Path params schema for sync filtering by kind/type. |
| projects/api/src/contracts/users/schema/request/syncIdParamsSchema.ts | Path params schema for numeric sync id routes. |
| projects/api/src/contracts/traktContract.ts | Registers the new younify router at the top-level contract. |
| projects/api/deno.json | Bumps @trakt/api version to 0.4.14. |
| commitlint.config.js | Allows younify as a commit scope. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bc3d674 to
8f42f83
Compare
vladjerca
approved these changes
Jun 4, 2026
vladjerca
approved these changes
Jun 4, 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 v2 younify streaming-sync management endpoints into the
@trakt/apits-rest contracts, so native clients can port the web/settings/scrobblers("Streaming Sync") page.All routes require an official Trakt app API key and a user OAuth token, consistent with the existing
/younify/*endpoints.1. New top-level
younifycontract (/younify,authMetadata('required'))connectionsGET /younify/connections200→connectionSchema[]connectPOST /younify/connect200→{ url },400/422refreshPOST /younify/users/refresh/:service_id204refreshAllPOST /younify/users/refresh/:service_id/:all_data204disconnectDELETE /younify/users/services/:service_id204connectionsreturns every connectable service with the user's status merged in. Array order is significant — clients must preserve response order when rendering the grid (documented in the route description).connectmints a signed younify web-auth URL from the client'sreturn_url.refresh/refreshAll/disconnectare the existing reused actions the native page depends on (they weren't yet in the contract). The optional Rails segment(/:all_data)is modeled as a second explicit route (refreshAll), since ts-rest can't express truly-optional path segments.2. New
syncssub-router on theuserscontract (collection-level,/users/syncs)listGET /users/syncs200→syncSchema[]listByTypeGET /users/syncs/:type200→syncSchema[]detailsGET /users/syncs/:id200→syncSchemapausedGET /users/syncs/:id/paused200→syncItemSchema[]skippedGET /users/syncs/:id/skipped200→syncItemSchema[]undoDELETE /users/syncs/:id204pageQuerySchema+ standardX-Pagination-*headers (X-Pagination-Item-Count= total sync count for the "synced N times" banner).syncSchemais counts-only (added counts +paused_count/skipped_count); the potentially-huge paused/skipped item arrays are split into their own paginated routes.syncItemSchemais the raw stored item + a normalized envelope, made permissive with.passthrough()(preserves source-specific plex fields) and a discriminatedtrakt_item.kinddiscriminateshistoryvsrating(paused is alwayshistory; skipped mixes both)..000Z; an unknown:type404s;:id/:typepath collision is fine (ts-rest dispatches by route key).Conventions: placed alongside the existing inline
GLOBAL_LEVEL/ENTITY_LEVELrouters inusers/index.ts; one schema per file underschema/request|response;#### 🔒 OAuth Requireddescriptions;z.infertype aliases + schema re-exports; error responses usez.undefined()to match the repo-wide norm. Registered in bothtraktContract.tsandsrc/index.ts, and bumped@trakt/apito0.4.14.Testing
deno check src/index.ts— passes.deno lint+deno fmt --check— clean on all changed files.generate+validate— pass; all 9 new paths appear in the generated spec (.passthrough()and discriminated unions generate valid OpenAPI).Checklist
deno fmt/deno lintclean)