Skip to content

Commit

Permalink
fix(endpoints): add missing validators in schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
dvcol committed Aug 21, 2024
1 parent b2744db commit 9cb1c97
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/api/endpoints/calendar.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const opts: TraktApiTemplateOptions = {
start_date: false,
days: false,
},
query: {
extended: false,
},
},
};

Expand Down
10 changes: 10 additions & 0 deletions lib/api/endpoints/comments.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ export const comments = {
path: {
id: true,
},
query: {
comment: true,
spoiler: false,
},
},
},
body: {
Expand Down Expand Up @@ -247,6 +251,9 @@ export const comments = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -367,6 +374,7 @@ export const comments = {
},
query: {
include_replies: false,
extended: false,
},
},
},
Expand Down Expand Up @@ -407,6 +415,7 @@ export const comments = {
},
query: {
include_replies: false,
extended: false,
},
},
},
Expand Down Expand Up @@ -447,6 +456,7 @@ export const comments = {
},
query: {
include_replies: false,
extended: false,
},
},
},
Expand Down
20 changes: 18 additions & 2 deletions lib/api/endpoints/episodes.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,21 @@ export const episodes = {
* @see [get-a-single-episode-for-a-show]{@link https://trakt.docs.apiary.io/#reference/episodes/summary/get-a-single-episode-for-a-show}
*/
summary: new TraktClientEndpoint<BaseEpisodeParam & TraktApiParamsExtended<typeof TraktApiExtended.Full>, TraktEpisode<'any'>>({
method: HttpMethod.GET,
url: '/shows/:id/seasons/:season/episodes/:episode',
opts: {
extended: [TraktApiExtended.Full],
parameters: {
path: {
id: true,
season: true,
episode: true,
},
query: {
extended: false,
},
},
},
method: HttpMethod.GET,
url: '/shows/:id/seasons/:season/episodes/:episode',
}),
/**
* Returns all translations for an episode, including language and translated values for title and overview.
Expand Down Expand Up @@ -162,6 +172,9 @@ export const episodes = {
season: true,
episode: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -219,6 +232,9 @@ export const episodes = {
season: true,
episode: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down
3 changes: 3 additions & 0 deletions lib/api/endpoints/lists.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ export const lists = {
id: true,
type: false,
},
query: {
extended: false,
},
},
},
transform: params => (Array.isArray(params.type) ? { ...params, type: params.type.join(',') as never } : params),
Expand Down
27 changes: 27 additions & 0 deletions lib/api/endpoints/movies.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ const baseOptions: TraktApiTemplateOptions = {
pagination: true,
extended: [TraktApiExtended.Full],
filters: TraktApiMovieFilterValues,
parameters: {
query: {
extended: false,
},
},
};

export const movies = {
Expand Down Expand Up @@ -208,6 +213,11 @@ export const movies = {
url: '/movies/boxoffice',
opts: {
extended: [TraktApiExtended.Full],
parameters: {
query: {
extended: false,
},
},
},
}),
/**
Expand Down Expand Up @@ -245,6 +255,9 @@ export const movies = {
path: {
start_date: false,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -307,6 +320,9 @@ export const movies = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -474,6 +490,11 @@ export const movies = {
url: '/movies/:id/people',
opts: {
extended: [TraktApiExtended.Full],
parameters: {
query: {
extended: false,
},
},
},
}),
/**
Expand Down Expand Up @@ -522,6 +543,9 @@ export const movies = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -591,6 +615,9 @@ export const movies = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down
3 changes: 3 additions & 0 deletions lib/api/endpoints/notes.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ export const notes = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down
12 changes: 12 additions & 0 deletions lib/api/endpoints/people.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export const people = {
path: {
start_date: false,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -112,6 +115,9 @@ export const people = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -140,6 +146,9 @@ export const people = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -170,6 +179,9 @@ export const people = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down
2 changes: 2 additions & 0 deletions lib/api/endpoints/recommendations.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const recommendations = {
query: {
ignore_collected: false,
ignore_watchlisted: false,
extended: false,
},
},
},
Expand Down Expand Up @@ -104,6 +105,7 @@ export const recommendations = {
query: {
ignore_collected: false,
ignore_watchlisted: false,
extended: false,
},
},
},
Expand Down
7 changes: 7 additions & 0 deletions lib/api/endpoints/seasons.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export const seasons = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -82,6 +85,7 @@ export const seasons = {
},
query: {
translations: false,
extended: false,
},
},
},
Expand Down Expand Up @@ -305,6 +309,9 @@ export const seasons = {
id: true,
season: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down
36 changes: 36 additions & 0 deletions lib/api/endpoints/shows.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ const baseOptions: TraktApiTemplateOptions = {
pagination: true,
extended: [TraktApiExtended.Full],
filters: TraktApiShowFilterValues,
parameters: {
query: {
extended: false,
},
},
};

export const shows = {
Expand Down Expand Up @@ -232,6 +237,9 @@ export const shows = {
path: {
start_date: false,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -295,6 +303,9 @@ export const shows = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -631,6 +642,14 @@ export const shows = {
url: '/shows/:id/people',
opts: {
extended: [TraktApiExtended.Full, TraktApiExtended.GuestStars],
parameters: {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
/**
Expand Down Expand Up @@ -680,6 +699,9 @@ export const shows = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand Down Expand Up @@ -749,6 +771,9 @@ export const shows = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand All @@ -774,6 +799,9 @@ export const shows = {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
Expand All @@ -795,6 +823,14 @@ export const shows = {
url: '/shows/:id/last_episode',
opts: {
extended: [TraktApiExtended.Full],
parameters: {
path: {
id: true,
},
query: {
extended: false,
},
},
},
}),
};
Loading

0 comments on commit 9cb1c97

Please sign in to comment.