refactor: Better types #17

Merged
timharek merged 11 commits from feature-better-type-safety into main 2024-04-02 12:57:30 +00:00
2 changed files with 1058 additions and 1076 deletions
Showing only changes of commit f535a96d9d - Show all commits

File diff suppressed because it is too large Load Diff

View File

@ -5,35 +5,59 @@
export interface paths { export interface paths {
"/radio/search/title": { "/radio/search/title": {
/** Gives results for titles */ /**
* Title search
* @description Gives results for titles
*/
get: operations["TitleSearch"]; get: operations["TitleSearch"];
}; };
"/radio/search/title/suggest": { "/radio/search/title/suggest": {
/** Gives suggestion for misspelling on titles only */ /**
* Title suggest search
* @description Gives suggestion for misspelling on titles only
*/
get: operations["TitleSuggestSearch"]; get: operations["TitleSuggestSearch"];
}; };
"/radio/search/suggest": { "/radio/search/suggest": {
/** Deprecated. Use '/radio/search/title/suggest'. Gives suggestion for misspelling */ /**
* Deprecated
* @deprecated
* @description Deprecated. Use '/radio/search/title/suggest'. Gives suggestion for misspelling
*/
get: operations["TitleSuggestSearchDeprecated"]; get: operations["TitleSuggestSearchDeprecated"];
}; };
"/radio/search/search": { "/radio/search/search": {
/** Search endpoint for all content */ /**
* Search
* @description Search endpoint for all content
*/
get: operations["Search"]; get: operations["Search"];
}; };
"/radio/search/search/suggest": { "/radio/search/search/suggest": {
/** Gives suggestion for misspelling */ /**
* Search suggest search
* @description Gives suggestion for misspelling
*/
get: operations["RadioSuggestSearch"]; get: operations["RadioSuggestSearch"];
}; };
"/radio/search/categories/{category}": { "/radio/search/categories/{category}": {
/** Alphabetical listing of all series, podcasts and umbrella seasons that are not excluded from search results in given category. Categories correspond to those in pages-api, including 'alt-innhold'. For the category 'podcast', all podcasts are listed, also those excluded from search results. */ /**
* List all series, podcast and umbrella seasons in category
* @description Alphabetical listing of all series, podcasts and umbrella seasons that are not excluded from search results in given category. Categories correspond to those in pages-api, including 'alt-innhold'. For the category 'podcast', all podcasts are listed, also those excluded from search results.
*/
get: operations["RadioListAllForCategory"]; get: operations["RadioListAllForCategory"];
}; };
"/radio/search/int/search": { "/radio/search/int/search": {
/** Search endpoint for `internal use only`. Searches series and episodes. */ /**
* Internal search
* @description Search endpoint for `internal use only`. Searches series and episodes.
*/
get: operations["InternalSearch"]; get: operations["InternalSearch"];
}; };
} }
export type webhooks = Record<string, never>;
export interface components { export interface components {
schemas: { schemas: {
/** Series search result */ /** Series search result */
@ -47,8 +71,6 @@ export interface components {
description?: string; description?: string;
trimmedDescription?: string; trimmedDescription?: string;
images?: components["schemas"]["image"][]; images?: components["schemas"]["image"][];
} & {
seriesId: unknown;
}; };
/** Episode search result */ /** Episode search result */
episodesearchintresult: { episodesearchintresult: {
@ -57,11 +79,7 @@ export interface components {
/** @description If type is `customSeasonEpisode` */ /** @description If type is `customSeasonEpisode` */
seasonId?: string; seasonId?: string;
/** @enum {string} */ /** @enum {string} */
type: type: "seriesEpisode" | "podcastEpisode" | "singleProgram" | "customSeasonEpisode";
| "seriesEpisode"
| "podcastEpisode"
| "singleProgram"
| "customSeasonEpisode";
title: string; title: string;
subtitle?: string; subtitle?: string;
trimmedSubtitle?: string; trimmedSubtitle?: string;
@ -88,8 +106,6 @@ export interface components {
/** @description if `isSuggestResult` is true, `suggestQuery` displays the suggested value which is used in the current result set */ /** @description if `isSuggestResult` is true, `suggestQuery` displays the suggested value which is used in the current result set */
suggestQuery?: string; suggestQuery?: string;
}; };
} & {
isSuggestResult: unknown;
}; };
/** /**
* Channel result * Channel result
@ -131,7 +147,7 @@ export interface components {
*/ */
seriesResult: { seriesResult: {
links?: components["schemas"]["nextLink"]; links?: components["schemas"]["nextLink"];
results?: { results?: ({
/** @description Unique id */ /** @description Unique id */
id: string; id: string;
seriesId: string; seriesId: string;
@ -145,7 +161,7 @@ export interface components {
images: components["schemas"]["image"][]; images: components["schemas"]["image"][];
images_1_1?: components["schemas"]["image"][]; images_1_1?: components["schemas"]["image"][];
highlights?: components["schemas"]["seriesHighlight"]; highlights?: components["schemas"]["seriesHighlight"];
}[]; })[];
}; };
/** /**
* Episode results * Episode results
@ -153,7 +169,7 @@ export interface components {
*/ */
episodeResult: { episodeResult: {
links?: components["schemas"]["nextLink"]; links?: components["schemas"]["nextLink"];
results?: { results?: ({
/** @description Unique id */ /** @description Unique id */
id: string; id: string;
episodeId: string; episodeId: string;
@ -162,11 +178,7 @@ export interface components {
/** @description Only included in type `customSeasonEpisode` */ /** @description Only included in type `customSeasonEpisode` */
seasonId?: string; seasonId?: string;
/** @enum {string} */ /** @enum {string} */
type: type: "seriesEpisode" | "podcastEpisode" | "customSeasonEpisode" | "singleProgram";
| "seriesEpisode"
| "podcastEpisode"
| "customSeasonEpisode"
| "singleProgram";
title: string; title: string;
/** @description Not included in type `singleProgram` */ /** @description Not included in type `singleProgram` */
seriesTitle?: string; seriesTitle?: string;
@ -175,7 +187,7 @@ export interface components {
/** Format: date */ /** Format: date */
date: string; date: string;
highlights?: components["schemas"]["episodeHighlight"]; highlights?: components["schemas"]["episodeHighlight"];
}[]; })[];
}; };
nextLink: { nextLink: {
/** /**
@ -336,30 +348,48 @@ export interface components {
totalCount: number; totalCount: number;
}; };
}; };
responses: never;
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
} }
export type $defs = Record<string, never>;
export type external = Record<string, never>;
export interface operations { export interface operations {
/** Gives results for titles */ /**
* Title search
* @description Gives results for titles
*/
TitleSearch: { TitleSearch: {
parameters: { parameters: {
header: {
accept?: "application/json;api-version=2";
};
query: { query: {
/** The query text */ /**
* @description The query text
* @example stanghelle
*/
q: string; q: string;
/** Number of results to take */ /** @description Number of results to take */
take?: number; take?: number;
/** Number of results to skip */ /**
* @description Number of results to skip
* @example 0
*/
skip?: number; skip?: number;
/** Filters only playable content */ /** @description Filters only playable content */
filterNotPlayable?: boolean; filterNotPlayable?: boolean;
/** Returns only the specified type */ /** @description Returns only the specified type */
type?: "series" | "episode"; type?: "series" | "episode";
}; };
header?: {
accept?: "application/json;api-version=2";
};
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": components["schemas"]["titlesearchresult"]; "application/json": components["schemas"]["titlesearchresult"];
@ -367,16 +397,22 @@ export interface operations {
}; };
}; };
}; };
/** Gives suggestion for misspelling on titles only */ /**
* Title suggest search
* @description Gives suggestion for misspelling on titles only
*/
TitleSuggestSearch: { TitleSuggestSearch: {
parameters: { parameters: {
query: { query: {
/** The query text */ /**
* @description The query text
* @example smukker
*/
q: string; q: string;
}; };
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": string[]; "application/json": string[];
@ -384,18 +420,28 @@ export interface operations {
}; };
}; };
}; };
/** Deprecated. Use '/radio/search/title/suggest'. Gives suggestion for misspelling */ /**
* Deprecated
* @deprecated
* @description Deprecated. Use '/radio/search/title/suggest'. Gives suggestion for misspelling
*/
TitleSuggestSearchDeprecated: { TitleSuggestSearchDeprecated: {
parameters: { parameters: {
query: { query: {
/** The query text */ /**
* @description The query text
* @example stanghelle
*/
q: string; q: string;
/** Defaults to 10 if not set */ /**
* @description Defaults to 10 if not set
* @example 10
*/
take?: number; take?: number;
}; };
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": string[]; "application/json": string[];
@ -403,26 +449,38 @@ export interface operations {
}; };
}; };
}; };
/** Search endpoint for all content */ /**
* Search
* @description Search endpoint for all content
*/
Search: { Search: {
parameters: { parameters: {
query: { query: {
/** The query text */ /**
* @description The query text
* @example stanghelle
*/
q: string; q: string;
/** Number of results to take per type in the result set (see type parameter) */ /** @description Number of results to take per type in the result set (see type parameter) */
take?: number; take?: number;
/** Number of results to skip */ /**
* @description Number of results to skip
* @example 0
*/
skip?: number; skip?: number;
/** Which page of results to get */ /**
* @description Which page of results to get
* @example 2
*/
page?: number; page?: number;
/** Filters only playable content, applies to `episodes` and `series` */ /** @description Filters only playable content, applies to `episodes` and `series` */
filterNotPlayable?: boolean; filterNotPlayable?: boolean;
/** Returns only the specified type */ /** @description Returns only the specified type */
type?: "series" | "episode" | "channel" | "category"; type?: "series" | "episode" | "channel" | "category";
}; };
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": components["schemas"]["searchresult"]; "application/json": components["schemas"]["searchresult"];
@ -430,16 +488,22 @@ export interface operations {
}; };
}; };
}; };
/** Gives suggestion for misspelling */ /**
* Search suggest search
* @description Gives suggestion for misspelling
*/
RadioSuggestSearch: { RadioSuggestSearch: {
parameters: { parameters: {
query: { query: {
/** The query text */ /**
* @description The query text
* @example smukker
*/
q: string; q: string;
}; };
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": string[]; "application/json": string[];
@ -447,25 +511,28 @@ export interface operations {
}; };
}; };
}; };
/** Alphabetical listing of all series, podcasts and umbrella seasons that are not excluded from search results in given category. Categories correspond to those in pages-api, including 'alt-innhold'. For the category 'podcast', all podcasts are listed, also those excluded from search results. */ /**
* List all series, podcast and umbrella seasons in category
* @description Alphabetical listing of all series, podcasts and umbrella seasons that are not excluded from search results in given category. Categories correspond to those in pages-api, including 'alt-innhold'. For the category 'podcast', all podcasts are listed, also those excluded from search results.
*/
RadioListAllForCategory: { RadioListAllForCategory: {
parameters: { parameters: {
path: { query?: {
category: string;
};
query: {
take?: number; take?: number;
skip?: number; skip?: number;
}; };
path: {
category: string;
};
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": components["schemas"]["categoriesResponse"]; "application/json": components["schemas"]["categoriesResponse"];
}; };
}; };
/** Category not found */ /** @description Category not found */
404: { 404: {
content: { content: {
"text/plain": unknown; "text/plain": unknown;
@ -473,28 +540,41 @@ export interface operations {
}; };
}; };
}; };
/** Search endpoint for `internal use only`. Searches series and episodes. */ /**
* Internal search
* @description Search endpoint for `internal use only`. Searches series and episodes.
*/
InternalSearch: { InternalSearch: {
parameters: { parameters: {
query: { query: {
/** The query text */ /**
* @description The query text
* @example stanghelle
*/
q: string; q: string;
/** Defaults to 10 if not set */ /**
* @description Defaults to 10 if not set
* @example 10
*/
take?: number; take?: number;
/** Defaults to `desc` if not set */ /**
* @description Defaults to `desc` if not set
* @example asc
*/
sort?: string; sort?: string;
/** options `series` or `episode` */ /**
* @description options `series` or `episode`
* @example series
*/
type?: string; type?: string;
}; };
}; };
responses: { responses: {
/** OK */ /** @description OK */
200: { 200: {
content: { content: {
"application/json": ( "application/json":
| components["schemas"]["episodesearchintresult"] (components["schemas"]["episodesearchintresult"] | components["schemas"]["seriessearchintresult"])[];
| components["schemas"]["seriessearchintresult"]
)[];
}; };
}; };
}; };