From 4052c1d8b7983058c824af345366990fc15d709b Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 16:05:22 +1200 Subject: [PATCH 1/7] build(codegen): reproducible NSwag pipeline with checked-in spec overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns the ad-hoc NSwag generation into a one-command, reproducible pipeline: - tools/openapi/patch_spec.py — checked-in overlay (PyYAML). Coerces the 32 integer resource-id PATH params that TheTVDB types as `number` (→ C# double) to integer/int64 (→ long). Narrow by design: the only other `number` fields are the genuinely-float `score` properties, left untouched. - tools/openapi/generate.sh — download live v4 spec → apply overlay → run NSwag. Raw + patched specs are committed so a regen diff is reviewable. - Pin NSwag as a local tool (NSwag.ConsoleCore 14.2.0, rollForward=true so it runs on the net10 runtime when net9 isn't installed). - Repoint TvdbClient.nswag at the local patched spec. Smoke-verified: NSwag against the patched spec emits 32 `long id` params, 0 `double id`. The in-place regen + model cleanup + facade come next. Co-Authored-By: Claude Opus 4.8 (1M context) --- .config/dotnet-tools.json | 12 +- src/TvdbClient/TvdbClient.nswag | 2 +- src/TvdbClient/openapi/tvdb-v4.patched.yml | 4403 ++++++++++++++++++++ src/TvdbClient/openapi/tvdb-v4.raw.yml | 4264 +++++++++++++++++++ tools/openapi/generate.sh | 30 + tools/openapi/patch_spec.py | 64 + 6 files changed, 8772 insertions(+), 3 deletions(-) create mode 100644 src/TvdbClient/openapi/tvdb-v4.patched.yml create mode 100644 src/TvdbClient/openapi/tvdb-v4.raw.yml create mode 100755 tools/openapi/generate.sh create mode 100644 tools/openapi/patch_spec.py diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 59f98fd..217d090 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -6,7 +6,15 @@ "version": "6.3.0", "commands": [ "dotnet-gitversion" - ] + ], + "rollForward": false + }, + "nswag.consolecore": { + "version": "14.2.0", + "commands": [ + "nswag" + ], + "rollForward": true } } -} +} \ No newline at end of file diff --git a/src/TvdbClient/TvdbClient.nswag b/src/TvdbClient/TvdbClient.nswag index 3ba978d..539960f 100644 --- a/src/TvdbClient/TvdbClient.nswag +++ b/src/TvdbClient/TvdbClient.nswag @@ -3,7 +3,7 @@ "defaultVariables": null, "documentGenerator": { "fromDocument": { - "url": "https://thetvdb.github.io/v4-api/swagger.yml", + "url": "openapi/tvdb-v4.patched.yml", "output": null, "newLineBehavior": "Auto" } diff --git a/src/TvdbClient/openapi/tvdb-v4.patched.yml b/src/TvdbClient/openapi/tvdb-v4.patched.yml new file mode 100644 index 0000000..3cd14ac --- /dev/null +++ b/src/TvdbClient/openapi/tvdb-v4.patched.yml @@ -0,0 +1,4403 @@ +openapi: 3.0.0 +info: + description: 'Documentation of [TheTVDB](https://thetvdb.com/) API V4. All related information is linked from our [Github repo](https://github.com/thetvdb/v4-api). You might also want to use our [Postman collection] (https://www.getpostman.com/collections/7a9397ce69ff246f74d0) + + ## Authentication + + 1. Use the /login endpoint and provide your API key as "apikey". If you have a user-supported key, also provide your subscriber PIN as "pin". Otherwise completely remove "pin" from your call. + + 2. Executing this call will provide you with a bearer token, which is valid for 1 month. + + 3. Provide your bearer token for subsequent API calls by clicking Authorize below or including in the header of all direct API calls: `Authorization: Bearer [your-token]` + + + ## Notes + + 1. "score" is a field across almost all entities. We generate scores for different types of entities in various ways, so no assumptions should be made about the meaning of this value. It is simply used to hint at relative popularity for sorting purposes. + + ' + title: TVDB API V4 + version: 4.7.10 +security: +- bearerAuth: [] +paths: + /login: + post: + summary: create an auth token. The token has one month validation length. + requestBody: + content: + application/json: + schema: + type: object + required: + - apikey + properties: + apikey: + type: string + pin: + type: string + required: true + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + properties: + token: + type: string + type: object + status: + type: string + type: object + '401': + description: invalid credentials + tags: + - Login + /artwork/{id}: + get: + description: Returns a single artwork base record. + operationId: getArtworkBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ArtworkBaseRecord' + status: + type: string + type: object + '400': + description: Invalid artwork id + '401': + description: Unauthorized + '404': + description: Artwork not found + tags: + - Artwork + /artwork/{id}/extended: + get: + description: Returns a single artwork extended record. + operationId: getArtworkExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ArtworkExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid artwork id + '401': + description: Unauthorized + '404': + description: Artwork not found + tags: + - Artwork + /artwork/statuses: + get: + description: Returns list of artwork status records. + operationId: getAllArtworkStatuses + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ArtworkStatus' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Artwork Statuses + /artwork/types: + get: + description: Returns a list of artworkType records + operationId: getAllArtworkTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ArtworkType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Artwork Types + /awards: + get: + description: Returns a list of award base records + operationId: getAllAwards + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Awards + /awards/{id}: + get: + description: Returns a single award base record + operationId: getAward + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardBaseRecord' + status: + type: string + type: object + '400': + description: Invalid awards id + '401': + description: Unauthorized + '404': + description: Awards not found + tags: + - Awards + /awards/{id}/extended: + get: + description: Returns a single award extended record + operationId: getAwardExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid awards id + '401': + description: Unauthorized + '404': + description: Awards not found + tags: + - Awards + /awards/categories/{id}: + get: + description: Returns a single award category base record + operationId: getAwardCategory + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardCategoryBaseRecord' + status: + type: string + type: object + '400': + description: Invalid category id + '401': + description: Unauthorized + '404': + description: Category not found + tags: + - Award Categories + /awards/categories/{id}/extended: + get: + description: Returns a single award category extended record + operationId: getAwardCategoryExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardCategoryExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid category id + '401': + description: Unauthorized + '404': + description: Category not found + tags: + - Award Categories + /characters/{id}: + get: + description: Returns character base record + operationId: getCharacterBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Character' + status: + type: string + type: object + '400': + description: Invalid character id + '401': + description: Unauthorized + '404': + description: Character not found + tags: + - Characters + /companies: + get: + description: returns a paginated list of company records + operationId: getAllCompanies + parameters: + - description: name + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Company' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Companies + /companies/types: + get: + description: returns all company type records + operationId: getCompanyTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + type: array + items: + $ref: '#/components/schemas/CompanyType' + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Companies + /companies/{id}: + get: + description: returns a company record + operationId: getCompany + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Company' + status: + type: string + type: object + '400': + description: Invalid company id + '401': + description: Unauthorized + '404': + description: Company not found + tags: + - Companies + /content/ratings: + get: + description: returns list content rating records + operationId: getAllContentRatings + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ContentRating' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Content Ratings + /countries: + get: + description: returns list of country records + operationId: getAllCountries + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Country' + type: array + status: + type: string + type: object + tags: + - Countries + /entities: + get: + description: returns the active entity types + operationId: getEntityTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/EntityType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Entity Types + /episodes: + get: + description: Returns a list of episodes base records with the basic attributes.
Note that all episodes are returned, even those that may not be included in a series' default season order. + operationId: getAllEpisodes + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Episodes + /episodes/{id}: + get: + description: Returns episode base record + operationId: getEpisodeBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/EpisodeBaseRecord' + status: + type: string + type: object + '400': + description: Invalid episode id + '401': + description: Unauthorized + '404': + description: Episode not found + tags: + - Episodes + /episodes/{id}/extended: + get: + description: Returns episode extended record + operationId: getEpisodeExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: + - translations + example: translations + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/EpisodeExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid episode id + '401': + description: Unauthorized + '404': + description: Episode not found + tags: + - Episodes + /episodes/{id}/translations/{language}: + get: + description: Returns episode translation record + operationId: getEpisodeTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid episode id. Invalid language. + '401': + description: Unauthorized + '404': + description: Episode not found + tags: + - Episodes + /genders: + get: + description: returns list of gender records + operationId: getAllGenders + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Gender' + type: array + status: + type: string + type: object + tags: + - Genders + /genres: + get: + description: returns list of genre records + operationId: getAllGenres + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/GenreBaseRecord' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Genres + /genres/{id}: + get: + description: Returns genre record + operationId: getGenreBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/GenreBaseRecord' + status: + type: string + type: object + '400': + description: Invalid genre id + '401': + description: Unauthorized + '404': + description: Genre not found + tags: + - Genres + /inspiration/types: + get: + description: returns list of inspiration types records + operationId: getAllInspirationTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/InspirationType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - InspirationTypes + /languages: + get: + description: returns list of language records + operationId: getAllLanguages + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Language' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Languages + /lists: + get: + description: returns list of list base records + operationId: getAllLists + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ListBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + '401': + description: Unauthorized + tags: + - Lists + /lists/{id}: + get: + description: returns an list base record + operationId: getList + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ListBaseRecord' + status: + type: string + type: object + '400': + description: Invalid list id + '401': + description: Unauthorized + '404': + description: List not found + tags: + - Lists + /lists/slug/{slug}: + get: + description: returns an list base record search by slug + operationId: getListBySlug + parameters: + - description: slug + in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ListBaseRecord' + status: + type: string + type: object + '400': + description: Invalid list slug + '401': + description: Unauthorized + '404': + description: List not found + tags: + - Lists + /lists/{id}/extended: + get: + description: returns a list extended record + operationId: getListExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ListExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid list id + '401': + description: Unauthorized + '404': + description: Lists not found + tags: + - Lists + /lists/{id}/translations/{language}: + get: + description: Returns list translation record + operationId: getListTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Translation' + type: array + status: + type: string + type: object + '400': + description: Invalid lists id + '401': + description: Unauthorized + '404': + description: Lists not found + tags: + - Lists + /movies: + get: + description: returns list of movie base records + operationId: getAllMovie + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/MovieBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Movies + /movies/{id}: + get: + description: Returns movie base record + operationId: getMovieBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/MovieBaseRecord' + status: + type: string + type: object + '400': + description: Invalid movie id + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + /movies/{id}/extended: + get: + description: Returns movie extended record + operationId: getMovieExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: + - translations + example: translations + - description: reduce the payload and returns the short version of this record without characters, artworks and trailers. + in: query + name: short + required: false + schema: + type: boolean + enum: + - true + - false + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/MovieExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid movie id + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + /movies/filter: + get: + description: Search movies based on filter parameters + operationId: getMoviesFilter + parameters: + - description: production company + in: query + name: company + required: false + schema: + type: number + example: 1 + - description: content rating id base on a country + in: query + name: contentRating + required: false + schema: + type: number + example: 245 + - description: country of origin + in: query + name: country + required: true + schema: + type: string + example: usa + - description: genre + in: query + name: genre + required: false + schema: + type: number + example: 3 + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + - 16 + - 17 + - 18 + - 19 + - 21 + - 22 + - 23 + - 24 + - 25 + - 26 + - 27 + - 28 + - 29 + - 30 + - 31 + - 32 + - 33 + - 34 + - 35 + - 36 + - description: original language + in: query + name: lang + required: true + schema: + type: string + example: eng + - description: sort by results + in: query + name: sort + required: false + schema: + type: string + enum: + - score + - firstAired + - name + - description: status + in: query + name: status + required: false + schema: + type: number + enum: + - 1 + - 2 + - 3 + - description: release year + in: query + name: year + required: false + schema: + type: number + example: 2020 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/MovieBaseRecord' + type: array + status: + type: string + type: object + '400': + description: Invalid format parameter. + '401': + description: Unauthorized + tags: + - Movies + /movies/slug/{slug}: + get: + description: Returns movie base record search by slug + operationId: getMovieBaseBySlug + parameters: + - description: slug + in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/MovieBaseRecord' + status: + type: string + type: object + '400': + description: Invalid movie slug + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + /movies/{id}/translations/{language}: + get: + description: Returns movie translation record + operationId: getMovieTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid movie id, invalid language. + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + /movies/statuses: + get: + description: returns list of status records + operationId: getAllMovieStatuses + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Status' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Movie Statuses + /people: + get: + description: Returns a list of people base records with the basic attributes. + operationId: getAllPeople + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/PeopleBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - People + /people/{id}: + get: + description: Returns people base record + operationId: getPeopleBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/PeopleBaseRecord' + status: + type: string + type: object + '400': + description: Invalid people id + '401': + description: Unauthorized + '404': + description: People not found + tags: + - People + /people/{id}/extended: + get: + description: Returns people extended record + operationId: getPeopleExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: + - translations + example: translations + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/PeopleExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid people id + '401': + description: Unauthorized + '404': + description: People not found + tags: + - People + /people/{id}/translations/{language}: + get: + description: Returns people translation record + operationId: getPeopleTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid people id, invalid language. + '401': + description: Unauthorized + '404': + description: People not found + tags: + - People + /people/types: + get: + description: returns list of peopleType records + operationId: getAllPeopleTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/PeopleType' + type: array + status: + type: string + type: object + tags: + - People Types + /search: + get: + description: Our search index includes series, movies, people, and companies. Search is limited to 5k results max. + operationId: getSearchResults + parameters: + - description: The primary search string, which can include the main title for a record including all translations and aliases. + in: query + name: query + schema: + type: string + - description: Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. + in: query + name: q + schema: + type: string + - description: Restrict results to a specific entity type. Can be movie, series, person, or company. + in: query + name: type + schema: + type: string + - description: Restrict results to a specific year. Currently only used for series and movies. + in: query + name: year + schema: + type: number + - description: Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". + in: query + name: company + schema: + type: string + - description: Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. + in: query + name: country + schema: + type: string + - description: Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". + in: query + name: director + schema: + type: string + - description: Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. + in: query + name: language + schema: + type: string + - description: Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. + in: query + name: primaryType + schema: + type: string + - description: Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. + in: query + name: network + schema: + type: string + - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + in: query + name: remote_id + schema: + type: string + - description: Offset results. + in: query + name: offset + schema: + type: number + - description: Limit results. + in: query + name: limit + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SearchResult' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + '400': + description: Max results overflow + tags: + - Search + /search/remoteid/{remoteId}: + get: + description: Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. + operationId: getSearchResultsByRemoteId + parameters: + - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + in: path + required: true + name: remoteId + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SearchByRemoteIdResult' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Search + /seasons: + get: + description: returns list of seasons base records + operationId: getAllSeasons + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Seasons + /seasons/{id}: + get: + description: Returns season base record + operationId: getSeasonBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeasonBaseRecord' + status: + type: string + type: object + '400': + description: Invalid season id + '401': + description: Unauthorized + '404': + description: Season not found + tags: + - Seasons + /seasons/{id}/extended: + get: + description: Returns season extended record + operationId: getSeasonExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeasonExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid seasons id + '401': + description: Unauthorized + '404': + description: Season not found + tags: + - Seasons + /seasons/types: + get: + description: Returns season type records + operationId: getSeasonTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeasonType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Seasons + /seasons/{id}/translations/{language}: + get: + description: Returns season translation record + operationId: getSeasonTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid season id, language not found. + '401': + description: Unauthorized + '404': + description: Season not found + tags: + - Seasons + /series: + get: + description: returns list of series base records + operationId: getAllSeries + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeriesBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Series + /series/{id}: + get: + description: Returns series base record + operationId: getSeriesBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/{id}/artworks: + get: + description: Returns series artworks base on language and type.
Note: Artwork type is an id that can be found using **/artwork/types** endpoint. + operationId: getSeriesArtworks + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: lang + in: query + name: lang + required: false + schema: + type: string + example: eng, spa + - description: type + in: query + name: type + required: false + schema: + type: integer + example: 1,2,3 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/{id}/nextAired: + get: + description: Returns series base record including the nextAired field.
Note: nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. + operationId: getSeriesNextAired + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/{id}/extended: + get: + description: Returns series extended record + operationId: getSeriesExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: + - translations + - episodes + example: translations + - description: reduce the payload and returns the short version of this record without characters and artworks + in: query + name: short + required: false + schema: + type: boolean + enum: + - true + - false + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/{id}/episodes/{season-type}: + get: + description: Returns series episodes from the specified season type, default returns the episodes in the series default season type + operationId: getSeriesEpisodes + parameters: + - in: query + name: page + required: true + schema: + type: integer + default: 0 + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: season-type + in: path + name: season-type + required: true + schema: + type: string + examples: + default: + value: default + official: + value: official + dvd: + value: dvd + absolute: + value: absolute + alternate: + value: alternate + regional: + value: regional + - in: query + name: season + required: false + schema: + type: integer + default: 0 + - in: query + name: episodeNumber + required: false + schema: + type: integer + default: 0 + - description: airDate of the episode, format is yyyy-mm-dd + in: query + name: airDate + required: false + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + type: object + properties: + series: + $ref: '#/components/schemas/SeriesBaseRecord' + episodes: + type: array + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id, episodeNumber is not null then season must be present + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/{id}/episodes/{season-type}/{lang}: + get: + description: Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. + operationId: getSeriesSeasonEpisodesTranslated + parameters: + - in: query + name: page + required: true + schema: + type: integer + default: 0 + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: season-type + in: path + name: season-type + required: true + schema: + type: string + examples: + default: + value: default + official: + value: official + dvd: + value: dvd + absolute: + value: absolute + alternate: + value: alternate + regional: + value: regional + - in: path + name: lang + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + type: object + properties: + series: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id, invalid language. + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/filter: + get: + description: Search series based on filter parameters + operationId: getSeriesFilter + parameters: + - description: production company + in: query + name: company + required: false + schema: + type: number + example: 1 + - description: content rating id base on a country + in: query + name: contentRating + required: false + schema: + type: number + example: 245 + - description: country of origin + in: query + name: country + required: true + schema: + type: string + example: usa + - description: Genre id. This id can be found using **/genres** endpoint. + in: query + name: genre + required: false + schema: + type: number + example: 3 + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + - 16 + - 17 + - 18 + - 19 + - 21 + - 22 + - 23 + - 24 + - 25 + - 26 + - 27 + - 28 + - 29 + - 30 + - 31 + - 32 + - 33 + - 34 + - 35 + - 36 + - description: original language + in: query + name: lang + required: true + schema: + type: string + example: eng + - description: sort by results + in: query + name: sort + required: false + schema: + type: string + enum: + - score + - firstAired + - lastAired + - name + - description: sort type ascending or descending + in: query + name: sortType + required: false + schema: + type: string + enum: + - asc + - desc + - description: status + in: query + name: status + required: false + schema: + type: number + enum: + - 1 + - 2 + - 3 + - description: release year + in: query + name: year + required: false + schema: + type: number + example: 2020 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeriesBaseRecord' + type: array + type: object + '400': + description: Invalid format parameter. + '401': + description: Unauthorized + tags: + - Series + /series/slug/{slug}: + get: + description: Returns series base record searched by slug + operationId: getSeriesBaseBySlug + parameters: + - description: slug + in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series slug + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/{id}/translations/{language}: + get: + description: Returns series translation record + operationId: getSeriesTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid series id, invalid language. + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/statuses: + get: + description: returns list of status records + operationId: getAllSeriesStatuses + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Status' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Series Statuses + /sources/types: + get: + description: returns list of sourceType records + operationId: getAllSourceTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SourceType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Source Types + /updates: + get: + description: Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. + operationId: updates + parameters: + - in: query + name: since + required: true + schema: + type: number + - in: query + name: type + required: false + schema: + type: string + enum: + - artwork + - award_nominees + - companies + - episodes + - lists + - people + - seasons + - series + - seriespeople + - artworktypes + - award_categories + - awards + - company_types + - content_ratings + - countries + - entity_types + - genres + - languages + - movies + - movie_genres + - movie_status + - peopletypes + - seasontypes + - sourcetypes + - tag_options + - tags + - translatedcharacters + - translatedcompanies + - translatedepisodes + - translatedlists + - translatedmovies + - translatedpeople + - translatedseasons + - translatedserierk + example: movies + - in: query + name: action + required: false + schema: + type: string + enum: + - delete + - update + example: movies + - description: name + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/EntityUpdate' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '400': + description: Invalid since, type param. + '401': + description: Unauthorized + tags: + - Updates + /user: + get: + description: returns user info + operationId: getUserInfo + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/UserInfo' + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - User info + /user/{id}: + get: + description: returns user info by user id + operationId: getUserInfoById + parameters: + - description: id + in: path + name: id + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/UserInfo' + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - User info + /user/favorites: + get: + description: returns user favorites + operationId: getUserFavorites + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Favorites' + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Favorites + post: + description: creates a new user favorite + operationId: createUserFavorites + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FavoriteRecord' + responses: + '200': + description: Ok + '400': + description: Bad format + '401': + description: Unauthorized + tags: + - Favorites +servers: +- url: https://api4.thetvdb.com/v4 +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + schemas: + Alias: + description: An alias model, which can be associated with a series, season, movie, person, or list. + properties: + language: + type: string + maximum: 4 + description: A 3-4 character string indicating the language of the alias, as defined in Language. + name: + type: string + maximum: 100 + description: A string containing the alias itself. + type: object + ArtworkBaseRecord: + description: base artwork record + properties: + height: + format: int64 + type: integer + x-go-name: Height + id: + type: integer + image: + type: string + x-go-name: Image + includesText: + type: boolean + language: + type: string + score: + type: number + thumbnail: + type: string + x-go-name: Thumbnail + type: + format: int64 + type: integer + x-go-name: Type + description: The artwork type corresponds to the ids from the /artwork/types endpoint. + width: + format: int64 + type: integer + x-go-name: Width + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ArtworkExtendedRecord: + description: extended artwork record + properties: + episodeId: + type: integer + height: + format: int64 + type: integer + x-go-name: Height + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + x-go-name: Image + includesText: + type: boolean + language: + type: string + movieId: + type: integer + networkId: + type: integer + peopleId: + type: integer + score: + type: number + seasonId: + type: integer + seriesId: + type: integer + seriesPeopleId: + type: integer + status: + $ref: '#/components/schemas/ArtworkStatus' + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + thumbnail: + type: string + x-go-name: Thumbnail + thumbnailHeight: + format: int64 + type: integer + x-go-name: ThumbnailHeight + thumbnailWidth: + format: int64 + type: integer + x-go-name: ThumbnailWidth + type: + format: int64 + type: integer + x-go-name: Type + description: The artwork type corresponds to the ids from the /artwork/types endpoint. + updatedAt: + format: int64 + type: integer + x-go-name: UpdatedAt + width: + format: int64 + type: integer + x-go-name: Width + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ArtworkStatus: + description: artwork status record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ArtworkType: + description: artwork type record + properties: + height: + format: int64 + type: integer + id: + format: int64 + type: integer + x-go-name: ID + imageFormat: + type: string + x-go-name: ImageFormat + name: + type: string + x-go-name: Name + recordType: + type: string + x-go-name: RecordType + slug: + type: string + x-go-name: Slug + thumbHeight: + format: int64 + type: integer + x-go-name: ThumbHeight + thumbWidth: + format: int64 + type: integer + x-go-name: ThumbWidth + width: + format: int64 + type: integer + x-go-name: Width + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardBaseRecord: + description: base award record + properties: + id: + type: integer + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardCategoryBaseRecord: + description: base award category record + properties: + allowCoNominees: + type: boolean + x-go-name: AllowCoNominees + award: + $ref: '#/components/schemas/AwardBaseRecord' + forMovies: + type: boolean + x-go-name: ForMovies + forSeries: + type: boolean + x-go-name: ForSeries + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardCategoryExtendedRecord: + description: extended award category record + properties: + allowCoNominees: + type: boolean + x-go-name: AllowCoNominees + award: + $ref: '#/components/schemas/AwardBaseRecord' + forMovies: + type: boolean + x-go-name: ForMovies + forSeries: + type: boolean + x-go-name: ForSeries + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + nominees: + items: + $ref: '#/components/schemas/AwardNomineeBaseRecord' + type: array + x-go-name: Nominees + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardExtendedRecord: + description: extended award record + properties: + categories: + items: + $ref: '#/components/schemas/AwardCategoryBaseRecord' + type: array + x-go-name: Categories + id: + type: integer + name: + type: string + score: + format: int64 + type: integer + x-go-name: Score + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardNomineeBaseRecord: + description: base award nominee record + properties: + character: + $ref: '#/components/schemas/Character' + details: + type: string + episode: + $ref: '#/components/schemas/EpisodeBaseRecord' + id: + format: int64 + type: integer + x-go-name: ID + isWinner: + type: boolean + x-go-name: IsWinner + movie: + $ref: '#/components/schemas/MovieBaseRecord' + series: + $ref: '#/components/schemas/SeriesBaseRecord' + year: + type: string + category: + type: string + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Biography: + description: biography record + properties: + biography: + type: string + x-go-name: Biography + language: + type: string + x-go-name: Language + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Character: + description: character record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + episode: + $ref: '#/components/schemas/RecordInfo' + episodeId: + type: integer + nullable: true + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + isFeatured: + type: boolean + x-go-name: IsFeatured + movieId: + type: integer + nullable: true + movie: + $ref: '#/components/schemas/RecordInfo' + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + peopleId: + type: integer + personImgURL: + type: string + peopleType: + type: string + seriesId: + type: integer + nullable: true + series: + $ref: '#/components/schemas/RecordInfo' + sort: + format: int64 + type: integer + x-go-name: Sort + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + type: + format: int64 + type: integer + x-go-name: Type + url: + type: string + x-go-name: URL + personName: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Company: + description: A company record + properties: + activeDate: + type: string + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + country: + type: string + id: + format: int64 + type: integer + x-go-name: ID + inactiveDate: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + primaryCompanyType: + format: int64 + type: integer + x-go-name: PrimaryCompanyType + nullable: true + slug: + type: string + x-go-name: Slug + parentCompany: + type: object + $ref: '#/components/schemas/ParentCompany' + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ParentCompany: + description: A parent company record + type: object + properties: + id: + type: integer + nullable: true + name: + type: string + relation: + type: object + $ref: '#/components/schemas/CompanyRelationShip' + CompanyRelationShip: + description: A company relationship + properties: + id: + type: integer + nullable: true + typeName: + type: string + CompanyType: + description: A company type record + type: object + properties: + companyTypeId: + type: integer + companyTypeName: + type: string + ContentRating: + description: content rating record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + description: + type: string + country: + type: string + contentType: + type: string + order: + type: integer + fullName: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Country: + description: country record + properties: + id: + type: string + x-go-name: ID + name: + type: string + x-go-name: Name + shortCode: + type: string + x-go-name: ShortCode + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Entity: + description: Entity record + properties: + movieId: + type: integer + order: + format: int64 + type: integer + x-go-name: Order + seriesId: + type: integer + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + EntityType: + description: Entity Type record + properties: + id: + type: integer + name: + type: string + x-go-name: Order + hasSpecials: + type: boolean + type: object + EntityUpdate: + description: entity update record + properties: + entityType: + type: string + x-go-name: EnitityType + methodInt: + type: integer + method: + type: string + x-go-name: Method + extraInfo: + type: string + userId: + type: integer + recordType: + type: string + recordId: + format: int64 + type: integer + x-go-name: RecordID + timeStamp: + format: int64 + type: integer + x-go-name: TimeStamp + seriesId: + description: Only present for episodes records + format: int64 + type: integer + x-go-name: RecordID + mergeToId: + format: int64 + type: integer + mergeToEntityType: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + EpisodeBaseRecord: + description: base episode record + properties: + absoluteNumber: + type: integer + aired: + type: string + airsAfterSeason: + type: integer + airsBeforeEpisode: + type: integer + airsBeforeSeason: + type: integer + finaleType: + description: season, midseason, or series + type: string + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageType: + type: integer + nullable: true + isMovie: + format: int64 + type: integer + x-go-name: IsMovie + lastUpdated: + type: string + linkedMovie: + type: integer + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + number: + type: integer + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + runtime: + type: integer + nullable: true + seasonNumber: + type: integer + seasons: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + x-go-name: Seasons + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + seasonName: + type: string + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + EpisodeExtendedRecord: + description: extended episode record + properties: + aired: + type: string + airsAfterSeason: + type: integer + airsBeforeEpisode: + type: integer + airsBeforeSeason: + type: integer + awards: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + x-go-name: Awards + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + companies: + items: + $ref: '#/components/schemas/Company' + type: array + contentRatings: + items: + $ref: '#/components/schemas/ContentRating' + type: array + x-go-name: ContentRatings + finaleType: + description: season, midseason, or series + type: string + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageType: + type: integer + nullable: true + isMovie: + format: int64 + type: integer + x-go-name: IsMovie + lastUpdated: + type: string + linkedMovie: + type: integer + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + networks: + items: + $ref: '#/components/schemas/Company' + type: array + nominations: + items: + $ref: '#/components/schemas/AwardNomineeBaseRecord' + type: array + x-go-name: Nominees + number: + type: integer + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + productionCode: + type: string + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + runtime: + type: integer + nullable: true + seasonNumber: + type: integer + seasons: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + x-go-name: Seasons + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + studios: + items: + $ref: '#/components/schemas/Company' + type: array + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + translations: + $ref: '#/components/schemas/TranslationExtended' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Favorites: + description: User favorites record + properties: + series: + items: + type: integer + type: array + x-go-name: series + movies: + items: + type: integer + type: array + x-go-name: movies + episodes: + items: + type: integer + type: array + x-go-name: episodes + artwork: + items: + type: integer + type: array + x-go-name: artwork + people: + items: + type: integer + type: array + x-go-name: people + lists: + items: + type: integer + type: array + x-go-name: list + FavoriteRecord: + description: Favorites record + properties: + series: + type: integer + x-go-name: series + movie: + type: integer + x-go-name: movies + episode: + type: integer + x-go-name: episodes + artwork: + type: integer + x-go-name: artwork + people: + type: integer + x-go-name: people + list: + type: integer + x-go-name: list + Gender: + description: gender record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + GenreBaseRecord: + description: base genre record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + slug: + type: string + x-go-name: Slug + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Language: + description: language record + properties: + id: + type: string + x-go-name: ID + name: + type: string + x-go-name: Name + nativeName: + type: string + x-go-name: NativeName + shortCode: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ListBaseRecord: + description: base list record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageIsFallback: + type: boolean + isOfficial: + type: boolean + x-go-name: IsOfficial + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + tags: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + score: + type: integer + url: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ListExtendedRecord: + description: extended list record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + entities: + items: + $ref: '#/components/schemas/Entity' + type: array + x-go-name: Entities + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageIsFallback: + type: boolean + isOfficial: + type: boolean + x-go-name: IsOfficial + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: int64 + type: integer + x-go-name: Score + url: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + MovieBaseRecord: + description: base movie record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + x-go-name: Image + lastUpdated: + type: string + name: + type: string + x-go-name: Name + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: double + type: number + x-go-name: Score + slug: + type: string + x-go-name: Slug + status: + $ref: '#/components/schemas/Status' + runtime: + type: integer + nullable: true + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + MovieExtendedRecord: + description: extended movie record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + artworks: + items: + $ref: '#/components/schemas/ArtworkBaseRecord' + type: array + x-go-name: Artworks + audioLanguages: + items: + type: string + type: array + x-go-name: AudioLanguages + awards: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + x-go-name: Awards + boxOffice: + type: string + boxOfficeUS: + type: string + budget: + type: string + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + companies: + type: object + $ref: '#/components/schemas/Companies' + contentRatings: + items: + $ref: '#/components/schemas/ContentRating' + type: array + first_release: + type: object + $ref: '#/components/schemas/Release' + genres: + items: + $ref: '#/components/schemas/GenreBaseRecord' + type: array + x-go-name: Genres + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + x-go-name: Image + inspirations: + items: + $ref: '#/components/schemas/Inspiration' + type: array + x-go-name: Inspirations + lastUpdated: + type: string + lists: + items: + $ref: '#/components/schemas/ListBaseRecord' + type: array + name: + type: string + x-go-name: Name + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + originalCountry: + type: string + originalLanguage: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + production_countries: + items: + $ref: '#/components/schemas/ProductionCountry' + type: array + x-go-name: ProductionCountries + releases: + items: + $ref: '#/components/schemas/Release' + type: array + x-go-name: Releases + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + runtime: + type: integer + nullable: true + score: + format: double + type: number + x-go-name: Score + slug: + type: string + x-go-name: Slug + spoken_languages: + items: + type: string + type: array + x-go-name: SpokenLanguages + status: + $ref: '#/components/schemas/Status' + studios: + items: + $ref: '#/components/schemas/StudioBaseRecord' + type: array + x-go-name: Studios + subtitleLanguages: + items: + type: string + type: array + x-go-name: SubtitleLanguages + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + translations: + $ref: '#/components/schemas/TranslationExtended' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + PeopleBaseRecord: + description: base people record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: int64 + type: integer + x-go-name: Score + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + PeopleExtendedRecord: + description: extended people record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + awards: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + x-go-name: Awards + biographies: + items: + $ref: '#/components/schemas/Biography' + type: array + x-go-name: Biographies + birth: + type: string + birthPlace: + type: string + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + death: + type: string + gender: + type: integer + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + races: + items: + $ref: '#/components/schemas/Race' + type: array + x-go-name: Races + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + score: + format: int64 + type: integer + x-go-name: Score + slug: + type: string + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + translations: + $ref: '#/components/schemas/TranslationExtended' + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + PeopleType: + description: people type record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Race: + description: race record + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + RecordInfo: + description: base record info + properties: + image: + type: string + x-go-name: Image + name: + type: string + x-go-name: Name + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Release: + description: release record + properties: + country: + type: string + date: + type: string + detail: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + RemoteID: + description: remote id record + properties: + id: + type: string + x-go-name: ID + type: + format: int64 + type: integer + x-go-name: Type + sourceName: + type: string + x-go-name: SourceName + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SearchResult: + description: search result + properties: + aliases: + items: + type: string + type: array + companies: + items: + type: string + type: array + companyType: + type: string + country: + type: string + director: + type: string + first_air_time: + type: string + genres: + items: + type: string + type: array + id: + type: string + image_url: + type: string + name: + type: string + is_official: + type: boolean + name_translated: + type: string + network: + type: string + objectID: + type: string + officialList: + type: string + overview: + type: string + overviews: + $ref: '#/components/schemas/TranslationSimple' + overview_translated: + items: + type: string + type: array + poster: + type: string + posters: + items: + type: string + type: array + primary_language: + type: string + remote_ids: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + status: + type: string + x-go-name: Status + slug: + type: string + studios: + items: + type: string + type: array + title: + type: string + thumbnail: + type: string + translations: + $ref: '#/components/schemas/TranslationSimple' + translationsWithLang: + items: + type: string + type: array + tvdb_id: + type: string + type: + type: string + year: + type: string + type: object + SearchByRemoteIdResult: + description: search by remote reuslt is a base record for a movie, series, people, season or company search result + properties: + series: + type: object + $ref: '#/components/schemas/SeriesBaseRecord' + people: + type: object + $ref: '#/components/schemas/PeopleBaseRecord' + movie: + type: object + $ref: '#/components/schemas/MovieBaseRecord' + episode: + type: object + $ref: '#/components/schemas/EpisodeBaseRecord' + company: + type: object + $ref: '#/components/schemas/Company' + SeasonBaseRecord: + description: season genre record + properties: + id: + type: integer + image: + type: string + imageType: + type: integer + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + number: + format: int64 + type: integer + x-go-name: Number + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + companies: + type: object + $ref: '#/components/schemas/Companies' + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + type: + $ref: '#/components/schemas/SeasonType' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeasonExtendedRecord: + description: extended season record + properties: + artwork: + items: + $ref: '#/components/schemas/ArtworkBaseRecord' + type: array + x-go-name: Artwork + companies: + type: object + $ref: '#/components/schemas/Companies' + episodes: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + x-go-name: Episodes + id: + type: integer + image: + type: string + imageType: + type: integer + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + number: + format: int64 + type: integer + x-go-name: Number + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + type: + $ref: '#/components/schemas/SeasonType' + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + translations: + items: + $ref: '#/components/schemas/Translation' + type: array + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeasonType: + description: season type record + properties: + alternateName: + type: string + x-go-name: Name + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + type: + type: string + x-go-name: Type + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeriesAirsDays: + description: A series airs day record + properties: + friday: + type: boolean + x-go-name: Friday + monday: + type: boolean + x-go-name: Monday + saturday: + type: boolean + x-go-name: Saturday + sunday: + type: boolean + x-go-name: Sunday + thursday: + type: boolean + x-go-name: Thursday + tuesday: + type: boolean + x-go-name: Tuesday + wednesday: + type: boolean + x-go-name: Wednesday + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeriesBaseRecord: + description: The base record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + averageRuntime: + type: integer + nullable: true + country: + type: string + defaultSeasonType: + format: int64 + type: integer + x-go-name: DefaultSeasonType + episodes: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + x-go-name: Episodes + firstAired: + type: string + id: + type: integer + image: + type: string + isOrderRandomized: + type: boolean + x-go-name: IsOrderRandomized + lastAired: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + nextAired: + type: string + x-go-name: NextAired + originalCountry: + type: string + originalLanguage: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: double + type: number + x-go-name: Score + slug: + type: string + status: + $ref: '#/components/schemas/Status' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeriesExtendedRecord: + description: The extended record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. + properties: + abbreviation: + type: string + airsDays: + $ref: '#/components/schemas/SeriesAirsDays' + airsTime: + type: string + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + artworks: + items: + $ref: '#/components/schemas/ArtworkExtendedRecord' + type: array + x-go-name: Artworks + averageRuntime: + type: integer + nullable: true + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + contentRatings: + items: + $ref: '#/components/schemas/ContentRating' + type: array + country: + type: string + defaultSeasonType: + format: int64 + type: integer + x-go-name: DefaultSeasonType + episodes: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + x-go-name: Episodes + firstAired: + type: string + lists: + items: + $ref: '#/components/schemas/ListBaseRecord' + genres: + items: + $ref: '#/components/schemas/GenreBaseRecord' + type: array + x-go-name: Genres + id: + type: integer + image: + type: string + isOrderRandomized: + type: boolean + x-go-name: IsOrderRandomized + lastAired: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + companies: + items: + $ref: '#/components/schemas/Company' + type: array + nextAired: + type: string + x-go-name: NextAired + originalCountry: + type: string + originalLanguage: + type: string + originalNetwork: + $ref: '#/components/schemas/Company' + overview: + type: string + latestNetwork: + $ref: '#/components/schemas/Company' + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + score: + format: double + type: number + x-go-name: Score + seasons: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + x-go-name: Seasons + seasonTypes: + items: + $ref: '#/components/schemas/SeasonType' + type: array + x-go-name: Seasons + slug: + type: string + status: + $ref: '#/components/schemas/Status' + tags: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + translations: + $ref: '#/components/schemas/TranslationExtended' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SourceType: + description: source type record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + postfix: + type: string + prefix: + type: string + slug: + type: string + x-go-name: Slug + sort: + format: int64 + type: integer + x-go-name: Sort + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Status: + description: status record + properties: + id: + format: int64 + type: integer + x-go-name: ID + nullable: true + keepUpdated: + type: boolean + x-go-name: KeepUpdated + name: + type: string + x-go-name: Name + recordType: + type: string + x-go-name: RecordType + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + StudioBaseRecord: + description: studio record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + parentStudio: + type: integer + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Tag: + description: tag record + properties: + allowsMultiple: + type: boolean + x-go-name: AllowsMultiple + helpText: + type: string + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + options: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + TagOption: + description: tag option record + properties: + helpText: + type: string + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + tag: + format: int64 + type: integer + x-go-name: Tag + tagName: + type: string + x-go-name: TagName + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Trailer: + description: trailer record + properties: + id: + format: int64 + type: integer + x-go-name: ID + language: + type: string + name: + type: string + url: + type: string + runtime: + type: integer + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Translation: + description: translation record + properties: + aliases: + items: + type: string + type: array + isAlias: + type: boolean + isPrimary: + type: boolean + language: + type: string + x-go-name: Language + name: + type: string + overview: + type: string + tagline: + type: string + description: Only populated for movie translations. We disallow taglines without a title. + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + TranslationSimple: + description: translation simple record + additionalProperties: + type: string + example: + ara: تدور قصة المسلسل حول... + ces: Během letu č. 815 společnosti Oceanic... + deu: Im Bruchteil einer Sekunde gerät das Leben... + type: object + TranslationExtended: + description: translation extended record + properties: + nameTranslations: + items: + $ref: '#/components/schemas/Translation' + type: array + overviewTranslations: + items: + $ref: '#/components/schemas/Translation' + type: array + alias: + items: + type: string + type: array + type: object + TagOptionEntity: + description: a entity with selected tag option + type: object + properties: + name: + type: string + tagName: + type: string + tagId: + type: integer + UserInfo: + description: User info record + type: object + properties: + id: + type: integer + language: + type: string + name: + type: string + type: + type: string + Inspiration: + description: Movie inspiration record + properties: + id: + format: int64 + type: integer + x-go-name: ID + type: + type: string + type_name: + type: string + url: + type: string + InspirationType: + description: Movie inspiration type record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + description: + type: string + reference_name: + type: string + url: + type: string + ProductionCountry: + description: Production country record + properties: + id: + format: int64 + type: integer + x-go-name: ID + country: + type: string + name: + type: string + Companies: + description: Companies by type record + properties: + studio: + type: array + items: + $ref: '#/components/schemas/Company' + network: + type: array + items: + $ref: '#/components/schemas/Company' + production: + type: array + items: + $ref: '#/components/schemas/Company' + distributor: + type: array + items: + $ref: '#/components/schemas/Company' + special_effects: + type: array + items: + $ref: '#/components/schemas/Company' + Links: + description: Links for next, previous and current record + properties: + prev: + type: string + nullable: true + self: + type: string + nullable: true + next: + type: string + total_items: + type: integer + page_size: + type: integer diff --git a/src/TvdbClient/openapi/tvdb-v4.raw.yml b/src/TvdbClient/openapi/tvdb-v4.raw.yml new file mode 100644 index 0000000..7c7ddff --- /dev/null +++ b/src/TvdbClient/openapi/tvdb-v4.raw.yml @@ -0,0 +1,4264 @@ +openapi: 3.0.0 +info: + description: | + Documentation of [TheTVDB](https://thetvdb.com/) API V4. All related information is linked from our [Github repo](https://github.com/thetvdb/v4-api). You might also want to use our [Postman collection] (https://www.getpostman.com/collections/7a9397ce69ff246f74d0) + ## Authentication + 1. Use the /login endpoint and provide your API key as "apikey". If you have a user-supported key, also provide your subscriber PIN as "pin". Otherwise completely remove "pin" from your call. + 2. Executing this call will provide you with a bearer token, which is valid for 1 month. + 3. Provide your bearer token for subsequent API calls by clicking Authorize below or including in the header of all direct API calls: `Authorization: Bearer [your-token]` + + ## Notes + 1. "score" is a field across almost all entities. We generate scores for different types of entities in various ways, so no assumptions should be made about the meaning of this value. It is simply used to hint at relative popularity for sorting purposes. + title: TVDB API V4 + version: 4.7.10 +security: + - bearerAuth: [ ] +paths: + /login: + post: + summary: create an auth token. The token has one month validation length. + requestBody: + content: + application/json: + schema: + type: object + required: + - apikey + properties: + apikey: + type: string + pin: + type: string + required: true + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + properties: + token: + type: string + type: object + status: + type: string + type: object + '401': + description: invalid credentials + tags: + - Login + '/artwork/{id}': + get: + description: Returns a single artwork base record. + operationId: getArtworkBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ArtworkBaseRecord' + status: + type: string + type: object + '400': + description: Invalid artwork id + '401': + description: Unauthorized + '404': + description: Artwork not found + tags: + - Artwork + + '/artwork/{id}/extended': + get: + description: Returns a single artwork extended record. + operationId: getArtworkExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ArtworkExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid artwork id + '401': + description: Unauthorized + '404': + description: Artwork not found + tags: + - Artwork + + '/artwork/statuses': + get: + description: Returns list of artwork status records. + operationId: getAllArtworkStatuses + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ArtworkStatus' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Artwork Statuses + + '/artwork/types': + get: + description: Returns a list of artworkType records + operationId: getAllArtworkTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ArtworkType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Artwork Types + + /awards: + get: + description: Returns a list of award base records + operationId: getAllAwards + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Awards + + '/awards/{id}': + get: + description: Returns a single award base record + operationId: getAward + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardBaseRecord' + status: + type: string + type: object + '400': + description: Invalid awards id + '401': + description: Unauthorized + '404': + description: Awards not found + tags: + - Awards + + '/awards/{id}/extended': + get: + description: Returns a single award extended record + operationId: getAwardExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid awards id + '401': + description: Unauthorized + '404': + description: Awards not found + tags: + - Awards + + '/awards/categories/{id}': + get: + description: Returns a single award category base record + operationId: getAwardCategory + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardCategoryBaseRecord' + status: + type: string + type: object + '400': + description: Invalid category id + '401': + description: Unauthorized + '404': + description: Category not found + tags: + - Award Categories + + '/awards/categories/{id}/extended': + get: + description: Returns a single award category extended record + operationId: getAwardCategoryExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/AwardCategoryExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid category id + '401': + description: Unauthorized + '404': + description: Category not found + tags: + - Award Categories + + '/characters/{id}': + get: + description: Returns character base record + operationId: getCharacterBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Character' + status: + type: string + type: object + '400': + description: Invalid character id + '401': + description: Unauthorized + '404': + description: Character not found + tags: + - Characters + /companies: + get: + description: returns a paginated list of company records + operationId: getAllCompanies + parameters: + - description: name + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Company' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Companies + '/companies/types': + get: + description: returns all company type records + operationId: getCompanyTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + type: array + items: + $ref: '#/components/schemas/CompanyType' + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Companies + '/companies/{id}': + get: + description: returns a company record + operationId: getCompany + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Company' + status: + type: string + type: object + '400': + description: Invalid company id + '401': + description: Unauthorized + '404': + description: Company not found + tags: + - Companies + /content/ratings: + get: + description: returns list content rating records + operationId: getAllContentRatings + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ContentRating' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Content Ratings + /countries: + get: + description: returns list of country records + operationId: getAllCountries + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Country' + type: array + status: + type: string + type: object + tags: + - Countries + '/entities': + get: + description: returns the active entity types + operationId: getEntityTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/EntityType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Entity Types + '/episodes': + get: + description: Returns a list of episodes base records with the basic attributes.
Note that all episodes are returned, even those that may not be included in a series' default season order. + operationId: getAllEpisodes + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Episodes + '/episodes/{id}': + get: + description: Returns episode base record + operationId: getEpisodeBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/EpisodeBaseRecord' + status: + type: string + type: object + '400': + description: Invalid episode id + '401': + description: Unauthorized + '404': + description: Episode not found + tags: + - Episodes + '/episodes/{id}/extended': + get: + description: Returns episode extended record + operationId: getEpisodeExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: [ translations ] + example: translations + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/EpisodeExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid episode id + '401': + description: Unauthorized + '404': + description: Episode not found + tags: + - Episodes + '/episodes/{id}/translations/{language}': + get: + description: Returns episode translation record + operationId: getEpisodeTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid episode id. Invalid language. + '401': + description: Unauthorized + '404': + description: Episode not found + tags: + - Episodes + + /genders: + get: + description: returns list of gender records + operationId: getAllGenders + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Gender' + type: array + status: + type: string + type: object + tags: + - Genders + + /genres: + get: + description: returns list of genre records + operationId: getAllGenres + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/GenreBaseRecord' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + + tags: + - Genres + + '/genres/{id}': + get: + description: Returns genre record + operationId: getGenreBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/GenreBaseRecord' + status: + type: string + type: object + '400': + description: Invalid genre id + '401': + description: Unauthorized + '404': + description: Genre not found + tags: + - Genres + /inspiration/types: + get: + description: returns list of inspiration types records + operationId: getAllInspirationTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/InspirationType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - InspirationTypes + /languages: + get: + description: returns list of language records + operationId: getAllLanguages + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Language' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Languages + /lists: + get: + description: returns list of list base records + operationId: getAllLists + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/ListBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + '401': + description: Unauthorized + tags: + - Lists + + '/lists/{id}': + get: + description: returns an list base record + operationId: getList + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ListBaseRecord' + status: + type: string + type: object + '400': + description: Invalid list id + '401': + description: Unauthorized + '404': + description: List not found + tags: + - Lists + '/lists/slug/{slug}': + get: + description: returns an list base record search by slug + operationId: getListBySlug + parameters: + - description: slug + in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ListBaseRecord' + status: + type: string + type: object + '400': + description: Invalid list slug + '401': + description: Unauthorized + '404': + description: List not found + tags: + - Lists + '/lists/{id}/extended': + get: + description: returns a list extended record + operationId: getListExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/ListExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid list id + '401': + description: Unauthorized + '404': + description: Lists not found + tags: + - Lists + '/lists/{id}/translations/{language}': + get: + description: Returns list translation record + operationId: getListTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Translation' + type: array + status: + type: string + type: object + '400': + description: Invalid lists id + '401': + description: Unauthorized + '404': + description: Lists not found + tags: + - Lists + + /movies: + get: + description: returns list of movie base records + operationId: getAllMovie + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/MovieBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Movies + '/movies/{id}': + get: + description: Returns movie base record + operationId: getMovieBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/MovieBaseRecord' + status: + type: string + type: object + '400': + description: Invalid movie id + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + '/movies/{id}/extended': + get: + description: Returns movie extended record + operationId: getMovieExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: [ translations ] + example: translations + - description: reduce the payload and returns the short version of this record without characters, artworks and trailers. + in: query + name: short + required: false + schema: + type: boolean + enum: [ true, false ] + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/MovieExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid movie id + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + '/movies/filter': + get: + description: Search movies based on filter parameters + operationId: getMoviesFilter + parameters: + - description: production company + in: query + name: company + required: false + schema: + type: number + example: 1 + - description: content rating id base on a country + in: query + name: contentRating + required: false + schema: + type: number + example: 245 + - description: country of origin + in: query + name: country + required: true + schema: + type: string + example: usa + - description: genre + in: query + name: genre + required: false + schema: + type: number + example: 3 + enum: [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 ] + - description: original language + in: query + name: lang + required: true + schema: + type: string + example: eng + - description: sort by results + in: query + name: sort + required: false + schema: + type: string + enum: [ score,firstAired,name ] + - description: status + in: query + name: status + required: false + schema: + type: number + enum: [ 1,2,3 ] + - description: release year + in: query + name: year + required: false + schema: + type: number + example: 2020 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/MovieBaseRecord' + type: array + status: + type: string + type: object + '400': + description: Invalid format parameter. + '401': + description: Unauthorized + tags: + - Movies + '/movies/slug/{slug}': + get: + description: Returns movie base record search by slug + operationId: getMovieBaseBySlug + parameters: + - description: slug + in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/MovieBaseRecord' + status: + type: string + type: object + '400': + description: Invalid movie slug + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + '/movies/{id}/translations/{language}': + get: + description: Returns movie translation record + operationId: getMovieTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid movie id, invalid language. + '401': + description: Unauthorized + '404': + description: Movie not found + tags: + - Movies + /movies/statuses: + get: + description: returns list of status records + operationId: getAllMovieStatuses + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Status' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Movie Statuses + '/people': + get: + description: Returns a list of people base records with the basic attributes. + operationId: getAllPeople + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/PeopleBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - People + + '/people/{id}': + get: + description: Returns people base record + operationId: getPeopleBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/PeopleBaseRecord' + status: + type: string + type: object + '400': + description: Invalid people id + '401': + description: Unauthorized + '404': + description: People not found + tags: + - People + '/people/{id}/extended': + get: + description: Returns people extended record + operationId: getPeopleExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: [ translations ] + example: translations + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/PeopleExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid people id + '401': + description: Unauthorized + '404': + description: People not found + tags: + - People + '/people/{id}/translations/{language}': + get: + description: Returns people translation record + operationId: getPeopleTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid people id, invalid language. + '401': + description: Unauthorized + '404': + description: People not found + tags: + - People + /people/types: + get: + description: returns list of peopleType records + operationId: getAllPeopleTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/PeopleType' + type: array + status: + type: string + type: object + tags: + - People Types + + /search: + get: + description: Our search index includes series, movies, people, and companies. Search is limited to 5k results max. + operationId: getSearchResults + parameters: + - description: The primary search string, which can include the main title for a record including all translations and aliases. + in: query + name: query + schema: + type: string + - description: Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. + in: query + name: q + schema: + type: string + - description: Restrict results to a specific entity type. Can be movie, series, person, or company. + in: query + name: type + schema: + type: string + - description: Restrict results to a specific year. Currently only used for series and movies. + in: query + name: year + schema: + type: number + - description: Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". + in: query + name: company + schema: + type: string + - description: Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. + in: query + name: country + schema: + type: string + - description: Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". + in: query + name: director + schema: + type: string + - description: Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. + in: query + name: language + schema: + type: string + - description: Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. + in: query + name: primaryType + schema: + type: string + - description: Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. + in: query + name: network + schema: + type: string + + + - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + in: query + name: remote_id + schema: + type: string + + - description: Offset results. + in: query + name: offset + schema: + type: number + - description: Limit results. + in: query + name: limit + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SearchResult' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + '400': + description: Max results overflow + tags: + - Search + /search/remoteid/{remoteId}: + get: + description: Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. + operationId: getSearchResultsByRemoteId + parameters: + - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + in: path + required: true + name: remoteId + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SearchByRemoteIdResult' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Search + + /seasons: + get: + description: returns list of seasons base records + operationId: getAllSeasons + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Seasons + '/seasons/{id}': + get: + description: Returns season base record + operationId: getSeasonBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeasonBaseRecord' + status: + type: string + type: object + '400': + description: Invalid season id + '401': + description: Unauthorized + '404': + description: Season not found + tags: + - Seasons + '/seasons/{id}/extended': + get: + description: Returns season extended record + operationId: getSeasonExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeasonExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid seasons id + '401': + description: Unauthorized + '404': + description: Season not found + tags: + - Seasons + '/seasons/types': + get: + description: Returns season type records + operationId: getSeasonTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeasonType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Seasons + '/seasons/{id}/translations/{language}': + get: + description: Returns season translation record + operationId: getSeasonTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid season id, language not found. + '401': + description: Unauthorized + '404': + description: Season not found + tags: + - Seasons + /series: + get: + description: returns list of series base records + operationId: getAllSeries + parameters: + - description: page number + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeriesBaseRecord' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '401': + description: Unauthorized + tags: + - Series + '/series/{id}': + get: + description: Returns series base record + operationId: getSeriesBase + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/{id}/artworks': + get: + description: Returns series artworks base on language and type.
Note: Artwork type is an id that can be found using **/artwork/types** endpoint. + operationId: getSeriesArtworks + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: lang + in: query + name: lang + required: false + schema: + type: string + example: eng, spa + - description: type + in: query + name: type + required: false + schema: + type: integer + example: 1,2,3 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/{id}/nextAired': + get: + description: Returns series base record including the nextAired field.
Note: nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. + operationId: getSeriesNextAired + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/{id}/extended': + get: + description: Returns series extended record + operationId: getSeriesExtended + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: meta + in: query + name: meta + required: false + schema: + type: string + enum: [ translations, episodes ] + example: translations + - description: reduce the payload and returns the short version of this record without characters and artworks + in: query + name: short + required: false + schema: + type: boolean + enum: [ true, false ] + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesExtendedRecord' + status: + type: string + type: object + '400': + description: Invalid series id + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/{id}/episodes/{season-type}': + get: + description: Returns series episodes from the specified season type, default returns the episodes in the series default season type + operationId: getSeriesEpisodes + parameters: + - in: query + name: page + required: true + schema: + type: integer + default: 0 + - description: id + in: path + name: id + required: true + schema: + type: number + - description: season-type + in: path + name: season-type + required: true + schema: + type: string + examples: + default: + value: default + official: + value: official + dvd: + value: dvd + absolute: + value: absolute + alternate: + value: alternate + regional: + value: regional + - in: query + name: season + required: false + schema: + type: integer + default: 0 + - in: query + name: episodeNumber + required: false + schema: + type: integer + default: 0 + - description: airDate of the episode, format is yyyy-mm-dd + in: query + name: airDate + required: false + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + type: object + properties: + series: + $ref: '#/components/schemas/SeriesBaseRecord' + episodes: + type: array + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id, episodeNumber is not null then season must be present + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/{id}/episodes/{season-type}/{lang}': + get: + description: Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. + operationId: getSeriesSeasonEpisodesTranslated + parameters: + - in: query + name: page + required: true + schema: + type: integer + default: 0 + - description: id + in: path + name: id + required: true + schema: + type: number + - description: season-type + in: path + name: season-type + required: true + schema: + type: string + examples: + default: + value: default + official: + value: official + dvd: + value: dvd + absolute: + value: absolute + alternate: + value: alternate + regional: + value: regional + - in: path + name: lang + required: true + schema: + type: string + + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + type: object + properties: + series: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series id, invalid language. + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/filter': + get: + description: Search series based on filter parameters + operationId: getSeriesFilter + parameters: + - description: production company + in: query + name: company + required: false + schema: + type: number + example: 1 + - description: content rating id base on a country + in: query + name: contentRating + required: false + schema: + type: number + example: 245 + - description: country of origin + in: query + name: country + required: true + schema: + type: string + example: usa + - description: Genre id. This id can be found using **/genres** endpoint. + in: query + name: genre + required: false + schema: + type: number + example: 3 + enum: [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 ] + - description: original language + in: query + name: lang + required: true + schema: + type: string + example: eng + - description: sort by results + in: query + name: sort + required: false + schema: + type: string + enum: [ score,firstAired,lastAired,name ] + - description: sort type ascending or descending + in: query + name: sortType + required: false + schema: + type: string + enum: [ asc,desc ] + - description: status + in: query + name: status + required: false + schema: + type: number + enum: [ 1,2,3 ] + - description: release year + in: query + name: year + required: false + schema: + type: number + example: 2020 + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SeriesBaseRecord' + type: array + type: object + '400': + description: Invalid format parameter. + '401': + description: Unauthorized + tags: + - Series + '/series/slug/{slug}': + get: + description: Returns series base record searched by slug + operationId: getSeriesBaseBySlug + parameters: + - description: slug + in: path + name: slug + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/SeriesBaseRecord' + status: + type: string + type: object + '400': + description: Invalid series slug + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + '/series/{id}/translations/{language}': + get: + description: Returns series translation record + operationId: getSeriesTranslation + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + - description: language + in: path + name: language + required: true + schema: + type: string + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + $ref: '#/components/schemas/Translation' + status: + type: string + type: object + '400': + description: Invalid series id, invalid language. + '401': + description: Unauthorized + '404': + description: Series not found + tags: + - Series + /series/statuses: + get: + description: returns list of status records + operationId: getAllSeriesStatuses + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Status' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Series Statuses + /sources/types: + get: + description: returns list of sourceType records + operationId: getAllSourceTypes + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/SourceType' + type: array + status: + type: string + type: object + '401': + description: Unauthorized + tags: + - Source Types + /updates: + get: + description: Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. + operationId: updates + parameters: + - in: query + name: since + required: true + schema: + type: number + - in: query + name: type + required: false + schema: + type: string + enum: [ artwork,award_nominees,companies,episodes,lists,people,seasons,series,seriespeople,artworktypes,award_categories,awards,company_types,content_ratings,countries,entity_types,genres,languages,movies,movie_genres,movie_status,peopletypes,seasontypes,sourcetypes,tag_options,tags,translatedcharacters,translatedcompanies,translatedepisodes,translatedlists,translatedmovies,translatedpeople,translatedseasons,translatedserierk ] + example: movies + - in: query + name: action + required: false + schema: + type: string + enum: [ delete, update ] + example: movies + - description: name + in: query + name: page + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/EntityUpdate' + type: array + status: + type: string + links: + $ref: '#/components/schemas/Links' + type: object + '400': + description: Invalid since, type param. + '401': + description: Unauthorized + + tags: + - Updates + /user: + get: + description: returns user info + operationId: getUserInfo + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/UserInfo' + status: + type: string + type: object + '401': + description: Unauthorized + + tags: + - User info + /user/{id}: + get: + description: returns user info by user id + operationId: getUserInfoById + parameters: + - description: id + in: path + name: id + required: true + schema: + type: number + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/UserInfo' + status: + type: string + type: object + '401': + description: Unauthorized + + tags: + - User info + /user/favorites: + get: + description: returns user favorites + operationId: getUserFavorites + responses: + '200': + description: response + content: + application/json: + schema: + properties: + data: + items: + $ref: '#/components/schemas/Favorites' + status: + type: string + type: object + '401': + description: Unauthorized + + tags: + - Favorites + post: + description: creates a new user favorite + operationId: createUserFavorites + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FavoriteRecord' + responses: + '200': + description: Ok + '400': + description: Bad format + '401': + description: Unauthorized + + tags: + - Favorites + +servers: + - url: 'https://api4.thetvdb.com/v4' +components: + securitySchemes: + bearerAuth: # arbitrary name for the security scheme + type: http + scheme: bearer + bearerFormat: JWT + schemas: + Alias: + description: An alias model, which can be associated with a series, season, movie, person, or list. + properties: + language: + type: string + maximum: 4 + description: A 3-4 character string indicating the language of the alias, as defined in Language. + name: + type: string + maximum: 100 + description: A string containing the alias itself. + type: object + ArtworkBaseRecord: + description: base artwork record + properties: + height: + format: int64 + type: integer + x-go-name: Height + id: + type: integer + image: + type: string + x-go-name: Image + includesText: + type: boolean + language: + type: string + score: + type: number + thumbnail: + type: string + x-go-name: Thumbnail + type: + format: int64 + type: integer + x-go-name: Type + description: The artwork type corresponds to the ids from the /artwork/types endpoint. + width: + format: int64 + type: integer + x-go-name: Width + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ArtworkExtendedRecord: + description: extended artwork record + properties: + episodeId: + type: integer + height: + format: int64 + type: integer + x-go-name: Height + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + x-go-name: Image + includesText: + type: boolean + language: + type: string + movieId: + type: integer + networkId: + type: integer + peopleId: + type: integer + score: + type: number + seasonId: + type: integer + seriesId: + type: integer + seriesPeopleId: + type: integer + status: + $ref: '#/components/schemas/ArtworkStatus' + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + thumbnail: + type: string + x-go-name: Thumbnail + thumbnailHeight: + format: int64 + type: integer + x-go-name: ThumbnailHeight + thumbnailWidth: + format: int64 + type: integer + x-go-name: ThumbnailWidth + type: + format: int64 + type: integer + x-go-name: Type + description: The artwork type corresponds to the ids from the /artwork/types endpoint. + updatedAt: + format: int64 + type: integer + x-go-name: UpdatedAt + width: + format: int64 + type: integer + x-go-name: Width + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ArtworkStatus: + description: artwork status record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ArtworkType: + description: artwork type record + properties: + height: + format: int64 + type: integer + id: + format: int64 + type: integer + x-go-name: ID + imageFormat: + type: string + x-go-name: ImageFormat + name: + type: string + x-go-name: Name + recordType: + type: string + x-go-name: RecordType + slug: + type: string + x-go-name: Slug + thumbHeight: + format: int64 + type: integer + x-go-name: ThumbHeight + thumbWidth: + format: int64 + type: integer + x-go-name: ThumbWidth + width: + format: int64 + type: integer + x-go-name: Width + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardBaseRecord: + description: base award record + properties: + id: + type: integer + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardCategoryBaseRecord: + description: base award category record + properties: + allowCoNominees: + type: boolean + x-go-name: AllowCoNominees + award: + $ref: '#/components/schemas/AwardBaseRecord' + forMovies: + type: boolean + x-go-name: ForMovies + forSeries: + type: boolean + x-go-name: ForSeries + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardCategoryExtendedRecord: + description: extended award category record + properties: + allowCoNominees: + type: boolean + x-go-name: AllowCoNominees + award: + $ref: '#/components/schemas/AwardBaseRecord' + forMovies: + type: boolean + x-go-name: ForMovies + forSeries: + type: boolean + x-go-name: ForSeries + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + nominees: + items: + $ref: '#/components/schemas/AwardNomineeBaseRecord' + type: array + x-go-name: Nominees + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardExtendedRecord: + description: extended award record + properties: + categories: + items: + $ref: '#/components/schemas/AwardCategoryBaseRecord' + type: array + x-go-name: Categories + id: + type: integer + name: + type: string + score: + format: int64 + type: integer + x-go-name: Score + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + AwardNomineeBaseRecord: + description: base award nominee record + properties: + character: + $ref: '#/components/schemas/Character' + details: + type: string + episode: + $ref: '#/components/schemas/EpisodeBaseRecord' + id: + format: int64 + type: integer + x-go-name: ID + isWinner: + type: boolean + x-go-name: IsWinner + movie: + $ref: '#/components/schemas/MovieBaseRecord' + series: + $ref: '#/components/schemas/SeriesBaseRecord' + year: + type: string + category: + type: string + name: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Biography: + description: biography record + properties: + biography: + type: string + x-go-name: Biography + language: + type: string + x-go-name: Language + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Character: + description: character record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + episode: + $ref: '#/components/schemas/RecordInfo' + episodeId: + type: integer + nullable: true + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + isFeatured: + type: boolean + x-go-name: IsFeatured + movieId: + type: integer + nullable: true + movie: + $ref: '#/components/schemas/RecordInfo' + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + peopleId: + type: integer + personImgURL: + type: string + peopleType: + type: string + seriesId: + type: integer + nullable: true + series: + $ref: '#/components/schemas/RecordInfo' + sort: + format: int64 + type: integer + x-go-name: Sort + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + type: + format: int64 + type: integer + x-go-name: Type + url: + type: string + x-go-name: URL + personName: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Company: + description: A company record + properties: + activeDate: + type: string + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + country: + type: string + id: + format: int64 + type: integer + x-go-name: ID + inactiveDate: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + primaryCompanyType: + format: int64 + type: integer + x-go-name: PrimaryCompanyType + nullable: true + slug: + type: string + x-go-name: Slug + parentCompany: + type: object + $ref: '#/components/schemas/ParentCompany' + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ParentCompany: + description: A parent company record + type: object + properties: + id: + type: integer + nullable: true + name: + type: string + relation: + type: object + $ref: '#/components/schemas/CompanyRelationShip' + CompanyRelationShip: + description: A company relationship + properties: + id: + type: integer + nullable: true + typeName: + type: string + CompanyType: + description: A company type record + type: object + properties: + companyTypeId: + type: integer + companyTypeName: + type: string + ContentRating: + description: content rating record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + description: + type: string + country: + type: string + contentType: + type: string + order: + type: integer + fullName: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Country: + description: country record + properties: + id: + type: string + x-go-name: ID + name: + type: string + x-go-name: Name + shortCode: + type: string + x-go-name: ShortCode + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Entity: + description: Entity record + properties: + movieId: + type: integer + order: + format: int64 + type: integer + x-go-name: Order + seriesId: + type: integer + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + EntityType: + description: Entity Type record + properties: + id: + type: integer + name: + type: string + x-go-name: Order + hasSpecials: + type: boolean + type: object + EntityUpdate: + description: entity update record + properties: + entityType: + type: string + x-go-name: EnitityType + methodInt: + type: integer + method: + type: string + x-go-name: Method + extraInfo: + type: string + userId: + type: integer + recordType: + type: string + recordId: + format: int64 + type: integer + x-go-name: RecordID + timeStamp: + format: int64 + type: integer + x-go-name: TimeStamp + seriesId: + description: Only present for episodes records + format: int64 + type: integer + x-go-name: RecordID + mergeToId: + format: int64 + type: integer + mergeToEntityType: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + EpisodeBaseRecord: + description: base episode record + properties: + absoluteNumber: + type: integer + aired: + type: string + airsAfterSeason: + type: integer + airsBeforeEpisode: + type: integer + airsBeforeSeason: + type: integer + finaleType: + description: season, midseason, or series + type: string + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageType: + type: integer + nullable: true + isMovie: + format: int64 + type: integer + x-go-name: IsMovie + lastUpdated: + type: string + linkedMovie: + type: integer + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + number: + type: integer + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + runtime: + type: integer + nullable: true + seasonNumber: + type: integer + seasons: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + x-go-name: Seasons + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + seasonName: + type: string + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + EpisodeExtendedRecord: + description: extended episode record + properties: + aired: + type: string + airsAfterSeason: + type: integer + airsBeforeEpisode: + type: integer + airsBeforeSeason: + type: integer + awards: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + x-go-name: Awards + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + companies: + items: + $ref: '#/components/schemas/Company' + type: array + contentRatings: + items: + $ref: '#/components/schemas/ContentRating' + type: array + x-go-name: ContentRatings + finaleType: + description: season, midseason, or series + type: string + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageType: + type: integer + nullable: true + isMovie: + format: int64 + type: integer + x-go-name: IsMovie + lastUpdated: + type: string + linkedMovie: + type: integer + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + networks: + items: + $ref: '#/components/schemas/Company' + type: array + nominations: + items: + $ref: '#/components/schemas/AwardNomineeBaseRecord' + type: array + x-go-name: Nominees + number: + type: integer + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + productionCode: + type: string + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + runtime: + type: integer + nullable: true + seasonNumber: + type: integer + seasons: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + x-go-name: Seasons + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + studios: + items: + $ref: '#/components/schemas/Company' + type: array + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + translations: + $ref: '#/components/schemas/TranslationExtended' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Favorites: + description: User favorites record + properties: + series: + items: + type: integer + type: array + x-go-name: series + movies: + items: + type: integer + type: array + x-go-name: movies + episodes: + items: + type: integer + type: array + x-go-name: episodes + artwork: + items: + type: integer + type: array + x-go-name: artwork + people: + items: + type: integer + type: array + x-go-name: people + lists: + items: + type: integer + type: array + x-go-name: list + FavoriteRecord: + description: Favorites record + properties: + series: + type: integer + x-go-name: series + movie: + type: integer + x-go-name: movies + episode: + type: integer + x-go-name: episodes + artwork: + type: integer + x-go-name: artwork + people: + type: integer + x-go-name: people + list: + type: integer + x-go-name: list + Gender: + description: gender record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + GenreBaseRecord: + description: base genre record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + slug: + type: string + x-go-name: Slug + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Language: + description: language record + properties: + id: + type: string + x-go-name: ID + name: + type: string + x-go-name: Name + nativeName: + type: string + x-go-name: NativeName + shortCode: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ListBaseRecord: + description: base list record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageIsFallback: + type: boolean + isOfficial: + type: boolean + x-go-name: IsOfficial + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + tags: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + score: + type: integer + url: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + ListExtendedRecord: + description: extended list record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + entities: + items: + $ref: '#/components/schemas/Entity' + type: array + x-go-name: Entities + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + imageIsFallback: + type: boolean + isOfficial: + type: boolean + x-go-name: IsOfficial + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overview: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: int64 + type: integer + x-go-name: Score + url: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + MovieBaseRecord: + description: base movie record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + x-go-name: Image + lastUpdated: + type: string + name: + type: string + x-go-name: Name + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: double + type: number + x-go-name: Score + slug: + type: string + x-go-name: Slug + status: + $ref: '#/components/schemas/Status' + runtime: + type: integer + nullable: true + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + MovieExtendedRecord: + description: extended movie record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + artworks: + items: + $ref: '#/components/schemas/ArtworkBaseRecord' + type: array + x-go-name: Artworks + audioLanguages: + items: + type: string + type: array + x-go-name: AudioLanguages + awards: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + x-go-name: Awards + boxOffice: + type: string + boxOfficeUS: + type: string + budget: + type: string + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + companies: + type: object + $ref: '#/components/schemas/Companies' + contentRatings: + items: + $ref: '#/components/schemas/ContentRating' + type: array + first_release: + type: object + $ref: '#/components/schemas/Release' + genres: + items: + $ref: '#/components/schemas/GenreBaseRecord' + type: array + x-go-name: Genres + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + x-go-name: Image + inspirations: + items: + $ref: '#/components/schemas/Inspiration' + type: array + x-go-name: Inspirations + lastUpdated: + type: string + lists: + items: + $ref: '#/components/schemas/ListBaseRecord' + type: array + name: + type: string + x-go-name: Name + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + originalCountry: + type: string + originalLanguage: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + production_countries: + items: + $ref: '#/components/schemas/ProductionCountry' + type: array + x-go-name: ProductionCountries + releases: + items: + $ref: '#/components/schemas/Release' + type: array + x-go-name: Releases + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + runtime: + type: integer + nullable: true + score: + format: double + type: number + x-go-name: Score + slug: + type: string + x-go-name: Slug + spoken_languages: + items: + type: string + type: array + x-go-name: SpokenLanguages + status: + $ref: '#/components/schemas/Status' + studios: + items: + $ref: '#/components/schemas/StudioBaseRecord' + type: array + x-go-name: Studios + subtitleLanguages: + items: + type: string + type: array + x-go-name: SubtitleLanguages + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + translations: + $ref: '#/components/schemas/TranslationExtended' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + PeopleBaseRecord: + description: base people record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: int64 + type: integer + x-go-name: Score + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + PeopleExtendedRecord: + description: extended people record + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + awards: + items: + $ref: '#/components/schemas/AwardBaseRecord' + type: array + x-go-name: Awards + biographies: + items: + $ref: '#/components/schemas/Biography' + type: array + x-go-name: Biographies + birth: + type: string + birthPlace: + type: string + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + death: + type: string + gender: + type: integer + id: + format: int64 + type: integer + x-go-name: ID + image: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + races: + items: + $ref: '#/components/schemas/Race' + type: array + x-go-name: Races + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + score: + format: int64 + type: integer + x-go-name: Score + slug: + type: string + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + translations: + $ref: '#/components/schemas/TranslationExtended' + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + PeopleType: + description: people type record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Race: + description: race record + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + RecordInfo: + description: base record info + properties: + image: + type: string + x-go-name: Image + name: + type: string + x-go-name: Name + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Release: + description: release record + properties: + country: + type: string + date: + type: string + detail: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + RemoteID: + description: remote id record + properties: + id: + type: string + x-go-name: ID + type: + format: int64 + type: integer + x-go-name: Type + sourceName: + type: string + x-go-name: SourceName + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SearchResult: + description: search result + properties: + aliases: + items: + type: string + type: array + companies: + items: + type: string + type: array + companyType: + type: string + country: + type: string + director: + type: string + first_air_time: + type: string + genres: + items: + type: string + type: array + id: + type: string + image_url: + type: string + name: + type: string + is_official: + type: boolean + name_translated: + type: string + network: + type: string + objectID: + type: string + officialList: + type: string + overview: + type: string + overviews: + $ref: '#/components/schemas/TranslationSimple' + overview_translated: + items: + type: string + type: array + poster: + type: string + posters: + items: + type: string + type: array + primary_language: + type: string + remote_ids: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + status: + type: string + x-go-name: Status + slug: + type: string + studios: + items: + type: string + type: array + title: + type: string + thumbnail: + type: string + translations: + $ref: '#/components/schemas/TranslationSimple' + translationsWithLang: + items: + type: string + type: array + tvdb_id: + type: string + type: + type: string + year: + type: string + type: object + SearchByRemoteIdResult: + description: search by remote reuslt is a base record for a movie, series, people, season or company search result + properties: + series: + type: object + $ref: '#/components/schemas/SeriesBaseRecord' + people: + type: object + $ref: '#/components/schemas/PeopleBaseRecord' + movie: + type: object + $ref: '#/components/schemas/MovieBaseRecord' + episode: + type: object + $ref: '#/components/schemas/EpisodeBaseRecord' + company: + type: object + $ref: '#/components/schemas/Company' + + SeasonBaseRecord: + description: season genre record + properties: + id: + type: integer + image: + type: string + imageType: + type: integer + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + number: + format: int64 + type: integer + x-go-name: Number + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + companies: + type: object + $ref: '#/components/schemas/Companies' + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + type: + $ref: '#/components/schemas/SeasonType' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeasonExtendedRecord: + description: extended season record + properties: + artwork: + items: + $ref: '#/components/schemas/ArtworkBaseRecord' + type: array + x-go-name: Artwork + companies: + type: object + $ref: '#/components/schemas/Companies' + episodes: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + x-go-name: Episodes + id: + type: integer + image: + type: string + imageType: + type: integer + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + number: + format: int64 + type: integer + x-go-name: Number + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + seriesId: + format: int64 + type: integer + x-go-name: SeriesID + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + type: + $ref: '#/components/schemas/SeasonType' + tagOptions: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + translations: + items: + $ref: '#/components/schemas/Translation' + type: array + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeasonType: + description: season type record + properties: + alternateName: + type: string + x-go-name: Name + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + type: + type: string + x-go-name: Type + + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeriesAirsDays: + description: A series airs day record + properties: + friday: + type: boolean + x-go-name: Friday + monday: + type: boolean + x-go-name: Monday + saturday: + type: boolean + x-go-name: Saturday + sunday: + type: boolean + x-go-name: Sunday + thursday: + type: boolean + x-go-name: Thursday + tuesday: + type: boolean + x-go-name: Tuesday + wednesday: + type: boolean + x-go-name: Wednesday + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeriesBaseRecord: + description: The base record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. + properties: + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + averageRuntime: + type: integer + nullable: true + country: + type: string + defaultSeasonType: + format: int64 + type: integer + x-go-name: DefaultSeasonType + episodes: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + x-go-name: Episodes + firstAired: + type: string + id: + type: integer + image: + type: string + isOrderRandomized: + type: boolean + x-go-name: IsOrderRandomized + lastAired: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + nextAired: + type: string + x-go-name: NextAired + originalCountry: + type: string + originalLanguage: + type: string + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + score: + format: double + type: number + x-go-name: Score + slug: + type: string + status: + $ref: '#/components/schemas/Status' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SeriesExtendedRecord: + description: The extended record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. + properties: + abbreviation: + type: string + airsDays: + $ref: '#/components/schemas/SeriesAirsDays' + airsTime: + type: string + aliases: + items: + $ref: '#/components/schemas/Alias' + type: array + x-go-name: Aliases + artworks: + items: + $ref: '#/components/schemas/ArtworkExtendedRecord' + type: array + x-go-name: Artworks + averageRuntime: + type: integer + nullable: true + characters: + items: + $ref: '#/components/schemas/Character' + type: array + x-go-name: Characters + contentRatings: + items: + $ref: '#/components/schemas/ContentRating' + type: array + country: + type: string + defaultSeasonType: + format: int64 + type: integer + x-go-name: DefaultSeasonType + episodes: + items: + $ref: '#/components/schemas/EpisodeBaseRecord' + type: array + x-go-name: Episodes + firstAired: + type: string + lists: + items: + $ref: '#/components/schemas/ListBaseRecord' + genres: + items: + $ref: '#/components/schemas/GenreBaseRecord' + type: array + x-go-name: Genres + id: + type: integer + image: + type: string + isOrderRandomized: + type: boolean + x-go-name: IsOrderRandomized + lastAired: + type: string + lastUpdated: + type: string + name: + type: string + nameTranslations: + items: + type: string + type: array + x-go-name: NameTranslations + companies: + items: + $ref: '#/components/schemas/Company' + type: array + nextAired: + type: string + x-go-name: NextAired + originalCountry: + type: string + originalLanguage: + type: string + originalNetwork: + $ref: '#/components/schemas/Company' + overview: + type: string + latestNetwork: + $ref: '#/components/schemas/Company' + overviewTranslations: + items: + type: string + type: array + x-go-name: OverviewTranslations + remoteIds: + items: + $ref: '#/components/schemas/RemoteID' + type: array + x-go-name: RemoteIDs + score: + format: double + type: number + x-go-name: Score + seasons: + items: + $ref: '#/components/schemas/SeasonBaseRecord' + type: array + x-go-name: Seasons + seasonTypes: + items: + $ref: '#/components/schemas/SeasonType' + type: array + x-go-name: Seasons + slug: + type: string + status: + $ref: '#/components/schemas/Status' + tags: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + trailers: + items: + $ref: '#/components/schemas/Trailer' + type: array + x-go-name: Trailers + translations: + $ref: '#/components/schemas/TranslationExtended' + year: + type: string + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + SourceType: + description: source type record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + postfix: + type: string + prefix: + type: string + slug: + type: string + x-go-name: Slug + sort: + format: int64 + type: integer + x-go-name: Sort + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Status: + description: status record + properties: + id: + format: int64 + type: integer + x-go-name: ID + nullable: true + keepUpdated: + type: boolean + x-go-name: KeepUpdated + name: + type: string + x-go-name: Name + recordType: + type: string + x-go-name: RecordType + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + StudioBaseRecord: + description: studio record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + parentStudio: + type: integer + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Tag: + description: tag record + properties: + allowsMultiple: + type: boolean + x-go-name: AllowsMultiple + helpText: + type: string + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + options: + items: + $ref: '#/components/schemas/TagOption' + type: array + x-go-name: TagOptions + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + TagOption: + description: tag option record + properties: + helpText: + type: string + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + x-go-name: Name + tag: + format: int64 + type: integer + x-go-name: Tag + tagName: + type: string + x-go-name: TagName + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Trailer: + description: trailer record + properties: + id: + format: int64 + type: integer + x-go-name: ID + language: + type: string + name: + type: string + url: + type: string + runtime: + type: integer + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + Translation: + description: translation record + properties: + aliases: + items: + type: string + type: array + isAlias: + type: boolean + isPrimary: + type: boolean + language: + type: string + x-go-name: Language + name: + type: string + overview: + type: string + tagline: + type: string + description: Only populated for movie translations. We disallow taglines without a title. + type: object + x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model + TranslationSimple: + description: translation simple record + additionalProperties: + type: string + example: # Ejemplo específico del objeto + ara: "تدور قصة المسلسل حول..." + ces: "Během letu č. 815 společnosti Oceanic..." + deu: "Im Bruchteil einer Sekunde gerät das Leben..." + type: object + TranslationExtended: + description: translation extended record + properties: + nameTranslations: + items: + $ref: '#/components/schemas/Translation' + type: array + overviewTranslations: + items: + $ref: '#/components/schemas/Translation' + type: array + alias: + items: + type: string + type: array + type: object + TagOptionEntity: + description: a entity with selected tag option + type: object + properties: + name: + type: string + tagName: + type: string + tagId: + type: integer + UserInfo: + description: User info record + type: object + properties: + id: + type: integer + language: + type: string + name: + type: string + type: + type: string + Inspiration: + description: Movie inspiration record + properties: + id: + format: int64 + type: integer + x-go-name: ID + type: + type: string + type_name: + type: string + url: + type: string + InspirationType: + description: Movie inspiration type record + properties: + id: + format: int64 + type: integer + x-go-name: ID + name: + type: string + description: + type: string + reference_name: + type: string + url: + type: string + ProductionCountry: + description: Production country record + properties: + id: + format: int64 + type: integer + x-go-name: ID + country: + type: string + name: + type: string + Companies: + description: Companies by type record + properties: + studio: + type: array + items: + $ref: '#/components/schemas/Company' + network: + type: array + items: + $ref: '#/components/schemas/Company' + production: + type: array + items: + $ref: '#/components/schemas/Company' + distributor: + type: array + items: + $ref: '#/components/schemas/Company' + special_effects: + type: array + items: + $ref: '#/components/schemas/Company' + Links: + description: Links for next, previous and current record + properties: + prev: + type: string + nullable: true + self: + type: string + nullable: true + next: + type: string + total_items: + type: integer + page_size: + type: integer \ No newline at end of file diff --git a/tools/openapi/generate.sh b/tools/openapi/generate.sh new file mode 100755 index 0000000..29ed3cf --- /dev/null +++ b/tools/openapi/generate.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Reproducible codegen for the TheTVDB v4 client. +# +# 1. download the live TheTVDB v4 OpenAPI spec -> openapi/tvdb-v4.raw.yml +# 2. apply the checked-in overlay (patch_spec.py) -> openapi/tvdb-v4.patched.yml +# 3. run NSwag (pinned local tool) against the patched spec +# +# The raw + patched specs are committed so a regen diff is reviewable. +# Run from anywhere: tools/openapi/generate.sh +set -euo pipefail + +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO="$(cd "$HERE/../.." && pwd)" +SPEC_URL="${TVDB_SPEC_URL:-https://thetvdb.github.io/v4-api/swagger.yml}" +OPENAPI_DIR="$REPO/src/TvdbClient/openapi" +RAW="$OPENAPI_DIR/tvdb-v4.raw.yml" +PATCHED="$OPENAPI_DIR/tvdb-v4.patched.yml" + +mkdir -p "$OPENAPI_DIR" +echo "→ downloading live spec: $SPEC_URL" +curl -fsSL "$SPEC_URL" -o "$RAW" +echo "→ applying overlay" +python3 "$HERE/patch_spec.py" "$RAW" "$PATCHED" +echo "→ restoring pinned tools" +( cd "$REPO" && dotnet tool restore >/dev/null ) +echo "→ running NSwag" +# NSwag.ConsoleCore targets net9.0; roll forward onto a newer runtime (e.g. net10) +# when the 9.0 runtime isn't installed. Also pinned via .config/dotnet-tools.json. +( cd "$REPO/src/TvdbClient" && DOTNET_ROLL_FORWARD="${DOTNET_ROLL_FORWARD:-Major}" dotnet nswag run TvdbClient.nswag ) +echo "✓ codegen complete" diff --git a/tools/openapi/patch_spec.py b/tools/openapi/patch_spec.py new file mode 100644 index 0000000..3be1c9e --- /dev/null +++ b/tools/openapi/patch_spec.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Overlay/preprocess for TheTVDB v4 OpenAPI spec, applied before NSwag codegen. + +TheTVDB's swagger types every integer resource id as ``schema: {type: number}``, +which NSwag maps to C# ``double`` — so generated methods take ``double id`` and +entities would expose ``double`` ids. This overlay coerces those *path* id +parameters to ``integer``/``int64`` so they generate as ``long``. + +Scope is deliberately narrow (path parameters only): the only other ``number`` +fields in the spec are the ``score`` properties, which are genuinely +floating-point and must stay ``double``. + +Idempotent — safe to re-run. Usage: patch_spec.py +""" +import sys +import yaml + + +def coerce_path_id_params(spec: dict) -> list[str]: + """Coerce every `in: path` parameter typed `number` to integer/int64. + + Returns a list of "METHOD /path :: paramName" for each parameter changed. + """ + changed: list[str] = [] + for path, item in (spec.get("paths") or {}).items(): + if not isinstance(item, dict): + continue + for method, op in item.items(): + if not isinstance(op, dict) or "parameters" not in op: + continue + for param in op.get("parameters") or []: + if param.get("in") != "path": + continue + schema = param.get("schema") or {} + if schema.get("type") == "number": + schema["type"] = "integer" + schema["format"] = "int64" + param["schema"] = schema + changed.append(f"{method.upper()} {path} :: {param.get('name')}") + return changed + + +def main() -> int: + if len(sys.argv) != 3: + print("usage: patch_spec.py ", file=sys.stderr) + return 2 + src, dst = sys.argv[1], sys.argv[2] + with open(src) as f: + spec = yaml.safe_load(f) + + changed = coerce_path_id_params(spec) + + with open(dst, "w") as f: + yaml.safe_dump(spec, f, sort_keys=False, allow_unicode=True, width=4096) + + print(f"overlay: coerced {len(changed)} path id param(s) number → int64") + for c in changed: + print(f" {c}") + print(f"overlay: wrote {dst}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From a26a48da9a1bf9716da5efd398761a465f9ab3ad Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 16:23:03 +1200 Subject: [PATCH 2/7] build(codegen): in-stack Fallout `Generate` target (replaces py/sh pipeline) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per review feedback (stay within the .NET stack — no Python/Bash), replace the previous patch_spec.py + generate.sh with a Fallout build. - build/ Fallout build project (Fallout.Common/Components 11.0.18 from nuget.org, isolated from the repo-root packaging props). `Build.cs` adds a `Generate` target that uses NSwag's C# API directly (NSwag.CodeGeneration.CSharp) — no CLI, no .nswag config, no intermediate patched-yaml. It downloads the live v4 spec, applies the overlay in-memory (coerce the 32 integer id PATH params from `number` → int64, i.e. C# `long`; the only other `number` fields are the float `score`s, left alone), then emits clients + DTOs. - build.ps1 / build.cmd bootstrappers (run the build project directly; no global tool needed): `./build.ps1 Generate`. - .fallout/ root marker; drop the NSwag CLI tool pin from dotnet-tools.json. - Remove tools/openapi/*.{py,sh}, the committed spec yamls, and TvdbClient.nswag. Verified: `./build.ps1 Generate` succeeds and emits 32 `long id`, 0 `double id`, 135 model classes. The generated OUTPUT is intentionally not in this commit — the in-place regen + hand-split-model cleanup + facade land in the next step. Co-Authored-By: Claude Opus 4.8 (1M context) --- .config/dotnet-tools.json | 9 +- .fallout/build.schema.json | 111 + .fallout/parameters.json | 3 + build.cmd | 4 + build.ps1 | 10 + build/Build.cs | 106 + build/Directory.Build.props | 5 + build/Directory.Build.targets | 3 + build/_build.csproj | 23 + src/TvdbClient/TvdbClient.nswag | 106 - src/TvdbClient/openapi/tvdb-v4.patched.yml | 4403 -------------------- src/TvdbClient/openapi/tvdb-v4.raw.yml | 4264 ------------------- tools/openapi/generate.sh | 30 - tools/openapi/patch_spec.py | 64 - 14 files changed, 266 insertions(+), 8875 deletions(-) create mode 100644 .fallout/build.schema.json create mode 100644 .fallout/parameters.json create mode 100644 build.cmd create mode 100755 build.ps1 create mode 100644 build/Build.cs create mode 100644 build/Directory.Build.props create mode 100644 build/Directory.Build.targets create mode 100644 build/_build.csproj delete mode 100644 src/TvdbClient/TvdbClient.nswag delete mode 100644 src/TvdbClient/openapi/tvdb-v4.patched.yml delete mode 100644 src/TvdbClient/openapi/tvdb-v4.raw.yml delete mode 100755 tools/openapi/generate.sh delete mode 100644 tools/openapi/patch_spec.py diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 217d090..206303f 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -8,13 +8,6 @@ "dotnet-gitversion" ], "rollForward": false - }, - "nswag.consolecore": { - "version": "14.2.0", - "commands": [ - "nswag" - ], - "rollForward": true } } -} \ No newline at end of file +} diff --git a/.fallout/build.schema.json b/.fallout/build.schema.json new file mode 100644 index 0000000..1a026dc --- /dev/null +++ b/.fallout/build.schema.json @@ -0,0 +1,111 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": { + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Generate" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "FalloutBuild": { + "properties": { + "Continue": { + "type": "boolean", + "description": "Indicates to continue a previously failed build attempt" + }, + "Help": { + "type": "boolean", + "description": "Shows the help text for this build assembly" + }, + "Host": { + "description": "Host for execution. Default is 'automatic'", + "$ref": "#/definitions/Host" + }, + "NoLogo": { + "type": "boolean", + "description": "Disables displaying the NUKE logo" + }, + "Partition": { + "type": "string", + "description": "Partition to use on CI" + }, + "Plan": { + "type": "boolean", + "description": "Shows the execution plan (HTML)" + }, + "Profile": { + "type": "array", + "description": "Defines the profiles to load", + "items": { + "type": "string" + } + }, + "Root": { + "type": "string", + "description": "Root directory during build execution" + }, + "Skip": { + "type": "array", + "description": "List of targets to be skipped. Empty list skips all dependencies", + "items": { + "$ref": "#/definitions/ExecutableTarget" + } + }, + "Target": { + "type": "array", + "description": "List of targets to be invoked. Default is '{default_target}'", + "items": { + "$ref": "#/definitions/ExecutableTarget" + } + }, + "Verbosity": { + "description": "Logging verbosity during build execution. Default is 'Normal'", + "$ref": "#/definitions/Verbosity" + }, + "BuildProjectFile": { + "type": [ + "null", + "string" + ], + "description": "Path to the build project (.csproj) relative to the repository root. Defaults to 'build/_build.csproj' when unset. Read by the Fallout global tool's in-tool runner." + } + } + } + }, + "allOf": [ + {}, + { + "$ref": "#/definitions/FalloutBuild" + } + ] +} diff --git a/.fallout/parameters.json b/.fallout/parameters.json new file mode 100644 index 0000000..0c59dcb --- /dev/null +++ b/.fallout/parameters.json @@ -0,0 +1,3 @@ +{ + "$schema": "./build.schema.json" +} diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..93f8100 --- /dev/null +++ b/build.cmd @@ -0,0 +1,4 @@ +@echo off +:: Fallout build bootstrapper (Windows). Runs the build project directly. +:: build.cmd Generate +dotnet run --project "%~dp0build\_build.csproj" -- %* diff --git a/build.ps1 b/build.ps1 new file mode 100755 index 0000000..a4a3e7d --- /dev/null +++ b/build.ps1 @@ -0,0 +1,10 @@ +#!/usr/bin/env pwsh +# Fallout build bootstrapper. Runs the build project directly (no global tool needed). +# ./build.ps1 Generate # regenerate the TheTVDB client from the live spec +# ./build.ps1 # default target +[CmdletBinding()] +Param([Parameter(ValueFromRemainingArguments = $true)] [string[]] $BuildArguments) + +$ErrorActionPreference = 'Stop' +dotnet run --project "$PSScriptRoot/build/_build.csproj" -- @BuildArguments +exit $LASTEXITCODE diff --git a/build/Build.cs b/build/Build.cs new file mode 100644 index 0000000..aa266e6 --- /dev/null +++ b/build/Build.cs @@ -0,0 +1,106 @@ +using System.Linq; +using System.Threading.Tasks; +using Fallout.Common; +using Fallout.Common.IO; +using NJsonSchema; +using NJsonSchema.CodeGeneration.CSharp; +using NSwag; +using NSwag.CodeGeneration; +using NSwag.CodeGeneration.CSharp; +using NSwag.CodeGeneration.OperationNameGenerators; +using Serilog; + +/// +/// Fallout build for the TheTVDB v4 client. +/// +/// The Generate target owns codegen in-stack (NSwag's C# API — no CLI, no +/// .nswag config, no external scripts). It downloads the live v4 OpenAPI spec, +/// applies the overlay in-memory (TheTVDB types integer resource ids as +/// number → C# double; we coerce the path-id params to +/// integer/int64 → long), then emits the clients + DTOs. It is deliberately +/// NOT wired into any CI workflow — run it locally via ./build.ps1 Generate. +/// +partial class Build : FalloutBuild +{ + public static int Main() => Execute(x => x.Generate); + + const string SpecUrl = "https://thetvdb.github.io/v4-api/swagger.yml"; + + AbsolutePath ClientProjectDirectory => RootDirectory / "src" / "TvdbClient"; + + Target Generate => _ => _ + .Description("Regenerate the TheTVDB v4 client from the live OpenAPI spec") + .Executes(async () => + { + Log.Information("Downloading spec: {Url}", SpecUrl); + var document = await OpenApiYamlDocument.FromUrlAsync(SpecUrl); + + var coerced = CoerceIntegerIdPathParameters(document); + Log.Information("Overlay: coerced {Count} id path param(s) number → int64", coerced); + + var settings = new CSharpClientGeneratorSettings + { + ClassName = "{controller}Client", + ClientBaseInterface = "ITvdbClient", + InjectHttpClient = true, + DisposeHttpClient = true, + GenerateClientInterfaces = true, + GenerateExceptionClasses = true, + ExceptionClass = "ApiException", + WrapDtoExceptions = true, + UseBaseUrl = false, + GenerateBaseUrlProperty = true, + GenerateSyncMethods = false, + GenerateOptionalParameters = true, + OperationNameGenerator = new MultipleClientsFromFirstTagAndPathSegmentsOperationNameGenerator(), + }; + settings.CSharpGeneratorSettings.Namespace = "Tvdb.Models"; + settings.CSharpGeneratorSettings.JsonLibrary = CSharpJsonLibrary.SystemTextJson; + settings.CSharpGeneratorSettings.ClassStyle = CSharpClassStyle.Poco; + settings.CSharpGeneratorSettings.GenerateDataAnnotations = true; + settings.CSharpGeneratorSettings.GenerateOptionalPropertiesAsNullable = true; + settings.CSharpGeneratorSettings.RequiredPropertiesMustBeDefined = true; + settings.CSharpGeneratorSettings.DateType = "System.DateTimeOffset"; + settings.CSharpGeneratorSettings.DateTimeType = "System.DateTimeOffset"; + settings.CSharpGeneratorSettings.TimeType = "System.TimeSpan"; + settings.CSharpGeneratorSettings.TimeSpanType = "System.TimeSpan"; + + var generator = new CSharpClientGenerator(document, settings); + + var clients = generator.GenerateFile(ClientGeneratorOutputType.Implementation); + var contracts = generator.GenerateFile(ClientGeneratorOutputType.Contracts); + + var clientsPath = ClientProjectDirectory / "Clients" / "TvdbClient.cs"; + var contractsPath = ClientProjectDirectory / "Models" / "TvdbModels.cs"; + clientsPath.WriteAllText(clients); + contractsPath.WriteAllText(contracts); + + Log.Information("Wrote {Clients} and {Contracts}", clientsPath, contractsPath); + }); + + /// + /// TheTVDB types integer resource ids as number, which NSwag maps to + /// double. Coerce the path-id parameters to integer/int64. Narrow by + /// design: the only other number fields are the genuinely-float + /// score properties, which must stay double. + /// + static int CoerceIntegerIdPathParameters(OpenApiDocument document) + { + var count = 0; + foreach (var pathItem in document.Paths.Values) + foreach (var operation in pathItem.Values) + foreach (var parameter in operation.Parameters + .Where(p => p.Kind == OpenApiParameterKind.Path)) + { + var schema = parameter.Schema; + if (schema is { Type: JsonObjectType.Number }) + { + schema.Type = JsonObjectType.Integer; + schema.Format = "int64"; + count++; + } + } + + return count; + } +} diff --git a/build/Directory.Build.props b/build/Directory.Build.props new file mode 100644 index 0000000..ad259d6 --- /dev/null +++ b/build/Directory.Build.props @@ -0,0 +1,5 @@ + + + diff --git a/build/Directory.Build.targets b/build/Directory.Build.targets new file mode 100644 index 0000000..5567b76 --- /dev/null +++ b/build/Directory.Build.targets @@ -0,0 +1,3 @@ + + + diff --git a/build/_build.csproj b/build/_build.csproj new file mode 100644 index 0000000..bd11b8e --- /dev/null +++ b/build/_build.csproj @@ -0,0 +1,23 @@ + + + + Exe + net10.0 + enable + enable + false + false + _build + $(MSBuildProjectDirectory)/.. + CS0649;CS0169;CA1050;CS8618 + + + + + + + + + + + diff --git a/src/TvdbClient/TvdbClient.nswag b/src/TvdbClient/TvdbClient.nswag deleted file mode 100644 index 539960f..0000000 --- a/src/TvdbClient/TvdbClient.nswag +++ /dev/null @@ -1,106 +0,0 @@ -{ - "runtime": "Default", - "defaultVariables": null, - "documentGenerator": { - "fromDocument": { - "url": "openapi/tvdb-v4.patched.yml", - "output": null, - "newLineBehavior": "Auto" - } - }, - "codeGenerators": { - "openApiToCSharpClient": { - "clientBaseClass": null, - "configurationClass": null, - "generateClientClasses": true, - "suppressClientClassesOutput": false, - "generateClientInterfaces": true, - "suppressClientInterfacesOutput": false, - "clientBaseInterface": "ITvdbClient", - "injectHttpClient": true, - "disposeHttpClient": true, - "protectedMethods": [], - "generateExceptionClasses": true, - "exceptionClass": "ApiException", - "wrapDtoExceptions": true, - "useHttpClientCreationMethod": false, - "httpClientType": "System.Net.Http.HttpClient", - "useHttpRequestMessageCreationMethod": false, - "useBaseUrl": false, - "generateBaseUrlProperty": true, - "generateSyncMethods": false, - "generatePrepareRequestAndProcessResponseAsAsyncMethods": false, - "exposeJsonSerializerSettings": false, - "clientClassAccessModifier": "public", - "typeAccessModifier": "public", - "propertySetterAccessModifier": "", - "generateNativeRecords": false, - "generateContractsOutput": true, - "contractsNamespace": "Tvdb.Models", - "contractsOutputFilePath": "Models/TvdbModels.cs", - "parameterDateTimeFormat": "s", - "parameterDateFormat": "yyyy-MM-dd", - "generateUpdateJsonSerializerSettingsMethod": true, - "useRequestAndResponseSerializationSettings": false, - "serializeTypeInformation": false, - "queryNullValue": "", - "className": "{controller}Client", - "operationGenerationMode": "MultipleClientsFromFirstTagAndPathSegments", - "additionalNamespaceUsages": [ - "Tvdb.Models", - "System" - ], - "additionalContractNamespaceUsages": [ - "System", - "Tvdb.Clients" - ], - "generateOptionalParameters": true, - "generateJsonMethods": false, - "enforceFlagEnums": false, - "parameterArrayType": "System.Collections.Generic.IEnumerable", - "parameterDictionaryType": "System.Collections.Generic.IDictionary", - "responseArrayType": "System.Collections.Generic.ICollection", - "responseDictionaryType": "System.Collections.Generic.IDictionary", - "wrapResponses": false, - "wrapResponseMethods": [], - "generateResponseClasses": true, - "responseClass": "SwaggerResponse", - "namespace": "Tvdb.Clients", - "requiredPropertiesMustBeDefined": true, - "dateType": "System.DateTimeOffset", - "jsonConverters": null, - "anyType": "object", - "dateTimeType": "System.DateTimeOffset", - "timeType": "System.TimeSpan", - "timeSpanType": "System.TimeSpan", - "arrayType": "System.Collections.Generic.ICollection", - "arrayInstanceType": "System.Collections.ObjectModel.Collection", - "dictionaryType": "System.Collections.Generic.IDictionary", - "dictionaryInstanceType": "System.Collections.Generic.Dictionary", - "arrayBaseType": "System.Collections.ObjectModel.Collection", - "dictionaryBaseType": "System.Collections.Generic.Dictionary", - "classStyle": "Poco", - "jsonLibrary": "SystemTextJson", - "generateDefaultValues": true, - "generateDataAnnotations": true, - "excludedTypeNames": [], - "excludedParameterNames": [], - "handleReferences": true, - "generateImmutableArrayProperties": false, - "generateImmutableDictionaryProperties": false, - "jsonSerializerSettingsTransformationMethod": null, - "inlineNamedArrays": false, - "inlineNamedDictionaries": false, - "inlineNamedTuples": true, - "inlineNamedAny": false, - "generateDtoTypes": true, - "generateOptionalPropertiesAsNullable": true, - "generateNullableReferenceTypes": false, - "templateDirectory": null, - "serviceHost": null, - "serviceSchemes": null, - "output": "Clients/TvdbClient.cs", - "newLineBehavior": "Auto" - } - } -} \ No newline at end of file diff --git a/src/TvdbClient/openapi/tvdb-v4.patched.yml b/src/TvdbClient/openapi/tvdb-v4.patched.yml deleted file mode 100644 index 3cd14ac..0000000 --- a/src/TvdbClient/openapi/tvdb-v4.patched.yml +++ /dev/null @@ -1,4403 +0,0 @@ -openapi: 3.0.0 -info: - description: 'Documentation of [TheTVDB](https://thetvdb.com/) API V4. All related information is linked from our [Github repo](https://github.com/thetvdb/v4-api). You might also want to use our [Postman collection] (https://www.getpostman.com/collections/7a9397ce69ff246f74d0) - - ## Authentication - - 1. Use the /login endpoint and provide your API key as "apikey". If you have a user-supported key, also provide your subscriber PIN as "pin". Otherwise completely remove "pin" from your call. - - 2. Executing this call will provide you with a bearer token, which is valid for 1 month. - - 3. Provide your bearer token for subsequent API calls by clicking Authorize below or including in the header of all direct API calls: `Authorization: Bearer [your-token]` - - - ## Notes - - 1. "score" is a field across almost all entities. We generate scores for different types of entities in various ways, so no assumptions should be made about the meaning of this value. It is simply used to hint at relative popularity for sorting purposes. - - ' - title: TVDB API V4 - version: 4.7.10 -security: -- bearerAuth: [] -paths: - /login: - post: - summary: create an auth token. The token has one month validation length. - requestBody: - content: - application/json: - schema: - type: object - required: - - apikey - properties: - apikey: - type: string - pin: - type: string - required: true - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - properties: - token: - type: string - type: object - status: - type: string - type: object - '401': - description: invalid credentials - tags: - - Login - /artwork/{id}: - get: - description: Returns a single artwork base record. - operationId: getArtworkBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ArtworkBaseRecord' - status: - type: string - type: object - '400': - description: Invalid artwork id - '401': - description: Unauthorized - '404': - description: Artwork not found - tags: - - Artwork - /artwork/{id}/extended: - get: - description: Returns a single artwork extended record. - operationId: getArtworkExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ArtworkExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid artwork id - '401': - description: Unauthorized - '404': - description: Artwork not found - tags: - - Artwork - /artwork/statuses: - get: - description: Returns list of artwork status records. - operationId: getAllArtworkStatuses - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ArtworkStatus' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Artwork Statuses - /artwork/types: - get: - description: Returns a list of artworkType records - operationId: getAllArtworkTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ArtworkType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Artwork Types - /awards: - get: - description: Returns a list of award base records - operationId: getAllAwards - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Awards - /awards/{id}: - get: - description: Returns a single award base record - operationId: getAward - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardBaseRecord' - status: - type: string - type: object - '400': - description: Invalid awards id - '401': - description: Unauthorized - '404': - description: Awards not found - tags: - - Awards - /awards/{id}/extended: - get: - description: Returns a single award extended record - operationId: getAwardExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid awards id - '401': - description: Unauthorized - '404': - description: Awards not found - tags: - - Awards - /awards/categories/{id}: - get: - description: Returns a single award category base record - operationId: getAwardCategory - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardCategoryBaseRecord' - status: - type: string - type: object - '400': - description: Invalid category id - '401': - description: Unauthorized - '404': - description: Category not found - tags: - - Award Categories - /awards/categories/{id}/extended: - get: - description: Returns a single award category extended record - operationId: getAwardCategoryExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardCategoryExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid category id - '401': - description: Unauthorized - '404': - description: Category not found - tags: - - Award Categories - /characters/{id}: - get: - description: Returns character base record - operationId: getCharacterBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Character' - status: - type: string - type: object - '400': - description: Invalid character id - '401': - description: Unauthorized - '404': - description: Character not found - tags: - - Characters - /companies: - get: - description: returns a paginated list of company records - operationId: getAllCompanies - parameters: - - description: name - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Company' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Companies - /companies/types: - get: - description: returns all company type records - operationId: getCompanyTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - type: array - items: - $ref: '#/components/schemas/CompanyType' - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Companies - /companies/{id}: - get: - description: returns a company record - operationId: getCompany - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Company' - status: - type: string - type: object - '400': - description: Invalid company id - '401': - description: Unauthorized - '404': - description: Company not found - tags: - - Companies - /content/ratings: - get: - description: returns list content rating records - operationId: getAllContentRatings - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ContentRating' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Content Ratings - /countries: - get: - description: returns list of country records - operationId: getAllCountries - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Country' - type: array - status: - type: string - type: object - tags: - - Countries - /entities: - get: - description: returns the active entity types - operationId: getEntityTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/EntityType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Entity Types - /episodes: - get: - description: Returns a list of episodes base records with the basic attributes.
Note that all episodes are returned, even those that may not be included in a series' default season order. - operationId: getAllEpisodes - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Episodes - /episodes/{id}: - get: - description: Returns episode base record - operationId: getEpisodeBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/EpisodeBaseRecord' - status: - type: string - type: object - '400': - description: Invalid episode id - '401': - description: Unauthorized - '404': - description: Episode not found - tags: - - Episodes - /episodes/{id}/extended: - get: - description: Returns episode extended record - operationId: getEpisodeExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: - - translations - example: translations - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/EpisodeExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid episode id - '401': - description: Unauthorized - '404': - description: Episode not found - tags: - - Episodes - /episodes/{id}/translations/{language}: - get: - description: Returns episode translation record - operationId: getEpisodeTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid episode id. Invalid language. - '401': - description: Unauthorized - '404': - description: Episode not found - tags: - - Episodes - /genders: - get: - description: returns list of gender records - operationId: getAllGenders - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Gender' - type: array - status: - type: string - type: object - tags: - - Genders - /genres: - get: - description: returns list of genre records - operationId: getAllGenres - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/GenreBaseRecord' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Genres - /genres/{id}: - get: - description: Returns genre record - operationId: getGenreBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/GenreBaseRecord' - status: - type: string - type: object - '400': - description: Invalid genre id - '401': - description: Unauthorized - '404': - description: Genre not found - tags: - - Genres - /inspiration/types: - get: - description: returns list of inspiration types records - operationId: getAllInspirationTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/InspirationType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - InspirationTypes - /languages: - get: - description: returns list of language records - operationId: getAllLanguages - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Language' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Languages - /lists: - get: - description: returns list of list base records - operationId: getAllLists - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ListBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - '401': - description: Unauthorized - tags: - - Lists - /lists/{id}: - get: - description: returns an list base record - operationId: getList - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ListBaseRecord' - status: - type: string - type: object - '400': - description: Invalid list id - '401': - description: Unauthorized - '404': - description: List not found - tags: - - Lists - /lists/slug/{slug}: - get: - description: returns an list base record search by slug - operationId: getListBySlug - parameters: - - description: slug - in: path - name: slug - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ListBaseRecord' - status: - type: string - type: object - '400': - description: Invalid list slug - '401': - description: Unauthorized - '404': - description: List not found - tags: - - Lists - /lists/{id}/extended: - get: - description: returns a list extended record - operationId: getListExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ListExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid list id - '401': - description: Unauthorized - '404': - description: Lists not found - tags: - - Lists - /lists/{id}/translations/{language}: - get: - description: Returns list translation record - operationId: getListTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Translation' - type: array - status: - type: string - type: object - '400': - description: Invalid lists id - '401': - description: Unauthorized - '404': - description: Lists not found - tags: - - Lists - /movies: - get: - description: returns list of movie base records - operationId: getAllMovie - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/MovieBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Movies - /movies/{id}: - get: - description: Returns movie base record - operationId: getMovieBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/MovieBaseRecord' - status: - type: string - type: object - '400': - description: Invalid movie id - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - /movies/{id}/extended: - get: - description: Returns movie extended record - operationId: getMovieExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: - - translations - example: translations - - description: reduce the payload and returns the short version of this record without characters, artworks and trailers. - in: query - name: short - required: false - schema: - type: boolean - enum: - - true - - false - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/MovieExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid movie id - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - /movies/filter: - get: - description: Search movies based on filter parameters - operationId: getMoviesFilter - parameters: - - description: production company - in: query - name: company - required: false - schema: - type: number - example: 1 - - description: content rating id base on a country - in: query - name: contentRating - required: false - schema: - type: number - example: 245 - - description: country of origin - in: query - name: country - required: true - schema: - type: string - example: usa - - description: genre - in: query - name: genre - required: false - schema: - type: number - example: 3 - enum: - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10 - - 11 - - 12 - - 13 - - 14 - - 15 - - 16 - - 17 - - 18 - - 19 - - 21 - - 22 - - 23 - - 24 - - 25 - - 26 - - 27 - - 28 - - 29 - - 30 - - 31 - - 32 - - 33 - - 34 - - 35 - - 36 - - description: original language - in: query - name: lang - required: true - schema: - type: string - example: eng - - description: sort by results - in: query - name: sort - required: false - schema: - type: string - enum: - - score - - firstAired - - name - - description: status - in: query - name: status - required: false - schema: - type: number - enum: - - 1 - - 2 - - 3 - - description: release year - in: query - name: year - required: false - schema: - type: number - example: 2020 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/MovieBaseRecord' - type: array - status: - type: string - type: object - '400': - description: Invalid format parameter. - '401': - description: Unauthorized - tags: - - Movies - /movies/slug/{slug}: - get: - description: Returns movie base record search by slug - operationId: getMovieBaseBySlug - parameters: - - description: slug - in: path - name: slug - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/MovieBaseRecord' - status: - type: string - type: object - '400': - description: Invalid movie slug - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - /movies/{id}/translations/{language}: - get: - description: Returns movie translation record - operationId: getMovieTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid movie id, invalid language. - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - /movies/statuses: - get: - description: returns list of status records - operationId: getAllMovieStatuses - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Status' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Movie Statuses - /people: - get: - description: Returns a list of people base records with the basic attributes. - operationId: getAllPeople - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/PeopleBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - People - /people/{id}: - get: - description: Returns people base record - operationId: getPeopleBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/PeopleBaseRecord' - status: - type: string - type: object - '400': - description: Invalid people id - '401': - description: Unauthorized - '404': - description: People not found - tags: - - People - /people/{id}/extended: - get: - description: Returns people extended record - operationId: getPeopleExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: - - translations - example: translations - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/PeopleExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid people id - '401': - description: Unauthorized - '404': - description: People not found - tags: - - People - /people/{id}/translations/{language}: - get: - description: Returns people translation record - operationId: getPeopleTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid people id, invalid language. - '401': - description: Unauthorized - '404': - description: People not found - tags: - - People - /people/types: - get: - description: returns list of peopleType records - operationId: getAllPeopleTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/PeopleType' - type: array - status: - type: string - type: object - tags: - - People Types - /search: - get: - description: Our search index includes series, movies, people, and companies. Search is limited to 5k results max. - operationId: getSearchResults - parameters: - - description: The primary search string, which can include the main title for a record including all translations and aliases. - in: query - name: query - schema: - type: string - - description: Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. - in: query - name: q - schema: - type: string - - description: Restrict results to a specific entity type. Can be movie, series, person, or company. - in: query - name: type - schema: - type: string - - description: Restrict results to a specific year. Currently only used for series and movies. - in: query - name: year - schema: - type: number - - description: Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". - in: query - name: company - schema: - type: string - - description: Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. - in: query - name: country - schema: - type: string - - description: Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". - in: query - name: director - schema: - type: string - - description: Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. - in: query - name: language - schema: - type: string - - description: Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. - in: query - name: primaryType - schema: - type: string - - description: Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. - in: query - name: network - schema: - type: string - - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - in: query - name: remote_id - schema: - type: string - - description: Offset results. - in: query - name: offset - schema: - type: number - - description: Limit results. - in: query - name: limit - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SearchResult' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - '400': - description: Max results overflow - tags: - - Search - /search/remoteid/{remoteId}: - get: - description: Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. - operationId: getSearchResultsByRemoteId - parameters: - - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - in: path - required: true - name: remoteId - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SearchByRemoteIdResult' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Search - /seasons: - get: - description: returns list of seasons base records - operationId: getAllSeasons - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Seasons - /seasons/{id}: - get: - description: Returns season base record - operationId: getSeasonBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeasonBaseRecord' - status: - type: string - type: object - '400': - description: Invalid season id - '401': - description: Unauthorized - '404': - description: Season not found - tags: - - Seasons - /seasons/{id}/extended: - get: - description: Returns season extended record - operationId: getSeasonExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeasonExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid seasons id - '401': - description: Unauthorized - '404': - description: Season not found - tags: - - Seasons - /seasons/types: - get: - description: Returns season type records - operationId: getSeasonTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeasonType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Seasons - /seasons/{id}/translations/{language}: - get: - description: Returns season translation record - operationId: getSeasonTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid season id, language not found. - '401': - description: Unauthorized - '404': - description: Season not found - tags: - - Seasons - /series: - get: - description: returns list of series base records - operationId: getAllSeries - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeriesBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Series - /series/{id}: - get: - description: Returns series base record - operationId: getSeriesBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/{id}/artworks: - get: - description: Returns series artworks base on language and type.
Note: Artwork type is an id that can be found using **/artwork/types** endpoint. - operationId: getSeriesArtworks - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: lang - in: query - name: lang - required: false - schema: - type: string - example: eng, spa - - description: type - in: query - name: type - required: false - schema: - type: integer - example: 1,2,3 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/{id}/nextAired: - get: - description: Returns series base record including the nextAired field.
Note: nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. - operationId: getSeriesNextAired - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/{id}/extended: - get: - description: Returns series extended record - operationId: getSeriesExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: - - translations - - episodes - example: translations - - description: reduce the payload and returns the short version of this record without characters and artworks - in: query - name: short - required: false - schema: - type: boolean - enum: - - true - - false - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/{id}/episodes/{season-type}: - get: - description: Returns series episodes from the specified season type, default returns the episodes in the series default season type - operationId: getSeriesEpisodes - parameters: - - in: query - name: page - required: true - schema: - type: integer - default: 0 - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: season-type - in: path - name: season-type - required: true - schema: - type: string - examples: - default: - value: default - official: - value: official - dvd: - value: dvd - absolute: - value: absolute - alternate: - value: alternate - regional: - value: regional - - in: query - name: season - required: false - schema: - type: integer - default: 0 - - in: query - name: episodeNumber - required: false - schema: - type: integer - default: 0 - - description: airDate of the episode, format is yyyy-mm-dd - in: query - name: airDate - required: false - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - type: object - properties: - series: - $ref: '#/components/schemas/SeriesBaseRecord' - episodes: - type: array - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id, episodeNumber is not null then season must be present - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/{id}/episodes/{season-type}/{lang}: - get: - description: Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. - operationId: getSeriesSeasonEpisodesTranslated - parameters: - - in: query - name: page - required: true - schema: - type: integer - default: 0 - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: season-type - in: path - name: season-type - required: true - schema: - type: string - examples: - default: - value: default - official: - value: official - dvd: - value: dvd - absolute: - value: absolute - alternate: - value: alternate - regional: - value: regional - - in: path - name: lang - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - type: object - properties: - series: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id, invalid language. - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/filter: - get: - description: Search series based on filter parameters - operationId: getSeriesFilter - parameters: - - description: production company - in: query - name: company - required: false - schema: - type: number - example: 1 - - description: content rating id base on a country - in: query - name: contentRating - required: false - schema: - type: number - example: 245 - - description: country of origin - in: query - name: country - required: true - schema: - type: string - example: usa - - description: Genre id. This id can be found using **/genres** endpoint. - in: query - name: genre - required: false - schema: - type: number - example: 3 - enum: - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10 - - 11 - - 12 - - 13 - - 14 - - 15 - - 16 - - 17 - - 18 - - 19 - - 21 - - 22 - - 23 - - 24 - - 25 - - 26 - - 27 - - 28 - - 29 - - 30 - - 31 - - 32 - - 33 - - 34 - - 35 - - 36 - - description: original language - in: query - name: lang - required: true - schema: - type: string - example: eng - - description: sort by results - in: query - name: sort - required: false - schema: - type: string - enum: - - score - - firstAired - - lastAired - - name - - description: sort type ascending or descending - in: query - name: sortType - required: false - schema: - type: string - enum: - - asc - - desc - - description: status - in: query - name: status - required: false - schema: - type: number - enum: - - 1 - - 2 - - 3 - - description: release year - in: query - name: year - required: false - schema: - type: number - example: 2020 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeriesBaseRecord' - type: array - type: object - '400': - description: Invalid format parameter. - '401': - description: Unauthorized - tags: - - Series - /series/slug/{slug}: - get: - description: Returns series base record searched by slug - operationId: getSeriesBaseBySlug - parameters: - - description: slug - in: path - name: slug - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series slug - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/{id}/translations/{language}: - get: - description: Returns series translation record - operationId: getSeriesTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid series id, invalid language. - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/statuses: - get: - description: returns list of status records - operationId: getAllSeriesStatuses - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Status' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Series Statuses - /sources/types: - get: - description: returns list of sourceType records - operationId: getAllSourceTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SourceType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Source Types - /updates: - get: - description: Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. - operationId: updates - parameters: - - in: query - name: since - required: true - schema: - type: number - - in: query - name: type - required: false - schema: - type: string - enum: - - artwork - - award_nominees - - companies - - episodes - - lists - - people - - seasons - - series - - seriespeople - - artworktypes - - award_categories - - awards - - company_types - - content_ratings - - countries - - entity_types - - genres - - languages - - movies - - movie_genres - - movie_status - - peopletypes - - seasontypes - - sourcetypes - - tag_options - - tags - - translatedcharacters - - translatedcompanies - - translatedepisodes - - translatedlists - - translatedmovies - - translatedpeople - - translatedseasons - - translatedserierk - example: movies - - in: query - name: action - required: false - schema: - type: string - enum: - - delete - - update - example: movies - - description: name - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/EntityUpdate' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '400': - description: Invalid since, type param. - '401': - description: Unauthorized - tags: - - Updates - /user: - get: - description: returns user info - operationId: getUserInfo - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/UserInfo' - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - User info - /user/{id}: - get: - description: returns user info by user id - operationId: getUserInfoById - parameters: - - description: id - in: path - name: id - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/UserInfo' - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - User info - /user/favorites: - get: - description: returns user favorites - operationId: getUserFavorites - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Favorites' - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Favorites - post: - description: creates a new user favorite - operationId: createUserFavorites - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/FavoriteRecord' - responses: - '200': - description: Ok - '400': - description: Bad format - '401': - description: Unauthorized - tags: - - Favorites -servers: -- url: https://api4.thetvdb.com/v4 -components: - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - schemas: - Alias: - description: An alias model, which can be associated with a series, season, movie, person, or list. - properties: - language: - type: string - maximum: 4 - description: A 3-4 character string indicating the language of the alias, as defined in Language. - name: - type: string - maximum: 100 - description: A string containing the alias itself. - type: object - ArtworkBaseRecord: - description: base artwork record - properties: - height: - format: int64 - type: integer - x-go-name: Height - id: - type: integer - image: - type: string - x-go-name: Image - includesText: - type: boolean - language: - type: string - score: - type: number - thumbnail: - type: string - x-go-name: Thumbnail - type: - format: int64 - type: integer - x-go-name: Type - description: The artwork type corresponds to the ids from the /artwork/types endpoint. - width: - format: int64 - type: integer - x-go-name: Width - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ArtworkExtendedRecord: - description: extended artwork record - properties: - episodeId: - type: integer - height: - format: int64 - type: integer - x-go-name: Height - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - x-go-name: Image - includesText: - type: boolean - language: - type: string - movieId: - type: integer - networkId: - type: integer - peopleId: - type: integer - score: - type: number - seasonId: - type: integer - seriesId: - type: integer - seriesPeopleId: - type: integer - status: - $ref: '#/components/schemas/ArtworkStatus' - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - thumbnail: - type: string - x-go-name: Thumbnail - thumbnailHeight: - format: int64 - type: integer - x-go-name: ThumbnailHeight - thumbnailWidth: - format: int64 - type: integer - x-go-name: ThumbnailWidth - type: - format: int64 - type: integer - x-go-name: Type - description: The artwork type corresponds to the ids from the /artwork/types endpoint. - updatedAt: - format: int64 - type: integer - x-go-name: UpdatedAt - width: - format: int64 - type: integer - x-go-name: Width - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ArtworkStatus: - description: artwork status record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ArtworkType: - description: artwork type record - properties: - height: - format: int64 - type: integer - id: - format: int64 - type: integer - x-go-name: ID - imageFormat: - type: string - x-go-name: ImageFormat - name: - type: string - x-go-name: Name - recordType: - type: string - x-go-name: RecordType - slug: - type: string - x-go-name: Slug - thumbHeight: - format: int64 - type: integer - x-go-name: ThumbHeight - thumbWidth: - format: int64 - type: integer - x-go-name: ThumbWidth - width: - format: int64 - type: integer - x-go-name: Width - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardBaseRecord: - description: base award record - properties: - id: - type: integer - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardCategoryBaseRecord: - description: base award category record - properties: - allowCoNominees: - type: boolean - x-go-name: AllowCoNominees - award: - $ref: '#/components/schemas/AwardBaseRecord' - forMovies: - type: boolean - x-go-name: ForMovies - forSeries: - type: boolean - x-go-name: ForSeries - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardCategoryExtendedRecord: - description: extended award category record - properties: - allowCoNominees: - type: boolean - x-go-name: AllowCoNominees - award: - $ref: '#/components/schemas/AwardBaseRecord' - forMovies: - type: boolean - x-go-name: ForMovies - forSeries: - type: boolean - x-go-name: ForSeries - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - nominees: - items: - $ref: '#/components/schemas/AwardNomineeBaseRecord' - type: array - x-go-name: Nominees - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardExtendedRecord: - description: extended award record - properties: - categories: - items: - $ref: '#/components/schemas/AwardCategoryBaseRecord' - type: array - x-go-name: Categories - id: - type: integer - name: - type: string - score: - format: int64 - type: integer - x-go-name: Score - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardNomineeBaseRecord: - description: base award nominee record - properties: - character: - $ref: '#/components/schemas/Character' - details: - type: string - episode: - $ref: '#/components/schemas/EpisodeBaseRecord' - id: - format: int64 - type: integer - x-go-name: ID - isWinner: - type: boolean - x-go-name: IsWinner - movie: - $ref: '#/components/schemas/MovieBaseRecord' - series: - $ref: '#/components/schemas/SeriesBaseRecord' - year: - type: string - category: - type: string - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Biography: - description: biography record - properties: - biography: - type: string - x-go-name: Biography - language: - type: string - x-go-name: Language - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Character: - description: character record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - episode: - $ref: '#/components/schemas/RecordInfo' - episodeId: - type: integer - nullable: true - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - isFeatured: - type: boolean - x-go-name: IsFeatured - movieId: - type: integer - nullable: true - movie: - $ref: '#/components/schemas/RecordInfo' - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - peopleId: - type: integer - personImgURL: - type: string - peopleType: - type: string - seriesId: - type: integer - nullable: true - series: - $ref: '#/components/schemas/RecordInfo' - sort: - format: int64 - type: integer - x-go-name: Sort - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - type: - format: int64 - type: integer - x-go-name: Type - url: - type: string - x-go-name: URL - personName: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Company: - description: A company record - properties: - activeDate: - type: string - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - country: - type: string - id: - format: int64 - type: integer - x-go-name: ID - inactiveDate: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - primaryCompanyType: - format: int64 - type: integer - x-go-name: PrimaryCompanyType - nullable: true - slug: - type: string - x-go-name: Slug - parentCompany: - type: object - $ref: '#/components/schemas/ParentCompany' - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ParentCompany: - description: A parent company record - type: object - properties: - id: - type: integer - nullable: true - name: - type: string - relation: - type: object - $ref: '#/components/schemas/CompanyRelationShip' - CompanyRelationShip: - description: A company relationship - properties: - id: - type: integer - nullable: true - typeName: - type: string - CompanyType: - description: A company type record - type: object - properties: - companyTypeId: - type: integer - companyTypeName: - type: string - ContentRating: - description: content rating record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - description: - type: string - country: - type: string - contentType: - type: string - order: - type: integer - fullName: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Country: - description: country record - properties: - id: - type: string - x-go-name: ID - name: - type: string - x-go-name: Name - shortCode: - type: string - x-go-name: ShortCode - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Entity: - description: Entity record - properties: - movieId: - type: integer - order: - format: int64 - type: integer - x-go-name: Order - seriesId: - type: integer - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - EntityType: - description: Entity Type record - properties: - id: - type: integer - name: - type: string - x-go-name: Order - hasSpecials: - type: boolean - type: object - EntityUpdate: - description: entity update record - properties: - entityType: - type: string - x-go-name: EnitityType - methodInt: - type: integer - method: - type: string - x-go-name: Method - extraInfo: - type: string - userId: - type: integer - recordType: - type: string - recordId: - format: int64 - type: integer - x-go-name: RecordID - timeStamp: - format: int64 - type: integer - x-go-name: TimeStamp - seriesId: - description: Only present for episodes records - format: int64 - type: integer - x-go-name: RecordID - mergeToId: - format: int64 - type: integer - mergeToEntityType: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - EpisodeBaseRecord: - description: base episode record - properties: - absoluteNumber: - type: integer - aired: - type: string - airsAfterSeason: - type: integer - airsBeforeEpisode: - type: integer - airsBeforeSeason: - type: integer - finaleType: - description: season, midseason, or series - type: string - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageType: - type: integer - nullable: true - isMovie: - format: int64 - type: integer - x-go-name: IsMovie - lastUpdated: - type: string - linkedMovie: - type: integer - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - number: - type: integer - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - runtime: - type: integer - nullable: true - seasonNumber: - type: integer - seasons: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - x-go-name: Seasons - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - seasonName: - type: string - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - EpisodeExtendedRecord: - description: extended episode record - properties: - aired: - type: string - airsAfterSeason: - type: integer - airsBeforeEpisode: - type: integer - airsBeforeSeason: - type: integer - awards: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - x-go-name: Awards - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - companies: - items: - $ref: '#/components/schemas/Company' - type: array - contentRatings: - items: - $ref: '#/components/schemas/ContentRating' - type: array - x-go-name: ContentRatings - finaleType: - description: season, midseason, or series - type: string - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageType: - type: integer - nullable: true - isMovie: - format: int64 - type: integer - x-go-name: IsMovie - lastUpdated: - type: string - linkedMovie: - type: integer - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - networks: - items: - $ref: '#/components/schemas/Company' - type: array - nominations: - items: - $ref: '#/components/schemas/AwardNomineeBaseRecord' - type: array - x-go-name: Nominees - number: - type: integer - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - productionCode: - type: string - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - runtime: - type: integer - nullable: true - seasonNumber: - type: integer - seasons: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - x-go-name: Seasons - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - studios: - items: - $ref: '#/components/schemas/Company' - type: array - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - translations: - $ref: '#/components/schemas/TranslationExtended' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Favorites: - description: User favorites record - properties: - series: - items: - type: integer - type: array - x-go-name: series - movies: - items: - type: integer - type: array - x-go-name: movies - episodes: - items: - type: integer - type: array - x-go-name: episodes - artwork: - items: - type: integer - type: array - x-go-name: artwork - people: - items: - type: integer - type: array - x-go-name: people - lists: - items: - type: integer - type: array - x-go-name: list - FavoriteRecord: - description: Favorites record - properties: - series: - type: integer - x-go-name: series - movie: - type: integer - x-go-name: movies - episode: - type: integer - x-go-name: episodes - artwork: - type: integer - x-go-name: artwork - people: - type: integer - x-go-name: people - list: - type: integer - x-go-name: list - Gender: - description: gender record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - GenreBaseRecord: - description: base genre record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - slug: - type: string - x-go-name: Slug - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Language: - description: language record - properties: - id: - type: string - x-go-name: ID - name: - type: string - x-go-name: Name - nativeName: - type: string - x-go-name: NativeName - shortCode: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ListBaseRecord: - description: base list record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageIsFallback: - type: boolean - isOfficial: - type: boolean - x-go-name: IsOfficial - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - tags: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - score: - type: integer - url: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ListExtendedRecord: - description: extended list record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - entities: - items: - $ref: '#/components/schemas/Entity' - type: array - x-go-name: Entities - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageIsFallback: - type: boolean - isOfficial: - type: boolean - x-go-name: IsOfficial - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: int64 - type: integer - x-go-name: Score - url: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - MovieBaseRecord: - description: base movie record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - x-go-name: Image - lastUpdated: - type: string - name: - type: string - x-go-name: Name - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: double - type: number - x-go-name: Score - slug: - type: string - x-go-name: Slug - status: - $ref: '#/components/schemas/Status' - runtime: - type: integer - nullable: true - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - MovieExtendedRecord: - description: extended movie record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - artworks: - items: - $ref: '#/components/schemas/ArtworkBaseRecord' - type: array - x-go-name: Artworks - audioLanguages: - items: - type: string - type: array - x-go-name: AudioLanguages - awards: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - x-go-name: Awards - boxOffice: - type: string - boxOfficeUS: - type: string - budget: - type: string - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - companies: - type: object - $ref: '#/components/schemas/Companies' - contentRatings: - items: - $ref: '#/components/schemas/ContentRating' - type: array - first_release: - type: object - $ref: '#/components/schemas/Release' - genres: - items: - $ref: '#/components/schemas/GenreBaseRecord' - type: array - x-go-name: Genres - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - x-go-name: Image - inspirations: - items: - $ref: '#/components/schemas/Inspiration' - type: array - x-go-name: Inspirations - lastUpdated: - type: string - lists: - items: - $ref: '#/components/schemas/ListBaseRecord' - type: array - name: - type: string - x-go-name: Name - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - originalCountry: - type: string - originalLanguage: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - production_countries: - items: - $ref: '#/components/schemas/ProductionCountry' - type: array - x-go-name: ProductionCountries - releases: - items: - $ref: '#/components/schemas/Release' - type: array - x-go-name: Releases - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - runtime: - type: integer - nullable: true - score: - format: double - type: number - x-go-name: Score - slug: - type: string - x-go-name: Slug - spoken_languages: - items: - type: string - type: array - x-go-name: SpokenLanguages - status: - $ref: '#/components/schemas/Status' - studios: - items: - $ref: '#/components/schemas/StudioBaseRecord' - type: array - x-go-name: Studios - subtitleLanguages: - items: - type: string - type: array - x-go-name: SubtitleLanguages - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - translations: - $ref: '#/components/schemas/TranslationExtended' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - PeopleBaseRecord: - description: base people record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: int64 - type: integer - x-go-name: Score - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - PeopleExtendedRecord: - description: extended people record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - awards: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - x-go-name: Awards - biographies: - items: - $ref: '#/components/schemas/Biography' - type: array - x-go-name: Biographies - birth: - type: string - birthPlace: - type: string - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - death: - type: string - gender: - type: integer - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - races: - items: - $ref: '#/components/schemas/Race' - type: array - x-go-name: Races - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - score: - format: int64 - type: integer - x-go-name: Score - slug: - type: string - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - translations: - $ref: '#/components/schemas/TranslationExtended' - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - PeopleType: - description: people type record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Race: - description: race record - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - RecordInfo: - description: base record info - properties: - image: - type: string - x-go-name: Image - name: - type: string - x-go-name: Name - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Release: - description: release record - properties: - country: - type: string - date: - type: string - detail: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - RemoteID: - description: remote id record - properties: - id: - type: string - x-go-name: ID - type: - format: int64 - type: integer - x-go-name: Type - sourceName: - type: string - x-go-name: SourceName - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SearchResult: - description: search result - properties: - aliases: - items: - type: string - type: array - companies: - items: - type: string - type: array - companyType: - type: string - country: - type: string - director: - type: string - first_air_time: - type: string - genres: - items: - type: string - type: array - id: - type: string - image_url: - type: string - name: - type: string - is_official: - type: boolean - name_translated: - type: string - network: - type: string - objectID: - type: string - officialList: - type: string - overview: - type: string - overviews: - $ref: '#/components/schemas/TranslationSimple' - overview_translated: - items: - type: string - type: array - poster: - type: string - posters: - items: - type: string - type: array - primary_language: - type: string - remote_ids: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - status: - type: string - x-go-name: Status - slug: - type: string - studios: - items: - type: string - type: array - title: - type: string - thumbnail: - type: string - translations: - $ref: '#/components/schemas/TranslationSimple' - translationsWithLang: - items: - type: string - type: array - tvdb_id: - type: string - type: - type: string - year: - type: string - type: object - SearchByRemoteIdResult: - description: search by remote reuslt is a base record for a movie, series, people, season or company search result - properties: - series: - type: object - $ref: '#/components/schemas/SeriesBaseRecord' - people: - type: object - $ref: '#/components/schemas/PeopleBaseRecord' - movie: - type: object - $ref: '#/components/schemas/MovieBaseRecord' - episode: - type: object - $ref: '#/components/schemas/EpisodeBaseRecord' - company: - type: object - $ref: '#/components/schemas/Company' - SeasonBaseRecord: - description: season genre record - properties: - id: - type: integer - image: - type: string - imageType: - type: integer - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - number: - format: int64 - type: integer - x-go-name: Number - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - companies: - type: object - $ref: '#/components/schemas/Companies' - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - type: - $ref: '#/components/schemas/SeasonType' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeasonExtendedRecord: - description: extended season record - properties: - artwork: - items: - $ref: '#/components/schemas/ArtworkBaseRecord' - type: array - x-go-name: Artwork - companies: - type: object - $ref: '#/components/schemas/Companies' - episodes: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - x-go-name: Episodes - id: - type: integer - image: - type: string - imageType: - type: integer - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - number: - format: int64 - type: integer - x-go-name: Number - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - type: - $ref: '#/components/schemas/SeasonType' - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - translations: - items: - $ref: '#/components/schemas/Translation' - type: array - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeasonType: - description: season type record - properties: - alternateName: - type: string - x-go-name: Name - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - type: - type: string - x-go-name: Type - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeriesAirsDays: - description: A series airs day record - properties: - friday: - type: boolean - x-go-name: Friday - monday: - type: boolean - x-go-name: Monday - saturday: - type: boolean - x-go-name: Saturday - sunday: - type: boolean - x-go-name: Sunday - thursday: - type: boolean - x-go-name: Thursday - tuesday: - type: boolean - x-go-name: Tuesday - wednesday: - type: boolean - x-go-name: Wednesday - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeriesBaseRecord: - description: The base record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - averageRuntime: - type: integer - nullable: true - country: - type: string - defaultSeasonType: - format: int64 - type: integer - x-go-name: DefaultSeasonType - episodes: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - x-go-name: Episodes - firstAired: - type: string - id: - type: integer - image: - type: string - isOrderRandomized: - type: boolean - x-go-name: IsOrderRandomized - lastAired: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - nextAired: - type: string - x-go-name: NextAired - originalCountry: - type: string - originalLanguage: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: double - type: number - x-go-name: Score - slug: - type: string - status: - $ref: '#/components/schemas/Status' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeriesExtendedRecord: - description: The extended record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. - properties: - abbreviation: - type: string - airsDays: - $ref: '#/components/schemas/SeriesAirsDays' - airsTime: - type: string - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - artworks: - items: - $ref: '#/components/schemas/ArtworkExtendedRecord' - type: array - x-go-name: Artworks - averageRuntime: - type: integer - nullable: true - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - contentRatings: - items: - $ref: '#/components/schemas/ContentRating' - type: array - country: - type: string - defaultSeasonType: - format: int64 - type: integer - x-go-name: DefaultSeasonType - episodes: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - x-go-name: Episodes - firstAired: - type: string - lists: - items: - $ref: '#/components/schemas/ListBaseRecord' - genres: - items: - $ref: '#/components/schemas/GenreBaseRecord' - type: array - x-go-name: Genres - id: - type: integer - image: - type: string - isOrderRandomized: - type: boolean - x-go-name: IsOrderRandomized - lastAired: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - companies: - items: - $ref: '#/components/schemas/Company' - type: array - nextAired: - type: string - x-go-name: NextAired - originalCountry: - type: string - originalLanguage: - type: string - originalNetwork: - $ref: '#/components/schemas/Company' - overview: - type: string - latestNetwork: - $ref: '#/components/schemas/Company' - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - score: - format: double - type: number - x-go-name: Score - seasons: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - x-go-name: Seasons - seasonTypes: - items: - $ref: '#/components/schemas/SeasonType' - type: array - x-go-name: Seasons - slug: - type: string - status: - $ref: '#/components/schemas/Status' - tags: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - translations: - $ref: '#/components/schemas/TranslationExtended' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SourceType: - description: source type record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - postfix: - type: string - prefix: - type: string - slug: - type: string - x-go-name: Slug - sort: - format: int64 - type: integer - x-go-name: Sort - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Status: - description: status record - properties: - id: - format: int64 - type: integer - x-go-name: ID - nullable: true - keepUpdated: - type: boolean - x-go-name: KeepUpdated - name: - type: string - x-go-name: Name - recordType: - type: string - x-go-name: RecordType - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - StudioBaseRecord: - description: studio record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - parentStudio: - type: integer - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Tag: - description: tag record - properties: - allowsMultiple: - type: boolean - x-go-name: AllowsMultiple - helpText: - type: string - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - options: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - TagOption: - description: tag option record - properties: - helpText: - type: string - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - tag: - format: int64 - type: integer - x-go-name: Tag - tagName: - type: string - x-go-name: TagName - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Trailer: - description: trailer record - properties: - id: - format: int64 - type: integer - x-go-name: ID - language: - type: string - name: - type: string - url: - type: string - runtime: - type: integer - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Translation: - description: translation record - properties: - aliases: - items: - type: string - type: array - isAlias: - type: boolean - isPrimary: - type: boolean - language: - type: string - x-go-name: Language - name: - type: string - overview: - type: string - tagline: - type: string - description: Only populated for movie translations. We disallow taglines without a title. - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - TranslationSimple: - description: translation simple record - additionalProperties: - type: string - example: - ara: تدور قصة المسلسل حول... - ces: Během letu č. 815 společnosti Oceanic... - deu: Im Bruchteil einer Sekunde gerät das Leben... - type: object - TranslationExtended: - description: translation extended record - properties: - nameTranslations: - items: - $ref: '#/components/schemas/Translation' - type: array - overviewTranslations: - items: - $ref: '#/components/schemas/Translation' - type: array - alias: - items: - type: string - type: array - type: object - TagOptionEntity: - description: a entity with selected tag option - type: object - properties: - name: - type: string - tagName: - type: string - tagId: - type: integer - UserInfo: - description: User info record - type: object - properties: - id: - type: integer - language: - type: string - name: - type: string - type: - type: string - Inspiration: - description: Movie inspiration record - properties: - id: - format: int64 - type: integer - x-go-name: ID - type: - type: string - type_name: - type: string - url: - type: string - InspirationType: - description: Movie inspiration type record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - description: - type: string - reference_name: - type: string - url: - type: string - ProductionCountry: - description: Production country record - properties: - id: - format: int64 - type: integer - x-go-name: ID - country: - type: string - name: - type: string - Companies: - description: Companies by type record - properties: - studio: - type: array - items: - $ref: '#/components/schemas/Company' - network: - type: array - items: - $ref: '#/components/schemas/Company' - production: - type: array - items: - $ref: '#/components/schemas/Company' - distributor: - type: array - items: - $ref: '#/components/schemas/Company' - special_effects: - type: array - items: - $ref: '#/components/schemas/Company' - Links: - description: Links for next, previous and current record - properties: - prev: - type: string - nullable: true - self: - type: string - nullable: true - next: - type: string - total_items: - type: integer - page_size: - type: integer diff --git a/src/TvdbClient/openapi/tvdb-v4.raw.yml b/src/TvdbClient/openapi/tvdb-v4.raw.yml deleted file mode 100644 index 7c7ddff..0000000 --- a/src/TvdbClient/openapi/tvdb-v4.raw.yml +++ /dev/null @@ -1,4264 +0,0 @@ -openapi: 3.0.0 -info: - description: | - Documentation of [TheTVDB](https://thetvdb.com/) API V4. All related information is linked from our [Github repo](https://github.com/thetvdb/v4-api). You might also want to use our [Postman collection] (https://www.getpostman.com/collections/7a9397ce69ff246f74d0) - ## Authentication - 1. Use the /login endpoint and provide your API key as "apikey". If you have a user-supported key, also provide your subscriber PIN as "pin". Otherwise completely remove "pin" from your call. - 2. Executing this call will provide you with a bearer token, which is valid for 1 month. - 3. Provide your bearer token for subsequent API calls by clicking Authorize below or including in the header of all direct API calls: `Authorization: Bearer [your-token]` - - ## Notes - 1. "score" is a field across almost all entities. We generate scores for different types of entities in various ways, so no assumptions should be made about the meaning of this value. It is simply used to hint at relative popularity for sorting purposes. - title: TVDB API V4 - version: 4.7.10 -security: - - bearerAuth: [ ] -paths: - /login: - post: - summary: create an auth token. The token has one month validation length. - requestBody: - content: - application/json: - schema: - type: object - required: - - apikey - properties: - apikey: - type: string - pin: - type: string - required: true - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - properties: - token: - type: string - type: object - status: - type: string - type: object - '401': - description: invalid credentials - tags: - - Login - '/artwork/{id}': - get: - description: Returns a single artwork base record. - operationId: getArtworkBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ArtworkBaseRecord' - status: - type: string - type: object - '400': - description: Invalid artwork id - '401': - description: Unauthorized - '404': - description: Artwork not found - tags: - - Artwork - - '/artwork/{id}/extended': - get: - description: Returns a single artwork extended record. - operationId: getArtworkExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ArtworkExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid artwork id - '401': - description: Unauthorized - '404': - description: Artwork not found - tags: - - Artwork - - '/artwork/statuses': - get: - description: Returns list of artwork status records. - operationId: getAllArtworkStatuses - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ArtworkStatus' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Artwork Statuses - - '/artwork/types': - get: - description: Returns a list of artworkType records - operationId: getAllArtworkTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ArtworkType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Artwork Types - - /awards: - get: - description: Returns a list of award base records - operationId: getAllAwards - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Awards - - '/awards/{id}': - get: - description: Returns a single award base record - operationId: getAward - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardBaseRecord' - status: - type: string - type: object - '400': - description: Invalid awards id - '401': - description: Unauthorized - '404': - description: Awards not found - tags: - - Awards - - '/awards/{id}/extended': - get: - description: Returns a single award extended record - operationId: getAwardExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid awards id - '401': - description: Unauthorized - '404': - description: Awards not found - tags: - - Awards - - '/awards/categories/{id}': - get: - description: Returns a single award category base record - operationId: getAwardCategory - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardCategoryBaseRecord' - status: - type: string - type: object - '400': - description: Invalid category id - '401': - description: Unauthorized - '404': - description: Category not found - tags: - - Award Categories - - '/awards/categories/{id}/extended': - get: - description: Returns a single award category extended record - operationId: getAwardCategoryExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/AwardCategoryExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid category id - '401': - description: Unauthorized - '404': - description: Category not found - tags: - - Award Categories - - '/characters/{id}': - get: - description: Returns character base record - operationId: getCharacterBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Character' - status: - type: string - type: object - '400': - description: Invalid character id - '401': - description: Unauthorized - '404': - description: Character not found - tags: - - Characters - /companies: - get: - description: returns a paginated list of company records - operationId: getAllCompanies - parameters: - - description: name - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Company' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Companies - '/companies/types': - get: - description: returns all company type records - operationId: getCompanyTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - type: array - items: - $ref: '#/components/schemas/CompanyType' - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Companies - '/companies/{id}': - get: - description: returns a company record - operationId: getCompany - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Company' - status: - type: string - type: object - '400': - description: Invalid company id - '401': - description: Unauthorized - '404': - description: Company not found - tags: - - Companies - /content/ratings: - get: - description: returns list content rating records - operationId: getAllContentRatings - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ContentRating' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Content Ratings - /countries: - get: - description: returns list of country records - operationId: getAllCountries - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Country' - type: array - status: - type: string - type: object - tags: - - Countries - '/entities': - get: - description: returns the active entity types - operationId: getEntityTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/EntityType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Entity Types - '/episodes': - get: - description: Returns a list of episodes base records with the basic attributes.
Note that all episodes are returned, even those that may not be included in a series' default season order. - operationId: getAllEpisodes - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Episodes - '/episodes/{id}': - get: - description: Returns episode base record - operationId: getEpisodeBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/EpisodeBaseRecord' - status: - type: string - type: object - '400': - description: Invalid episode id - '401': - description: Unauthorized - '404': - description: Episode not found - tags: - - Episodes - '/episodes/{id}/extended': - get: - description: Returns episode extended record - operationId: getEpisodeExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: [ translations ] - example: translations - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/EpisodeExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid episode id - '401': - description: Unauthorized - '404': - description: Episode not found - tags: - - Episodes - '/episodes/{id}/translations/{language}': - get: - description: Returns episode translation record - operationId: getEpisodeTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid episode id. Invalid language. - '401': - description: Unauthorized - '404': - description: Episode not found - tags: - - Episodes - - /genders: - get: - description: returns list of gender records - operationId: getAllGenders - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Gender' - type: array - status: - type: string - type: object - tags: - - Genders - - /genres: - get: - description: returns list of genre records - operationId: getAllGenres - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/GenreBaseRecord' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - - tags: - - Genres - - '/genres/{id}': - get: - description: Returns genre record - operationId: getGenreBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/GenreBaseRecord' - status: - type: string - type: object - '400': - description: Invalid genre id - '401': - description: Unauthorized - '404': - description: Genre not found - tags: - - Genres - /inspiration/types: - get: - description: returns list of inspiration types records - operationId: getAllInspirationTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/InspirationType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - InspirationTypes - /languages: - get: - description: returns list of language records - operationId: getAllLanguages - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Language' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Languages - /lists: - get: - description: returns list of list base records - operationId: getAllLists - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/ListBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - '401': - description: Unauthorized - tags: - - Lists - - '/lists/{id}': - get: - description: returns an list base record - operationId: getList - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ListBaseRecord' - status: - type: string - type: object - '400': - description: Invalid list id - '401': - description: Unauthorized - '404': - description: List not found - tags: - - Lists - '/lists/slug/{slug}': - get: - description: returns an list base record search by slug - operationId: getListBySlug - parameters: - - description: slug - in: path - name: slug - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ListBaseRecord' - status: - type: string - type: object - '400': - description: Invalid list slug - '401': - description: Unauthorized - '404': - description: List not found - tags: - - Lists - '/lists/{id}/extended': - get: - description: returns a list extended record - operationId: getListExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/ListExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid list id - '401': - description: Unauthorized - '404': - description: Lists not found - tags: - - Lists - '/lists/{id}/translations/{language}': - get: - description: Returns list translation record - operationId: getListTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Translation' - type: array - status: - type: string - type: object - '400': - description: Invalid lists id - '401': - description: Unauthorized - '404': - description: Lists not found - tags: - - Lists - - /movies: - get: - description: returns list of movie base records - operationId: getAllMovie - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/MovieBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Movies - '/movies/{id}': - get: - description: Returns movie base record - operationId: getMovieBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/MovieBaseRecord' - status: - type: string - type: object - '400': - description: Invalid movie id - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - '/movies/{id}/extended': - get: - description: Returns movie extended record - operationId: getMovieExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: [ translations ] - example: translations - - description: reduce the payload and returns the short version of this record without characters, artworks and trailers. - in: query - name: short - required: false - schema: - type: boolean - enum: [ true, false ] - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/MovieExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid movie id - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - '/movies/filter': - get: - description: Search movies based on filter parameters - operationId: getMoviesFilter - parameters: - - description: production company - in: query - name: company - required: false - schema: - type: number - example: 1 - - description: content rating id base on a country - in: query - name: contentRating - required: false - schema: - type: number - example: 245 - - description: country of origin - in: query - name: country - required: true - schema: - type: string - example: usa - - description: genre - in: query - name: genre - required: false - schema: - type: number - example: 3 - enum: [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 ] - - description: original language - in: query - name: lang - required: true - schema: - type: string - example: eng - - description: sort by results - in: query - name: sort - required: false - schema: - type: string - enum: [ score,firstAired,name ] - - description: status - in: query - name: status - required: false - schema: - type: number - enum: [ 1,2,3 ] - - description: release year - in: query - name: year - required: false - schema: - type: number - example: 2020 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/MovieBaseRecord' - type: array - status: - type: string - type: object - '400': - description: Invalid format parameter. - '401': - description: Unauthorized - tags: - - Movies - '/movies/slug/{slug}': - get: - description: Returns movie base record search by slug - operationId: getMovieBaseBySlug - parameters: - - description: slug - in: path - name: slug - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/MovieBaseRecord' - status: - type: string - type: object - '400': - description: Invalid movie slug - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - '/movies/{id}/translations/{language}': - get: - description: Returns movie translation record - operationId: getMovieTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid movie id, invalid language. - '401': - description: Unauthorized - '404': - description: Movie not found - tags: - - Movies - /movies/statuses: - get: - description: returns list of status records - operationId: getAllMovieStatuses - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Status' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Movie Statuses - '/people': - get: - description: Returns a list of people base records with the basic attributes. - operationId: getAllPeople - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/PeopleBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - People - - '/people/{id}': - get: - description: Returns people base record - operationId: getPeopleBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/PeopleBaseRecord' - status: - type: string - type: object - '400': - description: Invalid people id - '401': - description: Unauthorized - '404': - description: People not found - tags: - - People - '/people/{id}/extended': - get: - description: Returns people extended record - operationId: getPeopleExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: [ translations ] - example: translations - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/PeopleExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid people id - '401': - description: Unauthorized - '404': - description: People not found - tags: - - People - '/people/{id}/translations/{language}': - get: - description: Returns people translation record - operationId: getPeopleTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid people id, invalid language. - '401': - description: Unauthorized - '404': - description: People not found - tags: - - People - /people/types: - get: - description: returns list of peopleType records - operationId: getAllPeopleTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/PeopleType' - type: array - status: - type: string - type: object - tags: - - People Types - - /search: - get: - description: Our search index includes series, movies, people, and companies. Search is limited to 5k results max. - operationId: getSearchResults - parameters: - - description: The primary search string, which can include the main title for a record including all translations and aliases. - in: query - name: query - schema: - type: string - - description: Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. - in: query - name: q - schema: - type: string - - description: Restrict results to a specific entity type. Can be movie, series, person, or company. - in: query - name: type - schema: - type: string - - description: Restrict results to a specific year. Currently only used for series and movies. - in: query - name: year - schema: - type: number - - description: Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". - in: query - name: company - schema: - type: string - - description: Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. - in: query - name: country - schema: - type: string - - description: Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". - in: query - name: director - schema: - type: string - - description: Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. - in: query - name: language - schema: - type: string - - description: Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. - in: query - name: primaryType - schema: - type: string - - description: Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. - in: query - name: network - schema: - type: string - - - - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - in: query - name: remote_id - schema: - type: string - - - description: Offset results. - in: query - name: offset - schema: - type: number - - description: Limit results. - in: query - name: limit - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SearchResult' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - '400': - description: Max results overflow - tags: - - Search - /search/remoteid/{remoteId}: - get: - description: Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. - operationId: getSearchResultsByRemoteId - parameters: - - description: Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - in: path - required: true - name: remoteId - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SearchByRemoteIdResult' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Search - - /seasons: - get: - description: returns list of seasons base records - operationId: getAllSeasons - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Seasons - '/seasons/{id}': - get: - description: Returns season base record - operationId: getSeasonBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeasonBaseRecord' - status: - type: string - type: object - '400': - description: Invalid season id - '401': - description: Unauthorized - '404': - description: Season not found - tags: - - Seasons - '/seasons/{id}/extended': - get: - description: Returns season extended record - operationId: getSeasonExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeasonExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid seasons id - '401': - description: Unauthorized - '404': - description: Season not found - tags: - - Seasons - '/seasons/types': - get: - description: Returns season type records - operationId: getSeasonTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeasonType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Seasons - '/seasons/{id}/translations/{language}': - get: - description: Returns season translation record - operationId: getSeasonTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid season id, language not found. - '401': - description: Unauthorized - '404': - description: Season not found - tags: - - Seasons - /series: - get: - description: returns list of series base records - operationId: getAllSeries - parameters: - - description: page number - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeriesBaseRecord' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '401': - description: Unauthorized - tags: - - Series - '/series/{id}': - get: - description: Returns series base record - operationId: getSeriesBase - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/{id}/artworks': - get: - description: Returns series artworks base on language and type.
Note: Artwork type is an id that can be found using **/artwork/types** endpoint. - operationId: getSeriesArtworks - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: lang - in: query - name: lang - required: false - schema: - type: string - example: eng, spa - - description: type - in: query - name: type - required: false - schema: - type: integer - example: 1,2,3 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/{id}/nextAired': - get: - description: Returns series base record including the nextAired field.
Note: nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. - operationId: getSeriesNextAired - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/{id}/extended': - get: - description: Returns series extended record - operationId: getSeriesExtended - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: meta - in: query - name: meta - required: false - schema: - type: string - enum: [ translations, episodes ] - example: translations - - description: reduce the payload and returns the short version of this record without characters and artworks - in: query - name: short - required: false - schema: - type: boolean - enum: [ true, false ] - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesExtendedRecord' - status: - type: string - type: object - '400': - description: Invalid series id - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/{id}/episodes/{season-type}': - get: - description: Returns series episodes from the specified season type, default returns the episodes in the series default season type - operationId: getSeriesEpisodes - parameters: - - in: query - name: page - required: true - schema: - type: integer - default: 0 - - description: id - in: path - name: id - required: true - schema: - type: number - - description: season-type - in: path - name: season-type - required: true - schema: - type: string - examples: - default: - value: default - official: - value: official - dvd: - value: dvd - absolute: - value: absolute - alternate: - value: alternate - regional: - value: regional - - in: query - name: season - required: false - schema: - type: integer - default: 0 - - in: query - name: episodeNumber - required: false - schema: - type: integer - default: 0 - - description: airDate of the episode, format is yyyy-mm-dd - in: query - name: airDate - required: false - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - type: object - properties: - series: - $ref: '#/components/schemas/SeriesBaseRecord' - episodes: - type: array - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id, episodeNumber is not null then season must be present - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/{id}/episodes/{season-type}/{lang}': - get: - description: Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. - operationId: getSeriesSeasonEpisodesTranslated - parameters: - - in: query - name: page - required: true - schema: - type: integer - default: 0 - - description: id - in: path - name: id - required: true - schema: - type: number - - description: season-type - in: path - name: season-type - required: true - schema: - type: string - examples: - default: - value: default - official: - value: official - dvd: - value: dvd - absolute: - value: absolute - alternate: - value: alternate - regional: - value: regional - - in: path - name: lang - required: true - schema: - type: string - - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - type: object - properties: - series: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series id, invalid language. - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/filter': - get: - description: Search series based on filter parameters - operationId: getSeriesFilter - parameters: - - description: production company - in: query - name: company - required: false - schema: - type: number - example: 1 - - description: content rating id base on a country - in: query - name: contentRating - required: false - schema: - type: number - example: 245 - - description: country of origin - in: query - name: country - required: true - schema: - type: string - example: usa - - description: Genre id. This id can be found using **/genres** endpoint. - in: query - name: genre - required: false - schema: - type: number - example: 3 - enum: [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 ] - - description: original language - in: query - name: lang - required: true - schema: - type: string - example: eng - - description: sort by results - in: query - name: sort - required: false - schema: - type: string - enum: [ score,firstAired,lastAired,name ] - - description: sort type ascending or descending - in: query - name: sortType - required: false - schema: - type: string - enum: [ asc,desc ] - - description: status - in: query - name: status - required: false - schema: - type: number - enum: [ 1,2,3 ] - - description: release year - in: query - name: year - required: false - schema: - type: number - example: 2020 - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SeriesBaseRecord' - type: array - type: object - '400': - description: Invalid format parameter. - '401': - description: Unauthorized - tags: - - Series - '/series/slug/{slug}': - get: - description: Returns series base record searched by slug - operationId: getSeriesBaseBySlug - parameters: - - description: slug - in: path - name: slug - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/SeriesBaseRecord' - status: - type: string - type: object - '400': - description: Invalid series slug - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - '/series/{id}/translations/{language}': - get: - description: Returns series translation record - operationId: getSeriesTranslation - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - - description: language - in: path - name: language - required: true - schema: - type: string - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - $ref: '#/components/schemas/Translation' - status: - type: string - type: object - '400': - description: Invalid series id, invalid language. - '401': - description: Unauthorized - '404': - description: Series not found - tags: - - Series - /series/statuses: - get: - description: returns list of status records - operationId: getAllSeriesStatuses - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Status' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Series Statuses - /sources/types: - get: - description: returns list of sourceType records - operationId: getAllSourceTypes - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/SourceType' - type: array - status: - type: string - type: object - '401': - description: Unauthorized - tags: - - Source Types - /updates: - get: - description: Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. - operationId: updates - parameters: - - in: query - name: since - required: true - schema: - type: number - - in: query - name: type - required: false - schema: - type: string - enum: [ artwork,award_nominees,companies,episodes,lists,people,seasons,series,seriespeople,artworktypes,award_categories,awards,company_types,content_ratings,countries,entity_types,genres,languages,movies,movie_genres,movie_status,peopletypes,seasontypes,sourcetypes,tag_options,tags,translatedcharacters,translatedcompanies,translatedepisodes,translatedlists,translatedmovies,translatedpeople,translatedseasons,translatedserierk ] - example: movies - - in: query - name: action - required: false - schema: - type: string - enum: [ delete, update ] - example: movies - - description: name - in: query - name: page - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/EntityUpdate' - type: array - status: - type: string - links: - $ref: '#/components/schemas/Links' - type: object - '400': - description: Invalid since, type param. - '401': - description: Unauthorized - - tags: - - Updates - /user: - get: - description: returns user info - operationId: getUserInfo - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/UserInfo' - status: - type: string - type: object - '401': - description: Unauthorized - - tags: - - User info - /user/{id}: - get: - description: returns user info by user id - operationId: getUserInfoById - parameters: - - description: id - in: path - name: id - required: true - schema: - type: number - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/UserInfo' - status: - type: string - type: object - '401': - description: Unauthorized - - tags: - - User info - /user/favorites: - get: - description: returns user favorites - operationId: getUserFavorites - responses: - '200': - description: response - content: - application/json: - schema: - properties: - data: - items: - $ref: '#/components/schemas/Favorites' - status: - type: string - type: object - '401': - description: Unauthorized - - tags: - - Favorites - post: - description: creates a new user favorite - operationId: createUserFavorites - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/FavoriteRecord' - responses: - '200': - description: Ok - '400': - description: Bad format - '401': - description: Unauthorized - - tags: - - Favorites - -servers: - - url: 'https://api4.thetvdb.com/v4' -components: - securitySchemes: - bearerAuth: # arbitrary name for the security scheme - type: http - scheme: bearer - bearerFormat: JWT - schemas: - Alias: - description: An alias model, which can be associated with a series, season, movie, person, or list. - properties: - language: - type: string - maximum: 4 - description: A 3-4 character string indicating the language of the alias, as defined in Language. - name: - type: string - maximum: 100 - description: A string containing the alias itself. - type: object - ArtworkBaseRecord: - description: base artwork record - properties: - height: - format: int64 - type: integer - x-go-name: Height - id: - type: integer - image: - type: string - x-go-name: Image - includesText: - type: boolean - language: - type: string - score: - type: number - thumbnail: - type: string - x-go-name: Thumbnail - type: - format: int64 - type: integer - x-go-name: Type - description: The artwork type corresponds to the ids from the /artwork/types endpoint. - width: - format: int64 - type: integer - x-go-name: Width - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ArtworkExtendedRecord: - description: extended artwork record - properties: - episodeId: - type: integer - height: - format: int64 - type: integer - x-go-name: Height - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - x-go-name: Image - includesText: - type: boolean - language: - type: string - movieId: - type: integer - networkId: - type: integer - peopleId: - type: integer - score: - type: number - seasonId: - type: integer - seriesId: - type: integer - seriesPeopleId: - type: integer - status: - $ref: '#/components/schemas/ArtworkStatus' - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - thumbnail: - type: string - x-go-name: Thumbnail - thumbnailHeight: - format: int64 - type: integer - x-go-name: ThumbnailHeight - thumbnailWidth: - format: int64 - type: integer - x-go-name: ThumbnailWidth - type: - format: int64 - type: integer - x-go-name: Type - description: The artwork type corresponds to the ids from the /artwork/types endpoint. - updatedAt: - format: int64 - type: integer - x-go-name: UpdatedAt - width: - format: int64 - type: integer - x-go-name: Width - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ArtworkStatus: - description: artwork status record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ArtworkType: - description: artwork type record - properties: - height: - format: int64 - type: integer - id: - format: int64 - type: integer - x-go-name: ID - imageFormat: - type: string - x-go-name: ImageFormat - name: - type: string - x-go-name: Name - recordType: - type: string - x-go-name: RecordType - slug: - type: string - x-go-name: Slug - thumbHeight: - format: int64 - type: integer - x-go-name: ThumbHeight - thumbWidth: - format: int64 - type: integer - x-go-name: ThumbWidth - width: - format: int64 - type: integer - x-go-name: Width - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardBaseRecord: - description: base award record - properties: - id: - type: integer - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardCategoryBaseRecord: - description: base award category record - properties: - allowCoNominees: - type: boolean - x-go-name: AllowCoNominees - award: - $ref: '#/components/schemas/AwardBaseRecord' - forMovies: - type: boolean - x-go-name: ForMovies - forSeries: - type: boolean - x-go-name: ForSeries - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardCategoryExtendedRecord: - description: extended award category record - properties: - allowCoNominees: - type: boolean - x-go-name: AllowCoNominees - award: - $ref: '#/components/schemas/AwardBaseRecord' - forMovies: - type: boolean - x-go-name: ForMovies - forSeries: - type: boolean - x-go-name: ForSeries - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - nominees: - items: - $ref: '#/components/schemas/AwardNomineeBaseRecord' - type: array - x-go-name: Nominees - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardExtendedRecord: - description: extended award record - properties: - categories: - items: - $ref: '#/components/schemas/AwardCategoryBaseRecord' - type: array - x-go-name: Categories - id: - type: integer - name: - type: string - score: - format: int64 - type: integer - x-go-name: Score - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - AwardNomineeBaseRecord: - description: base award nominee record - properties: - character: - $ref: '#/components/schemas/Character' - details: - type: string - episode: - $ref: '#/components/schemas/EpisodeBaseRecord' - id: - format: int64 - type: integer - x-go-name: ID - isWinner: - type: boolean - x-go-name: IsWinner - movie: - $ref: '#/components/schemas/MovieBaseRecord' - series: - $ref: '#/components/schemas/SeriesBaseRecord' - year: - type: string - category: - type: string - name: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Biography: - description: biography record - properties: - biography: - type: string - x-go-name: Biography - language: - type: string - x-go-name: Language - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Character: - description: character record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - episode: - $ref: '#/components/schemas/RecordInfo' - episodeId: - type: integer - nullable: true - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - isFeatured: - type: boolean - x-go-name: IsFeatured - movieId: - type: integer - nullable: true - movie: - $ref: '#/components/schemas/RecordInfo' - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - peopleId: - type: integer - personImgURL: - type: string - peopleType: - type: string - seriesId: - type: integer - nullable: true - series: - $ref: '#/components/schemas/RecordInfo' - sort: - format: int64 - type: integer - x-go-name: Sort - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - type: - format: int64 - type: integer - x-go-name: Type - url: - type: string - x-go-name: URL - personName: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Company: - description: A company record - properties: - activeDate: - type: string - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - country: - type: string - id: - format: int64 - type: integer - x-go-name: ID - inactiveDate: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - primaryCompanyType: - format: int64 - type: integer - x-go-name: PrimaryCompanyType - nullable: true - slug: - type: string - x-go-name: Slug - parentCompany: - type: object - $ref: '#/components/schemas/ParentCompany' - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ParentCompany: - description: A parent company record - type: object - properties: - id: - type: integer - nullable: true - name: - type: string - relation: - type: object - $ref: '#/components/schemas/CompanyRelationShip' - CompanyRelationShip: - description: A company relationship - properties: - id: - type: integer - nullable: true - typeName: - type: string - CompanyType: - description: A company type record - type: object - properties: - companyTypeId: - type: integer - companyTypeName: - type: string - ContentRating: - description: content rating record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - description: - type: string - country: - type: string - contentType: - type: string - order: - type: integer - fullName: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Country: - description: country record - properties: - id: - type: string - x-go-name: ID - name: - type: string - x-go-name: Name - shortCode: - type: string - x-go-name: ShortCode - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Entity: - description: Entity record - properties: - movieId: - type: integer - order: - format: int64 - type: integer - x-go-name: Order - seriesId: - type: integer - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - EntityType: - description: Entity Type record - properties: - id: - type: integer - name: - type: string - x-go-name: Order - hasSpecials: - type: boolean - type: object - EntityUpdate: - description: entity update record - properties: - entityType: - type: string - x-go-name: EnitityType - methodInt: - type: integer - method: - type: string - x-go-name: Method - extraInfo: - type: string - userId: - type: integer - recordType: - type: string - recordId: - format: int64 - type: integer - x-go-name: RecordID - timeStamp: - format: int64 - type: integer - x-go-name: TimeStamp - seriesId: - description: Only present for episodes records - format: int64 - type: integer - x-go-name: RecordID - mergeToId: - format: int64 - type: integer - mergeToEntityType: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - EpisodeBaseRecord: - description: base episode record - properties: - absoluteNumber: - type: integer - aired: - type: string - airsAfterSeason: - type: integer - airsBeforeEpisode: - type: integer - airsBeforeSeason: - type: integer - finaleType: - description: season, midseason, or series - type: string - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageType: - type: integer - nullable: true - isMovie: - format: int64 - type: integer - x-go-name: IsMovie - lastUpdated: - type: string - linkedMovie: - type: integer - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - number: - type: integer - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - runtime: - type: integer - nullable: true - seasonNumber: - type: integer - seasons: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - x-go-name: Seasons - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - seasonName: - type: string - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - EpisodeExtendedRecord: - description: extended episode record - properties: - aired: - type: string - airsAfterSeason: - type: integer - airsBeforeEpisode: - type: integer - airsBeforeSeason: - type: integer - awards: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - x-go-name: Awards - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - companies: - items: - $ref: '#/components/schemas/Company' - type: array - contentRatings: - items: - $ref: '#/components/schemas/ContentRating' - type: array - x-go-name: ContentRatings - finaleType: - description: season, midseason, or series - type: string - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageType: - type: integer - nullable: true - isMovie: - format: int64 - type: integer - x-go-name: IsMovie - lastUpdated: - type: string - linkedMovie: - type: integer - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - networks: - items: - $ref: '#/components/schemas/Company' - type: array - nominations: - items: - $ref: '#/components/schemas/AwardNomineeBaseRecord' - type: array - x-go-name: Nominees - number: - type: integer - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - productionCode: - type: string - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - runtime: - type: integer - nullable: true - seasonNumber: - type: integer - seasons: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - x-go-name: Seasons - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - studios: - items: - $ref: '#/components/schemas/Company' - type: array - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - translations: - $ref: '#/components/schemas/TranslationExtended' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Favorites: - description: User favorites record - properties: - series: - items: - type: integer - type: array - x-go-name: series - movies: - items: - type: integer - type: array - x-go-name: movies - episodes: - items: - type: integer - type: array - x-go-name: episodes - artwork: - items: - type: integer - type: array - x-go-name: artwork - people: - items: - type: integer - type: array - x-go-name: people - lists: - items: - type: integer - type: array - x-go-name: list - FavoriteRecord: - description: Favorites record - properties: - series: - type: integer - x-go-name: series - movie: - type: integer - x-go-name: movies - episode: - type: integer - x-go-name: episodes - artwork: - type: integer - x-go-name: artwork - people: - type: integer - x-go-name: people - list: - type: integer - x-go-name: list - Gender: - description: gender record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - GenreBaseRecord: - description: base genre record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - slug: - type: string - x-go-name: Slug - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Language: - description: language record - properties: - id: - type: string - x-go-name: ID - name: - type: string - x-go-name: Name - nativeName: - type: string - x-go-name: NativeName - shortCode: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ListBaseRecord: - description: base list record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageIsFallback: - type: boolean - isOfficial: - type: boolean - x-go-name: IsOfficial - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - tags: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - score: - type: integer - url: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - ListExtendedRecord: - description: extended list record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - entities: - items: - $ref: '#/components/schemas/Entity' - type: array - x-go-name: Entities - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - imageIsFallback: - type: boolean - isOfficial: - type: boolean - x-go-name: IsOfficial - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overview: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: int64 - type: integer - x-go-name: Score - url: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - MovieBaseRecord: - description: base movie record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - x-go-name: Image - lastUpdated: - type: string - name: - type: string - x-go-name: Name - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: double - type: number - x-go-name: Score - slug: - type: string - x-go-name: Slug - status: - $ref: '#/components/schemas/Status' - runtime: - type: integer - nullable: true - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - MovieExtendedRecord: - description: extended movie record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - artworks: - items: - $ref: '#/components/schemas/ArtworkBaseRecord' - type: array - x-go-name: Artworks - audioLanguages: - items: - type: string - type: array - x-go-name: AudioLanguages - awards: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - x-go-name: Awards - boxOffice: - type: string - boxOfficeUS: - type: string - budget: - type: string - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - companies: - type: object - $ref: '#/components/schemas/Companies' - contentRatings: - items: - $ref: '#/components/schemas/ContentRating' - type: array - first_release: - type: object - $ref: '#/components/schemas/Release' - genres: - items: - $ref: '#/components/schemas/GenreBaseRecord' - type: array - x-go-name: Genres - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - x-go-name: Image - inspirations: - items: - $ref: '#/components/schemas/Inspiration' - type: array - x-go-name: Inspirations - lastUpdated: - type: string - lists: - items: - $ref: '#/components/schemas/ListBaseRecord' - type: array - name: - type: string - x-go-name: Name - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - originalCountry: - type: string - originalLanguage: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - production_countries: - items: - $ref: '#/components/schemas/ProductionCountry' - type: array - x-go-name: ProductionCountries - releases: - items: - $ref: '#/components/schemas/Release' - type: array - x-go-name: Releases - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - runtime: - type: integer - nullable: true - score: - format: double - type: number - x-go-name: Score - slug: - type: string - x-go-name: Slug - spoken_languages: - items: - type: string - type: array - x-go-name: SpokenLanguages - status: - $ref: '#/components/schemas/Status' - studios: - items: - $ref: '#/components/schemas/StudioBaseRecord' - type: array - x-go-name: Studios - subtitleLanguages: - items: - type: string - type: array - x-go-name: SubtitleLanguages - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - translations: - $ref: '#/components/schemas/TranslationExtended' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - PeopleBaseRecord: - description: base people record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: int64 - type: integer - x-go-name: Score - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - PeopleExtendedRecord: - description: extended people record - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - awards: - items: - $ref: '#/components/schemas/AwardBaseRecord' - type: array - x-go-name: Awards - biographies: - items: - $ref: '#/components/schemas/Biography' - type: array - x-go-name: Biographies - birth: - type: string - birthPlace: - type: string - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - death: - type: string - gender: - type: integer - id: - format: int64 - type: integer - x-go-name: ID - image: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - races: - items: - $ref: '#/components/schemas/Race' - type: array - x-go-name: Races - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - score: - format: int64 - type: integer - x-go-name: Score - slug: - type: string - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - translations: - $ref: '#/components/schemas/TranslationExtended' - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - PeopleType: - description: people type record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Race: - description: race record - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - RecordInfo: - description: base record info - properties: - image: - type: string - x-go-name: Image - name: - type: string - x-go-name: Name - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Release: - description: release record - properties: - country: - type: string - date: - type: string - detail: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - RemoteID: - description: remote id record - properties: - id: - type: string - x-go-name: ID - type: - format: int64 - type: integer - x-go-name: Type - sourceName: - type: string - x-go-name: SourceName - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SearchResult: - description: search result - properties: - aliases: - items: - type: string - type: array - companies: - items: - type: string - type: array - companyType: - type: string - country: - type: string - director: - type: string - first_air_time: - type: string - genres: - items: - type: string - type: array - id: - type: string - image_url: - type: string - name: - type: string - is_official: - type: boolean - name_translated: - type: string - network: - type: string - objectID: - type: string - officialList: - type: string - overview: - type: string - overviews: - $ref: '#/components/schemas/TranslationSimple' - overview_translated: - items: - type: string - type: array - poster: - type: string - posters: - items: - type: string - type: array - primary_language: - type: string - remote_ids: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - status: - type: string - x-go-name: Status - slug: - type: string - studios: - items: - type: string - type: array - title: - type: string - thumbnail: - type: string - translations: - $ref: '#/components/schemas/TranslationSimple' - translationsWithLang: - items: - type: string - type: array - tvdb_id: - type: string - type: - type: string - year: - type: string - type: object - SearchByRemoteIdResult: - description: search by remote reuslt is a base record for a movie, series, people, season or company search result - properties: - series: - type: object - $ref: '#/components/schemas/SeriesBaseRecord' - people: - type: object - $ref: '#/components/schemas/PeopleBaseRecord' - movie: - type: object - $ref: '#/components/schemas/MovieBaseRecord' - episode: - type: object - $ref: '#/components/schemas/EpisodeBaseRecord' - company: - type: object - $ref: '#/components/schemas/Company' - - SeasonBaseRecord: - description: season genre record - properties: - id: - type: integer - image: - type: string - imageType: - type: integer - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - number: - format: int64 - type: integer - x-go-name: Number - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - companies: - type: object - $ref: '#/components/schemas/Companies' - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - type: - $ref: '#/components/schemas/SeasonType' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeasonExtendedRecord: - description: extended season record - properties: - artwork: - items: - $ref: '#/components/schemas/ArtworkBaseRecord' - type: array - x-go-name: Artwork - companies: - type: object - $ref: '#/components/schemas/Companies' - episodes: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - x-go-name: Episodes - id: - type: integer - image: - type: string - imageType: - type: integer - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - number: - format: int64 - type: integer - x-go-name: Number - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - seriesId: - format: int64 - type: integer - x-go-name: SeriesID - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - type: - $ref: '#/components/schemas/SeasonType' - tagOptions: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - translations: - items: - $ref: '#/components/schemas/Translation' - type: array - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeasonType: - description: season type record - properties: - alternateName: - type: string - x-go-name: Name - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - type: - type: string - x-go-name: Type - - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeriesAirsDays: - description: A series airs day record - properties: - friday: - type: boolean - x-go-name: Friday - monday: - type: boolean - x-go-name: Monday - saturday: - type: boolean - x-go-name: Saturday - sunday: - type: boolean - x-go-name: Sunday - thursday: - type: boolean - x-go-name: Thursday - tuesday: - type: boolean - x-go-name: Tuesday - wednesday: - type: boolean - x-go-name: Wednesday - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeriesBaseRecord: - description: The base record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. - properties: - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - averageRuntime: - type: integer - nullable: true - country: - type: string - defaultSeasonType: - format: int64 - type: integer - x-go-name: DefaultSeasonType - episodes: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - x-go-name: Episodes - firstAired: - type: string - id: - type: integer - image: - type: string - isOrderRandomized: - type: boolean - x-go-name: IsOrderRandomized - lastAired: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - nextAired: - type: string - x-go-name: NextAired - originalCountry: - type: string - originalLanguage: - type: string - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - score: - format: double - type: number - x-go-name: Score - slug: - type: string - status: - $ref: '#/components/schemas/Status' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SeriesExtendedRecord: - description: The extended record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. - properties: - abbreviation: - type: string - airsDays: - $ref: '#/components/schemas/SeriesAirsDays' - airsTime: - type: string - aliases: - items: - $ref: '#/components/schemas/Alias' - type: array - x-go-name: Aliases - artworks: - items: - $ref: '#/components/schemas/ArtworkExtendedRecord' - type: array - x-go-name: Artworks - averageRuntime: - type: integer - nullable: true - characters: - items: - $ref: '#/components/schemas/Character' - type: array - x-go-name: Characters - contentRatings: - items: - $ref: '#/components/schemas/ContentRating' - type: array - country: - type: string - defaultSeasonType: - format: int64 - type: integer - x-go-name: DefaultSeasonType - episodes: - items: - $ref: '#/components/schemas/EpisodeBaseRecord' - type: array - x-go-name: Episodes - firstAired: - type: string - lists: - items: - $ref: '#/components/schemas/ListBaseRecord' - genres: - items: - $ref: '#/components/schemas/GenreBaseRecord' - type: array - x-go-name: Genres - id: - type: integer - image: - type: string - isOrderRandomized: - type: boolean - x-go-name: IsOrderRandomized - lastAired: - type: string - lastUpdated: - type: string - name: - type: string - nameTranslations: - items: - type: string - type: array - x-go-name: NameTranslations - companies: - items: - $ref: '#/components/schemas/Company' - type: array - nextAired: - type: string - x-go-name: NextAired - originalCountry: - type: string - originalLanguage: - type: string - originalNetwork: - $ref: '#/components/schemas/Company' - overview: - type: string - latestNetwork: - $ref: '#/components/schemas/Company' - overviewTranslations: - items: - type: string - type: array - x-go-name: OverviewTranslations - remoteIds: - items: - $ref: '#/components/schemas/RemoteID' - type: array - x-go-name: RemoteIDs - score: - format: double - type: number - x-go-name: Score - seasons: - items: - $ref: '#/components/schemas/SeasonBaseRecord' - type: array - x-go-name: Seasons - seasonTypes: - items: - $ref: '#/components/schemas/SeasonType' - type: array - x-go-name: Seasons - slug: - type: string - status: - $ref: '#/components/schemas/Status' - tags: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - trailers: - items: - $ref: '#/components/schemas/Trailer' - type: array - x-go-name: Trailers - translations: - $ref: '#/components/schemas/TranslationExtended' - year: - type: string - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - SourceType: - description: source type record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - postfix: - type: string - prefix: - type: string - slug: - type: string - x-go-name: Slug - sort: - format: int64 - type: integer - x-go-name: Sort - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Status: - description: status record - properties: - id: - format: int64 - type: integer - x-go-name: ID - nullable: true - keepUpdated: - type: boolean - x-go-name: KeepUpdated - name: - type: string - x-go-name: Name - recordType: - type: string - x-go-name: RecordType - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - StudioBaseRecord: - description: studio record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - parentStudio: - type: integer - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Tag: - description: tag record - properties: - allowsMultiple: - type: boolean - x-go-name: AllowsMultiple - helpText: - type: string - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - options: - items: - $ref: '#/components/schemas/TagOption' - type: array - x-go-name: TagOptions - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - TagOption: - description: tag option record - properties: - helpText: - type: string - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - x-go-name: Name - tag: - format: int64 - type: integer - x-go-name: Tag - tagName: - type: string - x-go-name: TagName - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Trailer: - description: trailer record - properties: - id: - format: int64 - type: integer - x-go-name: ID - language: - type: string - name: - type: string - url: - type: string - runtime: - type: integer - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - Translation: - description: translation record - properties: - aliases: - items: - type: string - type: array - isAlias: - type: boolean - isPrimary: - type: boolean - language: - type: string - x-go-name: Language - name: - type: string - overview: - type: string - tagline: - type: string - description: Only populated for movie translations. We disallow taglines without a title. - type: object - x-go-package: github.com/whip-networks/tvdb-api-v4-core/tvdb-api-v4-core/pkg/model - TranslationSimple: - description: translation simple record - additionalProperties: - type: string - example: # Ejemplo específico del objeto - ara: "تدور قصة المسلسل حول..." - ces: "Během letu č. 815 společnosti Oceanic..." - deu: "Im Bruchteil einer Sekunde gerät das Leben..." - type: object - TranslationExtended: - description: translation extended record - properties: - nameTranslations: - items: - $ref: '#/components/schemas/Translation' - type: array - overviewTranslations: - items: - $ref: '#/components/schemas/Translation' - type: array - alias: - items: - type: string - type: array - type: object - TagOptionEntity: - description: a entity with selected tag option - type: object - properties: - name: - type: string - tagName: - type: string - tagId: - type: integer - UserInfo: - description: User info record - type: object - properties: - id: - type: integer - language: - type: string - name: - type: string - type: - type: string - Inspiration: - description: Movie inspiration record - properties: - id: - format: int64 - type: integer - x-go-name: ID - type: - type: string - type_name: - type: string - url: - type: string - InspirationType: - description: Movie inspiration type record - properties: - id: - format: int64 - type: integer - x-go-name: ID - name: - type: string - description: - type: string - reference_name: - type: string - url: - type: string - ProductionCountry: - description: Production country record - properties: - id: - format: int64 - type: integer - x-go-name: ID - country: - type: string - name: - type: string - Companies: - description: Companies by type record - properties: - studio: - type: array - items: - $ref: '#/components/schemas/Company' - network: - type: array - items: - $ref: '#/components/schemas/Company' - production: - type: array - items: - $ref: '#/components/schemas/Company' - distributor: - type: array - items: - $ref: '#/components/schemas/Company' - special_effects: - type: array - items: - $ref: '#/components/schemas/Company' - Links: - description: Links for next, previous and current record - properties: - prev: - type: string - nullable: true - self: - type: string - nullable: true - next: - type: string - total_items: - type: integer - page_size: - type: integer \ No newline at end of file diff --git a/tools/openapi/generate.sh b/tools/openapi/generate.sh deleted file mode 100755 index 29ed3cf..0000000 --- a/tools/openapi/generate.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -# Reproducible codegen for the TheTVDB v4 client. -# -# 1. download the live TheTVDB v4 OpenAPI spec -> openapi/tvdb-v4.raw.yml -# 2. apply the checked-in overlay (patch_spec.py) -> openapi/tvdb-v4.patched.yml -# 3. run NSwag (pinned local tool) against the patched spec -# -# The raw + patched specs are committed so a regen diff is reviewable. -# Run from anywhere: tools/openapi/generate.sh -set -euo pipefail - -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -REPO="$(cd "$HERE/../.." && pwd)" -SPEC_URL="${TVDB_SPEC_URL:-https://thetvdb.github.io/v4-api/swagger.yml}" -OPENAPI_DIR="$REPO/src/TvdbClient/openapi" -RAW="$OPENAPI_DIR/tvdb-v4.raw.yml" -PATCHED="$OPENAPI_DIR/tvdb-v4.patched.yml" - -mkdir -p "$OPENAPI_DIR" -echo "→ downloading live spec: $SPEC_URL" -curl -fsSL "$SPEC_URL" -o "$RAW" -echo "→ applying overlay" -python3 "$HERE/patch_spec.py" "$RAW" "$PATCHED" -echo "→ restoring pinned tools" -( cd "$REPO" && dotnet tool restore >/dev/null ) -echo "→ running NSwag" -# NSwag.ConsoleCore targets net9.0; roll forward onto a newer runtime (e.g. net10) -# when the 9.0 runtime isn't installed. Also pinned via .config/dotnet-tools.json. -( cd "$REPO/src/TvdbClient" && DOTNET_ROLL_FORWARD="${DOTNET_ROLL_FORWARD:-Major}" dotnet nswag run TvdbClient.nswag ) -echo "✓ codegen complete" diff --git a/tools/openapi/patch_spec.py b/tools/openapi/patch_spec.py deleted file mode 100644 index 3be1c9e..0000000 --- a/tools/openapi/patch_spec.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python3 -"""Overlay/preprocess for TheTVDB v4 OpenAPI spec, applied before NSwag codegen. - -TheTVDB's swagger types every integer resource id as ``schema: {type: number}``, -which NSwag maps to C# ``double`` — so generated methods take ``double id`` and -entities would expose ``double`` ids. This overlay coerces those *path* id -parameters to ``integer``/``int64`` so they generate as ``long``. - -Scope is deliberately narrow (path parameters only): the only other ``number`` -fields in the spec are the ``score`` properties, which are genuinely -floating-point and must stay ``double``. - -Idempotent — safe to re-run. Usage: patch_spec.py -""" -import sys -import yaml - - -def coerce_path_id_params(spec: dict) -> list[str]: - """Coerce every `in: path` parameter typed `number` to integer/int64. - - Returns a list of "METHOD /path :: paramName" for each parameter changed. - """ - changed: list[str] = [] - for path, item in (spec.get("paths") or {}).items(): - if not isinstance(item, dict): - continue - for method, op in item.items(): - if not isinstance(op, dict) or "parameters" not in op: - continue - for param in op.get("parameters") or []: - if param.get("in") != "path": - continue - schema = param.get("schema") or {} - if schema.get("type") == "number": - schema["type"] = "integer" - schema["format"] = "int64" - param["schema"] = schema - changed.append(f"{method.upper()} {path} :: {param.get('name')}") - return changed - - -def main() -> int: - if len(sys.argv) != 3: - print("usage: patch_spec.py ", file=sys.stderr) - return 2 - src, dst = sys.argv[1], sys.argv[2] - with open(src) as f: - spec = yaml.safe_load(f) - - changed = coerce_path_id_params(spec) - - with open(dst, "w") as f: - yaml.safe_dump(spec, f, sort_keys=False, allow_unicode=True, width=4096) - - print(f"overlay: coerced {len(changed)} path id param(s) number → int64") - for c in changed: - print(f" {c}") - print(f"overlay: wrote {dst}") - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) From b4ef8603fe16917c560ac7c0467647a4f0725864 Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 23:06:00 +1200 Subject: [PATCH 3/7] refactor(models)!: split generated DTOs into versioned TvdbClient.Models project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Establishes the intended architecture: the API-versioned generated models live in their own project/namespace, separate from the generic client core. - New `TvdbClient.Models` project (PackageId TvdbClient.Models) holds the generated DTOs (ns `Tvdb.Models`); version tracks the TheTVDB API version. - The `Generate` target now emits DTOs-only → Tvdb.Models and clients-only → Tvdb.Clients (core project), the clients importing Tvdb.Models. No more single namespace. - Overlay gains inline-parameter-enum hoisting: TheTVDB's inline `/updates` type/action enums generated as `Type`/`Action`, colliding with System.* — they're now hoisted to named component schemas ({OperationId}{Param}). - Delete the ~64 hand-split model files + stale generated artifacts (Clients/Interfaces.cs, ILoginClient.cs, Models/ResponseClasses.cs, the old single-project TvdbModels.cs); keep the hand-written generics (ApiResponseWrapper, Token, LoginRequestBody, AbstractBaseRecord). Fix the invalid body-less ITvdbClient marker interface. Both src projects build clean (32 `long id`, 0 `double id`, 133 DTOs). Still to come: extract the generic TvdbClient.Abstractions (3rd project), the facade unwrap → T/Page, and the NetArchTest architecture spec. Co-Authored-By: Claude Opus 4.8 (1M context) --- TvdbApi.sln | 147 +- build/Build.cs | 142 +- .../TvdbClient.Models.csproj | 15 + src/TvdbClient.Models/TvdbModels.cs | 4764 ++++ src/TvdbClient/Clients/ILoginClient.cs | 16 - src/TvdbClient/Clients/ITvdbClient.cs | 12 +- src/TvdbClient/Clients/Interfaces.cs | 796 - src/TvdbClient/Clients/TvdbClient.cs | 21784 ++++++++-------- src/TvdbClient/Models/Alias.cs | 24 - src/TvdbClient/Models/ApiException.cs | 49 - src/TvdbClient/Models/ArtworkBaseRecord.cs | 40 - .../Models/ArtworkExtendedRecord.cs | 44 - src/TvdbClient/Models/ArtworkStatus.cs | 17 - src/TvdbClient/Models/ArtworkType.cs | 36 - src/TvdbClient/Models/AwardBaseRecord.cs | 15 - .../Models/AwardCategoryBaseRecord.cs | 27 - .../Models/AwardCategoryExtendedRecord.cs | 13 - src/TvdbClient/Models/AwardExtendedRecord.cs | 17 - .../Models/AwardNomineeBaseRecord.cs | 39 - src/TvdbClient/Models/Biography.cs | 15 - src/TvdbClient/Models/Character.cs | 72 - src/TvdbClient/Models/Companies.cs | 24 - src/TvdbClient/Models/Company.cs | 45 - src/TvdbClient/Models/CompanyRelationShip.cs | 15 - src/TvdbClient/Models/CompanyType.cs | 15 - src/TvdbClient/Models/ContentRating.cs | 30 - src/TvdbClient/Models/Country.cs | 20 - src/TvdbClient/Models/Entity.cs | 20 - src/TvdbClient/Models/EntityType.cs | 20 - src/TvdbClient/Models/EntityUpdate.cs | 48 - src/TvdbClient/Models/EpisodeBaseRecord.cs | 147 - .../Models/EpisodeExtendedRecord.cs | 47 - src/TvdbClient/Models/FavoriteRecord.cs | 27 - src/TvdbClient/Models/Favorites.cs | 27 - src/TvdbClient/Models/Gender.cs | 15 - src/TvdbClient/Models/GenreBaseRecord.cs | 18 - src/TvdbClient/Models/Inspiration.cs | 21 - src/TvdbClient/Models/InspirationType.cs | 24 - src/TvdbClient/Models/Language.cs | 21 - src/TvdbClient/Models/Links.cs | 55 - src/TvdbClient/Models/ListBaseRecord.cs | 48 - src/TvdbClient/Models/ListExtendedRecord.cs | 13 - src/TvdbClient/Models/MovieBaseRecord.cs | 54 - src/TvdbClient/Models/MovieExtendedRecord.cs | 84 - src/TvdbClient/Models/ParentCompany.cs | 18 - src/TvdbClient/Models/PeopleBaseRecord.cs | 37 - src/TvdbClient/Models/PeopleExtendedRecord.cs | 73 - src/TvdbClient/Models/PeopleType.cs | 16 - src/TvdbClient/Models/ProductionCountry.cs | 18 - src/TvdbClient/Models/Race.cs | 7 - src/TvdbClient/Models/RecordInfo.cs | 18 - src/TvdbClient/Models/Release.cs | 18 - src/TvdbClient/Models/RemoteID.cs | 18 - src/TvdbClient/Models/ResponseClasses.cs | 239 - .../Models/SearchByRemoteIdResult.cs | 24 - src/TvdbClient/Models/SearchResult.cs | 105 - src/TvdbClient/Models/SeasonBaseRecord.cs | 54 - src/TvdbClient/Models/SeasonExtendedRecord.cs | 26 - src/TvdbClient/Models/SeasonType.cs | 21 - src/TvdbClient/Models/SeriesAirsDays.cs | 30 - src/TvdbClient/Models/SeriesBaseRecord.cs | 78 - src/TvdbClient/Models/SeriesExtendedRecord.cs | 67 - src/TvdbClient/Models/SourceType.cs | 27 - src/TvdbClient/Models/Status.cs | 21 - src/TvdbClient/Models/StudioBaseRecord.cs | 18 - src/TvdbClient/Models/Tag.cs | 24 - src/TvdbClient/Models/TagOption.cs | 24 - src/TvdbClient/Models/TagOptionEntity.cs | 18 - src/TvdbClient/Models/Trailer.cs | 24 - src/TvdbClient/Models/Translation.cs | 34 - src/TvdbClient/Models/TranslationExtended.cs | 18 - src/TvdbClient/Models/TranslationSimple.cs | 7 - src/TvdbClient/Models/TvdbModels.cs | 77 - src/TvdbClient/Models/UserInfo.cs | 21 - src/TvdbClient/TvdbClient.csproj | 3 + 75 files changed, 16281 insertions(+), 13824 deletions(-) create mode 100644 src/TvdbClient.Models/TvdbClient.Models.csproj create mode 100644 src/TvdbClient.Models/TvdbModels.cs delete mode 100644 src/TvdbClient/Clients/ILoginClient.cs delete mode 100644 src/TvdbClient/Clients/Interfaces.cs delete mode 100644 src/TvdbClient/Models/Alias.cs delete mode 100644 src/TvdbClient/Models/ApiException.cs delete mode 100644 src/TvdbClient/Models/ArtworkBaseRecord.cs delete mode 100644 src/TvdbClient/Models/ArtworkExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/ArtworkStatus.cs delete mode 100644 src/TvdbClient/Models/ArtworkType.cs delete mode 100644 src/TvdbClient/Models/AwardBaseRecord.cs delete mode 100644 src/TvdbClient/Models/AwardCategoryBaseRecord.cs delete mode 100644 src/TvdbClient/Models/AwardCategoryExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/AwardExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/AwardNomineeBaseRecord.cs delete mode 100644 src/TvdbClient/Models/Biography.cs delete mode 100644 src/TvdbClient/Models/Character.cs delete mode 100644 src/TvdbClient/Models/Companies.cs delete mode 100644 src/TvdbClient/Models/Company.cs delete mode 100644 src/TvdbClient/Models/CompanyRelationShip.cs delete mode 100644 src/TvdbClient/Models/CompanyType.cs delete mode 100644 src/TvdbClient/Models/ContentRating.cs delete mode 100644 src/TvdbClient/Models/Country.cs delete mode 100644 src/TvdbClient/Models/Entity.cs delete mode 100644 src/TvdbClient/Models/EntityType.cs delete mode 100644 src/TvdbClient/Models/EntityUpdate.cs delete mode 100644 src/TvdbClient/Models/EpisodeBaseRecord.cs delete mode 100644 src/TvdbClient/Models/EpisodeExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/FavoriteRecord.cs delete mode 100644 src/TvdbClient/Models/Favorites.cs delete mode 100644 src/TvdbClient/Models/Gender.cs delete mode 100644 src/TvdbClient/Models/GenreBaseRecord.cs delete mode 100644 src/TvdbClient/Models/Inspiration.cs delete mode 100644 src/TvdbClient/Models/InspirationType.cs delete mode 100644 src/TvdbClient/Models/Language.cs delete mode 100644 src/TvdbClient/Models/Links.cs delete mode 100644 src/TvdbClient/Models/ListBaseRecord.cs delete mode 100644 src/TvdbClient/Models/ListExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/MovieBaseRecord.cs delete mode 100644 src/TvdbClient/Models/MovieExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/ParentCompany.cs delete mode 100644 src/TvdbClient/Models/PeopleBaseRecord.cs delete mode 100644 src/TvdbClient/Models/PeopleExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/PeopleType.cs delete mode 100644 src/TvdbClient/Models/ProductionCountry.cs delete mode 100644 src/TvdbClient/Models/Race.cs delete mode 100644 src/TvdbClient/Models/RecordInfo.cs delete mode 100644 src/TvdbClient/Models/Release.cs delete mode 100644 src/TvdbClient/Models/RemoteID.cs delete mode 100644 src/TvdbClient/Models/ResponseClasses.cs delete mode 100644 src/TvdbClient/Models/SearchByRemoteIdResult.cs delete mode 100644 src/TvdbClient/Models/SearchResult.cs delete mode 100644 src/TvdbClient/Models/SeasonBaseRecord.cs delete mode 100644 src/TvdbClient/Models/SeasonExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/SeasonType.cs delete mode 100644 src/TvdbClient/Models/SeriesAirsDays.cs delete mode 100644 src/TvdbClient/Models/SeriesBaseRecord.cs delete mode 100644 src/TvdbClient/Models/SeriesExtendedRecord.cs delete mode 100644 src/TvdbClient/Models/SourceType.cs delete mode 100644 src/TvdbClient/Models/Status.cs delete mode 100644 src/TvdbClient/Models/StudioBaseRecord.cs delete mode 100644 src/TvdbClient/Models/Tag.cs delete mode 100644 src/TvdbClient/Models/TagOption.cs delete mode 100644 src/TvdbClient/Models/TagOptionEntity.cs delete mode 100644 src/TvdbClient/Models/Trailer.cs delete mode 100644 src/TvdbClient/Models/Translation.cs delete mode 100644 src/TvdbClient/Models/TranslationExtended.cs delete mode 100644 src/TvdbClient/Models/TranslationSimple.cs delete mode 100644 src/TvdbClient/Models/TvdbModels.cs delete mode 100644 src/TvdbClient/Models/UserInfo.cs diff --git a/TvdbApi.sln b/TvdbApi.sln index 07c455c..13ff162 100644 --- a/TvdbApi.sln +++ b/TvdbApi.sln @@ -1,56 +1,91 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.13.35617.110 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "src\TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "tests\TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" - ProjectSection(SolutionItems) = preProject - .gitignore = .gitignore - Directory.Build.props = Directory.Build.props - LICENSE = LICENSE - .github\workflows\publish-nuget.yml = .github\workflows\publish-nuget.yml - README.md = README.md - .github\workflows\test-coverage.yml = .github\workflows\test-coverage.yml - version.json = version.json - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1570EA31-904E-4036-89EE-890A8358C7AA}" - ProjectSection(SolutionItems) = preProject - src\Directory.Build.props = src\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7849F1D9-4557-41C5-A747-241B92631187}" - ProjectSection(SolutionItems) = preProject - tests\Directory.Build.props = tests\Directory.Build.props - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|Any CPU.Build.0 = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {02CB1507-5FF6-9962-1A70-EC35D9E298ED} = {1570EA31-904E-4036-89EE-890A8358C7AA} - {E72AACA8-0A10-E62A-E526-41B75B6E6348} = {7849F1D9-4557-41C5-A747-241B92631187} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {EBB4E090-0583-48B6-AEC2-1AB4E3B98D2A} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35617.110 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "src\TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "tests\TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + Directory.Build.props = Directory.Build.props + LICENSE = LICENSE + .github\workflows\publish-nuget.yml = .github\workflows\publish-nuget.yml + README.md = README.md + .github\workflows\test-coverage.yml = .github\workflows\test-coverage.yml + version.json = version.json + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1570EA31-904E-4036-89EE-890A8358C7AA}" + ProjectSection(SolutionItems) = preProject + src\Directory.Build.props = src\Directory.Build.props + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7849F1D9-4557-41C5-A747-241B92631187}" + ProjectSection(SolutionItems) = preProject + tests\Directory.Build.props = tests\Directory.Build.props + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Models", "src\TvdbClient.Models\TvdbClient.Models.csproj", "{1B8ECC10-3AE4-4890-B738-8AB35FA661FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|x64.ActiveCfg = Debug|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|x64.Build.0 = Debug|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|x86.ActiveCfg = Debug|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Debug|x86.Build.0 = Debug|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|Any CPU.Build.0 = Release|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x64.ActiveCfg = Release|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x64.Build.0 = Release|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x86.ActiveCfg = Release|Any CPU + {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x86.Build.0 = Release|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x64.ActiveCfg = Debug|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x64.Build.0 = Debug|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x86.ActiveCfg = Debug|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x86.Build.0 = Debug|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|Any CPU.Build.0 = Release|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x64.ActiveCfg = Release|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x64.Build.0 = Release|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x86.ActiveCfg = Release|Any CPU + {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x86.Build.0 = Release|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|x64.ActiveCfg = Debug|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|x64.Build.0 = Debug|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|x86.ActiveCfg = Debug|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|x86.Build.0 = Debug|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|Any CPU.Build.0 = Release|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x64.ActiveCfg = Release|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x64.Build.0 = Release|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x86.ActiveCfg = Release|Any CPU + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {02CB1507-5FF6-9962-1A70-EC35D9E298ED} = {1570EA31-904E-4036-89EE-890A8358C7AA} + {E72AACA8-0A10-E62A-E526-41B75B6E6348} = {7849F1D9-4557-41C5-A747-241B92631187} + {1B8ECC10-3AE4-4890-B738-8AB35FA661FC} = {1570EA31-904E-4036-89EE-890A8358C7AA} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EBB4E090-0583-48B6-AEC2-1AB4E3B98D2A} + EndGlobalSection +EndGlobal diff --git a/build/Build.cs b/build/Build.cs index aa266e6..2c4416c 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -26,7 +26,14 @@ partial class Build : FalloutBuild const string SpecUrl = "https://thetvdb.github.io/v4-api/swagger.yml"; - AbsolutePath ClientProjectDirectory => RootDirectory / "src" / "TvdbClient"; + const string ModelsNamespace = "Tvdb.Models"; + const string ClientsNamespace = "Tvdb.Clients"; + + // The generated DTOs live in the API-versioned TvdbClient.Models project; + // the generated clients live in the generic TvdbClient core project and + // import the models namespace. (Architecture enforced by NamespaceSeparationSpecs.) + AbsolutePath ContractsOutput => RootDirectory / "src" / "TvdbClient.Models" / "TvdbModels.cs"; + AbsolutePath ClientsOutput => RootDirectory / "src" / "TvdbClient" / "Clients" / "TvdbClient.cs"; Target Generate => _ => _ .Description("Regenerate the TheTVDB v4 client from the live OpenAPI spec") @@ -38,46 +45,62 @@ partial class Build : FalloutBuild var coerced = CoerceIntegerIdPathParameters(document); Log.Information("Overlay: coerced {Count} id path param(s) number → int64", coerced); - var settings = new CSharpClientGeneratorSettings - { - ClassName = "{controller}Client", - ClientBaseInterface = "ITvdbClient", - InjectHttpClient = true, - DisposeHttpClient = true, - GenerateClientInterfaces = true, - GenerateExceptionClasses = true, - ExceptionClass = "ApiException", - WrapDtoExceptions = true, - UseBaseUrl = false, - GenerateBaseUrlProperty = true, - GenerateSyncMethods = false, - GenerateOptionalParameters = true, - OperationNameGenerator = new MultipleClientsFromFirstTagAndPathSegmentsOperationNameGenerator(), - }; - settings.CSharpGeneratorSettings.Namespace = "Tvdb.Models"; - settings.CSharpGeneratorSettings.JsonLibrary = CSharpJsonLibrary.SystemTextJson; - settings.CSharpGeneratorSettings.ClassStyle = CSharpClassStyle.Poco; - settings.CSharpGeneratorSettings.GenerateDataAnnotations = true; - settings.CSharpGeneratorSettings.GenerateOptionalPropertiesAsNullable = true; - settings.CSharpGeneratorSettings.RequiredPropertiesMustBeDefined = true; - settings.CSharpGeneratorSettings.DateType = "System.DateTimeOffset"; - settings.CSharpGeneratorSettings.DateTimeType = "System.DateTimeOffset"; - settings.CSharpGeneratorSettings.TimeType = "System.TimeSpan"; - settings.CSharpGeneratorSettings.TimeSpanType = "System.TimeSpan"; - - var generator = new CSharpClientGenerator(document, settings); - - var clients = generator.GenerateFile(ClientGeneratorOutputType.Implementation); - var contracts = generator.GenerateFile(ClientGeneratorOutputType.Contracts); - - var clientsPath = ClientProjectDirectory / "Clients" / "TvdbClient.cs"; - var contractsPath = ClientProjectDirectory / "Models" / "TvdbModels.cs"; - clientsPath.WriteAllText(clients); - contractsPath.WriteAllText(contracts); - - Log.Information("Wrote {Clients} and {Contracts}", clientsPath, contractsPath); + var hoisted = HoistInlineParameterEnums(document); + Log.Information("Overlay: hoisted {Count} inline parameter enum(s) to named schemas", hoisted); + + // DTOs only → Tvdb.Models (TvdbClient.Models project). No client interfaces/exception + // classes here — those belong with the generic client core. + var contracts = new CSharpClientGenerator(document, + CreateSettings(ModelsNamespace, dtoTypes: true, clientInterfaces: false, exceptionClasses: false)) + .GenerateFile(ClientGeneratorOutputType.Contracts); + + // Clients only → Tvdb.Clients (TvdbClient project), importing the DTOs from Tvdb.Models. + var clients = new CSharpClientGenerator(document, + CreateSettings(ClientsNamespace, dtoTypes: false, clientInterfaces: true, exceptionClasses: true, + additionalNamespaceUsages: new[] { ModelsNamespace })) + .GenerateFile(ClientGeneratorOutputType.Full); + + ContractsOutput.WriteAllText(contracts); + ClientsOutput.WriteAllText(clients); + + Log.Information("Wrote {Contracts} and {Clients}", ContractsOutput, ClientsOutput); }); + static CSharpClientGeneratorSettings CreateSettings( + string @namespace, bool dtoTypes, bool clientInterfaces, bool exceptionClasses, + string[]? additionalNamespaceUsages = null) + { + var settings = new CSharpClientGeneratorSettings + { + ClassName = "{controller}Client", + ClientBaseInterface = "ITvdbClient", + InjectHttpClient = true, + DisposeHttpClient = true, + GenerateClientInterfaces = clientInterfaces, + GenerateDtoTypes = dtoTypes, + GenerateExceptionClasses = exceptionClasses, + ExceptionClass = "ApiException", + WrapDtoExceptions = true, + UseBaseUrl = false, + GenerateBaseUrlProperty = true, + GenerateSyncMethods = false, + GenerateOptionalParameters = true, + OperationNameGenerator = new MultipleClientsFromFirstTagAndPathSegmentsOperationNameGenerator(), + AdditionalNamespaceUsages = additionalNamespaceUsages ?? System.Array.Empty(), + }; + settings.CSharpGeneratorSettings.Namespace = @namespace; + settings.CSharpGeneratorSettings.JsonLibrary = CSharpJsonLibrary.SystemTextJson; + settings.CSharpGeneratorSettings.ClassStyle = CSharpClassStyle.Poco; + settings.CSharpGeneratorSettings.GenerateDataAnnotations = true; + settings.CSharpGeneratorSettings.GenerateOptionalPropertiesAsNullable = true; + settings.CSharpGeneratorSettings.RequiredPropertiesMustBeDefined = true; + settings.CSharpGeneratorSettings.DateType = "System.DateTimeOffset"; + settings.CSharpGeneratorSettings.DateTimeType = "System.DateTimeOffset"; + settings.CSharpGeneratorSettings.TimeType = "System.TimeSpan"; + settings.CSharpGeneratorSettings.TimeSpanType = "System.TimeSpan"; + return settings; + } + /// /// TheTVDB types integer resource ids as number, which NSwag maps to /// double. Coerce the path-id parameters to integer/int64. Narrow by @@ -103,4 +126,45 @@ static int CoerceIntegerIdPathParameters(OpenApiDocument document) return count; } + + /// + /// TheTVDB defines several query-parameter enums inline (e.g. the /updates + /// type/action params), which NSwag names after the raw parameter — + /// yielding model types like Type and Action that collide with + /// System.Type/System.Action. Hoist each inline enum into a named + /// component schema ({OperationId}{ParamName}) so it generates as a clean, + /// non-colliding type. + /// + static int HoistInlineParameterEnums(OpenApiDocument document) + { + var count = 0; + foreach (var (path, pathItem) in document.Paths) + foreach (var (method, operation) in pathItem) + foreach (var parameter in operation.Parameters) + { + var schema = parameter.Schema; + if (schema is null || schema.HasReference || !schema.IsEnumeration) + continue; + + var opName = string.IsNullOrEmpty(operation.OperationId) + ? Pascalize(method) + Pascalize(path) + : Pascalize(operation.OperationId); + var name = opName + Pascalize(parameter.Name); + + if (!document.Components.Schemas.ContainsKey(name)) + document.Components.Schemas[name] = schema; + + parameter.Schema = new NJsonSchema.JsonSchema { Reference = document.Components.Schemas[name] }; + count++; + } + + return count; + } + + /// PascalCase an identifier, splitting on non-alphanumeric separators. + static string Pascalize(string value) + { + var parts = value.Split(new[] { '-', '_', '/', '.', '{', '}', ' ' }, System.StringSplitOptions.RemoveEmptyEntries); + return string.Concat(parts.Select(p => char.ToUpperInvariant(p[0]) + p.Substring(1))); + } } diff --git a/src/TvdbClient.Models/TvdbClient.Models.csproj b/src/TvdbClient.Models/TvdbClient.Models.csproj new file mode 100644 index 0000000..cc465e0 --- /dev/null +++ b/src/TvdbClient.Models/TvdbClient.Models.csproj @@ -0,0 +1,15 @@ + + + + + net9.0 + TvdbClient.Models + TVDB Api Client — Models + Generated data models (DTOs) for TheTVDB v4 API. Version tracks the TheTVDB API version. + + $(NoWarn);CS1591;CS8618 + + + diff --git a/src/TvdbClient.Models/TvdbModels.cs b/src/TvdbClient.Models/TvdbModels.cs new file mode 100644 index 0000000..afbc461 --- /dev/null +++ b/src/TvdbClient.Models/TvdbModels.cs @@ -0,0 +1,4764 @@ +//---------------------- +// +// Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" +#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" +#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" +#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." + +namespace Tvdb.Models +{ + using System = global::System; + + + + /// + /// An alias model, which can be associated with a series, season, movie, person, or list. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Alias + { + /// + /// A 3-4 character string indicating the language of the alias, as defined in Language. + /// + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + /// + /// A string containing the alias itself. + /// + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base artwork record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ArtworkBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("height")] + public long? Height { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("includesText")] + public bool? IncludesText { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public double? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbnail")] + public string Thumbnail { get; set; } + + /// + /// The artwork type corresponds to the ids from the /artwork/types endpoint. + /// + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public long? Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("width")] + public long? Width { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended artwork record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ArtworkExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("episodeId")] + public int? EpisodeId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("height")] + public long? Height { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("includesText")] + public bool? IncludesText { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movieId")] + public int? MovieId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("networkId")] + public int? NetworkId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("peopleId")] + public int? PeopleId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public double? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasonId")] + public int? SeasonId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public int? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesPeopleId")] + public int? SeriesPeopleId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public ArtworkStatus Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbnail")] + public string Thumbnail { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbnailHeight")] + public long? ThumbnailHeight { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbnailWidth")] + public long? ThumbnailWidth { get; set; } + + /// + /// The artwork type corresponds to the ids from the /artwork/types endpoint. + /// + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public long? Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] + public long? UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("width")] + public long? Width { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// artwork status record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ArtworkStatus + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// artwork type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ArtworkType + { + + [System.Text.Json.Serialization.JsonPropertyName("height")] + public long? Height { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageFormat")] + public string ImageFormat { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("recordType")] + public string RecordType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbHeight")] + public long? ThumbHeight { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbWidth")] + public long? ThumbWidth { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("width")] + public long? Width { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base award record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AwardBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base award category record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AwardCategoryBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("allowCoNominees")] + public bool? AllowCoNominees { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("award")] + public AwardBaseRecord Award { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("forMovies")] + public bool? ForMovies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("forSeries")] + public bool? ForSeries { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended award category record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AwardCategoryExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("allowCoNominees")] + public bool? AllowCoNominees { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("award")] + public AwardBaseRecord Award { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("forMovies")] + public bool? ForMovies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("forSeries")] + public bool? ForSeries { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nominees")] + public System.Collections.Generic.ICollection Nominees { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended award record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AwardExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("categories")] + public System.Collections.Generic.ICollection Categories { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public long? Score { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base award nominee record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AwardNomineeBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("character")] + public Character Character { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("details")] + public string Details { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episode")] + public EpisodeBaseRecord Episode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isWinner")] + public bool? IsWinner { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movie")] + public MovieBaseRecord Movie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public SeriesBaseRecord Series { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("category")] + public string Category { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// biography record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Biography + { + + [System.Text.Json.Serialization.JsonPropertyName("biography")] + public string Biography1 { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// character record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Character + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episode")] + public RecordInfo Episode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episodeId")] + public int? EpisodeId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isFeatured")] + public bool? IsFeatured { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movieId")] + public int? MovieId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movie")] + public RecordInfo Movie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("peopleId")] + public int? PeopleId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("personImgURL")] + public string PersonImgURL { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("peopleType")] + public string PeopleType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public int? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public RecordInfo Series { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("sort")] + public long? Sort { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public long? Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("personName")] + public string PersonName { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// A company record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Company + { + + [System.Text.Json.Serialization.JsonPropertyName("activeDate")] + public string ActiveDate { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("inactiveDate")] + public string InactiveDate { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("primaryCompanyType")] + public long? PrimaryCompanyType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("parentCompany")] + public ParentCompany ParentCompany { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// A parent company record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ParentCompany + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("relation")] + public CompanyRelationShip Relation { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// A company relationship + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CompanyRelationShip + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("typeName")] + public string TypeName { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// A company type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CompanyType + { + + [System.Text.Json.Serialization.JsonPropertyName("companyTypeId")] + public int? CompanyTypeId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companyTypeName")] + public string CompanyTypeName { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// content rating record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContentRating + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("contentType")] + public string ContentType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("order")] + public int? Order { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("fullName")] + public string FullName { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// country record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Country + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("shortCode")] + public string ShortCode { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Entity record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Entity + { + + [System.Text.Json.Serialization.JsonPropertyName("movieId")] + public int? MovieId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("order")] + public long? Order { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public int? SeriesId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Entity Type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EntityType + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("hasSpecials")] + public bool? HasSpecials { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// entity update record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EntityUpdate + { + + [System.Text.Json.Serialization.JsonPropertyName("entityType")] + public string EntityType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("methodInt")] + public int? MethodInt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("method")] + public string Method { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("extraInfo")] + public string ExtraInfo { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("userId")] + public int? UserId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("recordType")] + public string RecordType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("recordId")] + public long? RecordId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("timeStamp")] + public long? TimeStamp { get; set; } + + /// + /// Only present for episodes records + /// + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public long? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("mergeToId")] + public long? MergeToId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("mergeToEntityType")] + public string MergeToEntityType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base episode record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EpisodeBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("absoluteNumber")] + public int? AbsoluteNumber { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("aired")] + public string Aired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsAfterSeason")] + public int? AirsAfterSeason { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsBeforeEpisode")] + public int? AirsBeforeEpisode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsBeforeSeason")] + public int? AirsBeforeSeason { get; set; } + + /// + /// season, midseason, or series + /// + + [System.Text.Json.Serialization.JsonPropertyName("finaleType")] + public string FinaleType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageType")] + public int? ImageType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isMovie")] + public long? IsMovie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("linkedMovie")] + public int? LinkedMovie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("number")] + public int? Number { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("runtime")] + public int? Runtime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasonNumber")] + public int? SeasonNumber { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasons")] + public System.Collections.Generic.ICollection Seasons { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public long? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasonName")] + public string SeasonName { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended episode record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EpisodeExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aired")] + public string Aired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsAfterSeason")] + public int? AirsAfterSeason { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsBeforeEpisode")] + public int? AirsBeforeEpisode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsBeforeSeason")] + public int? AirsBeforeSeason { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("awards")] + public System.Collections.Generic.ICollection Awards { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("characters")] + public System.Collections.Generic.ICollection Characters { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companies")] + public System.Collections.Generic.ICollection Companies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("contentRatings")] + public System.Collections.Generic.ICollection ContentRatings { get; set; } + + /// + /// season, midseason, or series + /// + + [System.Text.Json.Serialization.JsonPropertyName("finaleType")] + public string FinaleType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageType")] + public int? ImageType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isMovie")] + public long? IsMovie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("linkedMovie")] + public int? LinkedMovie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("networks")] + public System.Collections.Generic.ICollection Networks { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nominations")] + public System.Collections.Generic.ICollection Nominations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("number")] + public int? Number { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("productionCode")] + public string ProductionCode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] + public System.Collections.Generic.ICollection RemoteIds { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("runtime")] + public int? Runtime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasonNumber")] + public int? SeasonNumber { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasons")] + public System.Collections.Generic.ICollection Seasons { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public long? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("studios")] + public System.Collections.Generic.ICollection Studios { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("trailers")] + public System.Collections.Generic.ICollection Trailers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translations")] + public TranslationExtended Translations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// User favorites record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Favorites + { + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public System.Collections.Generic.ICollection Series { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movies")] + public System.Collections.Generic.ICollection Movies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episodes")] + public System.Collections.Generic.ICollection Episodes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("artwork")] + public System.Collections.Generic.ICollection Artwork { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("people")] + public System.Collections.Generic.ICollection People { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lists")] + public System.Collections.Generic.ICollection Lists { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Favorites record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FavoriteRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public int? Series { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movie")] + public int? Movie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episode")] + public int? Episode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("artwork")] + public int? Artwork { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("people")] + public int? People { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("list")] + public int? List { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// gender record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Gender + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base genre record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class GenreBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// language record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Language + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nativeName")] + public string NativeName { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("shortCode")] + public string ShortCode { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base list record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ListBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageIsFallback")] + public bool? ImageIsFallback { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isOfficial")] + public bool? IsOfficial { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] + public System.Collections.Generic.ICollection RemoteIds { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tags")] + public System.Collections.Generic.ICollection Tags { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public int? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended list record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ListExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("entities")] + public System.Collections.Generic.ICollection Entities { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageIsFallback")] + public bool? ImageIsFallback { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isOfficial")] + public bool? IsOfficial { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public long? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base movie record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class MovieBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public double? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public Status Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("runtime")] + public int? Runtime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended movie record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class MovieExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("artworks")] + public System.Collections.Generic.ICollection Artworks { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("audioLanguages")] + public System.Collections.Generic.ICollection AudioLanguages { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("awards")] + public System.Collections.Generic.ICollection Awards { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("boxOffice")] + public string BoxOffice { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("boxOfficeUS")] + public string BoxOfficeUS { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("budget")] + public string Budget { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("characters")] + public System.Collections.Generic.ICollection Characters { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companies")] + public Companies Companies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("contentRatings")] + public System.Collections.Generic.ICollection ContentRatings { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("first_release")] + public Release First_release { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("genres")] + public System.Collections.Generic.ICollection Genres { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("inspirations")] + public System.Collections.Generic.ICollection Inspirations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lists")] + public System.Collections.Generic.ICollection Lists { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalCountry")] + public string OriginalCountry { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalLanguage")] + public string OriginalLanguage { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("production_countries")] + public System.Collections.Generic.ICollection Production_countries { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("releases")] + public System.Collections.Generic.ICollection Releases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] + public System.Collections.Generic.ICollection RemoteIds { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("runtime")] + public int? Runtime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public double? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("spoken_languages")] + public System.Collections.Generic.ICollection Spoken_languages { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public Status Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("studios")] + public System.Collections.Generic.ICollection Studios { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("subtitleLanguages")] + public System.Collections.Generic.ICollection SubtitleLanguages { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("trailers")] + public System.Collections.Generic.ICollection Trailers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translations")] + public TranslationExtended Translations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base people record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PeopleBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public long? Score { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended people record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PeopleExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("awards")] + public System.Collections.Generic.ICollection Awards { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("biographies")] + public System.Collections.Generic.ICollection Biographies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("birth")] + public string Birth { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("birthPlace")] + public string BirthPlace { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("characters")] + public System.Collections.Generic.ICollection Characters { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("death")] + public string Death { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("gender")] + public int? Gender { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("races")] + public System.Collections.Generic.ICollection Races { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] + public System.Collections.Generic.ICollection RemoteIds { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public long? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translations")] + public TranslationExtended Translations { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// people type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PeopleType + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// race record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Race + { + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// base record info + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RecordInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// release record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Release + { + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("date")] + public string Date { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("detail")] + public string Detail { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// remote id record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RemoteID + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public long? Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("sourceName")] + public string SourceName { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// search result + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchResult + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companies")] + public System.Collections.Generic.ICollection Companies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companyType")] + public string CompanyType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("director")] + public string Director { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("first_air_time")] + public string First_air_time { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("genres")] + public System.Collections.Generic.ICollection Genres { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image_url")] + public string Image_url { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("is_official")] + public bool? Is_official { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name_translated")] + public string Name_translated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("network")] + public string Network { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("objectID")] + public string ObjectID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("officialList")] + public string OfficialList { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviews")] + public TranslationSimple Overviews { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview_translated")] + public System.Collections.Generic.ICollection Overview_translated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("poster")] + public string Poster { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("posters")] + public System.Collections.Generic.ICollection Posters { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("primary_language")] + public string Primary_language { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("remote_ids")] + public System.Collections.Generic.ICollection Remote_ids { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("studios")] + public System.Collections.Generic.ICollection Studios { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("title")] + public string Title { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thumbnail")] + public string Thumbnail { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translations")] + public TranslationSimple Translations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translationsWithLang")] + public System.Collections.Generic.ICollection TranslationsWithLang { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tvdb_id")] + public string Tvdb_id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// search by remote reuslt is a base record for a movie, series, people, season or company search result + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchByRemoteIdResult + { + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public SeriesBaseRecord Series { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("people")] + public PeopleBaseRecord People { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("movie")] + public MovieBaseRecord Movie { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episode")] + public EpisodeBaseRecord Episode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("company")] + public Company Company { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// season genre record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeasonBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageType")] + public int? ImageType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("number")] + public long? Number { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companies")] + public Companies Companies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public long? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public SeasonType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// extended season record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeasonExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("artwork")] + public System.Collections.Generic.ICollection Artwork { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companies")] + public Companies Companies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episodes")] + public System.Collections.Generic.ICollection Episodes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("imageType")] + public int? ImageType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("number")] + public long? Number { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seriesId")] + public long? SeriesId { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("trailers")] + public System.Collections.Generic.ICollection Trailers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public SeasonType Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] + public System.Collections.Generic.ICollection TagOptions { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translations")] + public System.Collections.Generic.ICollection Translations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// season type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeasonType + { + + [System.Text.Json.Serialization.JsonPropertyName("alternateName")] + public string AlternateName { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// A series airs day record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeriesAirsDays + { + + [System.Text.Json.Serialization.JsonPropertyName("friday")] + public bool? Friday { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("monday")] + public bool? Monday { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("saturday")] + public bool? Saturday { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("sunday")] + public bool? Sunday { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("thursday")] + public bool? Thursday { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tuesday")] + public bool? Tuesday { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("wednesday")] + public bool? Wednesday { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// The base record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeriesBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("averageRuntime")] + public int? AverageRuntime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("defaultSeasonType")] + public long? DefaultSeasonType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episodes")] + public System.Collections.Generic.ICollection Episodes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("firstAired")] + public string FirstAired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isOrderRandomized")] + public bool? IsOrderRandomized { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastAired")] + public string LastAired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nextAired")] + public string NextAired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalCountry")] + public string OriginalCountry { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalLanguage")] + public string OriginalLanguage { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public double? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public Status Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// The extended record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeriesExtendedRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("abbreviation")] + public string Abbreviation { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsDays")] + public SeriesAirsDays AirsDays { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("airsTime")] + public string AirsTime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("artworks")] + public System.Collections.Generic.ICollection Artworks { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("averageRuntime")] + public int? AverageRuntime { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("characters")] + public System.Collections.Generic.ICollection Characters { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("contentRatings")] + public System.Collections.Generic.ICollection ContentRatings { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("defaultSeasonType")] + public long? DefaultSeasonType { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episodes")] + public System.Collections.Generic.ICollection Episodes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("firstAired")] + public string FirstAired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lists")] + public object Lists { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("genres")] + public System.Collections.Generic.ICollection Genres { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("image")] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isOrderRandomized")] + public bool? IsOrderRandomized { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastAired")] + public string LastAired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] + public string LastUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("companies")] + public System.Collections.Generic.ICollection Companies { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("nextAired")] + public string NextAired { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalCountry")] + public string OriginalCountry { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalLanguage")] + public string OriginalLanguage { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("originalNetwork")] + public Company OriginalNetwork { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("latestNetwork")] + public Company LatestNetwork { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] + public System.Collections.Generic.ICollection RemoteIds { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("score")] + public double? Score { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasons")] + public System.Collections.Generic.ICollection Seasons { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("seasonTypes")] + public System.Collections.Generic.ICollection SeasonTypes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public Status Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tags")] + public System.Collections.Generic.ICollection Tags { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("trailers")] + public System.Collections.Generic.ICollection Trailers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("translations")] + public TranslationExtended Translations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("year")] + public string Year { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// source type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SourceType + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("postfix")] + public string Postfix { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("prefix")] + public string Prefix { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("slug")] + public string Slug { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("sort")] + public long? Sort { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// status record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Status + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("keepUpdated")] + public bool? KeepUpdated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("recordType")] + public string RecordType { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// studio record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class StudioBaseRecord + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("parentStudio")] + public int? ParentStudio { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// tag record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Tag + { + + [System.Text.Json.Serialization.JsonPropertyName("allowsMultiple")] + public bool? AllowsMultiple { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("helpText")] + public string HelpText { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("options")] + public System.Collections.Generic.ICollection Options { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// tag option record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TagOption + { + + [System.Text.Json.Serialization.JsonPropertyName("helpText")] + public string HelpText { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tag")] + public long? Tag { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagName")] + public string TagName { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// trailer record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Trailer + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("runtime")] + public int? Runtime { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// translation record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Translation + { + + [System.Text.Json.Serialization.JsonPropertyName("aliases")] + public System.Collections.Generic.ICollection Aliases { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isAlias")] + public bool? IsAlias { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("isPrimary")] + public bool? IsPrimary { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overview")] + public string Overview { get; set; } + + /// + /// Only populated for movie translations. We disallow taglines without a title. + /// + + [System.Text.Json.Serialization.JsonPropertyName("tagline")] + public string Tagline { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// translation simple record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TranslationSimple : System.Collections.Generic.Dictionary + { + + } + + /// + /// translation extended record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TranslationExtended + { + + [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] + public System.Collections.Generic.ICollection NameTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] + public System.Collections.Generic.ICollection OverviewTranslations { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("alias")] + public System.Collections.Generic.ICollection Alias { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// a entity with selected tag option + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TagOptionEntity + { + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagName")] + public string TagName { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tagId")] + public int? TagId { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// User info record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UserInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public int? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("language")] + public string Language { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Movie inspiration record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Inspiration + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("type_name")] + public string Type_name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Movie inspiration type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class InspirationType + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("description")] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("reference_name")] + public string Reference_name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("url")] + public string Url { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Production country record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ProductionCountry + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + public long? Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("country")] + public string Country { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Companies by type record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Companies + { + + [System.Text.Json.Serialization.JsonPropertyName("studio")] + public System.Collections.Generic.ICollection Studio { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("network")] + public System.Collections.Generic.ICollection Network { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("production")] + public System.Collections.Generic.ICollection Production { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("distributor")] + public System.Collections.Generic.ICollection Distributor { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("special_effects")] + public System.Collections.Generic.ICollection Special_effects { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + /// + /// Links for next, previous and current record + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Links + { + + [System.Text.Json.Serialization.JsonPropertyName("prev")] + public string Prev { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("self")] + public string Self { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("next")] + public string Next { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("total_items")] + public int? Total_items { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("page_size")] + public int? Page_size { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetEpisodeExtendedMeta + { + + [System.Runtime.Serialization.EnumMember(Value = @"translations")] + Translations = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetMovieExtendedMeta + { + + [System.Runtime.Serialization.EnumMember(Value = @"translations")] + Translations = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetMovieExtendedShort + { + + [System.Runtime.Serialization.EnumMember(Value = @"true")] + True = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"false")] + False = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetMoviesFilterGenre + { + + [System.Runtime.Serialization.EnumMember(Value = @"1")] + _1 = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"2")] + _2 = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"3")] + _3 = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"4")] + _4 = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"5")] + _5 = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"6")] + _6 = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"7")] + _7 = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"8")] + _8 = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"9")] + _9 = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"10")] + _10 = 9, + + [System.Runtime.Serialization.EnumMember(Value = @"11")] + _11 = 10, + + [System.Runtime.Serialization.EnumMember(Value = @"12")] + _12 = 11, + + [System.Runtime.Serialization.EnumMember(Value = @"13")] + _13 = 12, + + [System.Runtime.Serialization.EnumMember(Value = @"14")] + _14 = 13, + + [System.Runtime.Serialization.EnumMember(Value = @"15")] + _15 = 14, + + [System.Runtime.Serialization.EnumMember(Value = @"16")] + _16 = 15, + + [System.Runtime.Serialization.EnumMember(Value = @"17")] + _17 = 16, + + [System.Runtime.Serialization.EnumMember(Value = @"18")] + _18 = 17, + + [System.Runtime.Serialization.EnumMember(Value = @"19")] + _19 = 18, + + [System.Runtime.Serialization.EnumMember(Value = @"21")] + _21 = 19, + + [System.Runtime.Serialization.EnumMember(Value = @"22")] + _22 = 20, + + [System.Runtime.Serialization.EnumMember(Value = @"23")] + _23 = 21, + + [System.Runtime.Serialization.EnumMember(Value = @"24")] + _24 = 22, + + [System.Runtime.Serialization.EnumMember(Value = @"25")] + _25 = 23, + + [System.Runtime.Serialization.EnumMember(Value = @"26")] + _26 = 24, + + [System.Runtime.Serialization.EnumMember(Value = @"27")] + _27 = 25, + + [System.Runtime.Serialization.EnumMember(Value = @"28")] + _28 = 26, + + [System.Runtime.Serialization.EnumMember(Value = @"29")] + _29 = 27, + + [System.Runtime.Serialization.EnumMember(Value = @"30")] + _30 = 28, + + [System.Runtime.Serialization.EnumMember(Value = @"31")] + _31 = 29, + + [System.Runtime.Serialization.EnumMember(Value = @"32")] + _32 = 30, + + [System.Runtime.Serialization.EnumMember(Value = @"33")] + _33 = 31, + + [System.Runtime.Serialization.EnumMember(Value = @"34")] + _34 = 32, + + [System.Runtime.Serialization.EnumMember(Value = @"35")] + _35 = 33, + + [System.Runtime.Serialization.EnumMember(Value = @"36")] + _36 = 34, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetMoviesFilterSort + { + + [System.Runtime.Serialization.EnumMember(Value = @"score")] + Score = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"firstAired")] + FirstAired = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"name")] + Name = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetMoviesFilterStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"1")] + _1 = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"2")] + _2 = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"3")] + _3 = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetPeopleExtendedMeta + { + + [System.Runtime.Serialization.EnumMember(Value = @"translations")] + Translations = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetSeriesExtendedMeta + { + + [System.Runtime.Serialization.EnumMember(Value = @"translations")] + Translations = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"episodes")] + Episodes = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetSeriesExtendedShort + { + + [System.Runtime.Serialization.EnumMember(Value = @"true")] + True = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"false")] + False = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetSeriesFilterGenre + { + + [System.Runtime.Serialization.EnumMember(Value = @"1")] + _1 = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"2")] + _2 = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"3")] + _3 = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"4")] + _4 = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"5")] + _5 = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"6")] + _6 = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"7")] + _7 = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"8")] + _8 = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"9")] + _9 = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"10")] + _10 = 9, + + [System.Runtime.Serialization.EnumMember(Value = @"11")] + _11 = 10, + + [System.Runtime.Serialization.EnumMember(Value = @"12")] + _12 = 11, + + [System.Runtime.Serialization.EnumMember(Value = @"13")] + _13 = 12, + + [System.Runtime.Serialization.EnumMember(Value = @"14")] + _14 = 13, + + [System.Runtime.Serialization.EnumMember(Value = @"15")] + _15 = 14, + + [System.Runtime.Serialization.EnumMember(Value = @"16")] + _16 = 15, + + [System.Runtime.Serialization.EnumMember(Value = @"17")] + _17 = 16, + + [System.Runtime.Serialization.EnumMember(Value = @"18")] + _18 = 17, + + [System.Runtime.Serialization.EnumMember(Value = @"19")] + _19 = 18, + + [System.Runtime.Serialization.EnumMember(Value = @"21")] + _21 = 19, + + [System.Runtime.Serialization.EnumMember(Value = @"22")] + _22 = 20, + + [System.Runtime.Serialization.EnumMember(Value = @"23")] + _23 = 21, + + [System.Runtime.Serialization.EnumMember(Value = @"24")] + _24 = 22, + + [System.Runtime.Serialization.EnumMember(Value = @"25")] + _25 = 23, + + [System.Runtime.Serialization.EnumMember(Value = @"26")] + _26 = 24, + + [System.Runtime.Serialization.EnumMember(Value = @"27")] + _27 = 25, + + [System.Runtime.Serialization.EnumMember(Value = @"28")] + _28 = 26, + + [System.Runtime.Serialization.EnumMember(Value = @"29")] + _29 = 27, + + [System.Runtime.Serialization.EnumMember(Value = @"30")] + _30 = 28, + + [System.Runtime.Serialization.EnumMember(Value = @"31")] + _31 = 29, + + [System.Runtime.Serialization.EnumMember(Value = @"32")] + _32 = 30, + + [System.Runtime.Serialization.EnumMember(Value = @"33")] + _33 = 31, + + [System.Runtime.Serialization.EnumMember(Value = @"34")] + _34 = 32, + + [System.Runtime.Serialization.EnumMember(Value = @"35")] + _35 = 33, + + [System.Runtime.Serialization.EnumMember(Value = @"36")] + _36 = 34, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetSeriesFilterSort + { + + [System.Runtime.Serialization.EnumMember(Value = @"score")] + Score = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"firstAired")] + FirstAired = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"lastAired")] + LastAired = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"name")] + Name = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetSeriesFilterSortType + { + + [System.Runtime.Serialization.EnumMember(Value = @"asc")] + Asc = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"desc")] + Desc = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum GetSeriesFilterStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"1")] + _1 = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"2")] + _2 = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"3")] + _3 = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdatesType + { + + [System.Runtime.Serialization.EnumMember(Value = @"artwork")] + Artwork = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"award_nominees")] + Award_nominees = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"companies")] + Companies = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"episodes")] + Episodes = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"lists")] + Lists = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"people")] + People = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"seasons")] + Seasons = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"series")] + Series = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"seriespeople")] + Seriespeople = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"artworktypes")] + Artworktypes = 9, + + [System.Runtime.Serialization.EnumMember(Value = @"award_categories")] + Award_categories = 10, + + [System.Runtime.Serialization.EnumMember(Value = @"awards")] + Awards = 11, + + [System.Runtime.Serialization.EnumMember(Value = @"company_types")] + Company_types = 12, + + [System.Runtime.Serialization.EnumMember(Value = @"content_ratings")] + Content_ratings = 13, + + [System.Runtime.Serialization.EnumMember(Value = @"countries")] + Countries = 14, + + [System.Runtime.Serialization.EnumMember(Value = @"entity_types")] + Entity_types = 15, + + [System.Runtime.Serialization.EnumMember(Value = @"genres")] + Genres = 16, + + [System.Runtime.Serialization.EnumMember(Value = @"languages")] + Languages = 17, + + [System.Runtime.Serialization.EnumMember(Value = @"movies")] + Movies = 18, + + [System.Runtime.Serialization.EnumMember(Value = @"movie_genres")] + Movie_genres = 19, + + [System.Runtime.Serialization.EnumMember(Value = @"movie_status")] + Movie_status = 20, + + [System.Runtime.Serialization.EnumMember(Value = @"peopletypes")] + Peopletypes = 21, + + [System.Runtime.Serialization.EnumMember(Value = @"seasontypes")] + Seasontypes = 22, + + [System.Runtime.Serialization.EnumMember(Value = @"sourcetypes")] + Sourcetypes = 23, + + [System.Runtime.Serialization.EnumMember(Value = @"tag_options")] + Tag_options = 24, + + [System.Runtime.Serialization.EnumMember(Value = @"tags")] + Tags = 25, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedcharacters")] + Translatedcharacters = 26, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedcompanies")] + Translatedcompanies = 27, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedepisodes")] + Translatedepisodes = 28, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedlists")] + Translatedlists = 29, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedmovies")] + Translatedmovies = 30, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedpeople")] + Translatedpeople = 31, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedseasons")] + Translatedseasons = 32, + + [System.Runtime.Serialization.EnumMember(Value = @"translatedserierk")] + Translatedserierk = 33, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdatesAction + { + + [System.Runtime.Serialization.EnumMember(Value = @"delete")] + Delete = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"update")] + Update = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body + { + + [System.Text.Json.Serialization.JsonPropertyName("apikey")] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Apikey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("pin")] + public string Pin { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Data Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response2 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public ArtworkBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response3 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public ArtworkExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response4 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response5 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response6 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response7 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public AwardBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response8 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public AwardExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response9 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public AwardCategoryBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response10 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public AwardCategoryExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response11 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Character Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response12 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response13 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response14 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Company Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response15 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response16 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response17 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response18 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response19 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public EpisodeBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response20 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public EpisodeExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response21 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Translation Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response22 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response23 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response24 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public GenreBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response25 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response26 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response27 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response28 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public ListBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response29 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public ListBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response30 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public ListExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response31 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response32 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response33 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public MovieBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response34 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public MovieExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response35 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response36 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public MovieBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response37 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Translation Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response38 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response39 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response40 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public PeopleBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response41 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public PeopleExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response42 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Translation Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response43 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response44 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response45 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response46 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response47 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeasonBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response48 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeasonExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response49 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response50 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Translation Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response51 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response52 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeriesBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response53 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeriesExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response54 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeriesBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response55 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeriesExtendedRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response56 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Data2 Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response57 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Data3 Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response58 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response59 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public SeriesBaseRecord Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response60 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Translation Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response61 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response62 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response63 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public System.Collections.Generic.ICollection Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response64 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public object Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response65 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public object Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response66 + { + + [System.Text.Json.Serialization.JsonPropertyName("data")] + public object Data { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Data + { + + [System.Text.Json.Serialization.JsonPropertyName("token")] + public string Token { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Data2 + { + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public SeriesBaseRecord Series { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("episodes")] + public System.Collections.Generic.ICollection Episodes { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Data3 + { + + [System.Text.Json.Serialization.JsonPropertyName("series")] + public SeriesBaseRecord Series { get; set; } + + private System.Collections.Generic.IDictionary _additionalProperties; + + [System.Text.Json.Serialization.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } + set { _additionalProperties = value; } + } + + } + + +} + +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 +#pragma warning restore 1573 +#pragma warning restore 1591 +#pragma warning restore 8073 +#pragma warning restore 3016 +#pragma warning restore 8603 +#pragma warning restore 8604 +#pragma warning restore 8625 diff --git a/src/TvdbClient/Clients/ILoginClient.cs b/src/TvdbClient/Clients/ILoginClient.cs deleted file mode 100644 index 829a976..0000000 --- a/src/TvdbClient/Clients/ILoginClient.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Tvdb.Models; - -namespace Tvdb.Clients; - -public interface ILoginClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// create an auth token. The token has one month validation length. - /// - /// response - /// A server side error occurred. - Task> LoginAsync(LoginRequestBody body, CancellationToken cancellationToken = default); - -} \ No newline at end of file diff --git a/src/TvdbClient/Clients/ITvdbClient.cs b/src/TvdbClient/Clients/ITvdbClient.cs index 8a3c5bf..1eb8c50 100644 --- a/src/TvdbClient/Clients/ITvdbClient.cs +++ b/src/TvdbClient/Clients/ITvdbClient.cs @@ -1,3 +1,9 @@ -namespace Tvdb.Clients; - -public interface ITvdbClient; \ No newline at end of file +namespace Tvdb.Clients; + +/// +/// Marker interface implemented by every generated TheTVDB client, used by the +/// DI bootstrapper to discover and register them. +/// +public interface ITvdbClient +{ +} diff --git a/src/TvdbClient/Clients/Interfaces.cs b/src/TvdbClient/Clients/Interfaces.cs deleted file mode 100644 index eb77db3..0000000 --- a/src/TvdbClient/Clients/Interfaces.cs +++ /dev/null @@ -1,796 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tvdb.Models; -using Tvdb.Types; - -namespace Tvdb.Clients; - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IArtworkClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single artwork base record. - /// - /// id - /// response - /// A server side error occurred. - Task ArtworkAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single artwork extended record. - /// - /// id - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IArtwork_StatusesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns list of artwork status records. - /// - /// response - /// A server side error occurred. - Task StatusesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IArtwork_TypesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of artworkType records - /// - /// response - /// A server side error occurred. - Task TypesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IAwardsClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of award base records - /// - /// response - /// A server side error occurred. - Task AwardsGetAsync(CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award base record - /// - /// id - /// response - /// A server side error occurred. - Task AwardsGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award extended record - /// - /// id - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IAward_CategoriesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award category base record - /// - /// id - /// response - /// A server side error occurred. - Task CategoriesAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award category extended record - /// - /// id - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ICharactersClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns character base record - /// - /// id - /// response - /// A server side error occurred. - Task CharactersAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ICompaniesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns a paginated list of company records - /// - /// name - /// response - /// A server side error occurred. - Task CompaniesGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns all company type records - /// - /// response - /// A server side error occurred. - Task TypesAsync(CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns a company record - /// - /// id - /// response - /// A server side error occurred. - Task CompaniesGetAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IContent_RatingsClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list content rating records - /// - /// response - /// A server side error occurred. - Task RatingsAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ICountriesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of country records - /// - /// response - /// A server side error occurred. - Task CountriesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IEntity_TypesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns the active entity types - /// - /// response - /// A server side error occurred. - Task EntitiesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IEpisodesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of episodes base records with the basic attributes.<br> Note that all episodes are returned, even those that may not be included in a series' default season order. - /// - /// page number - /// response - /// A server side error occurred. - Task EpisodesGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns episode base record - /// - /// id - /// response - /// A server side error occurred. - Task EpisodesGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns episode extended record - /// - /// id - /// meta - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, EpisodesMeta? meta = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns episode translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - Task TranslationsAsync(double id, string language, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IGendersClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of gender records - /// - /// response - /// A server side error occurred. - Task GendersAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IGenresClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of genre records - /// - /// response - /// A server side error occurred. - Task GenresGetAsync(CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns genre record - /// - /// id - /// response - /// A server side error occurred. - Task GenresGetAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IInspirationTypesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of inspiration types records - /// - /// response - /// A server side error occurred. - Task TypesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ILanguagesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of language records - /// - /// response - /// A server side error occurred. - Task LanguagesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IListsClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of list base records - /// - /// page number - /// response - /// A server side error occurred. - Task ListsGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns an list base record - /// - /// id - /// response - /// A server side error occurred. - Task ListsGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns an list base record search by slug - /// - /// slug - /// response - /// A server side error occurred. - Task SlugAsync(string slug, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns a list extended record - /// - /// id - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns list translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - Task TranslationsAsync(double id, string language, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IMoviesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of movie base records - /// - /// page number - /// response - /// A server side error occurred. - Task MoviesGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie base record - /// - /// id - /// response - /// A server side error occurred. - Task MoviesGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie extended record - /// - /// id - /// meta - /// reduce the payload and returns the short version of this record without characters, artworks and trailers. - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, MoviesMeta? meta = null, bool? @short = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Search movies based on filter parameters - /// - /// country of origin - /// original language - /// production company - /// content rating id base on a country - /// genre - /// sort by results - /// status - /// release year - /// response - /// A server side error occurred. - Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, MovieSort? sort = null, double? status = null, double? year = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie base record search by slug - /// - /// slug - /// response - /// A server side error occurred. - Task SlugAsync(string slug, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - Task TranslationsAsync(double id, string language, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IMovie_StatusesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of status records - /// - /// response - /// A server side error occurred. - Task StatusesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IPeopleClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of people base records with the basic attributes. - /// - /// page number - /// response - /// A server side error occurred. - Task PeopleGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns people base record - /// - /// id - /// response - /// A server side error occurred. - Task PeopleGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns people extended record - /// - /// id - /// meta - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, PeopleMeta? meta = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns people translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - Task TranslationsAsync(double id, string language, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IPeople_TypesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of peopleType records - /// - /// response - /// A server side error occurred. - Task TypesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ISearchClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Our search index includes series, movies, people, and companies. Search is limited to 5k results max. - /// - /// The primary search string, which can include the main title for a record including all translations and aliases. - /// Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. - /// Restrict results to a specific entity type. Can be movie, series, person, or company. - /// Restrict results to a specific year. Currently only used for series and movies. - /// Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". - /// Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. - /// Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". - /// Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. - /// Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. - /// Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. - /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - /// Offset results. - /// Limit results. - /// response - /// A server side error occurred. - Task SearchAsync(string query = null, string q = null, string type = null, double? year = null, string company = null, string country = null, string director = null, string language = null, string primaryType = null, string network = null, string remote_id = null, double? offset = null, double? limit = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. - /// - /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - /// response - /// A server side error occurred. - Task RemoteidAsync(string remoteId, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ISeasonsClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of seasons base records - /// - /// page number - /// response - /// A server side error occurred. - Task SeasonsGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season base record - /// - /// id - /// response - /// A server side error occurred. - Task SeasonsGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season extended record - /// - /// id - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season type records - /// - /// response - /// A server side error occurred. - Task TypesAsync(CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - Task TranslationsAsync(double id, string language, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ISeriesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of series base records - /// - /// page number - /// response - /// A server side error occurred. - Task SeriesGetAsync(double? page = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record - /// - /// id - /// response - /// A server side error occurred. - Task SeriesGetAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series artworks base on language and type. <br> Note&#58; Artwork type is an id that can be found using **/artwork/types** endpoint. - /// - /// id - /// lang - /// type - /// response - /// A server side error occurred. - Task ArtworksAsync(double id, string lang = null, int? type = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record including the nextAired field. <br> Note&#58; nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. - /// - /// id - /// response - /// A server side error occurred. - Task NextAiredAsync(double id, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series extended record - /// - /// id - /// meta - /// reduce the payload and returns the short version of this record without characters and artworks - /// response - /// A server side error occurred. - Task ExtendedAsync(double id, SeriesMeta? meta = null, bool? @short = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series episodes from the specified season type, default returns the episodes in the series default season type - /// - /// id - /// season-type - /// airDate of the episode, format is yyyy-mm-dd - /// response - /// A server side error occurred. - Task EpisodesGetAsync(int page, double id, string season_type, int? season = null, int? episodeNumber = null, string airDate = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. - /// - /// id - /// season-type - /// response - /// A server side error occurred. - Task EpisodesGetAsync(int page, double id, string season_type, string lang, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Search series based on filter parameters - /// - /// country of origin - /// original language - /// production company - /// content rating id base on a country - /// Genre id. This id can be found using **/genres** endpoint. - /// sort by results - /// sort type ascending or descending - /// status - /// release year - /// response - /// A server side error occurred. - Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, SeriesSort? sort = null, SortType? sortType = null, double? status = null, double? year = null, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record searched by slug - /// - /// slug - /// response - /// A server side error occurred. - Task SlugAsync(string slug, CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - Task TranslationsAsync(double id, string language, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ISeries_StatusesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of status records - /// - /// response - /// A server side error occurred. - Task StatusesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface ISource_TypesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of sourceType records - /// - /// response - /// A server side error occurred. - Task TypesAsync(CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IUpdatesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. - /// - /// name - /// response - /// A server side error occurred. - Task UpdatesAsync(double since, UpdateEntity? type = null, UpdateAction? action = null, double? page = null, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IUser_infoClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns user info - /// - /// response - /// A server side error occurred. - Task UserGetAsync(CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns user info by user id - /// - /// id - /// response - /// A server side error occurred. - Task UserGetAsync(double id, CancellationToken cancellationToken = default); - -} - -[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] -public partial interface IFavoritesClient : ITvdbClient -{ - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns user favorites - /// - /// response - /// A server side error occurred. - Task FavoritesGetAsync(CancellationToken cancellationToken = default); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// creates a new user favorite - /// - /// Ok - /// A server side error occurred. - Task FavoritesPostAsync(FavoriteRecord body = null, CancellationToken cancellationToken = default); - -} \ No newline at end of file diff --git a/src/TvdbClient/Clients/TvdbClient.cs b/src/TvdbClient/Clients/TvdbClient.cs index 441902b..589124a 100644 --- a/src/TvdbClient/Clients/TvdbClient.cs +++ b/src/TvdbClient/Clients/TvdbClient.cs @@ -1,10488 +1,11296 @@ -//---------------------- -// -// Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) -// -//---------------------- - -using Tvdb.Models; -using System; -using Tvdb.Types; -using System.Diagnostics.CodeAnalysis; - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" -#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" -#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" -#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." - -namespace Tvdb.Clients -{ - using System = global::System; - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class LoginClient : ILoginClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public LoginClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// create an auth token. The token has one month validation length. - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> LoginAsync(LoginRequestBody body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "login" - urlBuilder_.Append("login"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("invalid credentials", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ArtworkClient : IArtworkClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public ArtworkClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single artwork base record. - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ArtworkAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "artwork/{id}" - urlBuilder_.Append("artwork/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid artwork id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Artwork not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single artwork extended record. - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "artwork/{id}/extended" - urlBuilder_.Append("artwork/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid artwork id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Artwork not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Artwork_StatusesClient : IArtwork_StatusesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Artwork_StatusesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns list of artwork status records. - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "artwork/statuses" - urlBuilder_.Append("artwork/statuses"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Artwork_TypesClient : IArtwork_TypesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Artwork_TypesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of artworkType records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "artwork/types" - urlBuilder_.Append("artwork/types"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class AwardsClient : IAwardsClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public AwardsClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of award base records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AwardsGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "awards" - urlBuilder_.Append("awards"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task AwardsGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "awards/{id}" - urlBuilder_.Append("awards/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid awards id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Awards not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award extended record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "awards/{id}/extended" - urlBuilder_.Append("awards/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid awards id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Awards not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Award_CategoriesClient : IAward_CategoriesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Award_CategoriesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award category base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CategoriesAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "awards/categories/{id}" - urlBuilder_.Append("awards/categories/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid category id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Category not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a single award category extended record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "awards/categories/{id}/extended" - urlBuilder_.Append("awards/categories/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid category id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Category not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CharactersClient : ICharactersClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public CharactersClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns character base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CharactersAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "characters/{id}" - urlBuilder_.Append("characters/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid character id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Character not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CompaniesClient : ICompaniesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public CompaniesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns a paginated list of company records - /// - /// name - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CompaniesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "companies" - urlBuilder_.Append("companies"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns all company type records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "companies/types" - urlBuilder_.Append("companies/types"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns a company record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CompaniesGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "companies/{id}" - urlBuilder_.Append("companies/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid company id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Company not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Content_RatingsClient : IContent_RatingsClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Content_RatingsClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list content rating records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task RatingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "content/ratings" - urlBuilder_.Append("content/ratings"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class CountriesClient : ICountriesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public CountriesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of country records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CountriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "countries" - urlBuilder_.Append("countries"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Entity_TypesClient : IEntity_TypesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Entity_TypesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns the active entity types - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EntitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "entities" - urlBuilder_.Append("entities"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class EpisodesClient : IEpisodesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public EpisodesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of episodes base records with the basic attributes.<br> Note that all episodes are returned, even those that may not be included in a series' default season order. - /// - /// page number - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EpisodesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "episodes" - urlBuilder_.Append("episodes"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns episode base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EpisodesGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "episodes/{id}" - urlBuilder_.Append("episodes/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid episode id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Episode not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns episode extended record - /// - /// id - /// meta - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, EpisodesMeta? meta = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "episodes/{id}/extended" - urlBuilder_.Append("episodes/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - urlBuilder_.Append('?'); - if (meta != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid episode id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Episode not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns episode translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TranslationsAsync(double id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (language == null) - throw new System.ArgumentNullException("language"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "episodes/{id}/translations/{language}" - urlBuilder_.Append("episodes/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/translations/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid episode id. Invalid language.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Episode not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GendersClient : IGendersClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public GendersClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of gender records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task GendersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "genders" - urlBuilder_.Append("genders"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class GenresClient : IGenresClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public GenresClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of genre records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task GenresGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "genres" - urlBuilder_.Append("genres"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns genre record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task GenresGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "genres/{id}" - urlBuilder_.Append("genres/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid genre id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Genre not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class InspirationTypesClient : IInspirationTypesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public InspirationTypesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of inspiration types records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "inspiration/types" - urlBuilder_.Append("inspiration/types"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class LanguagesClient : ILanguagesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public LanguagesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of language records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task LanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "languages" - urlBuilder_.Append("languages"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class ListsClient : IListsClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public ListsClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of list base records - /// - /// page number - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ListsGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "lists" - urlBuilder_.Append("lists"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns an list base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ListsGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "lists/{id}" - urlBuilder_.Append("lists/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid list id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("List not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns an list base record search by slug - /// - /// slug - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (slug == null) - throw new System.ArgumentNullException("slug"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "lists/slug/{slug}" - urlBuilder_.Append("lists/slug/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(slug, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid list slug", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("List not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns a list extended record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "lists/{id}/extended" - urlBuilder_.Append("lists/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid list id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Lists not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns list translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TranslationsAsync(double id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (language == null) - throw new System.ArgumentNullException("language"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "lists/{id}/translations/{language}" - urlBuilder_.Append("lists/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/translations/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid lists id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Lists not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class MoviesClient : IMoviesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public MoviesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of movie base records - /// - /// page number - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task MoviesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies" - urlBuilder_.Append("movies"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task MoviesGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies/{id}" - urlBuilder_.Append("movies/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid movie id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Movie not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie extended record - /// - /// id - /// meta - /// reduce the payload and returns the short version of this record without characters, artworks and trailers. - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, MoviesMeta? meta = null, bool? @short = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies/{id}/extended" - urlBuilder_.Append("movies/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - urlBuilder_.Append('?'); - if (meta != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (@short != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("short")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(@short, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid movie id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Movie not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Search movies based on filter parameters - /// - /// country of origin - /// original language - /// production company - /// content rating id base on a country - /// genre - /// sort by results - /// status - /// release year - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, MovieSort? sort = null, double? status = null, double? year = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (country == null) - throw new System.ArgumentNullException("country"); - - if (lang == null) - throw new System.ArgumentNullException("lang"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies/filter" - urlBuilder_.Append("movies/filter"); - urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("country")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(country, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - urlBuilder_.Append(System.Uri.EscapeDataString("lang")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - if (company != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("company")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(company, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (contentRating != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("contentRating")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(contentRating, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (genre != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("genre")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(genre, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (sort != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("sort")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (status != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("status")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (year != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("year")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(year, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid format parameter.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie base record search by slug - /// - /// slug - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (slug == null) - throw new System.ArgumentNullException("slug"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies/slug/{slug}" - urlBuilder_.Append("movies/slug/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(slug, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid movie slug", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Movie not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns movie translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TranslationsAsync(double id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (language == null) - throw new System.ArgumentNullException("language"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies/{id}/translations/{language}" - urlBuilder_.Append("movies/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/translations/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid movie id, invalid language.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Movie not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Movie_StatusesClient : IMovie_StatusesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Movie_StatusesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of status records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "movies/statuses" - urlBuilder_.Append("movies/statuses"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class PeopleClient : IPeopleClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public PeopleClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a list of people base records with the basic attributes. - /// - /// page number - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task PeopleGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "people" - urlBuilder_.Append("people"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns people base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task PeopleGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "people/{id}" - urlBuilder_.Append("people/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid people id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("People not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns people extended record - /// - /// id - /// meta - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, PeopleMeta? meta = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "people/{id}/extended" - urlBuilder_.Append("people/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - urlBuilder_.Append('?'); - if (meta != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid people id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("People not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns people translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TranslationsAsync(double id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (language == null) - throw new System.ArgumentNullException("language"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "people/{id}/translations/{language}" - urlBuilder_.Append("people/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/translations/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid people id, invalid language.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("People not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class People_TypesClient : IPeople_TypesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public People_TypesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of peopleType records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "people/types" - urlBuilder_.Append("people/types"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SearchClient : ISearchClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public SearchClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Our search index includes series, movies, people, and companies. Search is limited to 5k results max. - /// - /// The primary search string, which can include the main title for a record including all translations and aliases. - /// Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. - /// Restrict results to a specific entity type. Can be movie, series, person, or company. - /// Restrict results to a specific year. Currently only used for series and movies. - /// Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". - /// Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. - /// Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". - /// Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. - /// Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. - /// Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. - /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - /// Offset results. - /// Limit results. - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SearchAsync(string query = null, string q = null, string type = null, double? year = null, string company = null, string country = null, string director = null, string language = null, string primaryType = null, string network = null, string remote_id = null, double? offset = null, double? limit = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "search" - urlBuilder_.Append("search"); - urlBuilder_.Append('?'); - if (query != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("query")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (q != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("q")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(q, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (type != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("type")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (year != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("year")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(year, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (company != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("company")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(company, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (country != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("country")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(country, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (director != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("director")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(director, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (language != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("language")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (primaryType != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("primaryType")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(primaryType, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (network != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("network")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(network, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (remote_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("remote_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(remote_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (offset != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (limit != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Max results overflow", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. - /// - /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task RemoteidAsync(string remoteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (remoteId == null) - throw new System.ArgumentNullException("remoteId"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "search/remoteid/{remoteId}" - urlBuilder_.Append("search/remoteid/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(remoteId, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SeasonsClient : ISeasonsClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public SeasonsClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of seasons base records - /// - /// page number - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SeasonsGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "seasons" - urlBuilder_.Append("seasons"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SeasonsGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "seasons/{id}" - urlBuilder_.Append("seasons/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid season id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Season not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season extended record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "seasons/{id}/extended" - urlBuilder_.Append("seasons/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid seasons id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Season not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season type records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "seasons/types" - urlBuilder_.Append("seasons/types"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns season translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TranslationsAsync(double id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (language == null) - throw new System.ArgumentNullException("language"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "seasons/{id}/translations/{language}" - urlBuilder_.Append("seasons/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/translations/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid season id, language not found.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Season not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class SeriesClient : ISeriesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public SeriesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of series base records - /// - /// page number - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SeriesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series" - urlBuilder_.Append("series"); - urlBuilder_.Append('?'); - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SeriesGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series artworks base on language and type. <br> Note&#58; Artwork type is an id that can be found using **/artwork/types** endpoint. - /// - /// id - /// lang - /// type - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ArtworksAsync(double id, string lang = null, int? type = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}/artworks" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/artworks"); - urlBuilder_.Append('?'); - if (lang != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("lang")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (type != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("type")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record including the nextAired field. <br> Note&#58; nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task NextAiredAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}/nextAired" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/nextAired"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series extended record - /// - /// id - /// meta - /// reduce the payload and returns the short version of this record without characters and artworks - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ExtendedAsync(double id, SeriesMeta? meta = null, bool? @short = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}/extended" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/extended"); - urlBuilder_.Append('?'); - if (meta != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (@short != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("short")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(@short, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series episodes from the specified season type, default returns the episodes in the series default season type - /// - /// id - /// season-type - /// airDate of the episode, format is yyyy-mm-dd - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EpisodesGetAsync(int page, double id, string season_type, int? season = null, int? episodeNumber = null, string airDate = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (season_type == null) - throw new System.ArgumentNullException("season_type"); - - if (page == null) - throw new System.ArgumentNullException("page"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}/episodes/{season-type}" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/episodes/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(season_type, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - if (season != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("season")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(season, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (episodeNumber != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("episodeNumber")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(episodeNumber, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (airDate != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("airDate")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(airDate, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id, episodeNumber is not null then season must be present", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. - /// - /// id - /// season-type - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task EpisodesGetAsync(int page, double id, string season_type, string lang, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (season_type == null) - throw new System.ArgumentNullException("season_type"); - - if (lang == null) - throw new System.ArgumentNullException("lang"); - - if (page == null) - throw new System.ArgumentNullException("page"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}/episodes/{season-type}/{lang}" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/episodes/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(season_type, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('/'); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id, invalid language.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Search series based on filter parameters - /// - /// country of origin - /// original language - /// production company - /// content rating id base on a country - /// Genre id. This id can be found using **/genres** endpoint. - /// sort by results - /// sort type ascending or descending - /// status - /// release year - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, SeriesSort? sort = null, SortType? sortType = null, double? status = null, double? year = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (country == null) - throw new System.ArgumentNullException("country"); - - if (lang == null) - throw new System.ArgumentNullException("lang"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/filter" - urlBuilder_.Append("series/filter"); - urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("country")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(country, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - urlBuilder_.Append(System.Uri.EscapeDataString("lang")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - if (company != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("company")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(company, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (contentRating != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("contentRating")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(contentRating, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (genre != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("genre")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(genre, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (sort != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("sort")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (sortType != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("sortType")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sortType, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (status != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("status")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (year != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("year")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(year, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid format parameter.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series base record searched by slug - /// - /// slug - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (slug == null) - throw new System.ArgumentNullException("slug"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/slug/{slug}" - urlBuilder_.Append("series/slug/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(slug, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series slug", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns series translation record - /// - /// id - /// language - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TranslationsAsync(double id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - if (language == null) - throw new System.ArgumentNullException("language"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/{id}/translations/{language}" - urlBuilder_.Append("series/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - urlBuilder_.Append("/translations/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid series id, invalid language.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - if (status_ == 404) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Series not found", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Series_StatusesClient : ISeries_StatusesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Series_StatusesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of status records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "series/statuses" - urlBuilder_.Append("series/statuses"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class Source_TypesClient : ISource_TypesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public Source_TypesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns list of sourceType records - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "sources/types" - urlBuilder_.Append("sources/types"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class UpdatesClient : IUpdatesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public UpdatesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. - /// - /// name - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UpdatesAsync(double since, UpdateEntity? type = null, UpdateAction? action = null, double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (since == null) - throw new System.ArgumentNullException("since"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "updates" - urlBuilder_.Append("updates"); - urlBuilder_.Append('?'); - urlBuilder_.Append(System.Uri.EscapeDataString("since")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - if (type != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("type")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (action != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("action")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(action, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - if (page != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); - } - urlBuilder_.Length--; - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Invalid since, type param.", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class User_infoClient : IUser_infoClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public User_infoClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns user info - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "user" - urlBuilder_.Append("user"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns user info by user id - /// - /// id - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task UserGetAsync(double id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "user/{id}" - urlBuilder_.Append("user/"); - urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [ExcludeFromCodeCoverage] - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] - public partial class FavoritesClient : IFavoritesClient - { - private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; - - #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public FavoritesClient(System.Net.Http.HttpClient httpClient) - #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - { - _httpClient = httpClient; - Initialize(); - } - - private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() - { - var settings = new System.Text.Json.JsonSerializerOptions(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); - - partial void Initialize(); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// returns user favorites - /// - /// response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task FavoritesGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "user/favorites" - urlBuilder_.Append("user/favorites"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// creates a new user favorite - /// - /// Ok - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task FavoritesPostAsync(FavoriteRecord body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - - var urlBuilder_ = new System.Text.StringBuilder(); - - // Operation Path: "user/favorites" - urlBuilder_.Append("user/favorites"); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = new System.Collections.Generic.Dictionary>(); - foreach (var item_ in response_.Headers) - headers_[item_.Key] = item_.Value; - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 200) - { - return; - } - else - if (status_ == 400) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Bad format", status_, responseText_, headers_, null); - } - else - if (status_ == 401) - { - string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("Unauthorized", status_, responseText_, headers_, null); - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - { - var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (System.Text.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value is string[]) - { - return string.Join(",", (string[])value); - } - else if (value.GetType().IsArray) - { - var valueArray = (System.Array)value; - var valueTextArray = new string[valueArray.Length]; - for (var i = 0; i < valueArray.Length; i++) - { - valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); - } - return string.Join(",", valueTextArray); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - -} - -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 -#pragma warning restore 1573 -#pragma warning restore 1591 -#pragma warning restore 8073 -#pragma warning restore 3016 -#pragma warning restore 8603 -#pragma warning restore 8604 -#pragma warning restore 8625 \ No newline at end of file +//---------------------- +// +// Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +using Tvdb.Models; + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" +#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" +#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" +#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." + +namespace Tvdb.Clients +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ILoginClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// create an auth token. The token has one month validation length. + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task LoginAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LoginClient : ILoginClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public LoginClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// create an auth token. The token has one month validation length. + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task LoginAsync(Body body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "login" + urlBuilder_.Append("login"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("invalid credentials", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IArtworkClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single artwork base record. + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ArtworkAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single artwork extended record. + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ArtworkClient : IArtworkClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public ArtworkClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single artwork base record. + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ArtworkAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "artwork/{id}" + urlBuilder_.Append("artwork/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid artwork id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Artwork not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single artwork extended record. + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "artwork/{id}/extended" + urlBuilder_.Append("artwork/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid artwork id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Artwork not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IArtwork_StatusesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns list of artwork status records. + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Artwork_StatusesClient : IArtwork_StatusesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Artwork_StatusesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns list of artwork status records. + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "artwork/statuses" + urlBuilder_.Append("artwork/statuses"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IArtwork_TypesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of artworkType records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Artwork_TypesClient : IArtwork_TypesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Artwork_TypesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of artworkType records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "artwork/types" + urlBuilder_.Append("artwork/types"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IAwardsClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of award base records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task AwardsGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task AwardsGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award extended record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AwardsClient : IAwardsClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public AwardsClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of award base records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AwardsGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "awards" + urlBuilder_.Append("awards"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task AwardsGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "awards/{id}" + urlBuilder_.Append("awards/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid awards id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Awards not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award extended record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "awards/{id}/extended" + urlBuilder_.Append("awards/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid awards id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Awards not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IAward_CategoriesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award category base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task CategoriesAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award category extended record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Award_CategoriesClient : IAward_CategoriesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Award_CategoriesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award category base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CategoriesAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "awards/categories/{id}" + urlBuilder_.Append("awards/categories/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid category id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Category not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a single award category extended record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "awards/categories/{id}/extended" + urlBuilder_.Append("awards/categories/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid category id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Category not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ICharactersClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns character base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task CharactersAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CharactersClient : ICharactersClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public CharactersClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns character base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CharactersAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "characters/{id}" + urlBuilder_.Append("characters/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid character id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Character not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ICompaniesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns a paginated list of company records + /// + /// name + /// response + /// A server side error occurred. + System.Threading.Tasks.Task CompaniesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns all company type records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns a company record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task CompaniesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CompaniesClient : ICompaniesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public CompaniesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns a paginated list of company records + /// + /// name + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CompaniesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "companies" + urlBuilder_.Append("companies"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns all company type records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "companies/types" + urlBuilder_.Append("companies/types"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns a company record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CompaniesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "companies/{id}" + urlBuilder_.Append("companies/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid company id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Company not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IContent_RatingsClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list content rating records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task RatingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Content_RatingsClient : IContent_RatingsClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Content_RatingsClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list content rating records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RatingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "content/ratings" + urlBuilder_.Append("content/ratings"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ICountriesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of country records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task CountriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CountriesClient : ICountriesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public CountriesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of country records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task CountriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "countries" + urlBuilder_.Append("countries"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IEntity_TypesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns the active entity types + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task EntitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Entity_TypesClient : IEntity_TypesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Entity_TypesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns the active entity types + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EntitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "entities" + urlBuilder_.Append("entities"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IEpisodesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of episodes base records with the basic attributes.<br> Note that all episodes are returned, even those that may not be included in a series' default season order. + /// + /// page number + /// response + /// A server side error occurred. + System.Threading.Tasks.Task EpisodesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns episode base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task EpisodesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns episode extended record + /// + /// id + /// meta + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, GetEpisodeExtendedMeta? meta = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns episode translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EpisodesClient : IEpisodesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public EpisodesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of episodes base records with the basic attributes.<br> Note that all episodes are returned, even those that may not be included in a series' default season order. + /// + /// page number + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EpisodesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "episodes" + urlBuilder_.Append("episodes"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns episode base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EpisodesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "episodes/{id}" + urlBuilder_.Append("episodes/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid episode id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Episode not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns episode extended record + /// + /// id + /// meta + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, GetEpisodeExtendedMeta? meta = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "episodes/{id}/extended" + urlBuilder_.Append("episodes/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + urlBuilder_.Append('?'); + if (meta != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid episode id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Episode not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns episode translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (language == null) + throw new System.ArgumentNullException("language"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "episodes/{id}/translations/{language}" + urlBuilder_.Append("episodes/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/translations/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid episode id. Invalid language.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Episode not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IGendersClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of gender records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task GendersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class GendersClient : IGendersClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public GendersClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of gender records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GendersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "genders" + urlBuilder_.Append("genders"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IGenresClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of genre records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task GenresGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns genre record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task GenresGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class GenresClient : IGenresClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public GenresClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of genre records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GenresGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "genres" + urlBuilder_.Append("genres"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns genre record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task GenresGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "genres/{id}" + urlBuilder_.Append("genres/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid genre id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Genre not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IInspirationTypesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of inspiration types records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class InspirationTypesClient : IInspirationTypesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public InspirationTypesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of inspiration types records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "inspiration/types" + urlBuilder_.Append("inspiration/types"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ILanguagesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of language records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task LanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LanguagesClient : ILanguagesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public LanguagesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of language records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task LanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "languages" + urlBuilder_.Append("languages"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IListsClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of list base records + /// + /// page number + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ListsGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns an list base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ListsGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns an list base record search by slug + /// + /// slug + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns a list extended record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns list translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ListsClient : IListsClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public ListsClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of list base records + /// + /// page number + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListsGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "lists" + urlBuilder_.Append("lists"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns an list base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ListsGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "lists/{id}" + urlBuilder_.Append("lists/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid list id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("List not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns an list base record search by slug + /// + /// slug + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (slug == null) + throw new System.ArgumentNullException("slug"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "lists/slug/{slug}" + urlBuilder_.Append("lists/slug/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(slug, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid list slug", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("List not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns a list extended record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "lists/{id}/extended" + urlBuilder_.Append("lists/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid list id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Lists not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns list translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (language == null) + throw new System.ArgumentNullException("language"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "lists/{id}/translations/{language}" + urlBuilder_.Append("lists/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/translations/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid lists id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Lists not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IMoviesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of movie base records + /// + /// page number + /// response + /// A server side error occurred. + System.Threading.Tasks.Task MoviesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task MoviesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie extended record + /// + /// id + /// meta + /// reduce the payload and returns the short version of this record without characters, artworks and trailers. + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, GetMovieExtendedMeta? meta = null, bool? @short = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search movies based on filter parameters + /// + /// country of origin + /// original language + /// production company + /// content rating id base on a country + /// genre + /// sort by results + /// status + /// release year + /// response + /// A server side error occurred. + System.Threading.Tasks.Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, GetMoviesFilterSort? sort = null, double? status = null, double? year = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie base record search by slug + /// + /// slug + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class MoviesClient : IMoviesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public MoviesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of movie base records + /// + /// page number + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task MoviesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies" + urlBuilder_.Append("movies"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task MoviesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies/{id}" + urlBuilder_.Append("movies/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid movie id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Movie not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie extended record + /// + /// id + /// meta + /// reduce the payload and returns the short version of this record without characters, artworks and trailers. + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, GetMovieExtendedMeta? meta = null, bool? @short = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies/{id}/extended" + urlBuilder_.Append("movies/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + urlBuilder_.Append('?'); + if (meta != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (@short != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("short")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(@short, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid movie id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Movie not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search movies based on filter parameters + /// + /// country of origin + /// original language + /// production company + /// content rating id base on a country + /// genre + /// sort by results + /// status + /// release year + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, GetMoviesFilterSort? sort = null, double? status = null, double? year = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (country == null) + throw new System.ArgumentNullException("country"); + + if (lang == null) + throw new System.ArgumentNullException("lang"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies/filter" + urlBuilder_.Append("movies/filter"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("country")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(country, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("lang")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + if (company != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("company")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(company, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (contentRating != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("contentRating")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(contentRating, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (genre != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("genre")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(genre, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (status != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("status")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (year != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("year")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(year, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid format parameter.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie base record search by slug + /// + /// slug + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (slug == null) + throw new System.ArgumentNullException("slug"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies/slug/{slug}" + urlBuilder_.Append("movies/slug/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(slug, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid movie slug", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Movie not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns movie translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (language == null) + throw new System.ArgumentNullException("language"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies/{id}/translations/{language}" + urlBuilder_.Append("movies/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/translations/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid movie id, invalid language.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Movie not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IMovie_StatusesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of status records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Movie_StatusesClient : IMovie_StatusesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Movie_StatusesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of status records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "movies/statuses" + urlBuilder_.Append("movies/statuses"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IPeopleClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of people base records with the basic attributes. + /// + /// page number + /// response + /// A server side error occurred. + System.Threading.Tasks.Task PeopleGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns people base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task PeopleGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns people extended record + /// + /// id + /// meta + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, GetPeopleExtendedMeta? meta = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns people translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PeopleClient : IPeopleClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public PeopleClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns a list of people base records with the basic attributes. + /// + /// page number + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PeopleGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "people" + urlBuilder_.Append("people"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns people base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PeopleGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "people/{id}" + urlBuilder_.Append("people/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid people id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("People not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns people extended record + /// + /// id + /// meta + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, GetPeopleExtendedMeta? meta = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "people/{id}/extended" + urlBuilder_.Append("people/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + urlBuilder_.Append('?'); + if (meta != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid people id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("People not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns people translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (language == null) + throw new System.ArgumentNullException("language"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "people/{id}/translations/{language}" + urlBuilder_.Append("people/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/translations/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid people id, invalid language.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("People not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IPeople_TypesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of peopleType records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class People_TypesClient : IPeople_TypesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public People_TypesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of peopleType records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "people/types" + urlBuilder_.Append("people/types"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ISearchClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Our search index includes series, movies, people, and companies. Search is limited to 5k results max. + /// + /// The primary search string, which can include the main title for a record including all translations and aliases. + /// Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. + /// Restrict results to a specific entity type. Can be movie, series, person, or company. + /// Restrict results to a specific year. Currently only used for series and movies. + /// Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". + /// Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. + /// Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". + /// Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. + /// Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. + /// Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. + /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + /// Offset results. + /// Limit results. + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SearchAsync(string query = null, string q = null, string type = null, double? year = null, string company = null, string country = null, string director = null, string language = null, string primaryType = null, string network = null, string remote_id = null, double? offset = null, double? limit = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. + /// + /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + /// response + /// A server side error occurred. + System.Threading.Tasks.Task RemoteidAsync(string remoteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SearchClient : ISearchClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public SearchClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Our search index includes series, movies, people, and companies. Search is limited to 5k results max. + /// + /// The primary search string, which can include the main title for a record including all translations and aliases. + /// Alias of the "query" parameter. Recommend using query instead as this field will eventually be deprecated. + /// Restrict results to a specific entity type. Can be movie, series, person, or company. + /// Restrict results to a specific year. Currently only used for series and movies. + /// Restrict results to a specific company (original network, production company, studio, etc). As an example, "The Walking Dead" would have companies of "AMC", "AMC+", and "Disney+". + /// Restrict results to a specific country of origin. Should contain a 3 character country code. Currently only used for series and movies. + /// Restrict results to a specific director. Generally only used for movies. Should include the full name of the director, such as "Steven Spielberg". + /// Restrict results to a specific primary language. Should include the 3 character language code. Currently only used for series and movies. + /// Restrict results to a specific type of company. Should include the full name of the type of company, such as "Production Company". Only used for companies. + /// Restrict results to a specific network. Used for TV and TV movies, and functions the same as the company parameter with more specificity. + /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + /// Offset results. + /// Limit results. + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SearchAsync(string query = null, string q = null, string type = null, double? year = null, string company = null, string country = null, string director = null, string language = null, string primaryType = null, string network = null, string remote_id = null, double? offset = null, double? limit = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "search" + urlBuilder_.Append("search"); + urlBuilder_.Append('?'); + if (query != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("query")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (q != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("q")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(q, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (type != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("type")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (year != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("year")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(year, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (company != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("company")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(company, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (country != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("country")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(country, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (director != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("director")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(director, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (language != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("language")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (primaryType != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("primaryType")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(primaryType, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (network != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("network")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(network, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (remote_id != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("remote_id")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(remote_id, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (offset != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("offset")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(offset, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Max results overflow", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search a series, movie, people, episode, company or season by specific remote id and returns a base record for that entity. + /// + /// Search for a specific remote id. Allows searching for an IMDB or EIDR id, for example. + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task RemoteidAsync(string remoteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (remoteId == null) + throw new System.ArgumentNullException("remoteId"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "search/remoteid/{remoteId}" + urlBuilder_.Append("search/remoteid/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(remoteId, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ISeasonsClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of seasons base records + /// + /// page number + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SeasonsGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SeasonsGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season extended record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season type records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeasonsClient : ISeasonsClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public SeasonsClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of seasons base records + /// + /// page number + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SeasonsGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "seasons" + urlBuilder_.Append("seasons"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SeasonsGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "seasons/{id}" + urlBuilder_.Append("seasons/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid season id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Season not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season extended record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "seasons/{id}/extended" + urlBuilder_.Append("seasons/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid seasons id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Season not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season type records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "seasons/types" + urlBuilder_.Append("seasons/types"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns season translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (language == null) + throw new System.ArgumentNullException("language"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "seasons/{id}/translations/{language}" + urlBuilder_.Append("seasons/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/translations/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid season id, language not found.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Season not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ISeriesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of series base records + /// + /// page number + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SeriesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SeriesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series artworks base on language and type. <br> Note&#58; Artwork type is an id that can be found using **/artwork/types** endpoint. + /// + /// id + /// lang + /// type + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ArtworksAsync(long id, string lang = null, int? type = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record including the nextAired field. <br> Note&#58; nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task NextAiredAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series extended record + /// + /// id + /// meta + /// reduce the payload and returns the short version of this record without characters and artworks + /// response + /// A server side error occurred. + System.Threading.Tasks.Task ExtendedAsync(long id, GetSeriesExtendedMeta? meta = null, bool? @short = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series episodes from the specified season type, default returns the episodes in the series default season type + /// + /// id + /// season-type + /// airDate of the episode, format is yyyy-mm-dd + /// response + /// A server side error occurred. + System.Threading.Tasks.Task EpisodesGetAsync(int page, long id, string season_type, int? season = null, int? episodeNumber = null, string airDate = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. + /// + /// id + /// season-type + /// response + /// A server side error occurred. + System.Threading.Tasks.Task EpisodesGetAsync(int page, long id, string season_type, string lang, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search series based on filter parameters + /// + /// country of origin + /// original language + /// production company + /// content rating id base on a country + /// Genre id. This id can be found using **/genres** endpoint. + /// sort by results + /// sort type ascending or descending + /// status + /// release year + /// response + /// A server side error occurred. + System.Threading.Tasks.Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, GetSeriesFilterSort? sort = null, GetSeriesFilterSortType? sortType = null, double? status = null, double? year = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record searched by slug + /// + /// slug + /// response + /// A server side error occurred. + System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SeriesClient : ISeriesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public SeriesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of series base records + /// + /// page number + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SeriesGetAsync(double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series" + urlBuilder_.Append("series"); + urlBuilder_.Append('?'); + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SeriesGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series artworks base on language and type. <br> Note&#58; Artwork type is an id that can be found using **/artwork/types** endpoint. + /// + /// id + /// lang + /// type + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ArtworksAsync(long id, string lang = null, int? type = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}/artworks" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/artworks"); + urlBuilder_.Append('?'); + if (lang != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("lang")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (type != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("type")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record including the nextAired field. <br> Note&#58; nextAired was included in the base record endpoint but that field will deprecated in the future so developers should use the nextAired endpoint. + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NextAiredAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}/nextAired" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/nextAired"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series extended record + /// + /// id + /// meta + /// reduce the payload and returns the short version of this record without characters and artworks + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExtendedAsync(long id, GetSeriesExtendedMeta? meta = null, bool? @short = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}/extended" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/extended"); + urlBuilder_.Append('?'); + if (meta != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("meta")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(meta, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (@short != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("short")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(@short, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series episodes from the specified season type, default returns the episodes in the series default season type + /// + /// id + /// season-type + /// airDate of the episode, format is yyyy-mm-dd + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EpisodesGetAsync(int page, long id, string season_type, int? season = null, int? episodeNumber = null, string airDate = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (season_type == null) + throw new System.ArgumentNullException("season_type"); + + if (page == null) + throw new System.ArgumentNullException("page"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}/episodes/{season-type}" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/episodes/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(season_type, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + if (season != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("season")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(season, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (episodeNumber != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("episodeNumber")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(episodeNumber, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (airDate != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("airDate")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(airDate, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id, episodeNumber is not null then season must be present", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record with episodes from the specified season type and language. Default returns the episodes in the series default season type. + /// + /// id + /// season-type + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task EpisodesGetAsync(int page, long id, string season_type, string lang, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (season_type == null) + throw new System.ArgumentNullException("season_type"); + + if (lang == null) + throw new System.ArgumentNullException("lang"); + + if (page == null) + throw new System.ArgumentNullException("page"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}/episodes/{season-type}/{lang}" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/episodes/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(season_type, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('/'); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id, invalid language.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search series based on filter parameters + /// + /// country of origin + /// original language + /// production company + /// content rating id base on a country + /// Genre id. This id can be found using **/genres** endpoint. + /// sort by results + /// sort type ascending or descending + /// status + /// release year + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task FilterAsync(string country, string lang, double? company = null, double? contentRating = null, double? genre = null, GetSeriesFilterSort? sort = null, GetSeriesFilterSortType? sortType = null, double? status = null, double? year = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (country == null) + throw new System.ArgumentNullException("country"); + + if (lang == null) + throw new System.ArgumentNullException("lang"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/filter" + urlBuilder_.Append("series/filter"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("country")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(country, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("lang")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(lang, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + if (company != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("company")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(company, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (contentRating != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("contentRating")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(contentRating, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (genre != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("genre")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(genre, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (sort != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sort")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sort, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (sortType != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("sortType")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(sortType, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (status != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("status")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (year != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("year")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(year, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid format parameter.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series base record searched by slug + /// + /// slug + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SlugAsync(string slug, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (slug == null) + throw new System.ArgumentNullException("slug"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/slug/{slug}" + urlBuilder_.Append("series/slug/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(slug, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series slug", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns series translation record + /// + /// id + /// language + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TranslationsAsync(long id, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (language == null) + throw new System.ArgumentNullException("language"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/{id}/translations/{language}" + urlBuilder_.Append("series/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append("/translations/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid series id, invalid language.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Series not found", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ISeries_StatusesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of status records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Series_StatusesClient : ISeries_StatusesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Series_StatusesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of status records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task StatusesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "series/statuses" + urlBuilder_.Append("series/statuses"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface ISource_TypesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of sourceType records + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Source_TypesClient : ISource_TypesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public Source_TypesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns list of sourceType records + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "sources/types" + urlBuilder_.Append("sources/types"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IUpdatesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. + /// + /// name + /// response + /// A server side error occurred. + System.Threading.Tasks.Task UpdatesAsync(double since, UpdatesType? type = null, UpdatesAction? action = null, double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UpdatesClient : IUpdatesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public UpdatesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Returns updated entities. methodInt indicates a created record (1), an updated record (2), or a deleted record (3). If a record is deleted because it was a duplicate of another record, the target record's information is provided in mergeToType and mergeToId. + /// + /// name + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UpdatesAsync(double since, UpdatesType? type = null, UpdatesAction? action = null, double? page = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (since == null) + throw new System.ArgumentNullException("since"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "updates" + urlBuilder_.Append("updates"); + urlBuilder_.Append('?'); + urlBuilder_.Append(System.Uri.EscapeDataString("since")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + if (type != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("type")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (action != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("action")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(action, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + if (page != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + } + urlBuilder_.Length--; + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Invalid since, type param.", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IUser_infoClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns user info + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns user info by user id + /// + /// id + /// response + /// A server side error occurred. + System.Threading.Tasks.Task UserGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class User_infoClient : IUser_infoClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public User_infoClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns user info + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UserGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "user" + urlBuilder_.Append("user"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns user info by user id + /// + /// id + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task UserGetAsync(long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "user/{id}" + urlBuilder_.Append("user/"); + urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial interface IFavoritesClient : ITvdbClient + { + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns user favorites + /// + /// response + /// A server side error occurred. + System.Threading.Tasks.Task FavoritesGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// creates a new user favorite + /// + /// Ok + /// A server side error occurred. + System.Threading.Tasks.Task FavoritesPostAsync(FavoriteRecord body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FavoritesClient : IFavoritesClient + { + private System.Net.Http.HttpClient _httpClient; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private System.Text.Json.JsonSerializerOptions _instanceSettings; + + #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public FavoritesClient(System.Net.Http.HttpClient httpClient) + #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + { + _httpClient = httpClient; + Initialize(); + } + + private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } + + static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void Initialize(); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// returns user favorites + /// + /// response + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task FavoritesGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "user/favorites" + urlBuilder_.Append("user/favorites"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// creates a new user favorite + /// + /// Ok + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task FavoritesPostAsync(FavoriteRecord body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); + var content_ = new System.Net.Http.ByteArrayContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + var urlBuilder_ = new System.Text.StringBuilder(); + + // Operation Path: "user/favorites" + urlBuilder_.Append("user/favorites"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = new System.Collections.Generic.Dictionary>(); + foreach (var item_ in response_.Headers) + headers_[item_.Key] = item_.Value; + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Bad format", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("Unauthorized", status_, responseText_, headers_, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value is string[]) + { + return string.Join(",", (string[])value); + } + else if (value.GetType().IsArray) + { + var valueArray = (System.Array)value; + var valueTextArray = new string[valueArray.Length]; + for (var i = 0; i < valueArray.Length; i++) + { + valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo); + } + return string.Join(",", valueTextArray); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + + + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : ApiException + { + public TResult Result { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 +#pragma warning restore 1573 +#pragma warning restore 1591 +#pragma warning restore 8073 +#pragma warning restore 3016 +#pragma warning restore 8603 +#pragma warning restore 8604 +#pragma warning restore 8625 diff --git a/src/TvdbClient/Models/Alias.cs b/src/TvdbClient/Models/Alias.cs deleted file mode 100644 index e9b3d05..0000000 --- a/src/TvdbClient/Models/Alias.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// An alias model, which can be associated with a series, season, movie, person, or list. -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class Alias : AbstractBaseRecord -{ - /// - /// A 3-4 character string indicating the language of the alias, as defined in Language. - /// - - [JsonPropertyName("language")] - public string Language { get; set; } - - /// - /// A string containing the alias itself. - /// - - [JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ApiException.cs b/src/TvdbClient/Models/ApiException.cs deleted file mode 100644 index 38f9b8b..0000000 --- a/src/TvdbClient/Models/ApiException.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace Tvdb.Models; - -/// -/// Api Exception for TVDB -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class ApiException(string message, int statusCode, string response, IReadOnlyDictionary> headers, Exception innerException) - : Exception(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) -{ - #region Properties - /// - /// Http Status Code - /// - public int StatusCode { get; private set; } = statusCode; - - /// - /// Response from the API - /// - public string Response { get; private set; } = response; - - /// - /// Headers from the API - /// - public IReadOnlyDictionary> Headers { get; private set; } = headers; - #endregion - - #region Methods - /// - /// Override of to provide a more detailed output - /// - /// - public override string ToString() => string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); - #endregion -} - -/// -/// Api Exception for TVDB with a -/// -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class ApiException(string message, int statusCode, string response, IReadOnlyDictionary> headers, TResult result, Exception innerException) : ApiException(message, statusCode, response, headers, innerException) -{ - #region Properties - /// - /// Result of the API Call - /// - public TResult Result { get; private set; } = result; - #endregion -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ArtworkBaseRecord.cs b/src/TvdbClient/Models/ArtworkBaseRecord.cs deleted file mode 100644 index f63a050..0000000 --- a/src/TvdbClient/Models/ArtworkBaseRecord.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base artwork record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("height")] - public long? Height { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("image")] - public string Image { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("includesText")] - public bool? IncludesText { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("language")] - public string Language { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("score")] - public double? Score { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thumbnail")] - public string Thumbnail { get; set; } - - /// - /// The artwork type corresponds to the ids from the /artwork/types endpoint. - /// - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public long? Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("width")] - public long? Width { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ArtworkExtendedRecord.cs b/src/TvdbClient/Models/ArtworkExtendedRecord.cs deleted file mode 100644 index 25a0776..0000000 --- a/src/TvdbClient/Models/ArtworkExtendedRecord.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace Tvdb.Models; - -/// -/// extended artwork record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkExtendedRecord : ArtworkBaseRecord -{ - [System.Text.Json.Serialization.JsonPropertyName("episodeId")] - public int? EpisodeId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movieId")] - public int? MovieId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("networkId")] - public int? NetworkId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("peopleId")] - public int? PeopleId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("seasonId")] - public int? SeasonId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("seriesId")] - public int? SeriesId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("seriesPeopleId")] - public int? SeriesPeopleId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public ArtworkStatus Status { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] - public System.Collections.Generic.ICollection TagOptions { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thumbnailHeight")] - public long? ThumbnailHeight { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thumbnailWidth")] - public long? ThumbnailWidth { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("updatedAt")] - public long? UpdatedAt { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ArtworkStatus.cs b/src/TvdbClient/Models/ArtworkStatus.cs deleted file mode 100644 index 9e88ae2..0000000 --- a/src/TvdbClient/Models/ArtworkStatus.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// artwork status record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class ArtworkStatus : AbstractBaseRecord -{ - - [JsonPropertyName("id")] - public long? Id { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ArtworkType.cs b/src/TvdbClient/Models/ArtworkType.cs deleted file mode 100644 index 9c5fd03..0000000 --- a/src/TvdbClient/Models/ArtworkType.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Tvdb.Models; - -/// -/// artwork type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkType : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("height")] - public long? Height { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("imageFormat")] - public string ImageFormat { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("recordType")] - public string RecordType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("slug")] - public string Slug { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thumbHeight")] - public long? ThumbHeight { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thumbWidth")] - public long? ThumbWidth { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("width")] - public long? Width { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/AwardBaseRecord.cs b/src/TvdbClient/Models/AwardBaseRecord.cs deleted file mode 100644 index 786ec0f..0000000 --- a/src/TvdbClient/Models/AwardBaseRecord.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base award record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/AwardCategoryBaseRecord.cs b/src/TvdbClient/Models/AwardCategoryBaseRecord.cs deleted file mode 100644 index c3931f1..0000000 --- a/src/TvdbClient/Models/AwardCategoryBaseRecord.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base award category record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardCategoryBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("allowCoNominees")] - public bool? AllowCoNominees { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("award")] - public AwardBaseRecord Award { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("forMovies")] - public bool? ForMovies { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("forSeries")] - public bool? ForSeries { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/AwardCategoryExtendedRecord.cs b/src/TvdbClient/Models/AwardCategoryExtendedRecord.cs deleted file mode 100644 index 6c45f8b..0000000 --- a/src/TvdbClient/Models/AwardCategoryExtendedRecord.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended award category record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class AwardCategoryExtendedRecord : AwardCategoryBaseRecord -{ - [JsonPropertyName("nominees")] - public ICollection Nominees { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/AwardExtendedRecord.cs b/src/TvdbClient/Models/AwardExtendedRecord.cs deleted file mode 100644 index 1f16d9b..0000000 --- a/src/TvdbClient/Models/AwardExtendedRecord.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended award record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class AwardExtendedRecord : AwardBaseRecord -{ - - [JsonPropertyName("categories")] - public ICollection Categories { get; set; } - - [JsonPropertyName("score")] - public long? Score { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/AwardNomineeBaseRecord.cs b/src/TvdbClient/Models/AwardNomineeBaseRecord.cs deleted file mode 100644 index 5689ba9..0000000 --- a/src/TvdbClient/Models/AwardNomineeBaseRecord.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base award nominee record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardNomineeBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("character")] - public Character Character { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("details")] - public string Details { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episode")] - public EpisodeBaseRecord Episode { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("isWinner")] - public bool? IsWinner { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movie")] - public MovieBaseRecord Movie { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("series")] - public SeriesBaseRecord Series { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("year")] - public string Year { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("category")] - public string Category { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Biography.cs b/src/TvdbClient/Models/Biography.cs deleted file mode 100644 index ca1dbce..0000000 --- a/src/TvdbClient/Models/Biography.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Tvdb.Models; - -/// -/// biography record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Biography : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("biography")] - public string Biography1 { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("language")] - public string Language { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Character.cs b/src/TvdbClient/Models/Character.cs deleted file mode 100644 index a2efe7c..0000000 --- a/src/TvdbClient/Models/Character.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace Tvdb.Models; - -/// -/// character record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Character : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episode")] - public RecordInfo Episode { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episodeId")] - public int? EpisodeId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("image")] - public string Image { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("isFeatured")] - public bool? IsFeatured { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movieId")] - public int? MovieId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movie")] - public RecordInfo Movie { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] - public System.Collections.Generic.ICollection NameTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] - public System.Collections.Generic.ICollection OverviewTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("peopleId")] - public int? PeopleId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("personImgURL")] - public string PersonImgURL { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("peopleType")] - public string PeopleType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("seriesId")] - public int? SeriesId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("series")] - public RecordInfo Series { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("sort")] - public long? Sort { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] - public System.Collections.Generic.ICollection TagOptions { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public long? Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("personName")] - public string PersonName { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Companies.cs b/src/TvdbClient/Models/Companies.cs deleted file mode 100644 index eef177d..0000000 --- a/src/TvdbClient/Models/Companies.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Tvdb.Models; - -/// -/// Companies by type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Companies : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("studio")] - public System.Collections.Generic.ICollection Studio { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("network")] - public System.Collections.Generic.ICollection Network { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("production")] - public System.Collections.Generic.ICollection Production { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("distributor")] - public System.Collections.Generic.ICollection Distributor { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("special_effects")] - public System.Collections.Generic.ICollection Special_effects { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Company.cs b/src/TvdbClient/Models/Company.cs deleted file mode 100644 index 7763d1c..0000000 --- a/src/TvdbClient/Models/Company.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace Tvdb.Models; - -/// -/// A company record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Company : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("activeDate")] - public string ActiveDate { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("inactiveDate")] - public string InactiveDate { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] - public System.Collections.Generic.ICollection NameTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] - public System.Collections.Generic.ICollection OverviewTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("primaryCompanyType")] - public long? PrimaryCompanyType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("slug")] - public string Slug { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("parentCompany")] - public ParentCompany ParentCompany { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] - public System.Collections.Generic.ICollection TagOptions { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/CompanyRelationShip.cs b/src/TvdbClient/Models/CompanyRelationShip.cs deleted file mode 100644 index c3dde1d..0000000 --- a/src/TvdbClient/Models/CompanyRelationShip.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Tvdb.Models; - -/// -/// A company relationship -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class CompanyRelationShip : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("typeName")] - public string TypeName { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/CompanyType.cs b/src/TvdbClient/Models/CompanyType.cs deleted file mode 100644 index 6c4a3f1..0000000 --- a/src/TvdbClient/Models/CompanyType.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Tvdb.Models; - -/// -/// A company type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class CompanyType : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("companyTypeId")] - public int? CompanyTypeId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("companyTypeName")] - public string CompanyTypeName { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ContentRating.cs b/src/TvdbClient/Models/ContentRating.cs deleted file mode 100644 index a86f9a4..0000000 --- a/src/TvdbClient/Models/ContentRating.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Tvdb.Models; - -/// -/// content rating record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ContentRating : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("contentType")] - public string ContentType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("order")] - public int? Order { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("fullName")] - public string FullName { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Country.cs b/src/TvdbClient/Models/Country.cs deleted file mode 100644 index 3379407..0000000 --- a/src/TvdbClient/Models/Country.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// country record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class Country : AbstractBaseRecord -{ - - [JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("shortCode")] - public string ShortCode { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Entity.cs b/src/TvdbClient/Models/Entity.cs deleted file mode 100644 index ea06f6b..0000000 --- a/src/TvdbClient/Models/Entity.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// Entity record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class Entity : AbstractBaseRecord -{ - - [JsonPropertyName("movieId")] - public int? MovieId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("order")] - public long? Order { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("seriesId")] - public int? SeriesId { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/EntityType.cs b/src/TvdbClient/Models/EntityType.cs deleted file mode 100644 index 085e58f..0000000 --- a/src/TvdbClient/Models/EntityType.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// Entity Type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class EntityType : AbstractBaseRecord -{ - - [JsonPropertyName("id")] - public int? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("hasSpecials")] - public bool? HasSpecials { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/EntityUpdate.cs b/src/TvdbClient/Models/EntityUpdate.cs deleted file mode 100644 index 55f7310..0000000 --- a/src/TvdbClient/Models/EntityUpdate.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// entity update record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class EntityUpdate : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("entityType")] - public string EntityType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("methodInt")] - public int? MethodInt { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("method")] - public string Method { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("extraInfo")] - public string ExtraInfo { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("userId")] - public int? UserId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("recordType")] - public string RecordType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("recordId")] - public long? RecordId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("timeStamp")] - public long? TimeStamp { get; set; } - - /// - /// Only present for episodes records - /// - - [System.Text.Json.Serialization.JsonPropertyName("seriesId")] - public long? SeriesId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("mergeToId")] - public long? MergeToId { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("mergeToEntityType")] - public string MergeToEntityType { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/EpisodeBaseRecord.cs b/src/TvdbClient/Models/EpisodeBaseRecord.cs deleted file mode 100644 index aaf057c..0000000 --- a/src/TvdbClient/Models/EpisodeBaseRecord.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// base episode record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class EpisodeBaseRecord : AbstractBaseRecord -{ - /// - /// TVDB Episode Id - /// - [JsonPropertyName("id")] - public int Id { get; set; } - - /// - /// Absolute number of the episode - /// - [JsonPropertyName("absoluteNumber")] - public int? AbsoluteNumber { get; set; } - - /// - /// Aired Date - /// - [JsonConverter(typeof(Converters.DateTimeConverter))] - [JsonPropertyName("aired")] - public DateTime? Aired { get; set; } - - /// - /// Used for Specials to indicate which season they belong to - /// - /// Before which Season does this Episode air? - [JsonPropertyName("airsAfterSeason")] - public int? AirsAfterSeason { get; set; } - - /// - /// Used for Specials to indicate which Episode they belong to - /// - /// Before which Episode does this Episode air? - [JsonPropertyName("airsBeforeEpisode")] - public int? AirsBeforeEpisode { get; set; } - - /// - /// Used for Specials to indicate which season they belong to - /// - /// After which Season does this Episode air? - [JsonPropertyName("airsBeforeSeason")] - public int? AirsBeforeSeason { get; set; } - - /// - /// season, midseason, or series - /// - [JsonPropertyName("finaleType")] - public string FinaleType { get; set; } - - [JsonPropertyName("image")] - public string Image { get; set; } - - [JsonPropertyName("imageType")] - public int? ImageType { get; set; } - - /// - /// Is this a movie? - /// - [JsonPropertyName("isMovie")] - public int? IsMovie { get; set; } - - /// - /// Last Updated on TVDB - /// - [JsonConverter(typeof(Converters.DateTimeConverter))] - [JsonPropertyName("lastUpdated")] - public DateTime? LastUpdated { get; set; } - - /// - /// Linked Movie - /// - [JsonPropertyName("linkedMovie")] - public int? LinkedMovie { get; set; } - - /// - /// Episode Name - /// - [JsonPropertyName("name")] - public string Name { get; set; } - - /// - /// Episode Name Translations - /// - [JsonPropertyName("nameTranslations")] - public ICollection NameTranslations { get; set; } - - /// - /// Episode Number - /// - [JsonPropertyName("number")] - public int Number { get; set; } - - /// - /// Overview - /// - [JsonPropertyName("overview")] - public string Overview { get; set; } - - /// - /// Overview Translations - /// - [JsonPropertyName("overviewTranslations")] - public ICollection OverviewTranslations { get; set; } - - /// - /// How many minutes does this episode run? - /// - [JsonPropertyName("runtime")] - public int? Runtime { get; set; } - - /// - /// Season Number - /// - [JsonPropertyName("seasonNumber")] - public int SeasonNumber { get; set; } - - /// - /// Seasons - /// - [JsonPropertyName("seasons")] - public ICollection Seasons { get; set; } - - /// - /// TVDB Series Id - /// - [JsonPropertyName("seriesId")] - public long? SeriesId { get; set; } - - /// - /// Season Name - /// - [JsonPropertyName("seasonName")] - public string SeasonName { get; set; } - - /// - /// Year the Episode was published - /// - [JsonPropertyName("year")] - public string Year { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/EpisodeExtendedRecord.cs b/src/TvdbClient/Models/EpisodeExtendedRecord.cs deleted file mode 100644 index 20323d3..0000000 --- a/src/TvdbClient/Models/EpisodeExtendedRecord.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended episode record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class EpisodeExtendedRecord : EpisodeBaseRecord -{ - [JsonPropertyName("awards")] - - public ICollection Awards { get; set; } - - [JsonPropertyName("characters")] - public ICollection Characters { get; set; } - - [JsonPropertyName("companies")] - public ICollection Companies { get; set; } - - [JsonPropertyName("contentRatings")] - public ICollection ContentRatings { get; set; } - - [JsonPropertyName("networks")] - public ICollection Networks { get; set; } - - [JsonPropertyName("nominations")] - public ICollection Nominations { get; set; } - - [JsonPropertyName("productionCode")] - public string ProductionCode { get; set; } - - [JsonPropertyName("remoteIds")] - public ICollection RemoteIds { get; set; } - - [JsonPropertyName("studios")] - public ICollection Studios { get; set; } - - [JsonPropertyName("tagOptions")] - public ICollection TagOptions { get; set; } - - [JsonPropertyName("trailers")] - public ICollection Trailers { get; set; } - - [JsonPropertyName("translations")] - public TranslationExtended Translations { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/FavoriteRecord.cs b/src/TvdbClient/Models/FavoriteRecord.cs deleted file mode 100644 index c1c766e..0000000 --- a/src/TvdbClient/Models/FavoriteRecord.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Tvdb.Models; - -/// -/// Favorites record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class FavoriteRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("series")] - public int? Series { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movie")] - public int? Movie { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episode")] - public int? Episode { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("artwork")] - public int? Artwork { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("people")] - public int? People { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("list")] - public int? List { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Favorites.cs b/src/TvdbClient/Models/Favorites.cs deleted file mode 100644 index 125cb32..0000000 --- a/src/TvdbClient/Models/Favorites.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Tvdb.Models; - -/// -/// User favorites record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Favorites : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("series")] - public System.Collections.Generic.ICollection Series { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movies")] - public System.Collections.Generic.ICollection Movies { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episodes")] - public System.Collections.Generic.ICollection Episodes { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("artwork")] - public System.Collections.Generic.ICollection Artwork { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("people")] - public System.Collections.Generic.ICollection People { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("lists")] - public System.Collections.Generic.ICollection Lists { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Gender.cs b/src/TvdbClient/Models/Gender.cs deleted file mode 100644 index 4a80acd..0000000 --- a/src/TvdbClient/Models/Gender.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Tvdb.Models; - -/// -/// gender record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Gender : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/GenreBaseRecord.cs b/src/TvdbClient/Models/GenreBaseRecord.cs deleted file mode 100644 index e5a775c..0000000 --- a/src/TvdbClient/Models/GenreBaseRecord.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base genre record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class GenreBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("slug")] - public string Slug { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Inspiration.cs b/src/TvdbClient/Models/Inspiration.cs deleted file mode 100644 index e8e9968..0000000 --- a/src/TvdbClient/Models/Inspiration.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Tvdb.Models; - -/// -/// Movie inspiration record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Inspiration : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type_name")] - public string Type_name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/InspirationType.cs b/src/TvdbClient/Models/InspirationType.cs deleted file mode 100644 index c8ab99f..0000000 --- a/src/TvdbClient/Models/InspirationType.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Tvdb.Models; - -/// -/// Movie inspiration type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class InspirationType : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("description")] - public string Description { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("reference_name")] - public string Reference_name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Language.cs b/src/TvdbClient/Models/Language.cs deleted file mode 100644 index 5abc16b..0000000 --- a/src/TvdbClient/Models/Language.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Tvdb.Models; - -/// -/// language record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Language : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nativeName")] - public string NativeName { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("shortCode")] - public string ShortCode { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Links.cs b/src/TvdbClient/Models/Links.cs deleted file mode 100644 index b4df05d..0000000 --- a/src/TvdbClient/Models/Links.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// Links for next, previous and current record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class Links -{ - /// - /// Link to the previous page - /// - [JsonPropertyName("prev")] - public string PreviousPage { get; set; } - - /// - /// Link to the current page - /// - [JsonPropertyName("self")] - public string Self { get; set; } - - /// - /// Link to the next page - /// - [JsonPropertyName("next")] - public string NextPage { get; set; } - - /// - /// Total number of items - /// - [JsonPropertyName("total_items")] - public int? ItemCount { get; set; } - - /// - /// Number of Items per Page - /// - [JsonPropertyName("page_size")] - public int? PageSize { get; set; } - - /// - /// backing field for "/> - /// - private IDictionary? _additionalProperties; - - /// - /// Contains additional Properties that havent been mapped yet - /// - [JsonExtensionData] - public IDictionary AdditionalProperties - { - get => _additionalProperties ??= new Dictionary(); - set => _additionalProperties = value; - } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ListBaseRecord.cs b/src/TvdbClient/Models/ListBaseRecord.cs deleted file mode 100644 index 1738b65..0000000 --- a/src/TvdbClient/Models/ListBaseRecord.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base list record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ListBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("image")] - public string Image { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("imageIsFallback")] - public bool? ImageIsFallback { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("isOfficial")] - public bool? IsOfficial { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] - public System.Collections.Generic.ICollection NameTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overview")] - public string Overview { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] - public System.Collections.Generic.ICollection OverviewTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] - public System.Collections.Generic.ICollection RemoteIds { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tags")] - public System.Collections.Generic.ICollection Tags { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("score")] - public int? Score { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ListExtendedRecord.cs b/src/TvdbClient/Models/ListExtendedRecord.cs deleted file mode 100644 index b539fa1..0000000 --- a/src/TvdbClient/Models/ListExtendedRecord.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended list record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ListExtendedRecord : ListBaseRecord -{ - [JsonPropertyName("entities")] - public ICollection Entities { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/MovieBaseRecord.cs b/src/TvdbClient/Models/MovieBaseRecord.cs deleted file mode 100644 index 834e7ce..0000000 --- a/src/TvdbClient/Models/MovieBaseRecord.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json.Serialization; -using System.Threading.Tasks; - -namespace Tvdb.Models; - -/// -/// base movie record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class MovieBaseRecord : AbstractBaseRecord -{ - - [JsonPropertyName("aliases")] - public ICollection Aliases { get; set; } - - [JsonPropertyName("id")] - public long? Id { get; set; } - - [JsonPropertyName("image")] - public string Image { get; set; } - - [JsonConverter(typeof(Converters.DateTimeConverter))] - - [JsonPropertyName("lastUpdated")] - public DateTime? LastUpdated { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("nameTranslations")] - public ICollection NameTranslations { get; set; } - - [JsonPropertyName("overviewTranslations")] - public ICollection OverviewTranslations { get; set; } - - [JsonPropertyName("score")] - public double? Score { get; set; } - - [JsonPropertyName("slug")] - public string Slug { get; set; } - - [JsonPropertyName("status")] - public Status Status { get; set; } - - [JsonPropertyName("runtime")] - public int? Runtime { get; set; } - - [JsonPropertyName("year")] - public string Year { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/MovieExtendedRecord.cs b/src/TvdbClient/Models/MovieExtendedRecord.cs deleted file mode 100644 index a90b339..0000000 --- a/src/TvdbClient/Models/MovieExtendedRecord.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended movie record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class MovieExtendedRecord : MovieBaseRecord -{ - [JsonPropertyName("artworks")] - public ICollection Artworks { get; set; } - - [JsonPropertyName("audioLanguages")] - public ICollection AudioLanguages { get; set; } - - [JsonPropertyName("awards")] - public ICollection Awards { get; set; } - - [JsonPropertyName("boxOffice")] - public string BoxOffice { get; set; } - - [JsonPropertyName("boxOfficeUS")] - public string BoxOfficeUS { get; set; } - - [JsonPropertyName("budget")] - public string Budget { get; set; } - - [JsonPropertyName("characters")] - public ICollection Characters { get; set; } - - [JsonPropertyName("companies")] - public Companies Companies { get; set; } - - [JsonPropertyName("contentRatings")] - public ICollection ContentRatings { get; set; } - - [JsonPropertyName("first_release")] - public Release First_release { get; set; } - - [JsonPropertyName("genres")] - public ICollection Genres { get; set; } - - [JsonPropertyName("inspirations")] - public ICollection Inspirations { get; set; } - - [JsonConverter(typeof(Converters.DateTimeConverter))] - - [JsonPropertyName("lists")] - public ICollection Lists { get; set; } - - [JsonPropertyName("originalCountry")] - public string OriginalCountry { get; set; } - - [JsonPropertyName("originalLanguage")] - public string OriginalLanguage { get; set; } - - [JsonPropertyName("production_countries")] - public ICollection Production_countries { get; set; } - - [JsonPropertyName("releases")] - public ICollection Releases { get; set; } - - [JsonPropertyName("remoteIds")] - public ICollection RemoteIds { get; set; } - - [JsonPropertyName("spoken_languages")] - public ICollection Spoken_languages { get; set; } - - [JsonPropertyName("studios")] - public ICollection Studios { get; set; } - - [JsonPropertyName("subtitleLanguages")] - public ICollection SubtitleLanguages { get; set; } - - [JsonPropertyName("tagOptions")] - public ICollection TagOptions { get; set; } - - [JsonPropertyName("trailers")] - public ICollection Trailers { get; set; } - - [JsonPropertyName("translations")] - public TranslationExtended Translations { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ParentCompany.cs b/src/TvdbClient/Models/ParentCompany.cs deleted file mode 100644 index 822b8ad..0000000 --- a/src/TvdbClient/Models/ParentCompany.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// A parent company record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ParentCompany : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("relation")] - public CompanyRelationShip Relation { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/PeopleBaseRecord.cs b/src/TvdbClient/Models/PeopleBaseRecord.cs deleted file mode 100644 index 5aa5a52..0000000 --- a/src/TvdbClient/Models/PeopleBaseRecord.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// base people record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class PeopleBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("image")] - public string Image { get; set; } - - [JsonConverter(typeof(Converters.DateTimeConverter))] - - [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] - public DateTime? LastUpdated { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] - public System.Collections.Generic.ICollection NameTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] - public System.Collections.Generic.ICollection OverviewTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("score")] - public long? Score { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/PeopleExtendedRecord.cs b/src/TvdbClient/Models/PeopleExtendedRecord.cs deleted file mode 100644 index 7c97dde..0000000 --- a/src/TvdbClient/Models/PeopleExtendedRecord.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended people record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class PeopleExtendedRecord : PeopleBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("awards")] - public System.Collections.Generic.ICollection Awards { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("biographies")] - public System.Collections.Generic.ICollection Biographies { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("birth")] - public string Birth { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("birthPlace")] - public string BirthPlace { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("characters")] - public System.Collections.Generic.ICollection Characters { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("death")] - public string Death { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("gender")] - public int? Gender { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("image")] - public string Image { get; set; } - - [JsonConverter(typeof(Converters.DateTimeConverter))] - - [System.Text.Json.Serialization.JsonPropertyName("lastUpdated")] - public DateTime? LastUpdated { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] - public System.Collections.Generic.ICollection NameTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] - public System.Collections.Generic.ICollection OverviewTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("races")] - public System.Collections.Generic.ICollection Races { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("remoteIds")] - public System.Collections.Generic.ICollection RemoteIds { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("score")] - public long? Score { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("slug")] - public string Slug { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagOptions")] - public System.Collections.Generic.ICollection TagOptions { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("translations")] - public TranslationExtended Translations { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/PeopleType.cs b/src/TvdbClient/Models/PeopleType.cs deleted file mode 100644 index eaf8bcc..0000000 --- a/src/TvdbClient/Models/PeopleType.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// people type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class PeopleType : AbstractBaseRecord -{ - [JsonPropertyName("id")] - public long? Id { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ProductionCountry.cs b/src/TvdbClient/Models/ProductionCountry.cs deleted file mode 100644 index 4eaf80b..0000000 --- a/src/TvdbClient/Models/ProductionCountry.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// Production country record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ProductionCountry : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Race.cs b/src/TvdbClient/Models/Race.cs deleted file mode 100644 index deedd69..0000000 --- a/src/TvdbClient/Models/Race.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Tvdb.Models; - -/// -/// race record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class Race : AbstractBaseRecord; \ No newline at end of file diff --git a/src/TvdbClient/Models/RecordInfo.cs b/src/TvdbClient/Models/RecordInfo.cs deleted file mode 100644 index f991706..0000000 --- a/src/TvdbClient/Models/RecordInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// base record info -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class RecordInfo : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("image")] - public string Image { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("year")] - public string Year { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Release.cs b/src/TvdbClient/Models/Release.cs deleted file mode 100644 index 92703ea..0000000 --- a/src/TvdbClient/Models/Release.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// release record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Release : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("date")] - public string Date { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("detail")] - public string Detail { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/RemoteID.cs b/src/TvdbClient/Models/RemoteID.cs deleted file mode 100644 index b38c95f..0000000 --- a/src/TvdbClient/Models/RemoteID.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// remote id record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class RemoteID : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public long? Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("sourceName")] - public string SourceName { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/ResponseClasses.cs b/src/TvdbClient/Models/ResponseClasses.cs deleted file mode 100644 index 8acc2c7..0000000 --- a/src/TvdbClient/Models/ResponseClasses.cs +++ /dev/null @@ -1,239 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tvdb.Models; - - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkExtendedResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkStatusResponse : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class ArtworkTypeResponse : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardsResponse : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardExtendedResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardCategoryResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class AwardCategoryExtendedResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class CharacterResponse : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response12 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response13 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response14 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response15 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response16 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response17 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response18 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response19 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response20 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response21 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response22 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response23 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response24 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response25 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response26 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response27 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response28 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response29 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response30 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response31 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response32 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response33 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response34 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response35 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response36 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response37 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response38 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response39 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response40 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response41 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response42 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response43 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response44 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response45 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response46 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response47 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response48 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response49 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response50 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response51 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response52 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response53 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response54 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response55 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response56 -{ - - [System.Text.Json.Serialization.JsonPropertyName("data")] - public Data2 Data { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - -} - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response57 -{ - - [System.Text.Json.Serialization.JsonPropertyName("data")] - public Data3 Data { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - -} - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response58 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response59 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response60 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response61 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response62 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response63 : ApiResponseWrapper>; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response64 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response65 : ApiResponseWrapper; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Response66 : ApiResponseWrapper; \ No newline at end of file diff --git a/src/TvdbClient/Models/SearchByRemoteIdResult.cs b/src/TvdbClient/Models/SearchByRemoteIdResult.cs deleted file mode 100644 index cc415e1..0000000 --- a/src/TvdbClient/Models/SearchByRemoteIdResult.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Tvdb.Models; - -/// -/// search by remote reuslt is a base record for a movie, series, people, season or company search result -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class SearchByRemoteIdResult : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("series")] - public SeriesBaseRecord Series { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("people")] - public PeopleBaseRecord People { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("movie")] - public MovieBaseRecord Movie { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episode")] - public EpisodeBaseRecord Episode { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("company")] - public Company Company { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SearchResult.cs b/src/TvdbClient/Models/SearchResult.cs deleted file mode 100644 index a08c085..0000000 --- a/src/TvdbClient/Models/SearchResult.cs +++ /dev/null @@ -1,105 +0,0 @@ -namespace Tvdb.Models; - -/// -/// search result -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class SearchResult : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("companies")] - public System.Collections.Generic.ICollection Companies { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("companyType")] - public string CompanyType { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("country")] - public string Country { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("director")] - public string Director { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("first_air_time")] - public string First_air_time { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("genres")] - public System.Collections.Generic.ICollection Genres { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("image_url")] - public string Image_url { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("is_official")] - public bool? Is_official { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name_translated")] - public string Name_translated { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("network")] - public string Network { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("objectID")] - public string ObjectID { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("officialList")] - public string OfficialList { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overview")] - public string Overview { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviews")] - public TranslationSimple Overviews { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overview_translated")] - public System.Collections.Generic.ICollection Overview_translated { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("poster")] - public string Poster { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("posters")] - public System.Collections.Generic.ICollection Posters { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("primary_language")] - public string Primary_language { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("remote_ids")] - public System.Collections.Generic.ICollection Remote_ids { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("slug")] - public string Slug { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("studios")] - public System.Collections.Generic.ICollection Studios { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("title")] - public string Title { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thumbnail")] - public string Thumbnail { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("translations")] - public TranslationSimple Translations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("translationsWithLang")] - public System.Collections.Generic.ICollection TranslationsWithLang { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tvdb_id")] - public string Tvdb_id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("year")] - public string Year { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SeasonBaseRecord.cs b/src/TvdbClient/Models/SeasonBaseRecord.cs deleted file mode 100644 index b0141bc..0000000 --- a/src/TvdbClient/Models/SeasonBaseRecord.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json.Serialization; -using System.Threading.Tasks; - -namespace Tvdb.Models; - -/// -/// season genre record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class SeasonBaseRecord : AbstractBaseRecord -{ - - [JsonPropertyName("id")] - public int? Id { get; set; } - - [JsonPropertyName("image")] - public string Image { get; set; } - - [JsonPropertyName("imageType")] - public int? ImageType { get; set; } - - [JsonConverter(typeof(Converters.DateTimeConverter))] - - [JsonPropertyName("lastUpdated")] - public DateTime? LastUpdated { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("nameTranslations")] - public ICollection NameTranslations { get; set; } - - [JsonPropertyName("number")] - public long? Number { get; set; } - - [JsonPropertyName("overviewTranslations")] - public ICollection OverviewTranslations { get; set; } - - [JsonPropertyName("companies")] - public Companies Companies { get; set; } - - [JsonPropertyName("seriesId")] - public long? SeriesId { get; set; } - - [JsonPropertyName("type")] - public SeasonType Type { get; set; } - - [JsonPropertyName("year")] - public string Year { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SeasonExtendedRecord.cs b/src/TvdbClient/Models/SeasonExtendedRecord.cs deleted file mode 100644 index fc6efb5..0000000 --- a/src/TvdbClient/Models/SeasonExtendedRecord.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// extended season record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class SeasonExtendedRecord : SeasonBaseRecord -{ - - [JsonPropertyName("artwork")] - public ICollection Artwork { get; set; } - - [JsonPropertyName("episodes")] - public ICollection Episodes { get; set; } - - [JsonPropertyName("trailers")] - public ICollection Trailers { get; set; } - - [JsonPropertyName("tagOptions")] - public ICollection TagOptions { get; set; } - - [JsonPropertyName("translations")] - public ICollection Translations { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SeasonType.cs b/src/TvdbClient/Models/SeasonType.cs deleted file mode 100644 index f79c523..0000000 --- a/src/TvdbClient/Models/SeasonType.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Tvdb.Models; - -/// -/// season type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class SeasonType : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("alternateName")] - public string AlternateName { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SeriesAirsDays.cs b/src/TvdbClient/Models/SeriesAirsDays.cs deleted file mode 100644 index deabfd1..0000000 --- a/src/TvdbClient/Models/SeriesAirsDays.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Tvdb.Models; - -/// -/// A series airs day record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class SeriesAirsDays : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("friday")] - public bool? Friday { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("monday")] - public bool? Monday { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("saturday")] - public bool? Saturday { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("sunday")] - public bool? Sunday { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("thursday")] - public bool? Thursday { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tuesday")] - public bool? Tuesday { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("wednesday")] - public bool? Wednesday { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SeriesBaseRecord.cs b/src/TvdbClient/Models/SeriesBaseRecord.cs deleted file mode 100644 index 3fe9c69..0000000 --- a/src/TvdbClient/Models/SeriesBaseRecord.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// The base record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class SeriesBaseRecord : AbstractBaseRecord -{ - [JsonPropertyName("id")] - public int? Id { get; set; } - - [JsonPropertyName("aliases")] - public ICollection Aliases { get; set; } - - [JsonPropertyName("averageRuntime")] - public int? AverageRuntime { get; set; } - - [JsonPropertyName("country")] - public string Country { get; set; } - - [JsonPropertyName("defaultSeasonType")] - public long? DefaultSeasonType { get; set; } - - [JsonPropertyName("episodes")] - public ICollection Episodes { get; set; } - - [JsonConverter(typeof(Converters.DateOnlyConverter))] - [JsonPropertyName("firstAired")] - public DateOnly? FirstAired { get; set; } - - [JsonPropertyName("image")] - public string Image { get; set; } - - [JsonPropertyName("isOrderRandomized")] - public bool? IsOrderRandomized { get; set; } - - [JsonConverter(typeof(Converters.DateOnlyConverter))] - [JsonPropertyName("lastAired")] - public DateOnly? LastAired { get; set; } - - [JsonConverter(typeof(Converters.DateTimeConverter))] - - [JsonPropertyName("lastUpdated")] - public DateTime? LastUpdated { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("nameTranslations")] - public ICollection NameTranslations { get; set; } - - [JsonConverter(typeof(Converters.DateOnlyConverter))] - [JsonPropertyName("nextAired")] - public DateOnly? NextAired { get; set; } - - [JsonPropertyName("originalCountry")] - public string OriginalCountry { get; set; } - - [JsonPropertyName("originalLanguage")] - public string OriginalLanguage { get; set; } - - [JsonPropertyName("overviewTranslations")] - public ICollection OverviewTranslations { get; set; } - - [JsonPropertyName("score")] - public double? Score { get; set; } - - [JsonPropertyName("slug")] - public string Slug { get; set; } - - [JsonPropertyName("status")] - public Status Status { get; set; } - - [JsonPropertyName("year")] - public string Year { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SeriesExtendedRecord.cs b/src/TvdbClient/Models/SeriesExtendedRecord.cs deleted file mode 100644 index 48da6c2..0000000 --- a/src/TvdbClient/Models/SeriesExtendedRecord.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// The extended record for a series. All series airs time like firstAired, lastAired, nextAired, etc. are in US EST for US series, and for all non-US series, the time of the show’s country capital or most populous city. For streaming services, is the official release time. See https://support.thetvdb.com/kb/faq.php?id=29. -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class SeriesExtendedRecord : SeriesBaseRecord -{ - - [JsonPropertyName("abbreviation")] - public string Abbreviation { get; set; } - - [JsonPropertyName("airsDays")] - public SeriesAirsDays AirsDays { get; set; } - - [JsonConverter(typeof(Converters.TimeOnlyConverter))] - [JsonPropertyName("airsTime")] - public TimeOnly? AirsTime { get; set; } - - [JsonPropertyName("artworks")] - public ICollection Artworks { get; set; } - - - [JsonPropertyName("characters")] - public ICollection Characters { get; set; } - - [JsonPropertyName("contentRatings")] - public ICollection ContentRatings { get; set; } - - [JsonPropertyName("lists")] - public object Lists { get; set; } - - [JsonPropertyName("genres")] - public ICollection Genres { get; set; } - - [JsonPropertyName("companies")] - public ICollection Companies { get; set; } - - [JsonPropertyName("originalNetwork")] - public Company OriginalNetwork { get; set; } - - [JsonPropertyName("overview")] - public string Overview { get; set; } - - [JsonPropertyName("latestNetwork")] - public Company LatestNetwork { get; set; } - - [JsonPropertyName("remoteIds")] - public ICollection RemoteIds { get; set; } - - [JsonPropertyName("seasons")] - public ICollection Seasons { get; set; } - - [JsonPropertyName("seasonTypes")] - public ICollection SeasonTypes { get; set; } - - [JsonPropertyName("tags")] - public ICollection Tags { get; set; } - - [JsonPropertyName("trailers")] - public ICollection Trailers { get; set; } - - [JsonPropertyName("translations")] - public TranslationExtended Translations { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/SourceType.cs b/src/TvdbClient/Models/SourceType.cs deleted file mode 100644 index 3217af4..0000000 --- a/src/TvdbClient/Models/SourceType.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Tvdb.Models; - -/// -/// source type record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class SourceType : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("postfix")] - public string Postfix { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("prefix")] - public string Prefix { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("slug")] - public string Slug { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("sort")] - public long? Sort { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Status.cs b/src/TvdbClient/Models/Status.cs deleted file mode 100644 index 2b56a61..0000000 --- a/src/TvdbClient/Models/Status.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Tvdb.Models; - -/// -/// status record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Status : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("keepUpdated")] - public bool? KeepUpdated { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("recordType")] - public string RecordType { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/StudioBaseRecord.cs b/src/TvdbClient/Models/StudioBaseRecord.cs deleted file mode 100644 index 74d2412..0000000 --- a/src/TvdbClient/Models/StudioBaseRecord.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// studio record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class StudioBaseRecord : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("parentStudio")] - public int? ParentStudio { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Tag.cs b/src/TvdbClient/Models/Tag.cs deleted file mode 100644 index cf088f4..0000000 --- a/src/TvdbClient/Models/Tag.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Tvdb.Models; - -/// -/// tag record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Tag : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("allowsMultiple")] - public bool? AllowsMultiple { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("helpText")] - public string HelpText { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("options")] - public System.Collections.Generic.ICollection Options { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/TagOption.cs b/src/TvdbClient/Models/TagOption.cs deleted file mode 100644 index 0fbf8bc..0000000 --- a/src/TvdbClient/Models/TagOption.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Tvdb.Models; - -/// -/// tag option record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class TagOption : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("helpText")] - public string HelpText { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tag")] - public long? Tag { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagName")] - public string TagName { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/TagOptionEntity.cs b/src/TvdbClient/Models/TagOptionEntity.cs deleted file mode 100644 index 4fa89f7..0000000 --- a/src/TvdbClient/Models/TagOptionEntity.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// a entity with selected tag option -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class TagOptionEntity : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagName")] - public string TagName { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("tagId")] - public int? TagId { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Trailer.cs b/src/TvdbClient/Models/Trailer.cs deleted file mode 100644 index f2132f2..0000000 --- a/src/TvdbClient/Models/Trailer.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Tvdb.Models; - -/// -/// trailer record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Trailer : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public long? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("language")] - public string Language { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("url")] - public string Url { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("runtime")] - public int? Runtime { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/Translation.cs b/src/TvdbClient/Models/Translation.cs deleted file mode 100644 index 10d4581..0000000 --- a/src/TvdbClient/Models/Translation.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace Tvdb.Models; - -/// -/// translation record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class Translation : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("aliases")] - public System.Collections.Generic.ICollection Aliases { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("isAlias")] - public bool? IsAlias { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("isPrimary")] - public bool? IsPrimary { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("language")] - public string Language { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overview")] - public string Overview { get; set; } - - /// - /// Only populated for movie translations. We disallow taglines without a title. - /// - - [System.Text.Json.Serialization.JsonPropertyName("tagline")] - public string Tagline { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/TranslationExtended.cs b/src/TvdbClient/Models/TranslationExtended.cs deleted file mode 100644 index 80d3c83..0000000 --- a/src/TvdbClient/Models/TranslationExtended.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Tvdb.Models; - -/// -/// translation extended record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class TranslationExtended : Translation -{ - - [System.Text.Json.Serialization.JsonPropertyName("nameTranslations")] - public System.Collections.Generic.ICollection NameTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("overviewTranslations")] - public System.Collections.Generic.ICollection OverviewTranslations { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("alias")] - public System.Collections.Generic.ICollection Alias { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/Models/TranslationSimple.cs b/src/TvdbClient/Models/TranslationSimple.cs deleted file mode 100644 index dab8490..0000000 --- a/src/TvdbClient/Models/TranslationSimple.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Tvdb.Models; - -/// -/// translation simple record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class TranslationSimple : Dictionary; \ No newline at end of file diff --git a/src/TvdbClient/Models/TvdbModels.cs b/src/TvdbClient/Models/TvdbModels.cs deleted file mode 100644 index 6123746..0000000 --- a/src/TvdbClient/Models/TvdbModels.cs +++ /dev/null @@ -1,77 +0,0 @@ -//---------------------- -// -// Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) -// -//---------------------- - -using System; -using Tvdb.Clients; - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" -#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" -#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" -#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type" -#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." - -namespace Tvdb.Models -{ - using System = global::System; - - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - public partial class Data2 - { - [System.Text.Json.Serialization.JsonPropertyName("series")] - public SeriesBaseRecord Series { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("episodes")] - public System.Collections.Generic.ICollection Episodes { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - public partial class Data3 - { - - [System.Text.Json.Serialization.JsonPropertyName("series")] - public SeriesBaseRecord Series { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [System.Text.Json.Serialization.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } -} - -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 -#pragma warning restore 1573 -#pragma warning restore 1591 -#pragma warning restore 8073 -#pragma warning restore 3016 -#pragma warning restore 8603 -#pragma warning restore 8604 -#pragma warning restore 8625 \ No newline at end of file diff --git a/src/TvdbClient/Models/UserInfo.cs b/src/TvdbClient/Models/UserInfo.cs deleted file mode 100644 index bc0734d..0000000 --- a/src/TvdbClient/Models/UserInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Tvdb.Models; - -/// -/// User info record -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public partial class UserInfo : AbstractBaseRecord -{ - - [System.Text.Json.Serialization.JsonPropertyName("id")] - public int? Id { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("language")] - public string Language { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string Name { get; set; } - - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } -} \ No newline at end of file diff --git a/src/TvdbClient/TvdbClient.csproj b/src/TvdbClient/TvdbClient.csproj index 270e6b7..a58d746 100644 --- a/src/TvdbClient/TvdbClient.csproj +++ b/src/TvdbClient/TvdbClient.csproj @@ -11,6 +11,9 @@ + + + True TVDB Api Client From eec2a8887f0cb62bae079a3aa92582296ee0cf6b Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 23:21:09 +1200 Subject: [PATCH 4/7] refactor(arch)!: extract generic TvdbClient.Abstractions (3-project split) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes the 3-project architecture: one API-versioned project + two generic. - New TvdbClient.Abstractions (ns Tvdb.Abstractions): the generic contracts — ITvdbClient, ITokenProvider, TvdbConfiguration, ApiResponseWrapper, Token, LoginRequestBody, AbstractBaseRecord. Depends only on the Models leaf. - Vacates the Tvdb.Models namespace of hand-written types (they were wrongly sharing the generated DTOs' namespace). - Generated clients now import Tvdb.Abstractions (for ITvdbClient). - Delete dead code: Tvdb.Types param enums (superseded by hoisted generated enums in Tvdb.Models) and all Converters (generated DTOs use DateTimeOffset/ TimeSpan); inline the trivial IsInThePast extension into Token. - Re-point the facade (Bootstrapper/TokenProvider/Handler) at Tvdb.Abstractions. All three src projects build clean. Architecture test enforcing the separation lands next. Co-Authored-By: Claude Opus 4.8 (1M context) --- TvdbApi.sln | 15 ++ build/Build.cs | 3 +- .../AbstractBaseRecord.cs | 48 +++--- .../ApiResponseWrapper.cs | 125 +++++++------- .../ITokenProvider.cs | 46 +++--- .../ITvdbClient.cs | 2 +- .../LoginRequestBody.cs | 46 +++--- .../Token.cs | 77 +++++---- .../TvdbClient.Abstractions.csproj | 17 ++ .../TvdbConfiguration.cs | 66 ++++---- src/TvdbClient/Clients/TvdbClient.cs | 1 + .../Converters/DateOnlyConverter.cs | 33 ---- .../Converters/DateTimeConverter.cs | 33 ---- .../Converters/TimeOnlyConverter.cs | 33 ---- src/TvdbClient/Extensions/Bootstrapper.cs | 144 ++++++++-------- .../Extensions/DateTimeExtensions.cs | 20 --- .../TokenAuthorizationHeaderHandler.cs | 56 +++---- src/TvdbClient/Provider/TvdbTokenProvider.cs | 155 +++++++++-------- src/TvdbClient/TvdbClient.csproj | 1 + src/TvdbClient/Types/EpisodesMeta.cs | 14 -- src/TvdbClient/Types/MovieSort.cs | 27 --- src/TvdbClient/Types/MoviesMeta.cs | 15 -- src/TvdbClient/Types/PeopleMeta.cs | 9 - src/TvdbClient/Types/SeriesMeta.cs | 21 --- src/TvdbClient/Types/SeriesSort.cs | 33 ---- src/TvdbClient/Types/SortType.cs | 21 --- src/TvdbClient/Types/UpdateAction.cs | 21 --- src/TvdbClient/Types/UpdateEntity.cs | 156 ------------------ 28 files changed, 417 insertions(+), 821 deletions(-) rename src/{TvdbClient/Models => TvdbClient.Abstractions}/AbstractBaseRecord.cs (93%) rename src/{TvdbClient/Models => TvdbClient.Abstractions}/ApiResponseWrapper.cs (95%) rename src/{TvdbClient/Provider => TvdbClient.Abstractions}/ITokenProvider.cs (82%) rename src/{TvdbClient/Clients => TvdbClient.Abstractions}/ITvdbClient.cs (86%) rename src/{TvdbClient/Models => TvdbClient.Abstractions}/LoginRequestBody.cs (85%) rename src/{TvdbClient/Models => TvdbClient.Abstractions}/Token.cs (86%) create mode 100644 src/TvdbClient.Abstractions/TvdbClient.Abstractions.csproj rename src/{TvdbClient/Configuration => TvdbClient.Abstractions}/TvdbConfiguration.cs (89%) delete mode 100644 src/TvdbClient/Converters/DateOnlyConverter.cs delete mode 100644 src/TvdbClient/Converters/DateTimeConverter.cs delete mode 100644 src/TvdbClient/Converters/TimeOnlyConverter.cs delete mode 100644 src/TvdbClient/Extensions/DateTimeExtensions.cs delete mode 100644 src/TvdbClient/Types/EpisodesMeta.cs delete mode 100644 src/TvdbClient/Types/MovieSort.cs delete mode 100644 src/TvdbClient/Types/MoviesMeta.cs delete mode 100644 src/TvdbClient/Types/PeopleMeta.cs delete mode 100644 src/TvdbClient/Types/SeriesMeta.cs delete mode 100644 src/TvdbClient/Types/SeriesSort.cs delete mode 100644 src/TvdbClient/Types/SortType.cs delete mode 100644 src/TvdbClient/Types/UpdateAction.cs delete mode 100644 src/TvdbClient/Types/UpdateEntity.cs diff --git a/TvdbApi.sln b/TvdbApi.sln index 13ff162..0a12794 100644 --- a/TvdbApi.sln +++ b/TvdbApi.sln @@ -30,6 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7849F1D9 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Models", "src\TvdbClient.Models\TvdbClient.Models.csproj", "{1B8ECC10-3AE4-4890-B738-8AB35FA661FC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Abstractions", "src\TvdbClient.Abstractions\TvdbClient.Abstractions.csproj", "{E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -76,6 +78,18 @@ Global {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x64.Build.0 = Release|Any CPU {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x86.ActiveCfg = Release|Any CPU {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Release|x86.Build.0 = Release|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Debug|x64.ActiveCfg = Debug|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Debug|x64.Build.0 = Debug|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Debug|x86.ActiveCfg = Debug|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Debug|x86.Build.0 = Debug|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|Any CPU.Build.0 = Release|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x64.ActiveCfg = Release|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x64.Build.0 = Release|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x86.ActiveCfg = Release|Any CPU + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -84,6 +98,7 @@ Global {02CB1507-5FF6-9962-1A70-EC35D9E298ED} = {1570EA31-904E-4036-89EE-890A8358C7AA} {E72AACA8-0A10-E62A-E526-41B75B6E6348} = {7849F1D9-4557-41C5-A747-241B92631187} {1B8ECC10-3AE4-4890-B738-8AB35FA661FC} = {1570EA31-904E-4036-89EE-890A8358C7AA} + {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E} = {1570EA31-904E-4036-89EE-890A8358C7AA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EBB4E090-0583-48B6-AEC2-1AB4E3B98D2A} diff --git a/build/Build.cs b/build/Build.cs index 2c4416c..8e43073 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -28,6 +28,7 @@ partial class Build : FalloutBuild const string ModelsNamespace = "Tvdb.Models"; const string ClientsNamespace = "Tvdb.Clients"; + const string AbstractionsNamespace = "Tvdb.Abstractions"; // The generated DTOs live in the API-versioned TvdbClient.Models project; // the generated clients live in the generic TvdbClient core project and @@ -57,7 +58,7 @@ partial class Build : FalloutBuild // Clients only → Tvdb.Clients (TvdbClient project), importing the DTOs from Tvdb.Models. var clients = new CSharpClientGenerator(document, CreateSettings(ClientsNamespace, dtoTypes: false, clientInterfaces: true, exceptionClasses: true, - additionalNamespaceUsages: new[] { ModelsNamespace })) + additionalNamespaceUsages: new[] { ModelsNamespace, AbstractionsNamespace })) .GenerateFile(ClientGeneratorOutputType.Full); ContractsOutput.WriteAllText(contracts); diff --git a/src/TvdbClient/Models/AbstractBaseRecord.cs b/src/TvdbClient.Abstractions/AbstractBaseRecord.cs similarity index 93% rename from src/TvdbClient/Models/AbstractBaseRecord.cs rename to src/TvdbClient.Abstractions/AbstractBaseRecord.cs index d2acef7..1a4c2e8 100644 --- a/src/TvdbClient/Models/AbstractBaseRecord.cs +++ b/src/TvdbClient.Abstractions/AbstractBaseRecord.cs @@ -1,24 +1,24 @@ -namespace Tvdb.Models; - -/// -/// Base Record for all TVDB Records -/// - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public abstract class AbstractBaseRecord -{ - /// - /// backing field for "/> - /// - private IDictionary? _additionalProperties; - - /// - /// Contains additional Properties that havent been mapped yet - /// - [System.Text.Json.Serialization.JsonExtensionData] - public IDictionary AdditionalProperties - { - get => _additionalProperties ??= new Dictionary(); - set => _additionalProperties = value; - } -} +namespace Tvdb.Abstractions; + +/// +/// Base Record for all TVDB Records +/// + +[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +public abstract class AbstractBaseRecord +{ + /// + /// backing field for "/> + /// + private IDictionary? _additionalProperties; + + /// + /// Contains additional Properties that havent been mapped yet + /// + [System.Text.Json.Serialization.JsonExtensionData] + public IDictionary AdditionalProperties + { + get => _additionalProperties ??= new Dictionary(); + set => _additionalProperties = value; + } +} diff --git a/src/TvdbClient/Models/ApiResponseWrapper.cs b/src/TvdbClient.Abstractions/ApiResponseWrapper.cs similarity index 95% rename from src/TvdbClient/Models/ApiResponseWrapper.cs rename to src/TvdbClient.Abstractions/ApiResponseWrapper.cs index 29e3b24..5a2b5f9 100644 --- a/src/TvdbClient/Models/ApiResponseWrapper.cs +++ b/src/TvdbClient.Abstractions/ApiResponseWrapper.cs @@ -1,62 +1,63 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tvdb.Models; - -/// -/// Wrapper for TVDB API Responses -/// -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class ApiResponseWrapper - where TDataType : class -{ - /// - /// Request Status - /// - /// Can be success, failure - [System.Text.Json.Serialization.JsonPropertyName("status")] - public string Status { get; set; } - - /// - /// Is Response a success? - /// - [System.Text.Json.Serialization.JsonIgnore] - public bool IsSuccess => Status.Equals("success"); - - /// - /// Error Message in case of a Failure - /// - [System.Text.Json.Serialization.JsonPropertyName("message")] - public string? ErrorMessage { get; set; } - - /// - /// Contains the actual Data - /// - [System.Text.Json.Serialization.JsonPropertyName("data")] - public TDataType? Data { get; set; } - - /// - /// backing field for "/> - /// - private IDictionary? _additionalProperties; - - /// - /// Contains additional Properties that havent been mapped yet - /// - [System.Text.Json.Serialization.JsonExtensionData] - public IDictionary AdditionalProperties - { - get => _additionalProperties ??= new Dictionary(); - set => _additionalProperties = value; - } - - /// - /// O-Data Links for next, previous and current record - /// - [System.Text.Json.Serialization.JsonPropertyName("links")] - public Links Links { get; set; } -} +using Tvdb.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tvdb.Abstractions; + +/// +/// Wrapper for TVDB API Responses +/// +/// +[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +public class ApiResponseWrapper + where TDataType : class +{ + /// + /// Request Status + /// + /// Can be success, failure + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } + + /// + /// Is Response a success? + /// + [System.Text.Json.Serialization.JsonIgnore] + public bool IsSuccess => Status.Equals("success"); + + /// + /// Error Message in case of a Failure + /// + [System.Text.Json.Serialization.JsonPropertyName("message")] + public string? ErrorMessage { get; set; } + + /// + /// Contains the actual Data + /// + [System.Text.Json.Serialization.JsonPropertyName("data")] + public TDataType? Data { get; set; } + + /// + /// backing field for "/> + /// + private IDictionary? _additionalProperties; + + /// + /// Contains additional Properties that havent been mapped yet + /// + [System.Text.Json.Serialization.JsonExtensionData] + public IDictionary AdditionalProperties + { + get => _additionalProperties ??= new Dictionary(); + set => _additionalProperties = value; + } + + /// + /// O-Data Links for next, previous and current record + /// + [System.Text.Json.Serialization.JsonPropertyName("links")] + public Links Links { get; set; } +} diff --git a/src/TvdbClient/Provider/ITokenProvider.cs b/src/TvdbClient.Abstractions/ITokenProvider.cs similarity index 82% rename from src/TvdbClient/Provider/ITokenProvider.cs rename to src/TvdbClient.Abstractions/ITokenProvider.cs index a1cb4a6..44fb6ab 100644 --- a/src/TvdbClient/Provider/ITokenProvider.cs +++ b/src/TvdbClient.Abstractions/ITokenProvider.cs @@ -1,25 +1,23 @@ -using Newtonsoft.Json.Linq; -using Tvdb.Models; - -namespace Tvdb.Provider; - -/// -/// Provider for Tokens -/// -public interface ITokenProvider -{ - #region Properties - /// - /// The current - /// - Token Token { get; } - #endregion - - #region Methods - /// - /// Acquire a - /// - /// - public Task AcquireTokenAsync(CancellationToken cancellationToken = default); - #endregion + +namespace Tvdb.Abstractions; + +/// +/// Provider for Tokens +/// +public interface ITokenProvider +{ + #region Properties + /// + /// The current + /// + Token Token { get; } + #endregion + + #region Methods + /// + /// Acquire a + /// + /// + public Task AcquireTokenAsync(CancellationToken cancellationToken = default); + #endregion } \ No newline at end of file diff --git a/src/TvdbClient/Clients/ITvdbClient.cs b/src/TvdbClient.Abstractions/ITvdbClient.cs similarity index 86% rename from src/TvdbClient/Clients/ITvdbClient.cs rename to src/TvdbClient.Abstractions/ITvdbClient.cs index 1eb8c50..cc417cf 100644 --- a/src/TvdbClient/Clients/ITvdbClient.cs +++ b/src/TvdbClient.Abstractions/ITvdbClient.cs @@ -1,4 +1,4 @@ -namespace Tvdb.Clients; +namespace Tvdb.Abstractions; /// /// Marker interface implemented by every generated TheTVDB client, used by the diff --git a/src/TvdbClient/Models/LoginRequestBody.cs b/src/TvdbClient.Abstractions/LoginRequestBody.cs similarity index 85% rename from src/TvdbClient/Models/LoginRequestBody.cs rename to src/TvdbClient.Abstractions/LoginRequestBody.cs index c61c836..6e321fc 100644 --- a/src/TvdbClient/Models/LoginRequestBody.cs +++ b/src/TvdbClient.Abstractions/LoginRequestBody.cs @@ -1,24 +1,24 @@ -using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; - -namespace Tvdb.Models; - -/// -/// Http Request for logging in and receiving a token -/// -public class LoginRequestBody : AbstractBaseRecord -{ - /// - /// Api Key - /// - [JsonPropertyName("apikey")] - [Required(AllowEmptyStrings = true)] - public string Apikey { get; set; } - - /// - /// Subscription Pin (optional) - /// - [JsonPropertyName("pin")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Pin { get; set; } +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; + +namespace Tvdb.Abstractions; + +/// +/// Http Request for logging in and receiving a token +/// +public class LoginRequestBody : AbstractBaseRecord +{ + /// + /// Api Key + /// + [JsonPropertyName("apikey")] + [Required(AllowEmptyStrings = true)] + public string Apikey { get; set; } + + /// + /// Subscription Pin (optional) + /// + [JsonPropertyName("pin")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Pin { get; set; } } \ No newline at end of file diff --git a/src/TvdbClient/Models/Token.cs b/src/TvdbClient.Abstractions/Token.cs similarity index 86% rename from src/TvdbClient/Models/Token.cs rename to src/TvdbClient.Abstractions/Token.cs index 02f669b..2358f30 100644 --- a/src/TvdbClient/Models/Token.cs +++ b/src/TvdbClient.Abstractions/Token.cs @@ -1,40 +1,39 @@ -using Tvdb.Extensions; - -namespace Tvdb.Models; - -/// -/// Bearer Token Model -/// -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -public class Token -{ - /// - /// Bearer Token - /// - [System.Text.Json.Serialization.JsonPropertyName("token")] - public string AccessToken { get; set; } - - /// - /// Timestamp of Creation - /// - public DateTime CreationTimestamp { get; } = DateTime.Now; - - /// - /// Expiry Date - /// - /// TVDB says their tokens last a month - [System.Text.Json.Serialization.JsonIgnore] - public DateTime TokenExpiryDate => CreationTimestamp.AddMonths(1); - - /// - /// Has this Token expired? - /// - [System.Text.Json.Serialization.JsonIgnore] - public bool IsTokenExpired => TokenExpiryDate.IsInThePast(); - - /// - /// Token Type - /// - /// Hardcoded Bearer even though its not quite a Bearer Token but ok - public static string TokenType => "Bearer"; + +namespace Tvdb.Abstractions; + +/// +/// Bearer Token Model +/// +[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +public class Token +{ + /// + /// Bearer Token + /// + [System.Text.Json.Serialization.JsonPropertyName("token")] + public string AccessToken { get; set; } + + /// + /// Timestamp of Creation + /// + public DateTime CreationTimestamp { get; } = DateTime.Now; + + /// + /// Expiry Date + /// + /// TVDB says their tokens last a month + [System.Text.Json.Serialization.JsonIgnore] + public DateTime TokenExpiryDate => CreationTimestamp.AddMonths(1); + + /// + /// Has this Token expired? + /// + [System.Text.Json.Serialization.JsonIgnore] + public bool IsTokenExpired => TokenExpiryDate < DateTime.Now; + + /// + /// Token Type + /// + /// Hardcoded Bearer even though its not quite a Bearer Token but ok + public static string TokenType => "Bearer"; } \ No newline at end of file diff --git a/src/TvdbClient.Abstractions/TvdbClient.Abstractions.csproj b/src/TvdbClient.Abstractions/TvdbClient.Abstractions.csproj new file mode 100644 index 0000000..586aca3 --- /dev/null +++ b/src/TvdbClient.Abstractions/TvdbClient.Abstractions.csproj @@ -0,0 +1,17 @@ + + + + + net9.0 + TvdbClient.Abstractions + TVDB Api Client — Abstractions + Generic contracts, configuration and response envelope for the TheTVDB v4 client. + + + + + + + diff --git a/src/TvdbClient/Configuration/TvdbConfiguration.cs b/src/TvdbClient.Abstractions/TvdbConfiguration.cs similarity index 89% rename from src/TvdbClient/Configuration/TvdbConfiguration.cs rename to src/TvdbClient.Abstractions/TvdbConfiguration.cs index 1dbcaab..71b3df4 100644 --- a/src/TvdbClient/Configuration/TvdbConfiguration.cs +++ b/src/TvdbClient.Abstractions/TvdbConfiguration.cs @@ -1,34 +1,34 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tvdb.Configuration; - -/// -/// Configuration for the TVDB Client -/// -public class TvdbConfiguration -{ - /// - /// TVDB Api Key - /// - - public virtual string ApiKey { get; set; } - - /// - /// Optional: TVDB Subscriber Pin - /// - public virtual string? Pin { get; set; } - - /// - /// Base URL for the API - /// - public virtual string BaseUrl { get; set; } - - /// - /// Url for the Token Generation - /// - public string TokenUrl => $"{BaseUrl}/login"; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tvdb.Abstractions; + +/// +/// Configuration for the TVDB Client +/// +public class TvdbConfiguration +{ + /// + /// TVDB Api Key + /// + + public virtual string ApiKey { get; set; } + + /// + /// Optional: TVDB Subscriber Pin + /// + public virtual string? Pin { get; set; } + + /// + /// Base URL for the API + /// + public virtual string BaseUrl { get; set; } + + /// + /// Url for the Token Generation + /// + public string TokenUrl => $"{BaseUrl}/login"; } \ No newline at end of file diff --git a/src/TvdbClient/Clients/TvdbClient.cs b/src/TvdbClient/Clients/TvdbClient.cs index 589124a..87bf31e 100644 --- a/src/TvdbClient/Clients/TvdbClient.cs +++ b/src/TvdbClient/Clients/TvdbClient.cs @@ -5,6 +5,7 @@ //---------------------- using Tvdb.Models; +using Tvdb.Abstractions; #pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." #pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." diff --git a/src/TvdbClient/Converters/DateOnlyConverter.cs b/src/TvdbClient/Converters/DateOnlyConverter.cs deleted file mode 100644 index 2248a73..0000000 --- a/src/TvdbClient/Converters/DateOnlyConverter.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Tvdb.Converters; - -/// -/// Converter for TVDB -/// -public class DateOnlyConverter(string? serializationFormat) : JsonConverter -{ - private readonly string serializationFormat = serializationFormat ?? dateFormat; - private const string dateFormat = "yyyy-MM-dd"; - - #region Constructor -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - public DateOnlyConverter() : this(null) { } -#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member - #endregion - - #region Methods - /// - public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var value = reader.GetString(); - if (string.IsNullOrEmpty(value)) return default; - return DateOnly.Parse(value!); - } - - /// - public override void Write(Utf8JsonWriter writer, DateOnly? value, JsonSerializerOptions options) - => writer.WriteStringValue(value.HasValue ? value.Value.ToString(serializationFormat) : string.Empty); - #endregion -} \ No newline at end of file diff --git a/src/TvdbClient/Converters/DateTimeConverter.cs b/src/TvdbClient/Converters/DateTimeConverter.cs deleted file mode 100644 index 548246c..0000000 --- a/src/TvdbClient/Converters/DateTimeConverter.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Tvdb.Converters; - -/// -/// Converter for TVDB -/// -public class DateTimeConverter(string? serializationFormat) : JsonConverter -{ - private readonly string serializationFormat = serializationFormat ?? dateFormat; - private const string dateFormat = "yyyy-MM-dd HH:mm:ss"; - - #region Constructor -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - public DateTimeConverter() : this(null) { } -#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member - #endregion - - #region Methods - /// - public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var value = reader.GetString(); - if (string.IsNullOrEmpty(value)) return default; - return DateTime.Parse(value!); - } - - /// - public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options) - => writer.WriteStringValue(value.HasValue ? value.Value.ToString(serializationFormat) : string.Empty); - #endregion -} \ No newline at end of file diff --git a/src/TvdbClient/Converters/TimeOnlyConverter.cs b/src/TvdbClient/Converters/TimeOnlyConverter.cs deleted file mode 100644 index efc2ad1..0000000 --- a/src/TvdbClient/Converters/TimeOnlyConverter.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Tvdb.Converters; - -/// -/// Converter for TVDB -/// -public class TimeOnlyConverter(string? serializationFormat) : JsonConverter -{ - private readonly string serializationFormat = serializationFormat ?? dateFormat; - private const string dateFormat = "HH:mm:ss"; - - #region Constructor -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - public TimeOnlyConverter() : this(null) { } -#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member - #endregion - - #region Methods - /// - public override TimeOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var value = reader.GetString(); - if (string.IsNullOrEmpty(value)) return default; - return TimeOnly.Parse(value!); - } - - /// - public override void Write(Utf8JsonWriter writer, TimeOnly? value, JsonSerializerOptions options) - => writer.WriteStringValue(value.HasValue ? value.Value.ToString(serializationFormat) : string.Empty); - #endregion -} \ No newline at end of file diff --git a/src/TvdbClient/Extensions/Bootstrapper.cs b/src/TvdbClient/Extensions/Bootstrapper.cs index 6d37cd0..3beb7e5 100644 --- a/src/TvdbClient/Extensions/Bootstrapper.cs +++ b/src/TvdbClient/Extensions/Bootstrapper.cs @@ -1,72 +1,72 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Tvdb.Configuration; -using Tvdb.Handlers; -using Tvdb.Provider; - -namespace Microsoft.Extensions.DependencyInjection; - -/// -/// Bootstrapper for TVDB Client -/// -public static class Bootstrapper -{ - /// - /// Add the TVDB Client to the configuration - /// - /// - /// - public static IConfigurationBuilder AddTvdbClient(this IConfigurationBuilder builder) - { - var config = builder - .AddJsonFile("TvdbClientConfig.json", optional: true) - .Build(); - - return builder; - } - - /// - /// Add the TVDB Client to the service collection - /// - /// - /// - /// - public static IServiceCollection AddTvdbClient(this IServiceCollection builder, IConfiguration config) - { - /* Inject TVDB Clients */ - builder.Configure(config.GetRequiredSection("TvdbConfiguration")); - builder.TryAddSingleton(); - builder.TryAddTransient(); - - string baseUrl = config.GetValue("TvdbConfiguration:BaseUrl") ?? "https://api4.thetvdb.com/v4"; - builder - .AddHttpClient(Tvdb.Constants.TvdbConstants.HttpClientName, client => - { - client.BaseAddress = new Uri(baseUrl.EnsureTrailingSlash()); - }) - .AddHttpMessageHandler(); - - /* Inject all Tvdb Clients at once */ - builder.Scan(scan => scan - .FromCallingAssembly() - .AddClasses(classes => classes.AssignableTo()) - .AsMatchingInterface() - .AsHttpClient(Tvdb.Constants.TvdbConstants.HttpClientName) - ); - - return builder; - } - - /// - /// Ensure that the input string ends on a slash - /// - /// - /// - public static string EnsureTrailingSlash(this string inputString) - { - if (string.IsNullOrWhiteSpace(inputString)) return string.Empty; - - if (!inputString.EndsWith('/')) inputString += '/'; - return inputString; - } -} +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Tvdb.Abstractions; +using Tvdb.Provider; +using Tvdb.Handlers; + +namespace Microsoft.Extensions.DependencyInjection; + +/// +/// Bootstrapper for TVDB Client +/// +public static class Bootstrapper +{ + /// + /// Add the TVDB Client to the configuration + /// + /// + /// + public static IConfigurationBuilder AddTvdbClient(this IConfigurationBuilder builder) + { + var config = builder + .AddJsonFile("TvdbClientConfig.json", optional: true) + .Build(); + + return builder; + } + + /// + /// Add the TVDB Client to the service collection + /// + /// + /// + /// + public static IServiceCollection AddTvdbClient(this IServiceCollection builder, IConfiguration config) + { + /* Inject TVDB Clients */ + builder.Configure(config.GetRequiredSection("TvdbConfiguration")); + builder.TryAddSingleton(); + builder.TryAddTransient(); + + string baseUrl = config.GetValue("TvdbConfiguration:BaseUrl") ?? "https://api4.thetvdb.com/v4"; + builder + .AddHttpClient(Tvdb.Constants.TvdbConstants.HttpClientName, client => + { + client.BaseAddress = new Uri(baseUrl.EnsureTrailingSlash()); + }) + .AddHttpMessageHandler(); + + /* Inject all Tvdb Clients at once */ + builder.Scan(scan => scan + .FromCallingAssembly() + .AddClasses(classes => classes.AssignableTo()) + .AsMatchingInterface() + .AsHttpClient(Tvdb.Constants.TvdbConstants.HttpClientName) + ); + + return builder; + } + + /// + /// Ensure that the input string ends on a slash + /// + /// + /// + public static string EnsureTrailingSlash(this string inputString) + { + if (string.IsNullOrWhiteSpace(inputString)) return string.Empty; + + if (!inputString.EndsWith('/')) inputString += '/'; + return inputString; + } +} diff --git a/src/TvdbClient/Extensions/DateTimeExtensions.cs b/src/TvdbClient/Extensions/DateTimeExtensions.cs deleted file mode 100644 index efda001..0000000 --- a/src/TvdbClient/Extensions/DateTimeExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tvdb.Extensions; - -/// -/// Extensions for -/// -public static class DateTimeExtensions -{ - /// - /// Check whether a Date is in the Past - /// - /// - /// - public static bool IsInThePast(this DateTime date) => date < DateTime.Now; -} \ No newline at end of file diff --git a/src/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs b/src/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs index f6b85af..6c244a2 100644 --- a/src/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs +++ b/src/TvdbClient/Handlers/TokenAuthorizationHeaderHandler.cs @@ -1,28 +1,28 @@ -using Tvdb.Provider; - -namespace Tvdb.Handlers; - -/// -/// Handler to add Authorization Header to the request -/// -/// -public class TokenAuthorizationHeaderHandler(ITokenProvider tokenProvider) : DelegatingHandler -{ - #region Overrides - /// - /// Send the request with the Authorization Header - /// - /// - /// - /// - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - // Acquire the token - var token = await tokenProvider.AcquireTokenAsync(cancellationToken); - - // Add the Authorization Header to the request - request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(Models.Token.TokenType, token.AccessToken); - return await base.SendAsync(request, cancellationToken); - } - #endregion -} \ No newline at end of file +using Tvdb.Abstractions; + +namespace Tvdb.Handlers; + +/// +/// Handler to add Authorization Header to the request +/// +/// +public class TokenAuthorizationHeaderHandler(ITokenProvider tokenProvider) : DelegatingHandler +{ + #region Overrides + /// + /// Send the request with the Authorization Header + /// + /// + /// + /// + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + // Acquire the token + var token = await tokenProvider.AcquireTokenAsync(cancellationToken); + + // Add the Authorization Header to the request + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(Token.TokenType, token.AccessToken); + return await base.SendAsync(request, cancellationToken); + } + #endregion +} diff --git a/src/TvdbClient/Provider/TvdbTokenProvider.cs b/src/TvdbClient/Provider/TvdbTokenProvider.cs index d9f103f..32e1051 100644 --- a/src/TvdbClient/Provider/TvdbTokenProvider.cs +++ b/src/TvdbClient/Provider/TvdbTokenProvider.cs @@ -1,78 +1,77 @@ -using System.Text; -using System.Text.Json; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Tvdb.Configuration; -using Tvdb.Handlers; -using Tvdb.Models; - -namespace Tvdb.Provider; - -/// -/// Token Provider for TVDB -/// -/// -/// -public class TvdbTokenProvider(IOptions options, ILogger logger) : ITokenProvider -{ - #region Properties - /// - public TvdbConfiguration Config => Options.Value; - - /// - public IOptions Options { get; } = options; - - /// - public ILogger Logger { get; } = logger; - - /// - public Token Token { get; internal set; } - #endregion - - #region Methods - /// - public async Task AcquireTokenAsync(CancellationToken cancellationToken = default) - { - /* Acquire new Token */ - if (Token is null || Token.IsTokenExpired) - { - try - { - var httpClient = new HttpClient(); - var requestBody = new StringContent(JsonSerializer.Serialize(new LoginRequestBody { Apikey = Config.ApiKey, Pin = Config.Pin }), Encoding.UTF8, System.Net.Mime.MediaTypeNames.Application.Json); - - var response = await httpClient.PostAsync(Config.TokenUrl, requestBody, cancellationToken); - if (!response.IsSuccessStatusCode) Logger.LogError("Failed acquiring Token"); - response.EnsureSuccessStatusCode(); - - var responseBody = await response.Content.ReadAsStringAsync(cancellationToken); - var responseData = JsonSerializer.Deserialize>(responseBody); - if(responseData is null) - { - Logger.LogError("Failed acquiring Token."); - throw new Exception("Failed acquiring Token."); - } - if (responseData is not null && !responseData.IsSuccess) - { - Logger.LogError("Failed acquiring Token. {errorMessage}", responseData.ErrorMessage); - throw new Exception($"Failed acquiring Token. {responseData.ErrorMessage}"); - } - var token = responseData!.Data; - if (token is null) - { - Logger.LogError("Failed deserializing Token response"); - throw new Exception("Failed deserializing Token response"); - } - Token = token; - } - catch (Exception ex) - { - Logger.LogError("Failed acquiring token. {errorMessage}", ex.Message); - throw; - } - } - - return Token; - } - #endregion -} \ No newline at end of file +using System.Text; +using System.Text.Json; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Tvdb.Abstractions; +using Tvdb.Handlers; + +namespace Tvdb.Provider; + +/// +/// Token Provider for TVDB +/// +/// +/// +public class TvdbTokenProvider(IOptions options, ILogger logger) : ITokenProvider +{ + #region Properties + /// + public TvdbConfiguration Config => Options.Value; + + /// + public IOptions Options { get; } = options; + + /// + public ILogger Logger { get; } = logger; + + /// + public Token Token { get; internal set; } + #endregion + + #region Methods + /// + public async Task AcquireTokenAsync(CancellationToken cancellationToken = default) + { + /* Acquire new Token */ + if (Token is null || Token.IsTokenExpired) + { + try + { + var httpClient = new HttpClient(); + var requestBody = new StringContent(JsonSerializer.Serialize(new LoginRequestBody { Apikey = Config.ApiKey, Pin = Config.Pin }), Encoding.UTF8, System.Net.Mime.MediaTypeNames.Application.Json); + + var response = await httpClient.PostAsync(Config.TokenUrl, requestBody, cancellationToken); + if (!response.IsSuccessStatusCode) Logger.LogError("Failed acquiring Token"); + response.EnsureSuccessStatusCode(); + + var responseBody = await response.Content.ReadAsStringAsync(cancellationToken); + var responseData = JsonSerializer.Deserialize>(responseBody); + if(responseData is null) + { + Logger.LogError("Failed acquiring Token."); + throw new Exception("Failed acquiring Token."); + } + if (responseData is not null && !responseData.IsSuccess) + { + Logger.LogError("Failed acquiring Token. {errorMessage}", responseData.ErrorMessage); + throw new Exception($"Failed acquiring Token. {responseData.ErrorMessage}"); + } + var token = responseData!.Data; + if (token is null) + { + Logger.LogError("Failed deserializing Token response"); + throw new Exception("Failed deserializing Token response"); + } + Token = token; + } + catch (Exception ex) + { + Logger.LogError("Failed acquiring token. {errorMessage}", ex.Message); + throw; + } + } + + return Token; + } + #endregion +} diff --git a/src/TvdbClient/TvdbClient.csproj b/src/TvdbClient/TvdbClient.csproj index a58d746..1115ad2 100644 --- a/src/TvdbClient/TvdbClient.csproj +++ b/src/TvdbClient/TvdbClient.csproj @@ -13,6 +13,7 @@ + True diff --git a/src/TvdbClient/Types/EpisodesMeta.cs b/src/TvdbClient/Types/EpisodesMeta.cs deleted file mode 100644 index 19b73a2..0000000 --- a/src/TvdbClient/Types/EpisodesMeta.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Runtime.Serialization; -namespace Tvdb.Types; - -/// -/// MetaData for -/// -public enum EpisodesMeta -{ - /// - /// Include - /// - [EnumMember(Value = @"translations")] - Translations = 0, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/MovieSort.cs b/src/TvdbClient/Types/MovieSort.cs deleted file mode 100644 index e8ada53..0000000 --- a/src/TvdbClient/Types/MovieSort.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// Sortation for -/// -public enum MovieSort -{ - /// - /// Sort by "/> - /// - [EnumMember(Value = @"score")] - Score = 0, - - /// - /// Sort by Air Date - /// - [EnumMember(Value = @"firstAired")] - FirstAired = 1, - - /// - /// Sort by "/> - /// - [EnumMember(Value = @"name")] - Name = 2, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/MoviesMeta.cs b/src/TvdbClient/Types/MoviesMeta.cs deleted file mode 100644 index 7a8cc3e..0000000 --- a/src/TvdbClient/Types/MoviesMeta.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// MetaData for -/// -public enum MoviesMeta -{ - /// - /// Include - /// - [EnumMember(Value = @"translations")] - Translations = 0, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/PeopleMeta.cs b/src/TvdbClient/Types/PeopleMeta.cs deleted file mode 100644 index 3a9217c..0000000 --- a/src/TvdbClient/Types/PeopleMeta.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Tvdb.Types; - -public enum PeopleMeta -{ - - [System.Runtime.Serialization.EnumMember(Value = @"translations")] - Translations = 0, - -} diff --git a/src/TvdbClient/Types/SeriesMeta.cs b/src/TvdbClient/Types/SeriesMeta.cs deleted file mode 100644 index 213c968..0000000 --- a/src/TvdbClient/Types/SeriesMeta.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// MetaData for to include -/// -public enum SeriesMeta -{ - /// - /// Include - /// - [EnumMember(Value = @"translations")] - Translations = 0, - - /// - /// Include Episodes on - /// - [EnumMember(Value = @"episodes")] - Episodes = 1, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/SeriesSort.cs b/src/TvdbClient/Types/SeriesSort.cs deleted file mode 100644 index 46a6df1..0000000 --- a/src/TvdbClient/Types/SeriesSort.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// Sortation for -/// -public enum SeriesSort -{ - /// - /// Sort by "/> - /// - [EnumMember(Value = @"score")] - Score = 0, - - /// - /// Sort by "/> - /// - [EnumMember(Value = @"firstAired")] - FirstAired = 1, - - /// - /// Sort by "/> - /// - [EnumMember(Value = @"lastAired")] - LastAired = 2, - - /// - /// Sort by "/> - /// - [EnumMember(Value = @"name")] - Name = 3, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/SortType.cs b/src/TvdbClient/Types/SortType.cs deleted file mode 100644 index c088409..0000000 --- a/src/TvdbClient/Types/SortType.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// Sortation Direction -/// -public enum SortType -{ - /// - /// Ascending - /// - [EnumMember(Value = @"asc")] - Ascending = 0, - - /// - /// Descending - /// - [EnumMember(Value = @"desc")] - Descending = 1, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/UpdateAction.cs b/src/TvdbClient/Types/UpdateAction.cs deleted file mode 100644 index f9cc168..0000000 --- a/src/TvdbClient/Types/UpdateAction.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// The action to perform on an update. -/// -public enum UpdateAction -{ - /// - /// Got Deleted - /// - [EnumMember(Value = @"delete")] - Delete = 0, - - /// - /// Got Updated - /// - [EnumMember(Value = @"update")] - Update = 1, -} \ No newline at end of file diff --git a/src/TvdbClient/Types/UpdateEntity.cs b/src/TvdbClient/Types/UpdateEntity.cs deleted file mode 100644 index 3dc3bcc..0000000 --- a/src/TvdbClient/Types/UpdateEntity.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System.Runtime.Serialization; - -namespace Tvdb.Types; - -/// -/// The entity to update. -/// -public enum UpdateEntity -{ - /// - /// - /// - [EnumMember(Value = @"artwork")] - Artwork = 0, - - /// - /// - /// - [EnumMember(Value = @"award_nominees")] - Award_nominees = 1, - - /// - /// - /// - [EnumMember(Value = @"companies")] - Companies = 2, - - /// - /// - /// - [EnumMember(Value = @"episodes")] - Episodes = 3, - - /// - /// - /// - [EnumMember(Value = @"lists")] - Lists = 4, - - /// - /// - /// - [EnumMember(Value = @"people")] - People = 5, - - /// - /// - /// - [EnumMember(Value = @"seasons")] - Seasons = 6, - - /// - /// - /// - [EnumMember(Value = @"series")] - Series = 7, - - [EnumMember(Value = @"seriespeople")] - Seriespeople = 8, - - [EnumMember(Value = @"artworktypes")] - Artworktypes = 9, - - /// - /// - /// - [EnumMember(Value = @"award_categories")] - Award_categories = 10, - - /// - /// - /// - [EnumMember(Value = @"awards")] - Awards = 11, - - [EnumMember(Value = @"company_types")] - Company_types = 12, - - [EnumMember(Value = @"content_ratings")] - Content_ratings = 13, - - /// - /// - /// - [EnumMember(Value = @"countries")] - Countries = 14, - - /// - /// - /// - [EnumMember(Value = @"entity_types")] - Entity_types = 15, - - /// - /// - /// - [EnumMember(Value = @"genres")] - Genres = 16, - - /// - /// - /// - [EnumMember(Value = @"languages")] - Languages = 17, - - /// - /// - /// - [EnumMember(Value = @"movies")] - Movies = 18, - - [EnumMember(Value = @"movie_genres")] - Movie_genres = 19, - - [EnumMember(Value = @"movie_status")] - Movie_status = 20, - - [EnumMember(Value = @"peopletypes")] - Peopletypes = 21, - - [EnumMember(Value = @"seasontypes")] - Seasontypes = 22, - - [EnumMember(Value = @"sourcetypes")] - Sourcetypes = 23, - - [EnumMember(Value = @"tag_options")] - Tag_options = 24, - - [EnumMember(Value = @"tags")] - Tags = 25, - - [EnumMember(Value = @"translatedcharacters")] - Translatedcharacters = 26, - - [EnumMember(Value = @"translatedcompanies")] - Translatedcompanies = 27, - - [EnumMember(Value = @"translatedepisodes")] - Translatedepisodes = 28, - - [EnumMember(Value = @"translatedlists")] - Translatedlists = 29, - - [EnumMember(Value = @"translatedmovies")] - Translatedmovies = 30, - - [EnumMember(Value = @"translatedpeople")] - Translatedpeople = 31, - - [EnumMember(Value = @"translatedseasons")] - Translatedseasons = 32, - - [EnumMember(Value = @"translatedserierk")] - Translatedserierk = 33, -} From 3fafa0b782e1790349421e83eeb4ea95c696c981 Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 23:24:22 +1200 Subject: [PATCH 5/7] test(arch): enforce the 3-project separation with NetArchTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the stale TUnit test project with the first Fallout-style spec project (xUnit + FluentAssertions + Verify + NetArchTest + Mockly; versioned packages injected via tests/Directory.Build.props for *.Specs — no Central Package Management). ArchitectureSpecs locks the architecture Chris asked to protect: - TvdbClient.Models depends on no other Tvdb project (regeneratable leaf). - TvdbClient.Abstractions does not depend on the client core. - The generated-model namespace Tvdb.Models lives only in the Models assembly. All 3 specs pass. (RollForward=Major so the net9 test host runs on dev machines that only have the net8/net10 runtimes.) Co-Authored-By: Claude Opus 4.8 (1M context) --- TvdbApi.sln | 30 ++++---- tests/Directory.Build.props | 32 ++++---- tests/TvdbClient.Specs/ArchitectureSpecs.cs | 55 ++++++++++++++ .../TvdbClient.Specs/TvdbClient.Specs.csproj | 16 ++++ .../AuthenticationUnitTests.cs | 72 ------------------ .../TvdbClient.Tests/Clients/SeriesClient.cs | 67 ----------------- .../Converters/DateOnlyConverterTests.cs | 73 ------------------- .../Converters/DateTimeConverterTests.cs | 70 ------------------ .../Converters/TimeOnlyConverterTests.cs | 73 ------------------- .../Provider/TvdbTokenProviderUnitTests.cs | 52 ------------- .../TvdbClient.Tests/TvdbClient.Tests.csproj | 30 -------- tests/TvdbClient.Tests/TvdbClientConfig.json | 8 -- 12 files changed, 104 insertions(+), 474 deletions(-) create mode 100644 tests/TvdbClient.Specs/ArchitectureSpecs.cs create mode 100644 tests/TvdbClient.Specs/TvdbClient.Specs.csproj delete mode 100644 tests/TvdbClient.Tests/AuthenticationUnitTests.cs delete mode 100644 tests/TvdbClient.Tests/Clients/SeriesClient.cs delete mode 100644 tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs delete mode 100644 tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs delete mode 100644 tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs delete mode 100644 tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs delete mode 100644 tests/TvdbClient.Tests/TvdbClient.Tests.csproj delete mode 100644 tests/TvdbClient.Tests/TvdbClientConfig.json diff --git a/TvdbApi.sln b/TvdbApi.sln index 0a12794..365847a 100644 --- a/TvdbApi.sln +++ b/TvdbApi.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.13.35617.110 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient", "src\TvdbClient\TvdbClient.csproj", "{02CB1507-5FF6-9962-1A70-EC35D9E298ED}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Tests", "tests\TvdbClient.Tests\TvdbClient.Tests.csproj", "{E72AACA8-0A10-E62A-E526-41B75B6E6348}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore @@ -32,6 +30,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Models", "src\Tv EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Abstractions", "src\TvdbClient.Abstractions\TvdbClient.Abstractions.csproj", "{E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TvdbClient.Specs", "tests\TvdbClient.Specs\TvdbClient.Specs.csproj", "{5E508C09-8035-4877-A1D0-299A04EA6962}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -54,18 +54,6 @@ Global {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x64.Build.0 = Release|Any CPU {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x86.ActiveCfg = Release|Any CPU {02CB1507-5FF6-9962-1A70-EC35D9E298ED}.Release|x86.Build.0 = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x64.ActiveCfg = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x64.Build.0 = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x86.ActiveCfg = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Debug|x86.Build.0 = Debug|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|Any CPU.Build.0 = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x64.ActiveCfg = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x64.Build.0 = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x86.ActiveCfg = Release|Any CPU - {E72AACA8-0A10-E62A-E526-41B75B6E6348}.Release|x86.Build.0 = Release|Any CPU {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B8ECC10-3AE4-4890-B738-8AB35FA661FC}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -90,15 +78,27 @@ Global {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x64.Build.0 = Release|Any CPU {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x86.ActiveCfg = Release|Any CPU {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E}.Release|x86.Build.0 = Release|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Debug|x64.ActiveCfg = Debug|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Debug|x64.Build.0 = Debug|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Debug|x86.ActiveCfg = Debug|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Debug|x86.Build.0 = Debug|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Release|Any CPU.Build.0 = Release|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Release|x64.ActiveCfg = Release|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Release|x64.Build.0 = Release|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Release|x86.ActiveCfg = Release|Any CPU + {5E508C09-8035-4877-A1D0-299A04EA6962}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {02CB1507-5FF6-9962-1A70-EC35D9E298ED} = {1570EA31-904E-4036-89EE-890A8358C7AA} - {E72AACA8-0A10-E62A-E526-41B75B6E6348} = {7849F1D9-4557-41C5-A747-241B92631187} {1B8ECC10-3AE4-4890-B738-8AB35FA661FC} = {1570EA31-904E-4036-89EE-890A8358C7AA} {E7E64FC1-D8C1-4437-AB3E-E9C4EBAA219E} = {1570EA31-904E-4036-89EE-890A8358C7AA} + {5E508C09-8035-4877-A1D0-299A04EA6962} = {7849F1D9-4557-41C5-A747-241B92631187} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EBB4E090-0583-48B6-AEC2-1AB4E3B98D2A} diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 87e9600..0e08fee 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -1,23 +1,27 @@ - - true + + + true - Exe + false - - - - - + + + + + + + + + + all runtime; build; native; contentfiles; analyzers - - - - - - \ No newline at end of file + diff --git a/tests/TvdbClient.Specs/ArchitectureSpecs.cs b/tests/TvdbClient.Specs/ArchitectureSpecs.cs new file mode 100644 index 0000000..2a776e5 --- /dev/null +++ b/tests/TvdbClient.Specs/ArchitectureSpecs.cs @@ -0,0 +1,55 @@ +using System.Linq; +using System.Reflection; +using FluentAssertions; +using NetArchTest.Rules; +using Xunit; + +namespace TvdbClient.Specs; + +/// +/// Fitness tests locking the 3-project separation in place: one API-versioned +/// project (the generated models) and two generic ones. Regenerating the models +/// must never be able to reach back into the client core. +/// +public class ArchitectureSpecs +{ + static readonly Assembly Models = typeof(Tvdb.Models.SeriesBaseRecord).Assembly; + static readonly Assembly Abstractions = typeof(Tvdb.Abstractions.ITvdbClient).Assembly; + static readonly Assembly Core = typeof(Tvdb.Clients.LoginClient).Assembly; + + [Fact] + public void Models_is_the_leaf_and_depends_on_no_other_Tvdb_project() + { + var result = Types.InAssembly(Models) + .Should().NotHaveDependencyOnAny("Tvdb.Abstractions", "Tvdb.Clients") + .GetResult(); + + result.IsSuccessful.Should().BeTrue( + because: "the API-versioned models are regenerated in isolation; offenders: " + + string.Join(", ", result.FailingTypeNames ?? Enumerable.Empty())); + } + + [Fact] + public void Abstractions_does_not_depend_on_the_client_core() + { + var result = Types.InAssembly(Abstractions) + .Should().NotHaveDependencyOn("Tvdb.Clients") + .GetResult(); + + result.IsSuccessful.Should().BeTrue( + because: "the generic contracts must not depend on the client implementation; offenders: " + + string.Join(", ", result.FailingTypeNames ?? Enumerable.Empty())); + } + + [Fact] + public void The_generated_models_namespace_lives_only_in_the_models_assembly() + { + var strays = Types.InAssembly(Abstractions).That().ResideInNamespace("Tvdb.Models").GetTypes() + .Concat(Types.InAssembly(Core).That().ResideInNamespace("Tvdb.Models").GetTypes()) + .Select(t => t.FullName) + .ToList(); + + strays.Should().BeEmpty( + "the generated-model namespace Tvdb.Models must belong to TvdbClient.Models alone"); + } +} diff --git a/tests/TvdbClient.Specs/TvdbClient.Specs.csproj b/tests/TvdbClient.Specs/TvdbClient.Specs.csproj new file mode 100644 index 0000000..3c56b08 --- /dev/null +++ b/tests/TvdbClient.Specs/TvdbClient.Specs.csproj @@ -0,0 +1,16 @@ + + + + net9.0 + + Major + + + + + + + + + diff --git a/tests/TvdbClient.Tests/AuthenticationUnitTests.cs b/tests/TvdbClient.Tests/AuthenticationUnitTests.cs deleted file mode 100644 index 7bb5c64..0000000 --- a/tests/TvdbClient.Tests/AuthenticationUnitTests.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Text.Json; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Tvdb.Clients; -using Tvdb.Models; - -namespace Tvdb; - -public class AuthenticationUnitTests -{ - public AuthenticationUnitTests() - { - var builder = new HostApplicationBuilder(); - var config = builder.Configuration - .AddTvdbClient() - .Build(); - ServiceProvider = builder.Services - .AddTvdbClient(config) - .BuildServiceProvider(); - } - - public ServiceProvider ServiceProvider { get; internal set; } - - [Test] - public async Task ManuallyAuthenticate_Fact() - { - // Arrange - var config = new Configuration.TvdbConfiguration - { - BaseUrl = "https://api4.thetvdb.com/v4", - ApiKey = "e82b72fe-8674-4cc1-8cbb-474ed12a3fed" - }; - var httpClient = new HttpClient(); - var requestBody = new StringContent(JsonSerializer.Serialize(new { apikey = config.ApiKey }), System.Text.Encoding.UTF8, System.Net.Mime.MediaTypeNames.Application.Json); - - // Act - var response = await httpClient.PostAsync(config.TokenUrl, requestBody); - response.EnsureSuccessStatusCode(); - var responseData = await response.Content.ReadAsStringAsync(); - var result = JsonSerializer.Deserialize>(responseData); - - // Assert - - /* Validate Wrapper, Response should be a success */ - result.ShouldNotBeNull(); - result.Status.ShouldBe("success"); - result.IsSuccess.ShouldBeTrue(); - - /* Validate Data, Token should be populated and valid for a month */ - result.Data.ShouldNotBeNull(); - var token = result.Data; - Token.TokenType.ShouldBe("Bearer"); - token.CreationTimestamp.ShouldBeLessThanOrEqualTo(DateTime.Now); - token.IsTokenExpired.ShouldBeFalse(); - token.TokenExpiryDate.ShouldBeGreaterThanOrEqualTo(DateTime.Today.AddMonths(1)); // should be roughly a month, +/- a day - - token.AccessToken.ShouldNotBeNullOrEmpty(); - } - - [Test] - public async Task TestRandomApi_Fact() - { - // Arrange - var client = ServiceProvider.GetRequiredService(); - - // Act - var result = await client.CountriesAsync(); - - // Assert - result.Status.ShouldBe("success"); - } -} \ No newline at end of file diff --git a/tests/TvdbClient.Tests/Clients/SeriesClient.cs b/tests/TvdbClient.Tests/Clients/SeriesClient.cs deleted file mode 100644 index e16e48a..0000000 --- a/tests/TvdbClient.Tests/Clients/SeriesClient.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace Tvdb.Clients; - -public class SeriesClient -{ - public SeriesClient() - { - - var builder = new HostApplicationBuilder(); - var config = builder.Configuration - .AddTvdbClient() - .Build(); - - ServiceProvider = builder.Services - .AddTvdbClient(config) - .BuildServiceProvider(); - - Client = ServiceProvider.GetRequiredService(); - } - - public ServiceProvider ServiceProvider { get; } - public ISeriesClient Client { get; } - - [Test] - public void DependencyInjection_Fact() => Client.ShouldNotBeNull(); - - [Test] - [Arguments(234791)] // Heute Show - public async Task GetSeriesById_Theory(int tvdbId) - { - // Arrange - - // Act - var result = await Client.SeriesGetAsync(tvdbId); - var data = result.Data; - - // Assert - result.ShouldNotBeNull(); - result.IsSuccess.ShouldBeTrue(); - - data.ShouldNotBeNull(); - } - - [Test] - [Arguments(234791)] // Heute Show - public async Task GetSeriesExtendedById_Theory(int tvdbId) - { - // Arrange - - // Act - var result = await Client.ExtendedAsync(tvdbId); - var data = result.Data; - - // Assert - result.ShouldNotBeNull(); - result.IsSuccess.ShouldBeTrue(); - - data.ShouldNotBeNull(); - } -} \ No newline at end of file diff --git a/tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs b/tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs deleted file mode 100644 index 982cb22..0000000 --- a/tests/TvdbClient.Tests/Converters/DateOnlyConverterTests.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Text; -using System.Text.Json; - -namespace Tvdb.Converters; - -public class DateOnlyConverterTests -{ - [Test] - public void Read_ValidDate_ReturnsDateOnly() - { - // Arrange - var json = "\"2023-10-05\""; - var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); - var converter = new DateOnlyConverter(null); - - // Act - reader.Read(); - var result = converter.Read(ref reader, typeof(DateOnly?), new JsonSerializerOptions()); - - // Assert - result.ShouldNotBeNull(); - result.ShouldBeOfType(); - // Validate the date - result.ShouldBe(new DateOnly(2023, 10, 5)); - } - - [Test] - public void Read_NullOrEmpty_ReturnsNull() - { - // Arrange - var json = "\"\""; - var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); - var converter = new DateOnlyConverter(null); - - // Act - reader.Read(); - var result = converter.Read(ref reader, typeof(DateOnly?), new JsonSerializerOptions()); - - // Assert - result.ShouldBeNull(); - } - - [Test] - public void Write_ValidDate_WritesCorrectJson() - { - // Arrange - var value = new DateOnly(2023, 10, 5); - var options = new JsonSerializerOptions { Converters = { new DateOnlyConverter(null) } }; - var expectedJson = "\"2023-10-05\""; - - // Act - var json = JsonSerializer.Serialize(value, options); - - // Assert - json.ShouldBeEquivalentTo(expectedJson); - } - - [Test] - public void Write_Null_WritesEmptyString() - { - // Arrange - DateOnly? value = null; - var options = new JsonSerializerOptions { Converters = { new DateOnlyConverter(null) } }; - var expectedJson = "null"; - - // Act - var json = JsonSerializer.Serialize(value, options); - - // Assert - json.ShouldBeEquivalentTo(expectedJson); - } -} \ No newline at end of file diff --git a/tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs b/tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs deleted file mode 100644 index efeac56..0000000 --- a/tests/TvdbClient.Tests/Converters/DateTimeConverterTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Text; -using System.Text.Json; - -namespace Tvdb.Converters; - -public class DateTimeConverterTests -{ - [Test] - [Arguments(2023, 10, 10, 12, 34, 56)] - public void Read_ValidDate_ReturnsDateTime(int year, int month, int day, int hour, int minute, int second) - { - // Arrange - var json = $"\"{year:0000}-{month:00}-{day:00} {hour:00}:{minute:00}:{second:00}\""; - var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); - var converter = new DateTimeConverter(); - - // Act - reader.Read(); - var result = converter.Read(ref reader, typeof(DateTime?), new JsonSerializerOptions()); - - // Assert - DateTime expectedDate = new(year, month, day, hour, minute, second); - result.ShouldBe(expectedDate); - } - - [Test] - public void Read_NullOrEmptyString_ReturnsNull() - { - // Arrange - var json = "\"\""; - var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); - var converter = new DateTimeConverter(); - - // Act - reader.Read(); - var result = converter.Read(ref reader, typeof(DateTime?), new JsonSerializerOptions()); - - // Assert - result.ShouldBeNull(); - } - - [Test] - public void Write_ValidDate_WritesCorrectJson() - { - // Arrange - var options = new JsonSerializerOptions { Converters = { new DateTimeConverter() } }; - var dateTime = new DateTime(2023, 10, 10, 12, 34, 56); - - // Act - var json = JsonSerializer.Serialize(dateTime, options); - - // Assert - json.ShouldBe("\"2023-10-10T12:34:56\""); - } - - [Test] - public void Write_NullValue_WritesEmptyString() - { - // Arrange - var options = new JsonSerializerOptions { Converters = { new DateTimeConverter() } }; - DateTime? dateTime = null; - - // Act - var json = JsonSerializer.Serialize(dateTime, options); - - // Assert - json.ShouldBe("null"); - } -} \ No newline at end of file diff --git a/tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs b/tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs deleted file mode 100644 index 20c0c6e..0000000 --- a/tests/TvdbClient.Tests/Converters/TimeOnlyConverterTests.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Text; -using System.Text.Json; - -namespace Tvdb.Converters; - -public class TimeOnlyConverterTests -{ - [Test] - [Arguments(14, 30, 0)] - public void Read_ValidTime_ReturnsTimeOnly(int hour, int minute, int second) - { - // Arrange - var json = $"\"{hour:00}:{minute:00}:{second:00}\""; - var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); - var converter = new TimeOnlyConverter(null); - - // Act - reader.Read(); - var result = converter.Read(ref reader, typeof(TimeOnly?), new JsonSerializerOptions()); - - // Assert - result.ShouldNotBeNull(); - result.ShouldBeOfType(); - result.ShouldBe(new TimeOnly(hour, minute, second)); - } - - [Test] - public void Read_NullOrEmpty_ReturnsNull() - { - // Arrange - var json = "\"\""; - var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); - var converter = new TimeOnlyConverter(null); - - // Act - reader.Read(); - var result = converter.Read(ref reader, typeof(TimeOnly?), new JsonSerializerOptions()); - - // Assert - result.ShouldBeNull(); - } - - [Test] - public void Write_ValidTime_WritesCorrectJson() - { - // Arrange - var value = new TimeOnly(14, 30, 0); - var options = new JsonSerializerOptions { Converters = { new TimeOnlyConverter(null) } }; - var expectedJson = "\"14:30:00\""; - - // Act - var json = JsonSerializer.Serialize(value, options); - - // Assert - json.ShouldBeEquivalentTo(expectedJson); - } - - [Test] - public void Write_Null_WritesEmptyString() - { - // Arrange - TimeOnly? value = null; - var options = new JsonSerializerOptions { Converters = { new TimeOnlyConverter(null) } }; - var expectedJson = "null"; - - // Act - var json = JsonSerializer.Serialize(value, options); - - // Assert - json.ShouldBeEquivalentTo(expectedJson); - } -} \ No newline at end of file diff --git a/tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs b/tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs deleted file mode 100644 index 499cff9..0000000 --- a/tests/TvdbClient.Tests/Provider/TvdbTokenProviderUnitTests.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Tvdb.Configuration; - -namespace Tvdb.Provider; - -public class TvdbTokenProviderUnitTests -{ - - public TvdbTokenProviderUnitTests() - { - - var builder = new HostApplicationBuilder(); - var config = builder.Configuration - .AddJsonFile("TvdbClientConfig.json", optional: false) - .Build(); - - ServiceProvider = builder.Services - .Configure(config.GetRequiredSection("TvdbConfiguration")) - .AddScoped() - .BuildServiceProvider(); - } - - public ServiceProvider ServiceProvider { get; internal set; } - - [Test] - public async Task AcquireTokenAsync_Fact() - { - // Arrange - var tokenProvider = ServiceProvider.GetRequiredService(); - - // Act - var token = await tokenProvider.AcquireTokenAsync(); - - // Assert - - /* Validate Data, Token should be populated and valid for a month */ - token.ShouldNotBeNull(); - Models.Token.TokenType.ShouldBe("Bearer"); - token.CreationTimestamp.ShouldBeLessThanOrEqualTo(DateTime.Now); - token.IsTokenExpired.ShouldBeFalse(); - token.TokenExpiryDate.ShouldBeGreaterThanOrEqualTo(DateTime.Today.AddMonths(1)); // should be roughly a month, +/- a day - - token.AccessToken.ShouldNotBeNullOrEmpty(); - } -} diff --git a/tests/TvdbClient.Tests/TvdbClient.Tests.csproj b/tests/TvdbClient.Tests/TvdbClient.Tests.csproj deleted file mode 100644 index 6444a4c..0000000 --- a/tests/TvdbClient.Tests/TvdbClient.Tests.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - net9.0 - enable - enable - false - - - - - - - - - - PreserveNewest - - - - - - - - - - - - - diff --git a/tests/TvdbClient.Tests/TvdbClientConfig.json b/tests/TvdbClient.Tests/TvdbClientConfig.json deleted file mode 100644 index 82e657f..0000000 --- a/tests/TvdbClient.Tests/TvdbClientConfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "TvdbConfiguration": { - "BaseUrl": "https://api4.thetvdb.com/v4", - /* This API Key comes from the TVDB Example and obviously needs to be replaced in production */ - "ApiKey": "580c9239-d2f8-4460-a22e-6831900a97a3", - "Pin": "IPQZOCMN" - } -} \ No newline at end of file From fb907462155a9f9c218a85c7355096519c7e9ece Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 23:30:57 +1200 Subject: [PATCH 6/7] chore(health): metadata, deps, versioning + README (phase 3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix package URLs: ChrisonSimtian → Chrison-dev (repo moved orgs). - Drop vestigial Newtonsoft.Json dep (generated code uses System.Text.Json; Newtonsoft only appeared in NSwag's generated comments). - Move off the prerelease Scrutor.Extensions.HttpClient 5.1.2-alpha.2 → stable 5.0.1. - Fix the DI registration bug: scan the core assembly (FromAssemblyOf<...>) instead of FromCallingAssembly(), which resolved to the consumer's assembly as a package and left the clients unregistered. - GitVersion: Major.Minor tracks the API version, patch is our counter; next-version 4.7.11. Static fallback bumped to 4.7.11. - Rewrite README with accurate usage (the old example referenced a non-existent API) + NuGet/build/license badges + the 3-package layout. Co-Authored-By: Claude Opus 4.8 (1M context) --- Directory.Build.props | 8 +- GitVersion.yml | 5 + README.md | 154 +++++++++++++--------- src/Directory.Build.props | 4 +- src/TvdbClient/Extensions/Bootstrapper.cs | 6 +- src/TvdbClient/TvdbClient.csproj | 9 +- 6 files changed, 111 insertions(+), 75 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index df0880f..2e9f1c7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,10 +14,10 @@ true - 4.7.10 - 4.7.10.0 - 4.7.10.0 - 4.7.10 + 4.7.11 + 4.7.11.0 + 4.7.11.0 + 4.7.11 $(GitVersion_FullSemVer) $(GitVersion_AssemblySemVer) diff --git a/GitVersion.yml b/GitVersion.yml index 702aa44..39306fb 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,10 @@ mode: ContinuousDelivery +# Versioning scheme: Major.Minor track the TheTVDB API version (currently 4.7); +# the PATCH is our internal release counter. Bump `next-version` for each release +# (e.g. 4.7.12) or when the API's major/minor changes (e.g. 4.8.0). +next-version: 4.7.11 + branches: main: mode: ContinuousDelivery diff --git a/README.md b/README.md index 2e18e46..7cb69df 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,92 @@ -# TvdbApi - -C# Api Client for the TVDB project - -## TVDB Project - -- [TVDB API](https://thetvdb.com) -- [TVDB API Github](https://github.com/thetvdb/v4-api) -- [TVDB API Documentation](https://thetvdb.github.io/v4-api) - -## Usage - -The TVDB Team recommends to maintain your own copy of their database or use a caching proxy to reduce the amount of calls being made against their API. -It is entirely up to you as the developer to implement this. This lbirary provides a simple API client AS IS, without any of the recommended caching mechanism. - -### Configuration - -The Client library relies on config records being present in either your appsettings.json or in a standalone TvdbClientConfig.json: - -```json -{ - "TvdbConfiguration": { - "BaseUrl": "https://api4.thetvdb.com/v4", - /* This API Key comes from the TVDB Example and obviously needs to be replaced in production */ - "ApiKey": "580c9239-d2f8-4460-a22e-6831900a97a3", - "Pin": "IPQZOCMN" - } -} -``` - -Make sure to replace the API Key in the example with your own API Key in [TVDBs API Key Dashboard](https://www.thetvdb.com/dashboard/account/apikey). - -### DI Registration - -Register TVDB Client with your DI of choice: - -```csharp - var config = builder.Configuration.AddTvdbClient().Build(); - builder.Services.AddTvdbClient(config); -``` - -### Using the Clients - -```csharp - var client = serviceProvider.GetRequiredService(); - var series = await client.GetSeriesAsync(121361); - Console.WriteLine(series.Data.SeriesName); -``` - -## Versioning - -I try my best to align the version of this library to the latest TVDB version on their Github repository to make it easy to see which version this client is compatible with. - -### Git Version - -This project uses [GitVersion](https://gitversion.net/docs/usage) for automatic semantic versioning. - -To view version information for a project, just run this command: - -``` bash -dotnet-gitversion -``` +# TvdbClient + +[![NuGet](https://img.shields.io/nuget/v/TvdbClient.svg)](https://www.nuget.org/packages/TvdbClient/) +[![Downloads](https://img.shields.io/nuget/dt/TvdbClient.svg)](https://www.nuget.org/packages/TvdbClient/) +[![Build](https://github.com/Chrison-dev/TvdbApi/actions/workflows/build.yml/badge.svg)](https://github.com/Chrison-dev/TvdbApi/actions/workflows/build.yml) +[![License](https://img.shields.io/github/license/Chrison-dev/TvdbApi.svg)](LICENSE) + +A C# `HttpClient`-based API client for [TheTVDB](https://thetvdb.com) **v4 API**. + +- [TheTVDB API](https://thetvdb.com) · [v4-api GitHub](https://github.com/thetvdb/v4-api) · [API docs](https://thetvdb.github.io/v4-api) + +> This is a thin client **AS IS** — it does not implement the caching/proxying that +> TheTVDB recommends. Add your own caching layer if you call the API at volume. + +## Packages + +The client is split into three packages so the API-versioned models can be +regenerated independently of the generic client code: + +| Package | What | Versioning | +|---|---|---| +| **`TvdbClient`** | Client core: generated clients, auth, DI wiring. | Generic SemVer | +| **`TvdbClient.Models`** | The generated DTOs (`Tvdb.Models`). | Tracks the TheTVDB API version (`Major.Minor`) | +| **`TvdbClient.Abstractions`** | Generic contracts, configuration, response envelope. | Generic SemVer | + +Installing `TvdbClient` pulls in the other two. + +```sh +dotnet add package TvdbClient +``` + +## Usage + +### Configuration + +Provide your TheTVDB API key (and optional subscriber PIN) via configuration — +either `appsettings.json` or a standalone `TvdbClientConfig.json`: + +```json +{ + "TvdbConfiguration": { + "BaseUrl": "https://api4.thetvdb.com/v4", + "ApiKey": "", + "Pin": "" + } +} +``` + +Get an API key from [TheTVDB's API Key dashboard](https://www.thetvdb.com/dashboard/account/apikey). + +### DI registration + +```csharp +using Microsoft.Extensions.DependencyInjection; + +builder.Configuration.AddTvdbClient(); +builder.Services.AddTvdbClient(builder.Configuration); +``` + +### Using the clients + +Resolve the per-resource client you need. Login/token acquisition and the +`Authorization` header are handled automatically by the registered handler. + +```csharp +using Tvdb.Clients; + +var series = serviceProvider.GetRequiredService(); +var response = await series.SeriesGetAsync(121361); // ids are long +var record = response.Data; // { data, status } envelope +``` + +## Regenerating the models + +Models + clients are generated from TheTVDB's OpenAPI spec via the +[Fallout](https://github.com/ChrisonSimtian/Fallout) build (NSwag under the hood): + +```sh +./build.ps1 Generate +``` + +This downloads the live v4 spec, applies a small overlay (integer-id coercion, +inline-enum hoisting), and regenerates `TvdbClient.Models` + the clients. + +## Versioning + +`Major.Minor` track the TheTVDB API version; the patch is this library's own +release counter. Managed with [GitVersion](https://gitversion.net) (`dotnet-gitversion`). + +## License + +[MIT](LICENSE) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 721f1dc..cd558bc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,8 +3,8 @@ Chrison Simtian $(CurrentYear) - $(Authors) - https://github.com/ChrisonSimtian/TvdbApi - https://github.com/ChrisonSimtian/TvdbApi.git + https://github.com/Chrison-dev/TvdbApi + https://github.com/Chrison-dev/TvdbApi.git git LICENSE True diff --git a/src/TvdbClient/Extensions/Bootstrapper.cs b/src/TvdbClient/Extensions/Bootstrapper.cs index 3beb7e5..b1cd8c6 100644 --- a/src/TvdbClient/Extensions/Bootstrapper.cs +++ b/src/TvdbClient/Extensions/Bootstrapper.cs @@ -46,9 +46,11 @@ public static IServiceCollection AddTvdbClient(this IServiceCollection builder, }) .AddHttpMessageHandler(); - /* Inject all Tvdb Clients at once */ + /* Inject all Tvdb Clients at once. + Scan THIS (core) assembly — where the generated clients live — not the + calling assembly, which would be the consumer's when used as a package. */ builder.Scan(scan => scan - .FromCallingAssembly() + .FromAssemblyOf() .AddClasses(classes => classes.AssignableTo()) .AsMatchingInterface() .AsHttpClient(Tvdb.Constants.TvdbConstants.HttpClientName) diff --git a/src/TvdbClient/TvdbClient.csproj b/src/TvdbClient/TvdbClient.csproj index 1115ad2..301454a 100644 --- a/src/TvdbClient/TvdbClient.csproj +++ b/src/TvdbClient/TvdbClient.csproj @@ -7,13 +7,12 @@ - - + - - - + + + True From 6fdffd93bbab0961cb983823310cbfe880d21468 Mon Sep 17 00:00:00 2001 From: Chrison Simtian Date: Thu, 23 Jul 2026 23:43:08 +1200 Subject: [PATCH 7/7] ci: Fallout-driven build + NuGet trusted publishing (phase 4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build/Build.cs gains Test + Pack targets (DotNet tasks) and a [GitHubActions] attribute describing the build lane. CI bootstraps via `dotnet run --project build/_build.csproj` (not the `fallout` global tool, which isn't on nuget.org). - .github/workflows/build.yml: PR/push-to-main → Test + Pack (uploads packages + test results). Replaces the old hand-written release.yml + code-coverage.yml. - .github/workflows/publish.yml: tag `v*` → Pack → NuGet Trusted Publishing (OIDC via NuGet/login@v1, no stored key) → push all three packages. - global.json (SDK pin) + .fallout/parameters.json (Solution) for the build. - GitVersion: releases cut by tagging v; Major.Minor track the API version, patch is our counter. GitVersion.MsBuild moved to src props so all three packages share one computed version. Verified locally: `./build.ps1 Pack` → 3 specs pass, 3 consistently-versioned packages in artifacts/packages. Co-Authored-By: Claude Opus 4.8 (1M context) --- .fallout/build.schema.json | 4 +- .fallout/parameters.json | 2 +- .github/workflows/build.yml | 59 +++++++++++ .github/workflows/code-coverage.yml | 83 --------------- .github/workflows/publish.yml | 50 +++++++++ .github/workflows/release.yml | 153 ---------------------------- GitVersion.yml | 6 +- build/Build.cs | 53 ++++++++-- global.json | 6 ++ src/Directory.Build.props | 4 + src/TvdbClient/TvdbClient.csproj | 2 - 11 files changed, 172 insertions(+), 250 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/code-coverage.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/release.yml create mode 100644 global.json diff --git a/.fallout/build.schema.json b/.fallout/build.schema.json index 1a026dc..f3393c0 100644 --- a/.fallout/build.schema.json +++ b/.fallout/build.schema.json @@ -24,7 +24,9 @@ "ExecutableTarget": { "type": "string", "enum": [ - "Generate" + "Generate", + "Pack", + "Test" ] }, "Verbosity": { diff --git a/.fallout/parameters.json b/.fallout/parameters.json index 0c59dcb..0f087ba 100644 --- a/.fallout/parameters.json +++ b/.fallout/parameters.json @@ -1,3 +1,3 @@ { - "$schema": "./build.schema.json" + "Solution": "TvdbApi.sln" } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..066047d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [GitHubActions (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# fallout --generate-configuration GitHubActions_build --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + +name: build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + ubuntu-latest: + name: ubuntu-latest + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: 'Cache: .fallout/temp, ~/.nuget/packages' + uses: actions/cache@v4 + with: + path: | + .fallout/temp + ~/.nuget/packages + key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} + - name: 'Setup: .NET SDK' + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + - name: 'Restore: dotnet tools' + run: dotnet tool restore + - name: 'Run: Test, Pack' + run: dotnet run --project build/_build.csproj -- Test Pack + - name: 'Publish: test-results' + uses: actions/upload-artifact@v5 + with: + name: test-results + path: artifacts/test-results + - name: 'Publish: packages' + uses: actions/upload-artifact@v5 + with: + name: packages + path: artifacts/packages diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml deleted file mode 100644 index 6be78c7..0000000 --- a/.github/workflows/code-coverage.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Code Coverage - -on: - push: - branches: [ "**" ] # Trigger on all branches - pull_request: - branches: [ "main", "release/**" ] # Trigger on PRs to main and release branches - -permissions: - contents: read - actions: read - checks: write - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history needed - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.x' # Adjust to your .NET version - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore --configuration Release - - - name: Run TUNIT tests with coverage - run: | - dotnet test --no-build --configuration Release \ - -- --report-trx --coverage \ - --results-directory ./test-results - continue-on-error: true # Continue even if tests fail - - - name: Generate Code Coverage Report - uses: danielpalme/ReportGenerator-GitHub-Action@v5 - with: - reports: '**/*.coverage' - targetdir: ./coverage-report - reporttypes: Html;Cobertura;MarkdownSummaryGithub - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: test-results - path: | - **/*.trx - **/*.coverage - - - name: Publish test results - uses: dorny/test-reporter@v1 - if: always() - with: - name: Test Results - path: '**/*.trx' - reporter: dotnet-trx - - - name: Code Coverage Report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: ./coverage-report/Cobertura.xml - badge: true - fail_below_min: false # Set to true if you want to fail on low coverage - format: markdown - hide_branch_rate: false - hide_complexity: false - indicators: true - output: both - thresholds: '60 80' # Warning at 60%, error below 80% - - - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - recreate: true - path: code-coverage-results.md \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..469eaff --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +# Publish to NuGet.org via Trusted Publishing (OIDC) — no stored API key. +# +# Requires a one-time Trusted Publisher policy on nuget.org for each package +# (TvdbClient, TvdbClient.Models, TvdbClient.Abstractions): owner Chrison-dev, +# repo TvdbApi, workflow publish.yml, environment nuget.org. Set the repo variable +# NUGET_USER to your nuget.org username. +# +# Triggered by pushing a version tag, e.g. `git tag v4.7.11 && git push origin v4.7.11`. +name: publish + +on: + push: + tags: ['v*'] + workflow_dispatch: + +permissions: + id-token: write # required for OIDC trusted publishing + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + environment: nuget.org + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # GitVersion needs full history + + - uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: 'Restore: dotnet tools' + run: dotnet tool restore + + - name: 'Pack' + run: dotnet run --project build/_build.csproj -- Pack + + - name: 'NuGet: trusted-publishing login (OIDC → short-lived key)' + uses: NuGet/login@v1 + id: login + with: + user: ${{ vars.NUGET_USER }} + + - name: 'NuGet: push' + run: > + dotnet nuget push "artifacts/packages/*.nupkg" + --source https://api.nuget.org/v3/index.json + --api-key ${{ steps.login.outputs.NUGET_API_KEY }} + --skip-duplicate diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 2d38397..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,153 +0,0 @@ -name: Release - -on: - push: - branches: [ release, release/* ] # Trigger on release branch(es) - workflow_dispatch: # Allows manual trigger from any branch - -permissions: - contents: write - packages: write - pull-requests: read - -jobs: - build-and-test: - runs-on: ubuntu-latest - - outputs: - version: ${{ steps.gitversion.outputs.fullSemVer }} - simple-version: ${{ steps.gitversion.outputs.semVer }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history needed - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.x' # Adjust to your .NET version - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4.0.1 - with: - versionSpec: '6.3.x' - - - name: Determine Version - id: gitversion - uses: gittools/actions/gitversion/execute@v4.0.1 - - - name: Display GitVersion outputs - run: | - echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" - echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}" - echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}" - echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}" - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore --configuration Release - - - name: Run TUNIT tests - run: dotnet test --no-build --configuration Release - - - name: Pack NuGet packages - run: | - dotnet pack --no-build --configuration Release \ - --output ./packages \ - -p:PackageVersion=${{ steps.gitversion.outputs.fullSemVer }} \ - -p:Version=${{ steps.gitversion.outputs.assemblySemVer }} \ - -p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }} \ - -p:FileVersion=${{ steps.gitversion.outputs.assemblySemVer }} \ - -p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: nuget-packages - path: ./packages/*.nupkg - - publish-nuget: - needs: build-and-test - runs-on: ubuntu-latest - - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: nuget-packages - path: ./packages - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.x' - - - name: Publish to NuGet - run: | - dotnet nuget push "./packages/*.nupkg" \ - --api-key ${{ secrets.NUGET_API_KEY }} \ - --source https://api.nuget.org/v3/index.json \ - --skip-duplicate - - github-release: - needs: [build-and-test, publish-nuget] - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: nuget-packages - path: ./packages - - - name: Create source archive - run: | - # Create a clean source archive excluding build artifacts - git archive --format=zip --output=./packages/source-v${{ needs.build-and-test.outputs.simple-version }}.zip HEAD - git archive --format=tar.gz --output=./packages/source-v${{ needs.build-and-test.outputs.simple-version }}.tar.gz HEAD - - - name: Generate Release Notes - id: release_notes - run: | - # Generate basic release notes from commits since last release tag - PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "") - - echo "## What's Changed" > release_notes.md - if [ -n "$PREVIOUS_TAG" ]; then - echo "" >> release_notes.md - git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD >> release_notes.md - else - echo "- Initial release" >> release_notes.md - fi - - echo "" >> release_notes.md - echo "## NuGet Package" >> release_notes.md - echo "This release is available on NuGet:" >> release_notes.md - echo '```' >> release_notes.md - echo "dotnet add package TvdbClient --version ${{ needs.build-and-test.outputs.version }}" >> release_notes.md - echo '```' >> release_notes.md - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ needs.build-and-test.outputs.simple-version }} - name: Release v${{ needs.build-and-test.outputs.simple-version }} - body_path: release_notes.md - files: | - ./packages/*.nupkg - ./packages/*.zip - ./packages/*.tar.gz - draft: false - prerelease: ${{ contains(needs.build-and-test.outputs.version, '-') }} - generate_release_notes: true - make_latest: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/GitVersion.yml b/GitVersion.yml index 39306fb..f55a8a1 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,9 +1,9 @@ mode: ContinuousDelivery # Versioning scheme: Major.Minor track the TheTVDB API version (currently 4.7); -# the PATCH is our internal release counter. Bump `next-version` for each release -# (e.g. 4.7.12) or when the API's major/minor changes (e.g. 4.8.0). -next-version: 4.7.11 +# the PATCH is our internal release counter. Releases are cut by tagging +# `v..` (e.g. `git tag v4.7.11`) — GitVersion reads the tag +# (tag-prefix 'v'). Untagged builds get a prerelease suffix. branches: main: diff --git a/build/Build.cs b/build/Build.cs index 8e43073..b8dccbb 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,7 +1,9 @@ using System.Linq; using System.Threading.Tasks; using Fallout.Common; +using Fallout.Common.CI.GitHubActions; using Fallout.Common.IO; +using Fallout.Common.Tools.DotNet; using NJsonSchema; using NJsonSchema.CodeGeneration.CSharp; using NSwag; @@ -9,20 +11,57 @@ using NSwag.CodeGeneration.CSharp; using NSwag.CodeGeneration.OperationNameGenerators; using Serilog; +using static Fallout.Common.Tools.DotNet.DotNetTasks; /// /// Fallout build for the TheTVDB v4 client. /// -/// The Generate target owns codegen in-stack (NSwag's C# API — no CLI, no -/// .nswag config, no external scripts). It downloads the live v4 OpenAPI spec, -/// applies the overlay in-memory (TheTVDB types integer resource ids as -/// number → C# double; we coerce the path-id params to -/// integer/int64 → long), then emits the clients + DTOs. It is deliberately -/// NOT wired into any CI workflow — run it locally via ./build.ps1 Generate. +/// CI (build.yml, auto-generated from the [GitHubActions] attribute) runs Test + Pack +/// on pushes/PRs to main. The Generate target owns codegen in-stack (NSwag's +/// C# API — no CLI, no .nswag config, no external scripts) and is deliberately NOT in +/// CI — run it locally via ./build.ps1 Generate. Publishing to NuGet uses +/// trusted publishing (OIDC) via a dedicated workflow (Fallout has no built-in OIDC). /// +// AutoGenerate=false: the workflow was generated from this attribute, but its run +// step is bootstrapped via `dotnet run --project build/_build.csproj` instead of the +// `fallout` global tool (Fallout.GlobalTools isn't on nuget.org). The attribute stays +// as the source-of-truth description of the build lane. +[GitHubActions( + "build", + GitHubActionsImage.UbuntuLatest, + AutoGenerate = false, + FetchDepth = 0, + OnPushBranches = new[] { "main" }, + OnPullRequestBranches = new[] { "main" }, + InvokedTargets = new[] { nameof(Test), nameof(Pack) })] partial class Build : FalloutBuild { - public static int Main() => Execute(x => x.Generate); + public static int Main() => Execute(x => x.Pack); + + static readonly string[] PackableProjects = { "TvdbClient", "TvdbClient.Models", "TvdbClient.Abstractions" }; + + AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; + AbsolutePath PackagesDirectory => ArtifactsDirectory / "packages"; + AbsolutePath SpecsProject => RootDirectory / "tests" / "TvdbClient.Specs" / "TvdbClient.Specs.csproj"; + + Target Test => _ => _ + .Description("Run the *.Specs test suite") + .Executes(() => DotNetTest(_ => _ + .SetProjectFile(SpecsProject) + .SetConfiguration("Release"))); + + Target Pack => _ => _ + .Description("Pack the three NuGet packages into artifacts/packages") + .DependsOn(Test) + .Executes(() => + { + PackagesDirectory.CreateOrCleanDirectory(); + foreach (var project in PackableProjects) + DotNetPack(_ => _ + .SetProject(RootDirectory / "src" / project / $"{project}.csproj") + .SetConfiguration("Release") + .SetOutputDirectory(PackagesDirectory)); + }); const string SpecUrl = "https://thetvdb.github.io/v4-api/swagger.yml"; diff --git a/global.json b/global.json new file mode 100644 index 0000000..1e7fdfa --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "10.0.100", + "rollForward": "latestMinor" + } +} diff --git a/src/Directory.Build.props b/src/Directory.Build.props index cd558bc..5ab57fc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -10,6 +10,10 @@ True README.md + + + + diff --git a/src/TvdbClient/TvdbClient.csproj b/src/TvdbClient/TvdbClient.csproj index 301454a..0756d69 100644 --- a/src/TvdbClient/TvdbClient.csproj +++ b/src/TvdbClient/TvdbClient.csproj @@ -8,14 +8,12 @@ - - True TVDB Api Client C# Api Client (HttpClient) for TVDB Api False