diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1099ff2f..05bb228a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -30,14 +30,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Cache SPM - uses: actions/cache@v3 - with: - path: .build - key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: diff --git a/Sources/TMDb/Certifications/CertificationService.swift b/Sources/TMDb/Certifications/CertificationService.swift index fe1e9fdf..d9c2c13e 100644 --- a/Sources/TMDb/Certifications/CertificationService.swift +++ b/Sources/TMDb/Certifications/CertificationService.swift @@ -48,12 +48,12 @@ public final class CertificationService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A dictionary of TV show certifications. - /// - public func tvShowCertifications() async throws -> [String: [Certification]] { + /// - Returns: A dictionary of TV series certifications. + /// + public func tvSeriesCertifications() async throws -> [String: [Certification]] { let certifications: Certifications do { - certifications = try await apiClient.get(endpoint: CertificationsEndpoint.tvShow) + certifications = try await apiClient.get(endpoint: CertificationsEndpoint.tvSeries) } catch let error { throw TMDbError(error: error) } diff --git a/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift b/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift index 46720c8b..ea7e8142 100644 --- a/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift +++ b/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift @@ -3,7 +3,7 @@ import Foundation enum CertificationsEndpoint { case movie - case tvShow + case tvSeries } @@ -18,7 +18,7 @@ extension CertificationsEndpoint: Endpoint { .appendingPathComponent("movie") .appendingPathComponent("list") - case .tvShow: + case .tvSeries: return Self.basePath .appendingPathComponent("tv") .appendingPathComponent("list") diff --git a/Sources/TMDb/Discover/DiscoverService.swift b/Sources/TMDb/Discover/DiscoverService.swift index 893cdf6d..bf521c5a 100644 --- a/Sources/TMDb/Discover/DiscoverService.swift +++ b/Sources/TMDb/Discover/DiscoverService.swift @@ -1,7 +1,7 @@ import Foundation /// -/// Provides an interface for discovering movies and TV shows from TMDb. +/// Provides an interface for discovering movies and TV series from TMDb. /// @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) public final class DiscoverService { @@ -52,9 +52,9 @@ public final class DiscoverService { } /// - /// Returns TV shows to be discovered. + /// Returns TV series to be discovered. /// - /// [TMDb API - Discover: TV](https://developer.themoviedb.org/reference/discover-tv) + /// [TMDb API - Discover: TV Series](https://developer.themoviedb.org/reference/discover-tv) /// /// - Precondition: `page` can be between `1` and `1000`. /// @@ -64,17 +64,17 @@ public final class DiscoverService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Matching TV shows as a pageable list. + /// - Returns: Matching TV series as a pageable list. /// - public func tvShows(sortedBy: TVShowSort? = nil, page: Int? = nil) async throws -> TVShowPageableList { - let tvShowList: TVShowPageableList + public func tvSeries(sortedBy: TVSeriesSort? = nil, page: Int? = nil) async throws -> TVSeriesPageableList { + let tvSeriesList: TVSeriesPageableList do { - tvShowList = try await apiClient.get(endpoint: DiscoverEndpoint.tvShows(sortedBy: sortedBy, page: page)) + tvSeriesList = try await apiClient.get(endpoint: DiscoverEndpoint.tvSeries(sortedBy: sortedBy, page: page)) } catch let error { throw TMDbError(error: error) } - return tvShowList + return tvSeriesList } } diff --git a/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift b/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift index 8b04e153..560939f0 100644 --- a/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift +++ b/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift @@ -3,7 +3,7 @@ import Foundation enum DiscoverEndpoint { case movies(sortedBy: MovieSort? = nil, people: [Person.ID]? = nil, page: Int? = nil) - case tvShows(sortedBy: TVShowSort? = nil, page: Int? = nil) + case tvSeries(sortedBy: TVSeriesSort? = nil, page: Int? = nil) } @@ -20,7 +20,7 @@ extension DiscoverEndpoint: Endpoint { .appendingWithPeople(people) .appendingPage(page) - case .tvShows(let sortedBy, let page): + case .tvSeries(let sortedBy, let page): return Self.basePath .appendingPathComponent("tv") .appendingSortBy(sortedBy) diff --git a/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift b/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift index 742f9731..4bd56a5d 100644 --- a/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift +++ b/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift @@ -3,7 +3,7 @@ import Foundation enum GenresEndpoint { case movie - case tvShow + case tvSeries } @@ -18,7 +18,7 @@ extension GenresEndpoint: Endpoint { .appendingPathComponent("movie") .appendingPathComponent("list") - case .tvShow: + case .tvSeries: return Self.basePath .appendingPathComponent("tv") .appendingPathComponent("list") diff --git a/Sources/TMDb/Genres/GenreService.swift b/Sources/TMDb/Genres/GenreService.swift index 90566e2a..6b839db2 100644 --- a/Sources/TMDb/Genres/GenreService.swift +++ b/Sources/TMDb/Genres/GenreService.swift @@ -1,7 +1,7 @@ import Foundation /// -/// Provides an interface for obtaining movie and TV show genres from TMDb. +/// Provides an interface for obtaining movie and TV series genres from TMDb. /// @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) public final class GenreService { @@ -42,7 +42,7 @@ public final class GenreService { } /// - /// Returns the list of official genres for TV shows. + /// Returns the list of official genres for TV series. /// /// [TMDb API - Genres: TV List](https://developer.themoviedb.org/reference/genre-tv-list) /// @@ -50,10 +50,10 @@ public final class GenreService { /// /// - Returns: A list of genres. /// - public func tvShowGenres() async throws -> [Genre] { + public func tvSeriesGenres() async throws -> [Genre] { let genreList: GenreList do { - genreList = try await apiClient.get(endpoint: GenresEndpoint.tvShow) + genreList = try await apiClient.get(endpoint: GenresEndpoint.tvSeries) } catch let error { throw TMDbError(error: error) } diff --git a/Sources/TMDb/Models/CastMember.swift b/Sources/TMDb/Models/CastMember.swift index d7d5f332..15034deb 100644 --- a/Sources/TMDb/Models/CastMember.swift +++ b/Sources/TMDb/Models/CastMember.swift @@ -11,12 +11,12 @@ public struct CastMember: Identifiable, Codable, Equatable, Hashable { public let id: Int /// - /// Cast member's identifier for the particular movie or TV show. + /// Cast member's identifier for the particular movie or TV series. /// public let castID: Int? /// - /// Credit identifier for that particular movie or TV show. + /// Credit identifier for that particular movie or TV series. /// public let creditID: String @@ -52,8 +52,8 @@ public struct CastMember: Identifiable, Codable, Equatable, Hashable { /// /// - Parameters: /// - id: Cast member's identifier. - /// - castID: Cast member's identifier for the particular movie or TV show. - /// - creditID: Credit identifier for that particular movie or TV show. + /// - castID: Cast member's identifier for the particular movie or TV series. + /// - creditID: Credit identifier for that particular movie or TV series. /// - name: Cast member's name. /// - character: Cast member's character name. /// - gender: Cast member's gender. diff --git a/Sources/TMDb/Models/CrewMember.swift b/Sources/TMDb/Models/CrewMember.swift index bf0360bb..1c614d90 100644 --- a/Sources/TMDb/Models/CrewMember.swift +++ b/Sources/TMDb/Models/CrewMember.swift @@ -11,7 +11,7 @@ public struct CrewMember: Identifiable, Codable, Equatable, Hashable { public let id: Int /// - /// Crew member's identifier for the particular movie or TV show. + /// Crew member's identifier for the particular movie or TV series. /// public let creditID: String @@ -47,7 +47,7 @@ public struct CrewMember: Identifiable, Codable, Equatable, Hashable { /// /// - Parameters: /// - id: Crew member's identifier. - /// - creditID: Crew member's identifier for the particular movie or TV show. + /// - creditID: Crew member's identifier for the particular movie or TV series. /// - name: Crew member's name. /// - job: Crew member's job. /// - department: Crew member's department. diff --git a/Sources/TMDb/Models/ImageCollection.swift b/Sources/TMDb/Models/ImageCollection.swift index c28d9aec..2bfce7ac 100644 --- a/Sources/TMDb/Models/ImageCollection.swift +++ b/Sources/TMDb/Models/ImageCollection.swift @@ -3,12 +3,12 @@ import Foundation /// /// A model representing an image collection. /// -/// A collection of poster and backdrop images for a movie or TV show. +/// A collection of poster and backdrop images for a movie or TV series. /// public struct ImageCollection: Codable, Equatable, Hashable { /// - /// Movie or TV show identifier for these images. + /// Movie or TV series identifier for these images. /// public let id: Int @@ -31,7 +31,7 @@ public struct ImageCollection: Codable, Equatable, Hashable { /// Creates an image collection object. /// /// - Parameters: - /// - id: Movie or TV show identifier for these images. + /// - id: Movie or TV series identifier for these images. /// - posters: Poster images. /// - backdrops: Backdrop images. /// diff --git a/Sources/TMDb/Models/Media.swift b/Sources/TMDb/Models/Media.swift index a6b3bd4c..9d23ed8b 100644 --- a/Sources/TMDb/Models/Media.swift +++ b/Sources/TMDb/Models/Media.swift @@ -13,8 +13,8 @@ public enum Media: Identifiable, Codable, Equatable, Hashable { case .movie(let movie): return movie.id - case .tvShow(let tvShow): - return tvShow.id + case .tvSeries(let tvSeries): + return tvSeries.id case .person(let person): return person.id @@ -27,9 +27,9 @@ public enum Media: Identifiable, Codable, Equatable, Hashable { case movie(Movie) /// - /// TV show. + /// TV series. /// - case tvShow(TVShow) + case tvSeries(TVSeries) /// /// Person. @@ -46,7 +46,7 @@ extension Media { private enum MediaType: String, Decodable, Equatable { case movie - case tvShow = "tv" + case tvSeries = "tv" case person } @@ -58,8 +58,8 @@ extension Media { case .movie: self = .movie(try Movie(from: decoder)) - case .tvShow: - self = .tvShow(try TVShow(from: decoder)) + case .tvSeries: + self = .tvSeries(try TVSeries(from: decoder)) case .person: self = .person(try Person(from: decoder)) @@ -73,8 +73,8 @@ extension Media { case .movie(let movie): try singleContainer.encode(movie) - case .tvShow(let tvShow): - try singleContainer.encode(tvShow) + case .tvSeries(let tvSeries): + try singleContainer.encode(tvSeries) case .person(let person): try singleContainer.encode(person) diff --git a/Sources/TMDb/Models/PersonCombinedCredits.swift b/Sources/TMDb/Models/PersonCombinedCredits.swift index 1206d441..14ce2198 100644 --- a/Sources/TMDb/Models/PersonCombinedCredits.swift +++ b/Sources/TMDb/Models/PersonCombinedCredits.swift @@ -1,7 +1,7 @@ import Foundation /// -/// A model representing combined movie and tv show credits for a person. +/// A model representing combined movie and TV series credits for a person. /// /// A person can be both a cast member and crew member of the same show. /// diff --git a/Sources/TMDb/Models/PersonTVSeriesCredits.swift b/Sources/TMDb/Models/PersonTVSeriesCredits.swift new file mode 100644 index 00000000..3ce1773e --- /dev/null +++ b/Sources/TMDb/Models/PersonTVSeriesCredits.swift @@ -0,0 +1,46 @@ +import Foundation + +/// +/// A model representing a TV series credits for a person. +/// +/// A person can be both a cast member and crew member of the same TV series. +/// +public struct PersonTVSeriesCredits: Identifiable, Decodable, Equatable, Hashable { + + /// + /// Person identifier. + /// + public let id: Int + + /// + /// TV series where the person is in the cast. + /// + public let cast: [TVSeries] + + /// + /// TV series where the person is in the crew. + /// + public let crew: [TVSeries] + + /// + /// All TV series the person is in. + /// + public var allShows: [TVSeries] { + (cast + crew).uniqued() + } + + /// + /// Creates a person TV series credits object. + /// + /// - Parameters: + /// - id: Person identifier. + /// - cast: TV series where the person is in the cast. + /// - crew: TV series where the person is in the crew. + /// + public init(id: Int, cast: [TVSeries], crew: [TVSeries]) { + self.id = id + self.cast = cast + self.crew = crew + } + +} diff --git a/Sources/TMDb/Models/PersonTVShowCredits.swift b/Sources/TMDb/Models/PersonTVShowCredits.swift deleted file mode 100644 index 2d4c11ff..00000000 --- a/Sources/TMDb/Models/PersonTVShowCredits.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation - -/// -/// A model representing a TV show credits for a person. -/// -/// A person can be both a cast member and crew member of the same TV show. -/// -public struct PersonTVShowCredits: Identifiable, Decodable, Equatable, Hashable { - - /// - /// Person identifier. - /// - public let id: Int - - /// - /// TV shows where the person is in the cast. - /// - public let cast: [TVShow] - - /// - /// TV shows where the person is in the crew. - /// - public let crew: [TVShow] - - /// - /// All TV shows the person is in. - /// - public var allShows: [TVShow] { - (cast + crew).uniqued() - } - - /// - /// Creates a person TV show credits object. - /// - /// - Parameters: - /// - id: Person identifier. - /// - cast: TV shows where the person is in the cast. - /// - crew: TV shows where the person is in the crew. - /// - public init(id: Int, cast: [TVShow], crew: [TVShow]) { - self.id = id - self.cast = cast - self.crew = crew - } - -} diff --git a/Sources/TMDb/Models/Show.swift b/Sources/TMDb/Models/Show.swift index cb5fa255..a899f82e 100644 --- a/Sources/TMDb/Models/Show.swift +++ b/Sources/TMDb/Models/Show.swift @@ -1,7 +1,7 @@ import Foundation /// -/// A model representing a show - movie or TV show. +/// A model representing a show - movie or TV series. /// public enum Show: Identifiable, Equatable, Hashable { @@ -13,8 +13,8 @@ public enum Show: Identifiable, Equatable, Hashable { case .movie(let movie): return movie.id - case .tvShow(let tvShow): - return tvShow.id + case .tvSeries(let tvSeries): + return tvSeries.id } } @@ -26,8 +26,8 @@ public enum Show: Identifiable, Equatable, Hashable { case .movie(let movie): return movie.popularity - case .tvShow(let tvShow): - return tvShow.popularity + case .tvSeries(let tvSeries): + return tvSeries.popularity } } @@ -39,8 +39,8 @@ public enum Show: Identifiable, Equatable, Hashable { case .movie(let movie): return movie.releaseDate - case .tvShow(let tvShow): - return tvShow.firstAirDate + case .tvSeries(let tvSeries): + return tvSeries.firstAirDate } } @@ -50,9 +50,9 @@ public enum Show: Identifiable, Equatable, Hashable { case movie(Movie) /// - /// TV show. + /// TV series. /// - case tvShow(TVShow) + case tvSeries(TVSeries) } @@ -64,7 +64,7 @@ extension Show: Decodable { private enum MediaType: String, Decodable, Equatable { case movie - case tvShow = "tv" + case tvSeries = "tv" } public init(from decoder: Decoder) throws { @@ -75,8 +75,8 @@ extension Show: Decodable { case .movie: self = .movie(try Movie(from: decoder)) - case .tvShow: - self = .tvShow(try TVShow(from: decoder)) + case .tvSeries: + self = .tvSeries(try TVSeries(from: decoder)) } } diff --git a/Sources/TMDb/Models/ShowCredits.swift b/Sources/TMDb/Models/ShowCredits.swift index 2a01479f..d8065094 100644 --- a/Sources/TMDb/Models/ShowCredits.swift +++ b/Sources/TMDb/Models/ShowCredits.swift @@ -1,14 +1,14 @@ import Foundation /// -/// A model representing a show's (movie or TV show) credits. +/// A model representing a show's (movie or TV series) credits. /// /// A person can be both a cast member and crew member of the same show. /// public struct ShowCredits: Identifiable, Decodable, Equatable, Hashable { /// - /// Movie or TV show identifier. + /// Movie or TV series identifier. /// public let id: Int @@ -26,7 +26,7 @@ public struct ShowCredits: Identifiable, Decodable, Equatable, Hashable { /// Creates a show credits object. /// /// - Parameters: - /// - id: Movie or TV show identifier. + /// - id: Movie or TV series identifier. /// - cast: Cast members of the show. /// - crew: Crew members of the show. /// diff --git a/Sources/TMDb/Models/TVShowEpisode.swift b/Sources/TMDb/Models/TVEpisode.swift similarity index 62% rename from Sources/TMDb/Models/TVShowEpisode.swift rename to Sources/TMDb/Models/TVEpisode.swift index fe8e30e7..4d786dbf 100644 --- a/Sources/TMDb/Models/TVShowEpisode.swift +++ b/Sources/TMDb/Models/TVEpisode.swift @@ -1,59 +1,59 @@ import Foundation /// -/// A model representing a TV show episode. +/// A model representing a TV episode. /// -public struct TVShowEpisode: Identifiable, Codable, Equatable, Hashable { +public struct TVEpisode: Identifiable, Codable, Equatable, Hashable { /// - /// TV show episode identifier. + /// TV episode identifier. /// public let id: Int /// - /// TV show episode name. + /// TV episode name. /// public let name: String /// - /// TV show episode number. + /// TV episode number. /// public let episodeNumber: Int /// - /// TV show episode season number. + /// TV episode season number. /// public let seasonNumber: Int /// - /// TV show episode overview. + /// TV episode overview. /// public let overview: String? /// - /// TV show episode air date. + /// TV episode air date. /// public let airDate: Date? /// - /// TV show episode production code. + /// TV episode production code. /// public let productionCode: String? /// - /// TV show episode still image path. + /// TV episode still image path. /// /// To generate a full URL see . /// public let stillPath: URL? /// - /// TV show episode crew. + /// TV episode crew. /// public let crew: [CrewMember]? /// - /// TV show episode guest cast members. + /// TV episode guest cast members. /// public let guestStars: [CastMember]? @@ -68,19 +68,19 @@ public struct TVShowEpisode: Identifiable, Codable, Equatable, Hashable { public let voteCount: Int? /// - /// Creates a TV show episode object. + /// Creates a TV episode object. /// /// - Parameters: - /// - id: TV show episode identifier. - /// - name: TV show episode name. - /// - episodeNumber: TV show episode number. - /// - seasonNumber: TV show episode season number. - /// - overview: TV show episode overview. - /// - airDate: TV show episode air date. - /// - productionCode: TV show episode production code. - /// - stillPath: TV show episode still image path. - /// - crew: TV show episode crew. - /// - guestStars: TV show episode guest cast members. + /// - id: TV episode identifier. + /// - name: TV episode name. + /// - episodeNumber: TV episode number. + /// - seasonNumber: TV episode season number. + /// - overview: TV episode overview. + /// - airDate: TV episode air date. + /// - productionCode: TV episode production code. + /// - stillPath: TV episode still image path. + /// - crew: TV episode crew. + /// - guestStars: TV episode guest cast members. /// - voteAverage: Average vote score. /// - voteCount: Number of votes. /// diff --git a/Sources/TMDb/Models/TVShowEpisodeImageCollection.swift b/Sources/TMDb/Models/TVEpisodeImageCollection.swift similarity index 66% rename from Sources/TMDb/Models/TVShowEpisodeImageCollection.swift rename to Sources/TMDb/Models/TVEpisodeImageCollection.swift index e83684dd..e0be9dc8 100644 --- a/Sources/TMDb/Models/TVShowEpisodeImageCollection.swift +++ b/Sources/TMDb/Models/TVEpisodeImageCollection.swift @@ -1,9 +1,9 @@ import Foundation /// -/// A model representing a TV show episode image collection. +/// A model representing a TV episode image collection. /// -public struct TVShowEpisodeImageCollection: Identifiable, Decodable, Equatable, Hashable { +public struct TVEpisodeImageCollection: Identifiable, Decodable, Equatable, Hashable { /// /// Collection identifier. @@ -16,7 +16,7 @@ public struct TVShowEpisodeImageCollection: Identifiable, Decodable, Equatable, public let stills: [ImageMetadata] /// - /// Creates a TV show episode image collection. + /// Creates a TV episode image collection. /// /// - Parameters: /// - id: Collection identifier. diff --git a/Sources/TMDb/Models/TVShowSeason.swift b/Sources/TMDb/Models/TVSeason.swift similarity index 50% rename from Sources/TMDb/Models/TVShowSeason.swift rename to Sources/TMDb/Models/TVSeason.swift index a80ffdf0..c5af942a 100644 --- a/Sources/TMDb/Models/TVShowSeason.swift +++ b/Sources/TMDb/Models/TVSeason.swift @@ -1,58 +1,58 @@ import Foundation /// -/// A model representing a TV show season. +/// A model representing a TV season. /// -public struct TVShowSeason: Identifiable, Codable, Equatable, Hashable { +public struct TVSeason: Identifiable, Codable, Equatable, Hashable { /// - /// TV show season identifier. + /// TV season identifier. /// public let id: Int /// - /// TV show season name. + /// TV season name. /// public let name: String /// - /// TV show season number. + /// TV season number. /// public let seasonNumber: Int /// - /// Overview of TV show season. + /// Overview of TV season. /// public let overview: String? /// - /// TV show season's air date. + /// TV season's air date. /// public let airDate: Date? /// - /// TV show season's poster path. + /// TV season's poster path. /// /// To generate a full URL see . /// public let posterPath: URL? /// - /// Episode's in this TV show season. + /// Episodes in this TV season. /// - public let episodes: [TVShowEpisode]? + public let episodes: [TVEpisode]? /// - /// Creates a TV show season object. + /// Creates a TV season object. /// /// - Parameters: - /// - id: TV show season identifier. - /// - name: TV show season name. - /// - seasonNumber: TV show season number. - /// - overview: Overview of TV show season. - /// - airDate: TV show season's air date. - /// - posterPath: TV show season's poster path. - /// - episodes: Episode's in this TV show season. + /// - id: TV season identifier. + /// - name: TV season name. + /// - seasonNumber: TV season number. + /// - overview: Overview of TV season. + /// - airDate: TV season's air date. + /// - posterPath: TV season's poster path. + /// - episodes: Episodes in this TV season. /// public init( id: Int, @@ -61,7 +61,7 @@ public struct TVShowSeason: Identifiable, Codable, Equatable, Hashable { overview: String? = nil, airDate: Date? = nil, posterPath: URL? = nil, - episodes: [TVShowEpisode]? = nil + episodes: [TVEpisode]? = nil ) { self.id = id self.name = name diff --git a/Sources/TMDb/Models/TVShowSeasonImageCollection.swift b/Sources/TMDb/Models/TVSeasonImageCollection.swift similarity index 67% rename from Sources/TMDb/Models/TVShowSeasonImageCollection.swift rename to Sources/TMDb/Models/TVSeasonImageCollection.swift index fb21d736..b933eea6 100644 --- a/Sources/TMDb/Models/TVShowSeasonImageCollection.swift +++ b/Sources/TMDb/Models/TVSeasonImageCollection.swift @@ -1,9 +1,9 @@ import Foundation /// -/// A model representing a TV show season image collection. +/// A model representing a TV season image collection. /// -public struct TVShowSeasonImageCollection: Identifiable, Decodable, Equatable, Hashable { +public struct TVSeasonImageCollection: Identifiable, Decodable, Equatable, Hashable { /// /// Collection identifier. @@ -16,7 +16,7 @@ public struct TVShowSeasonImageCollection: Identifiable, Decodable, Equatable, H public let posters: [ImageMetadata] /// - /// Creates a TV show season image collection. + /// Creates a TV season image collection. /// /// - Parameters: /// - id: Collection identifier. diff --git a/Sources/TMDb/Models/TVShow.swift b/Sources/TMDb/Models/TVSeries.swift similarity index 75% rename from Sources/TMDb/Models/TVShow.swift rename to Sources/TMDb/Models/TVSeries.swift index 2eed4118..0956b562 100644 --- a/Sources/TMDb/Models/TVShow.swift +++ b/Sources/TMDb/Models/TVSeries.swift @@ -1,131 +1,131 @@ import Foundation /// -/// A model representing a TV show. +/// A model representing a TV series. /// -public struct TVShow: Identifiable, Codable, Equatable, Hashable { +public struct TVSeries: Identifiable, Codable, Equatable, Hashable { /// - /// TV show identifier. + /// TV series identifier. /// public let id: Int /// - /// TV show name. + /// TV series name. /// public let name: String /// - /// TV show tagline. + /// TV series tagline. /// public let tagline: String? /// - /// Original TV show name. + /// Original TV series name. /// public let originalName: String? /// - /// Original language of the TV show. + /// Original language of the TV series. /// public let originalLanguage: String? /// - /// TV show overview. + /// TV series overview. /// public let overview: String? /// - /// TV show episode run times, in minutes. + /// TV series episode run times, in minutes. /// public let episodeRunTime: [Int]? /// - /// Number of seasons in the TV show. + /// Number of seasons in the TV series. /// public let numberOfSeasons: Int? /// - /// Total number of episodes in the TV show. + /// Total number of episodes in the TV series. /// public let numberOfEpisodes: Int? /// - /// Seasons in the TV show. + /// Seasons in the TV series. /// - public let seasons: [TVShowSeason]? + public let seasons: [TVSeason]? /// - /// TV show genres. + /// TV series genres. /// public let genres: [Genre]? /// - /// TV show's first air date. + /// TV series' first air date. /// public let firstAirDate: Date? /// - /// TV show country of origin. + /// TV series country of origin. /// public let originCountry: [String]? /// - /// TV show poster path. + /// TV series poster path. /// /// To generate a full URL see . /// public let posterPath: URL? /// - /// TV show backdrop path. + /// TV series backdrop path. /// /// To generate a full URL see . /// public let backdropPath: URL? /// - /// TV show's web site URL. + /// TV series' web site URL. /// public let homepageURL: URL? /// - /// Is the TV show currently in production. + /// Is the TV series currently in production. /// public let isInProduction: Bool? /// - /// Languages the TV show is available in. + /// Languages the TV series is available in. /// public let languages: [String]? /// - /// Last air date of the TV show. + /// Last air date of the TV series. /// public let lastAirDate: Date? /// - /// Networks involved in the TV show. + /// Networks involved in the TV series. /// public let networks: [Network]? /// - /// Production companies involved in the TV show. + /// Production companies involved in the TV series. /// public let productionCompanies: [ProductionCompany]? /// - /// TV show status. + /// TV series status. /// public let status: String? /// - /// TV show type. + /// TV series type. /// public let type: String? /// - /// TV show current popularity. + /// TV series current popularity. /// public let popularity: Double? @@ -140,40 +140,40 @@ public struct TVShow: Identifiable, Codable, Equatable, Hashable { public let voteCount: Int? /// - /// Is the TV show only suitable for adults. + /// Is the TV series only suitable for adults. /// public let isAdultOnly: Bool? /// - /// Creates a TV show object. + /// Creates a TV series object. /// /// - Parameters: - /// - id: TV show identifier. - /// - name: TV show name. - /// - tagline: TV show tagline. - /// - originalName: Original TV show name. - /// - originalLanguage: Original language of the TV show. - /// - overview: TV show overview. - /// - episodeRunTime: TV show episode run times, in minutes. - /// - numberOfSeasons: Number of seasons in the TV show. - /// - numberOfEpisodes: Total number of episodes in the TV show. - /// - seasons: Seasons in the TV show. - /// - genres: TV show genres. - /// - firstAirDate: TV show's first air date. - /// - originCountry: TV show country of origin. - /// - posterPath: TV show poster path. - /// - backdropPath: TV show backdrop path. - /// - homepageURL: TV show's web site URL. - /// - isInProduction: Is TV show currently in production. - /// - languages: Languages the TV show is available in. - /// - lastAirDate: Last air date of the TV show. - /// - networks: Networks involved in the TV show. - /// - productionCompanies: Production companies involved in the TV show. - /// - status: TV show status. - /// - popularity: TV show current popularity. + /// - id: TV series identifier. + /// - name: TV series name. + /// - tagline: TV series tagline. + /// - originalName: Original TV series name. + /// - originalLanguage: Original language of the TV series. + /// - overview: TV series overview. + /// - episodeRunTime: TV series episode run times, in minutes. + /// - numberOfSeasons: Number of seasons in the TV series. + /// - numberOfEpisodes: Total number of episodes in the TV series. + /// - seasons: Seasons in the TV series. + /// - genres: TV series genres. + /// - firstAirDate: TV series's first air date. + /// - originCountry: TV series country of origin. + /// - posterPath: TV series poster path. + /// - backdropPath: TV series backdrop path. + /// - homepageURL: TV series's web site URL. + /// - isInProduction: Is TV series currently in production. + /// - languages: Languages the TV series is available in. + /// - lastAirDate: Last air date of the TV series. + /// - networks: Networks involved in the TV series. + /// - productionCompanies: Production companies involved in the TV series. + /// - status: TV series status. + /// - popularity: TV series current popularity. /// - voteAverage: Average vote score. /// - voteCount: Number of votes. - /// - isAdultOnly: Is the TV show only suitable for adults. + /// - isAdultOnly: Is the TV series only suitable for adults. /// public init( id: Int, @@ -185,7 +185,7 @@ public struct TVShow: Identifiable, Codable, Equatable, Hashable { episodeRunTime: [Int]? = nil, numberOfSeasons: Int? = nil, numberOfEpisodes: Int? = nil, - seasons: [TVShowSeason]? = nil, + seasons: [TVSeason]? = nil, genres: [Genre]? = nil, firstAirDate: Date? = nil, originCountry: [String]? = nil, @@ -235,7 +235,7 @@ public struct TVShow: Identifiable, Codable, Equatable, Hashable { } -extension TVShow { +extension TVSeries { private enum CodingKeys: String, CodingKey { case id @@ -280,7 +280,7 @@ extension TVShow { self.episodeRunTime = try container.decodeIfPresent([Int].self, forKey: .episodeRunTime) self.numberOfSeasons = try container.decodeIfPresent(Int.self, forKey: .numberOfSeasons) self.numberOfEpisodes = try container.decodeIfPresent(Int.self, forKey: .numberOfEpisodes) - self.seasons = try container.decodeIfPresent([TVShowSeason].self, forKey: .seasons) + self.seasons = try container.decodeIfPresent([TVSeason].self, forKey: .seasons) self.genres = try container.decodeIfPresent([Genre].self, forKey: .genres) // Need to deal with empty strings - date decoding will fail with an empty string diff --git a/Sources/TMDb/Models/TVSeriesPageableList.swift b/Sources/TMDb/Models/TVSeriesPageableList.swift new file mode 100644 index 00000000..303a4150 --- /dev/null +++ b/Sources/TMDb/Models/TVSeriesPageableList.swift @@ -0,0 +1,6 @@ +import Foundation + +/// +/// A model representing a pageable list of TV series. +/// +public typealias TVSeriesPageableList = PageableListResult diff --git a/Sources/TMDb/Models/TVShowSort.swift b/Sources/TMDb/Models/TVSeriesSort.swift similarity index 88% rename from Sources/TMDb/Models/TVShowSort.swift rename to Sources/TMDb/Models/TVSeriesSort.swift index 52ccaef5..bd3c43be 100644 --- a/Sources/TMDb/Models/TVShowSort.swift +++ b/Sources/TMDb/Models/TVSeriesSort.swift @@ -1,9 +1,9 @@ import Foundation /// -/// A sort specifier when fetching TV shows. +/// A sort specifier when fetching TV series. /// -public enum TVShowSort: CustomStringConvertible { +public enum TVSeriesSort: CustomStringConvertible { /// /// By popularity. @@ -26,7 +26,7 @@ public enum TVShowSort: CustomStringConvertible { } -extension TVShowSort { +extension TVSeriesSort { private enum FieldName { static let popularity = "popularity" @@ -68,7 +68,7 @@ extension URL { static let sortBy = "sort_by" } - func appendingSortBy(_ sortBy: TVShowSort?) -> Self { + func appendingSortBy(_ sortBy: TVSeriesSort?) -> Self { guard let sortBy else { return self } diff --git a/Sources/TMDb/Models/TVShowPageableList.swift b/Sources/TMDb/Models/TVShowPageableList.swift deleted file mode 100644 index f9f88162..00000000 --- a/Sources/TMDb/Models/TVShowPageableList.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation - -/// -/// A model representing a pageable list of TV shows. -/// -public typealias TVShowPageableList = PageableListResult diff --git a/Sources/TMDb/Models/VideoCollection.swift b/Sources/TMDb/Models/VideoCollection.swift index c39d5a17..1343f13b 100644 --- a/Sources/TMDb/Models/VideoCollection.swift +++ b/Sources/TMDb/Models/VideoCollection.swift @@ -1,12 +1,12 @@ import Foundation /// -/// A model representing a collection of video images for a movie or TV show. +/// A model representing a collection of video images for a movie or TV series. /// public struct VideoCollection: Identifiable, Codable, Equatable, Hashable { /// - /// Movie or TV show identifier. + /// Movie or TV series identifier. /// public let id: Int @@ -19,7 +19,7 @@ public struct VideoCollection: Identifiable, Codable, Equatable, Hashable { /// Creates a video collection object. /// /// - Parameters: - /// - id: Movie or TV show identifier. + /// - id: Movie or TV series identifier. /// - results: Videos. /// public init(id: Int, results: [VideoMetadata]) { diff --git a/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift b/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift index ef1e218a..b54fbe88 100644 --- a/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift +++ b/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift @@ -5,7 +5,7 @@ enum PeopleEndpoint { case details(personID: Person.ID) case combinedCredits(personID: Person.ID) case movieCredits(personID: Person.ID) - case tvShowCredits(personID: Person.ID) + case tvSeriesCredits(personID: Person.ID) case images(personID: Person.ID) case popular(page: Int? = nil) @@ -31,7 +31,7 @@ extension PeopleEndpoint: Endpoint { .appendingPathComponent(personID) .appendingPathComponent("movie_credits") - case .tvShowCredits(let personID): + case .tvSeriesCredits(let personID): return Self.basePath .appendingPathComponent(personID) .appendingPathComponent("tv_credits") diff --git a/Sources/TMDb/People/PersonService.swift b/Sources/TMDb/People/PersonService.swift index 92a74ede..911d29ca 100644 --- a/Sources/TMDb/People/PersonService.swift +++ b/Sources/TMDb/People/PersonService.swift @@ -47,7 +47,7 @@ public final class PersonService { } /// - /// Returns the combined movie and TV show credits of a person. + /// Returns the combined movie and TV series credits of a person. /// /// [TMDb API - People: Combined Credits](https://developer.themoviedb.org/reference/person-combined-credits) /// @@ -56,7 +56,7 @@ public final class PersonService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: The matching person's combined movie and TV show credits. + /// - Returns: The matching person's combined movie and TV series credits. /// public func combinedCredits(forPerson personID: Person.ID) async throws -> PersonCombinedCredits { let credits: PersonCombinedCredits @@ -93,7 +93,7 @@ public final class PersonService { } /// - /// Returns the TV show credits of a person. + /// Returns the TV series credits of a person. /// /// [TMDb API - People: TV Credits](https://developer.themoviedb.org/reference/person-tv-credits) /// @@ -102,12 +102,12 @@ public final class PersonService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: The matching person's TV show credits. + /// - Returns: The matching person's TV series credits. /// - public func tvShowCredits(forPerson personID: Person.ID) async throws -> PersonTVShowCredits { - let credits: PersonTVShowCredits + public func tvSeriesCredits(forPerson personID: Person.ID) async throws -> PersonTVSeriesCredits { + let credits: PersonTVSeriesCredits do { - credits = try await apiClient.get(endpoint: PeopleEndpoint.tvShowCredits(personID: personID)) + credits = try await apiClient.get(endpoint: PeopleEndpoint.tvSeriesCredits(personID: personID)) } catch let error { throw TMDbError(error: error) } diff --git a/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift b/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift index dc41ad7e..f65cb47e 100644 --- a/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift +++ b/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift @@ -4,7 +4,7 @@ enum SearchEndpoint { case multi(query: String, page: Int? = nil) case movies(query: String, year: Int? = nil, page: Int? = nil) - case tvShows(query: String, firstAirDateYear: Int? = nil, page: Int? = nil) + case tvSeries(query: String, firstAirDateYear: Int? = nil, page: Int? = nil) case people(query: String, page: Int? = nil) } @@ -33,7 +33,7 @@ extension SearchEndpoint: Endpoint { .appendingYear(year) .appendingPage(page) - case .tvShows(let query, let firstAirDateYear, let page): + case .tvSeries(let query, let firstAirDateYear, let page): return Self.basePath .appendingPathComponent("tv") .appendingQueryItem(name: QueryItemName.query, value: query) diff --git a/Sources/TMDb/Search/SearchService.swift b/Sources/TMDb/Search/SearchService.swift index cc5ac3a1..6a6d6d93 100644 --- a/Sources/TMDb/Search/SearchService.swift +++ b/Sources/TMDb/Search/SearchService.swift @@ -22,7 +22,7 @@ public final class SearchService { } /// - /// Returns search results for movies, TV shows and people based on a query. + /// Returns search results for movies, TV series and people based on a query. /// /// [TMDb API - Search: Multi](https://developer.themoviedb.org/reference/search-multi) /// @@ -34,7 +34,7 @@ public final class SearchService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Movies, TV shows and people matching the query. + /// - Returns: Movies, TV series and people matching the query. /// public func searchAll(query: String, page: Int? = nil) async throws -> MediaPageableList { let mediaList: MediaPageableList @@ -75,7 +75,7 @@ public final class SearchService { } /// - /// Returns search results for TV shows. + /// Returns search results for TV series. /// /// [TMDb API - Search: TV](https://developer.themoviedb.org/reference/search-tv) /// @@ -88,20 +88,20 @@ public final class SearchService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: TV shows matching the query. + /// - Returns: TV series matching the query. /// - public func searchTVShows(query: String, firstAirDateYear: Int? = nil, - page: Int? = nil) async throws -> TVShowPageableList { - let tvShowList: TVShowPageableList + public func searchTVSeries(query: String, firstAirDateYear: Int? = nil, + page: Int? = nil) async throws -> TVSeriesPageableList { + let tvSeriesList: TVSeriesPageableList do { - tvShowList = try await apiClient.get( - endpoint: SearchEndpoint.tvShows(query: query, firstAirDateYear: firstAirDateYear, page: page) + tvSeriesList = try await apiClient.get( + endpoint: SearchEndpoint.tvSeries(query: query, firstAirDateYear: firstAirDateYear, page: page) ) } catch let error { throw TMDbError(error: error) } - return tvShowList + return tvSeriesList } /// diff --git a/Sources/TMDb/TMDb.docc/Extensions/CertificationService.md b/Sources/TMDb/TMDb.docc/Extensions/CertificationService.md index 2e3d6378..00a212e7 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/CertificationService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/CertificationService.md @@ -9,4 +9,4 @@ ### Certifications - ``movieCertifications()`` -- ``tvShowCertifications()`` +- ``tvSeriesCertifications()`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md b/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md index fb05df4b..2154b05c 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md @@ -10,6 +10,6 @@ - ``movies(sortedBy:withPeople:page:)`` -### Discover TV Shows +### Discover TV Series -- ``tvShows(sortedBy:page:)`` +- ``tvSeries(sortedBy:page:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/GenreService.md b/Sources/TMDb/TMDb.docc/Extensions/GenreService.md index 2af9ff11..7f365e83 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/GenreService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/GenreService.md @@ -10,6 +10,6 @@ - ``movieGenres()`` -### TV Show Genres +### TV Series Genres -- ``tvShowGenres()`` +- ``tvSeriesGenres()`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/PersonService.md b/Sources/TMDb/TMDb.docc/Extensions/PersonService.md index 349cc90a..1a658860 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/PersonService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/PersonService.md @@ -14,7 +14,7 @@ - ``combinedCredits(forPerson:)`` - ``movieCredits(forPerson:)`` -- ``tvShowCredits(forPerson:)`` +- ``tvSeriesCredits(forPerson:)`` ### Media diff --git a/Sources/TMDb/TMDb.docc/Extensions/SearchService.md b/Sources/TMDb/TMDb.docc/Extensions/SearchService.md index 7b4987e1..70dee8a8 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/SearchService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/SearchService.md @@ -14,9 +14,9 @@ - ``searchMovies(query:year:page:)`` -### TV Shows +### TV Series -- ``searchTVShows(query:firstAirDateYear:page:)`` +- ``searchTVSeries(query:firstAirDateYear:page:)`` ### People diff --git a/Sources/TMDb/TMDb.docc/Extensions/TVEpisodeService.md b/Sources/TMDb/TMDb.docc/Extensions/TVEpisodeService.md new file mode 100644 index 00000000..f984eecf --- /dev/null +++ b/Sources/TMDb/TMDb.docc/Extensions/TVEpisodeService.md @@ -0,0 +1,16 @@ +# ``TMDb/TVEpisodeService`` + +## Topics + +### Creating a TV Episode Service + +- ``init()`` + +### Details + +- ``details(forEpisode:inSeason:inTVSeries:)`` + +### Media + +- ``images(forEpisode:inSeason:inTVSeries:)`` +- ``videos(forEpisode:inSeason:inTVSeries:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/TVSeasonService.md b/Sources/TMDb/TMDb.docc/Extensions/TVSeasonService.md new file mode 100644 index 00000000..574abf60 --- /dev/null +++ b/Sources/TMDb/TMDb.docc/Extensions/TVSeasonService.md @@ -0,0 +1,16 @@ +# ``TMDb/TVSeasonService`` + +## Topics + +### Creating a TV Season Service + +- ``init()`` + +### Details + +- ``details(forSeason:inTVSeries:)`` + +### Media + +- ``images(forSeason:inTVSeries:)`` +- ``videos(forSeason:inTVSeries:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/TVSeriesService.md b/Sources/TMDb/TMDb.docc/Extensions/TVSeriesService.md new file mode 100644 index 00000000..6533bf68 --- /dev/null +++ b/Sources/TMDb/TMDb.docc/Extensions/TVSeriesService.md @@ -0,0 +1,30 @@ +# ``TMDb/TVSeriesService`` + +## Topics + +### Creating a TV Series Service + +- ``init()`` + +### Details + +- ``details(forTVSeries:)`` + +### Credits + +- ``credits(forTVSeries:)`` + +### Reviews + +- ``reviews(forTVSeries:page:)`` + +### Media + +- ``images(forTVSeries:)`` +- ``videos(forTVSeries:)`` + +### Lists and Related Content + +- ``recommendations(forTVSeries:page:)`` +- ``similar(toTVSeries:page:)`` +- ``popular(page:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/TVShowEpisodeService.md b/Sources/TMDb/TMDb.docc/Extensions/TVShowEpisodeService.md deleted file mode 100644 index d3f4cdf0..00000000 --- a/Sources/TMDb/TMDb.docc/Extensions/TVShowEpisodeService.md +++ /dev/null @@ -1,16 +0,0 @@ -# ``TMDb/TVShowEpisodeService`` - -## Topics - -### Creating a TV Show Episode Service - -- ``init()`` - -### Details - -- ``details(forEpisode:inSeason:inTVShow:)`` - -### Media - -- ``images(forEpisode:inSeason:inTVShow:)`` -- ``videos(forEpisode:inSeason:inTVShow:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/TVShowSeasonService.md b/Sources/TMDb/TMDb.docc/Extensions/TVShowSeasonService.md deleted file mode 100644 index e32141ea..00000000 --- a/Sources/TMDb/TMDb.docc/Extensions/TVShowSeasonService.md +++ /dev/null @@ -1,16 +0,0 @@ -# ``TMDb/TVShowSeasonService`` - -## Topics - -### Creating a TV Show Season Service - -- ``init()`` - -### Details - -- ``details(forSeason:inTVShow:)`` - -### Media - -- ``images(forSeason:inTVShow:)`` -- ``videos(forSeason:inTVShow:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/TVShowService.md b/Sources/TMDb/TMDb.docc/Extensions/TVShowService.md deleted file mode 100644 index abb700b5..00000000 --- a/Sources/TMDb/TMDb.docc/Extensions/TVShowService.md +++ /dev/null @@ -1,30 +0,0 @@ -# ``TMDb/TVShowService`` - -## Topics - -### Creating a TV Show Service - -- ``init()`` - -### Details - -- ``details(forTVShow:)`` - -### Credits - -- ``credits(forTVShow:)`` - -### Reviews - -- ``reviews(forTVShow:page:)`` - -### Media - -- ``images(forTVShow:)`` -- ``videos(forTVShow:)`` - -### Lists and Related Content - -- ``recommendations(forTVShow:page:)`` -- ``similar(toTVShow:page:)`` -- ``popular(page:)`` diff --git a/Sources/TMDb/TMDb.docc/Extensions/TrendingService.md b/Sources/TMDb/TMDb.docc/Extensions/TrendingService.md index e6dbf16c..2c656313 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/TrendingService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/TrendingService.md @@ -10,9 +10,9 @@ - ``movies(inTimeWindow:page:)`` -### TV Shows +### TV Series -- ``tvShows(inTimeWindow:page:)`` +- ``tvSeries(inTimeWindow:page:)`` ### People diff --git a/Sources/TMDb/TMDb.docc/Extensions/WatchProviderService.md b/Sources/TMDb/TMDb.docc/Extensions/WatchProviderService.md index 327b6a02..28032718 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/WatchProviderService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/WatchProviderService.md @@ -9,7 +9,7 @@ ### Providers - ``movieWatchProviders()`` -- ``tvShowWatchProviders()`` +- ``tvSeriesWatchProviders()`` ### Countries with Watch Provider data diff --git a/Sources/TMDb/TMDb.docc/HowTos/GeneratingImageURLs.md b/Sources/TMDb/TMDb.docc/HowTos/GeneratingImageURLs.md index e6d77c2e..83c042c1 100644 --- a/Sources/TMDb/TMDb.docc/HowTos/GeneratingImageURLs.md +++ b/Sources/TMDb/TMDb.docc/HowTos/GeneratingImageURLs.md @@ -4,7 +4,7 @@ Instructions on how to generate the full URL from an image path. ## Overview -TMDb returns paths to images in objects such as ``Movie``, ``TVShow`` and +TMDb returns paths to images in objects such as ``Movie``, ``TVSeries`` and ``Person``. In order to get the actual image the full URL needs to be generated. diff --git a/Sources/TMDb/TMDb.docc/TMDb.md b/Sources/TMDb/TMDb.docc/TMDb.md index 032e3945..ad20217a 100644 --- a/Sources/TMDb/TMDb.docc/TMDb.md +++ b/Sources/TMDb/TMDb.docc/TMDb.md @@ -1,6 +1,6 @@ # ``TMDb`` -Millions of movies, TV shows and people to discover. Explore now. +Millions of movies, TV series and people to discover. Explore now. ## Overview @@ -16,7 +16,7 @@ Every year since 2008, the number of contributions to their database has increased. With over 1,000,000 developers and companies using their platform, TMDB has become a premiere source for metadata. -Along with extensive metadata for movies, TV shows and people, they also offer +Along with extensive metadata for movies, TV series and people, they also offer one of the best selections of high resolution posters and fanart. On average, over 1,000 images are added every single day. @@ -62,29 +62,29 @@ For the TMDb API documentation, see - ``VideoCollection`` - ``MoviePageableList`` -### TV Shows +### TV Series -- ``TVShowService`` -- ``TVShow`` +- ``TVSeriesService`` +- ``TVSeries`` - ``ShowCredits`` - ``ReviewPageableList`` - ``Review`` - ``ImageCollection`` - ``VideoCollection`` -- ``TVShowPageableList`` +- ``TVSeriesPageableList`` -### TV Show Seasons +### TV Seasons -- ``TVShowSeasonService`` -- ``TVShowSeason`` -- ``TVShowSeasonImageCollection`` +- ``TVSeasonService`` +- ``TVSeason`` +- ``TVSeasonImageCollection`` - ``VideoCollection`` -### TV Show Episodes +### TV Episodes -- ``TVShowEpisodeService`` -- ``TVShowEpisode`` -- ``TVShowEpisodeImageCollection`` +- ``TVEpisodeService`` +- ``TVEpisode`` +- ``TVEpisodeImageCollection`` - ``VideoCollection`` ### People @@ -93,7 +93,7 @@ For the TMDb API documentation, see - ``Person`` - ``PersonCombinedCredits`` - ``PersonMovieCredits`` -- ``PersonTVShowCredits`` +- ``PersonTVSeriesCredits`` - ``PersonImageCollection`` - ``Show`` - ``PersonPageableList`` @@ -104,17 +104,17 @@ For the TMDb API documentation, see - ``MoviePageableList`` - ``Movie`` - ``MovieSort`` -- ``TVShowPageableList`` -- ``TVShow`` -- ``TVShowSort`` +- ``TVSeriesPageableList`` +- ``TVSeries`` +- ``TVSeriesSort`` ### Trending - ``TrendingService`` - ``MoviePageableList`` - ``Movie`` -- ``TVShowPageableList`` -- ``TVShow`` +- ``TVSeriesPageableList`` +- ``TVSeries`` - ``PersonPageableList`` - ``Person`` - ``TrendingTimeWindowFilterType`` @@ -126,8 +126,8 @@ For the TMDb API documentation, see - ``Media`` - ``MoviePageableList`` - ``Movie`` -- ``TVShowPageableList`` -- ``TVShow`` +- ``TVSeriesPageableList`` +- ``TVSeries`` - ``PersonPageableList`` - ``Person`` diff --git a/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift b/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift new file mode 100644 index 00000000..32eb79ce --- /dev/null +++ b/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift @@ -0,0 +1,42 @@ +import Foundation + +enum TVEpisodesEndpoint { + + case details(tvSeriesID: TVSeries.ID, seasonNumber: Int, episodeNumber: Int) + case images(tvSeriesID: TVSeries.ID, seasonNumber: Int, episodeNumber: Int) + case videos(tvSeriesID: TVSeries.ID, seasonNumber: Int, episodeNumber: Int) + +} + +extension TVEpisodesEndpoint: Endpoint { + + private static func basePath(for tvSeriesID: TVSeries.ID) -> URL { + TVSeriesEndpoint.details(tvSeriesID: tvSeriesID).path + .appendingPathComponent("season") + } + + var path: URL { + switch self { + case .details(let tvSeriesID, let seasonNumber, let episodeNumber): + return Self.basePath(for: tvSeriesID) + .appendingPathComponent(seasonNumber) + .appendingPathComponent("episode") + .appendingPathComponent(episodeNumber) + + case .images(let tvSeriesID, let seasonNumber, let episodeNumber): + return Self.basePath(for: tvSeriesID) + .appendingPathComponent(seasonNumber) + .appendingPathComponent("episode") + .appendingPathComponent(episodeNumber) + .appendingPathComponent("images") + + case .videos(let tvSeriesID, let seasonNumber, let episodeNumber): + return Self.basePath(for: tvSeriesID) + .appendingPathComponent(seasonNumber) + .appendingPathComponent("episode") + .appendingPathComponent(episodeNumber) + .appendingPathComponent("videos") + } + } + +} diff --git a/Sources/TMDb/TVShowEpisodes/TVShowEpisodeService.swift b/Sources/TMDb/TVEpisodes/TVEpisodeService.swift similarity index 55% rename from Sources/TMDb/TVShowEpisodes/TVShowEpisodeService.swift rename to Sources/TMDb/TVEpisodes/TVEpisodeService.swift index 9b61e4f5..8b5481b7 100644 --- a/Sources/TMDb/TVShowEpisodes/TVShowEpisodeService.swift +++ b/Sources/TMDb/TVEpisodes/TVEpisodeService.swift @@ -1,15 +1,15 @@ import Foundation /// -/// Provides an interface for obtaining TV show episodes from TMDb. +/// Provides an interface for obtaining TV episodes from TMDb. /// @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) -public final class TVShowEpisodeService { +public final class TVEpisodeService { private let apiClient: APIClient /// - /// Creates a TV show episode service object. + /// Creates a TV episode service object. /// public convenience init() { self.init( @@ -22,26 +22,26 @@ public final class TVShowEpisodeService { } /// - /// Returns the primary information about a TV show episode. + /// Returns the primary information about a TV episode. /// /// [TMDb API - TV Episodes: Details](https://developer.themoviedb.org/reference/tv-episode-details) /// /// - Parameters: - /// - episodeNumber: The episode number of a TV show. - /// - seasonNumber: The season number of a TV show. - /// - tvShowID: The identifier of the TV show. + /// - episodeNumber: The episode number of a TV series. + /// - seasonNumber: The season number of a TV series. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A episode of the matching TV show. + /// - Returns: A episode of the matching TV series. /// public func details(forEpisode episodeNumber: Int, inSeason seasonNumber: Int, - inTVShow tvShowID: TVShow.ID) async throws -> TVShowEpisode { - let episode: TVShowEpisode + inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVEpisode { + let episode: TVEpisode do { episode = try await apiClient.get( - endpoint: TVShowEpisodesEndpoint.details( - tvShowID: tvShowID, + endpoint: TVEpisodesEndpoint.details( + tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, episodeNumber: episodeNumber ) @@ -54,26 +54,26 @@ public final class TVShowEpisodeService { } /// - /// Returns the images that belong to a TV show episode. + /// Returns the images that belong to a TV episode. /// /// [TMDb API - TV Episode: Images](https://developer.themoviedb.org/reference/tv-episode-images) /// /// - Parameters: - /// - episodeNumber: The episode number of a TV show. - /// - seasonNumber: The season number of a TV show. - /// - tvShowID: The identifier of the TV show. + /// - episodeNumber: The episode number of a TV. + /// - seasonNumber: The season number of a TV. + /// - tvSeriesID: The identifier of the TV. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A collection of images for the matching TV show's episode. + /// - Returns: A collection of images for the matching TV's episode. /// public func images(forEpisode episodeNumber: Int, inSeason seasonNumber: Int, - inTVShow tvShowID: TVShow.ID) async throws -> TVShowEpisodeImageCollection { - let imageCollection: TVShowEpisodeImageCollection + inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVEpisodeImageCollection { + let imageCollection: TVEpisodeImageCollection do { imageCollection = try await apiClient.get( - endpoint: TVShowEpisodesEndpoint.images( - tvShowID: tvShowID, + endpoint: TVEpisodesEndpoint.images( + tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, episodeNumber: episodeNumber ) @@ -86,26 +86,26 @@ public final class TVShowEpisodeService { } /// - /// Returns the videos that belong to a TV show episode. + /// Returns the videos that belong to a TV series episode. /// /// [TMDb API - TV Episode: Videos](https://developer.themoviedb.org/reference/tv-episode-videos) /// /// - Parameters: - /// - episodeNumber: The episode number of a TV show. - /// - seasonNumber: The season number of a TV show. - /// - tvShowID: The identifier of the TV show. + /// - episodeNumber: The episode number of a TV. + /// - seasonNumber: The season number of a TV. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A collection of videos for the matching TV show's episode. + /// - Returns: A collection of videos for the matching TV's episode. /// public func videos(forEpisode episodeNumber: Int, inSeason seasonNumber: Int, - inTVShow tvShowID: TVShow.ID) async throws -> VideoCollection { + inTVSeries tvSeriesID: TVSeries.ID) async throws -> VideoCollection { let videoCollection: VideoCollection do { videoCollection = try await apiClient.get( - endpoint: TVShowEpisodesEndpoint.videos( - tvShowID: tvShowID, + endpoint: TVEpisodesEndpoint.videos( + tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, episodeNumber: episodeNumber ) diff --git a/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift b/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift new file mode 100644 index 00000000..15b59391 --- /dev/null +++ b/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift @@ -0,0 +1,38 @@ +import Foundation + +enum TVSeasonsEndpoint { + + case details(tvSeriesID: TVSeries.ID, seasonNumber: Int) + case images(tvSeriesID: TVSeries.ID, seasonNumber: Int, languageCode: String?) + case videos(tvSeriesID: TVSeries.ID, seasonNumber: Int, languageCode: String?) + +} + +extension TVSeasonsEndpoint: Endpoint { + + private static func basePath(for tvSeriesID: TVSeries.ID) -> URL { + TVSeriesEndpoint.details(tvSeriesID: tvSeriesID).path + .appendingPathComponent("season") + } + + var path: URL { + switch self { + case .details(let tvSeriesID, let seasonNumber): + return Self.basePath(for: tvSeriesID) + .appendingPathComponent(seasonNumber) + + case .images(let tvSeriesID, let seasonNumber, let languageCode): + return Self.basePath(for: tvSeriesID) + .appendingPathComponent(seasonNumber) + .appendingPathComponent("images") + .appendingImageLanguage(languageCode) + + case .videos(let tvSeriesID, let seasonNumber, let languageCode): + return Self.basePath(for: tvSeriesID) + .appendingPathComponent(seasonNumber) + .appendingPathComponent("videos") + .appendingVideoLanguage(languageCode) + } + } + +} diff --git a/Sources/TMDb/TVShowSeasons/TVShowSeasonService.swift b/Sources/TMDb/TVSeasons/TVSeasonService.swift similarity index 52% rename from Sources/TMDb/TVShowSeasons/TVShowSeasonService.swift rename to Sources/TMDb/TVSeasons/TVSeasonService.swift index 1b029207..a00d4757 100644 --- a/Sources/TMDb/TVShowSeasons/TVShowSeasonService.swift +++ b/Sources/TMDb/TVSeasons/TVSeasonService.swift @@ -1,16 +1,16 @@ import Foundation /// -/// Provides an interface for obtaining TV show seasons from TMDb. +/// Provides an interface for obtaining TV seasons from TMDb. /// @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) -public final class TVShowSeasonService { +public final class TVSeasonService { private let apiClient: APIClient private let localeProvider: () -> Locale /// - /// Creates a TV show season service object. + /// Creates a TV season service object. /// public convenience init() { self.init( @@ -25,23 +25,23 @@ public final class TVShowSeasonService { } /// - /// Returns the primary information about a TV show season. + /// Returns the primary information about a TV season. /// /// [TMDb API - TV Seasons: Details](https://developer.themoviedb.org/reference/tv-season-details) /// /// - Parameters: - /// - seasonNumber: The season number of a TV show. - /// - tvShowID: The identifier of the TV show. + /// - seasonNumber: The season number of a TV series. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A season of the matching TV show. + /// - Returns: A season of the matching TV series. /// - public func details(forSeason seasonNumber: Int, inTVShow tvShowID: TVShow.ID) async throws -> TVShowSeason { - let season: TVShowSeason + public func details(forSeason seasonNumber: Int, inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVSeason { + let season: TVSeason do { season = try await apiClient.get( - endpoint: TVShowSeasonsEndpoint.details(tvShowID: tvShowID, seasonNumber: seasonNumber) + endpoint: TVSeasonsEndpoint.details(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber) ) } catch let error { throw TMDbError(error: error) @@ -51,26 +51,26 @@ public final class TVShowSeasonService { } /// - /// Returns the images that belong to a TV show season. + /// Returns the images that belong to a TV season. /// /// [TMDb API - TV Seasons: Images](https://developer.themoviedb.org/reference/tv-season-images) /// /// - Parameters: - /// - seasonNumber: The season number of a TV show. - /// - tvShowID: The identifier of the TV show. + /// - seasonNumber: The season number of a TV series. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A collection of images for the matching TV show's season. + /// - Returns: A collection of images for the matching TV's season. /// public func images(forSeason seasonNumber: Int, - inTVShow tvShowID: TVShow.ID) async throws -> TVShowSeasonImageCollection { + inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVSeasonImageCollection { let languageCode = localeProvider().languageCode - let imageCollection: TVShowSeasonImageCollection + let imageCollection: TVSeasonImageCollection do { imageCollection = try await apiClient.get( - endpoint: TVShowSeasonsEndpoint.images(tvShowID: tvShowID, seasonNumber: seasonNumber, - languageCode: languageCode) + endpoint: TVSeasonsEndpoint.images(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, + languageCode: languageCode) ) } catch let error { throw TMDbError(error: error) @@ -80,25 +80,26 @@ public final class TVShowSeasonService { } /// - /// Returns the videos that belong to a TV show season. + /// Returns the videos that belong to a TV season. /// /// [TMDb API - TV Seasons: Videos](https://developer.themoviedb.org/reference/tv-season-videos) /// /// - Parameters: - /// - seasonNumber: The season number of a TV show. - /// - tvShowID: The identifier of the TV show. + /// - seasonNumber: The season number of a TV series. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A collection of videos for the matching TV show's season. + /// - Returns: A collection of videos for the matching TV series season. /// - public func videos(forSeason seasonNumber: Int, inTVShow tvShowID: TVShow.ID) async throws -> VideoCollection { + public func videos(forSeason seasonNumber: Int, + inTVSeries tvSeriesID: TVSeries.ID) async throws -> VideoCollection { let languageCode = localeProvider().languageCode let videoCollection: VideoCollection do { videoCollection = try await apiClient.get( - endpoint: TVShowSeasonsEndpoint.videos(tvShowID: tvShowID, seasonNumber: seasonNumber, - languageCode: languageCode) + endpoint: TVSeasonsEndpoint.videos(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, + languageCode: languageCode) ) } catch let error { throw TMDbError(error: error) diff --git a/Sources/TMDb/TVSeries/Endpoints/TVSeriesEndpoint.swift b/Sources/TMDb/TVSeries/Endpoints/TVSeriesEndpoint.swift new file mode 100644 index 00000000..a6c4fc47 --- /dev/null +++ b/Sources/TMDb/TVSeries/Endpoints/TVSeriesEndpoint.swift @@ -0,0 +1,68 @@ +import Foundation + +enum TVSeriesEndpoint { + + case details(tvSeriesID: TVSeries.ID) + case credits(tvSeriesID: TVSeries.ID) + case reviews(tvSeriesID: TVSeries.ID, page: Int? = nil) + case images(tvSeriesID: TVSeries.ID, languageCode: String?) + case videos(tvSeriesID: TVSeries.ID, languageCode: String?) + case recommendations(tvSeriesID: TVSeries.ID, page: Int? = nil) + case similar(tvSeriesID: TVSeries.ID, page: Int? = nil) + case popular(page: Int? = nil) + +} + +extension TVSeriesEndpoint: Endpoint { + + private static let basePath = URL(string: "/tv")! + + var path: URL { + switch self { + case .details(let tvSeriesID): + return Self.basePath + .appendingPathComponent(tvSeriesID) + + case .credits(let tvSeriesID): + return Self.basePath + .appendingPathComponent(tvSeriesID) + .appendingPathComponent("credits") + + case .reviews(let tvSeriesID, let page): + return Self.basePath + .appendingPathComponent(tvSeriesID) + .appendingPathComponent("reviews") + .appendingPage(page) + + case .images(let tvSeriesID, let languageCode): + return Self.basePath + .appendingPathComponent(tvSeriesID) + .appendingPathComponent("images") + .appendingImageLanguage(languageCode) + + case .videos(let tvSeriesID, let languageCode): + return Self.basePath + .appendingPathComponent(tvSeriesID) + .appendingPathComponent("videos") + .appendingVideoLanguage(languageCode) + + case .recommendations(let tvSeriesID, let page): + return Self.basePath + .appendingPathComponent(tvSeriesID) + .appendingPathComponent("recommendations") + .appendingPage(page) + + case .similar(let tvSeriesID, let page): + return Self.basePath + .appendingPathComponent(tvSeriesID) + .appendingPathComponent("similar") + .appendingPage(page) + + case .popular(let page): + return Self.basePath + .appendingPathComponent("popular") + .appendingPage(page) + } + } + +} diff --git a/Sources/TMDb/TVShows/TVShowService.swift b/Sources/TMDb/TVSeries/TVSeriesService.swift similarity index 53% rename from Sources/TMDb/TVShows/TVShowService.swift rename to Sources/TMDb/TVSeries/TVSeriesService.swift index 92958928..f3cb6360 100644 --- a/Sources/TMDb/TVShows/TVShowService.swift +++ b/Sources/TMDb/TVSeries/TVSeriesService.swift @@ -1,16 +1,16 @@ import Foundation /// -/// Provides an interface for obtaining TV shows from TMDb. +/// Provides an interface for obtaining TV series from TMDb. /// @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) -public final class TVShowService { +public final class TVSeriesService { private let apiClient: APIClient private let localeProvider: () -> Locale /// - /// Creates a TV show service object. + /// Creates a TV series service object. /// public convenience init() { self.init( @@ -25,44 +25,44 @@ public final class TVShowService { } /// - /// Returns the primary information about a TV show. + /// Returns the primary information about a TV series. /// /// [TMDb API - TV Series: Details](https://developer.themoviedb.org/reference/tv-series-details) /// /// - Parameters: - /// - id: The identifier of the TV show. + /// - id: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: The matching TV show. - /// - public func details(forTVShow id: TVShow.ID) async throws -> TVShow { - let tvShow: TVShow + /// - Returns: The matching TV series. + /// + public func details(forTVSeries id: TVSeries.ID) async throws -> TVSeries { + let tvSeries: TVSeries do { - tvShow = try await apiClient.get(endpoint: TVShowsEndpoint.details(tvShowID: id)) + tvSeries = try await apiClient.get(endpoint: TVSeriesEndpoint.details(tvSeriesID: id)) } catch let error { throw TMDbError(error: error) } - return tvShow + return tvSeries } /// - /// Returns the cast and crew of a TV show. + /// Returns the cast and crew of a TV series. /// /// [TMDb API - TV Series: Credits](https://developer.themoviedb.org/reference/tv-series-credits) /// /// - Parameters: - /// - tvShowID: The identifier of the TV show. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Show credits for the matching TV show. + /// - Returns: Show credits for the matching TV series. /// - public func credits(forTVShow tvShowID: TVShow.ID) async throws -> ShowCredits { + public func credits(forTVSeries tvSeriesID: TVSeries.ID) async throws -> ShowCredits { let credits: ShowCredits do { - credits = try await apiClient.get(endpoint: TVShowsEndpoint.credits(tvShowID: tvShowID)) + credits = try await apiClient.get(endpoint: TVSeriesEndpoint.credits(tvSeriesID: tvSeriesID)) } catch let error { throw TMDbError(error: error) } @@ -71,24 +71,24 @@ public final class TVShowService { } /// - /// Returns the user reviews for a TV show. + /// Returns the user reviews for a TV series. /// /// [TMDb API - TV Series: Reviews](https://developer.themoviedb.org/reference/tv-series-reviews) /// /// - Precondition: `page` can be between `1` and `1000`. /// /// - Parameters: - /// - tvShowID: The identifier of the TV show. + /// - tvSeriesID: The identifier of the TV series. /// - page: The page of results to return. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Reviews for the matching TV show as a pageable list. + /// - Returns: Reviews for the matching TV series as a pageable list. /// - public func reviews(forTVShow tvShowID: TVShow.ID, page: Int? = nil) async throws -> ReviewPageableList { + public func reviews(forTVSeries tvSeriesID: TVSeries.ID, page: Int? = nil) async throws -> ReviewPageableList { let reviewList: ReviewPageableList do { - reviewList = try await apiClient.get(endpoint: TVShowsEndpoint.reviews(tvShowID: tvShowID, page: page)) + reviewList = try await apiClient.get(endpoint: TVSeriesEndpoint.reviews(tvSeriesID: tvSeriesID, page: page)) } catch let error { throw TMDbError(error: error) } @@ -97,23 +97,23 @@ public final class TVShowService { } /// - /// Returns the images that belong to a TV show. + /// Returns the images that belong to a TV series. /// /// [TMDb API - TV Series: Images](https://developer.themoviedb.org/reference/tv-series-images) /// /// - Parameters: - /// - tvShowID: The identifier of the TV show. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A collection of images for the matching TV show. + /// - Returns: A collection of images for the matching TV series. /// - public func images(forTVShow tvShowID: TVShow.ID) async throws -> ImageCollection { + public func images(forTVSeries tvSeriesID: TVSeries.ID) async throws -> ImageCollection { let languageCode = localeProvider().languageCode let imageCollection: ImageCollection do { imageCollection = try await apiClient.get( - endpoint: TVShowsEndpoint.images(tvShowID: tvShowID, languageCode: languageCode) + endpoint: TVSeriesEndpoint.images(tvSeriesID: tvSeriesID, languageCode: languageCode) ) } catch let error { throw TMDbError(error: error) @@ -123,23 +123,23 @@ public final class TVShowService { } /// - /// Returns the videos that belong to a TV show. + /// Returns the videos that belong to a TV series. /// /// [TMDb API - TV Series: Videos](https://developer.themoviedb.org/reference/tv-series-videos) /// /// - Parameters: - /// - tvShowID: The identifier of the TV show. + /// - tvSeriesID: The identifier of the TV series. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: A collection of videos for the matching TV show. + /// - Returns: A collection of videos for the matching TV series. /// - public func videos(forTVShow tvShowID: TVShow.ID) async throws -> VideoCollection { + public func videos(forTVSeries tvSeriesID: TVSeries.ID) async throws -> VideoCollection { let languageCode = localeProvider().languageCode let videoCollection: VideoCollection do { videoCollection = try await apiClient.get( - endpoint: TVShowsEndpoint.videos(tvShowID: tvShowID, languageCode: languageCode) + endpoint: TVSeriesEndpoint.videos(tvSeriesID: tvSeriesID, languageCode: languageCode) ) } catch let error { throw TMDbError(error: error) @@ -149,35 +149,36 @@ public final class TVShowService { } /// - /// Returns a list of recommended TV shows for a TV show. + /// Returns a list of recommended TV series for a TV series. /// /// [TMDb API - TV Series: Recommendations](https://developer.themoviedb.org/reference/tv-series-recommendations) /// /// - Precondition: `page` can be between `1` and `1000`. /// /// - Parameters: - /// - tvShowID: The identifier of the TV show. + /// - tvSeriesID: The identifier of the TV series. /// - page: The page of results to return. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Recommended TV shows for the matching TV show as a pageable list. + /// - Returns: Recommended TV series for the matching TV series as a pageable list. /// - public func recommendations(forTVShow tvShowID: TVShow.ID, page: Int? = nil) async throws -> TVShowPageableList { - let tvShowList: TVShowPageableList + public func recommendations(forTVSeries tvSeriesID: TVSeries.ID, + page: Int? = nil) async throws -> TVSeriesPageableList { + let tvSeriesList: TVSeriesPageableList do { - tvShowList = try await apiClient.get( - endpoint: TVShowsEndpoint.recommendations(tvShowID: tvShowID, page: page) + tvSeriesList = try await apiClient.get( + endpoint: TVSeriesEndpoint.recommendations(tvSeriesID: tvSeriesID, page: page) ) } catch let error { throw TMDbError(error: error) } - return tvShowList + return tvSeriesList } /// - /// Returns a list of similar TV shows for a TV show. + /// Returns a list of similar TV series for a TV series. /// /// This is not the same as the *Recommendations*. /// @@ -186,26 +187,28 @@ public final class TVShowService { /// - Precondition: `page` can be between `1` and `1000`. /// /// - Parameters: - /// - tvShowID: The identifier of the TV show for get similar TV shows for. + /// - tvSeriesID: The identifier of the TV series for get similar TV series for. /// - page: The page of results to return. /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Similar TV shows for the matching TV show as a pageable list. + /// - Returns: Similar TV series for the matching TV series as a pageable list. /// - public func similar(toTVShow tvShowID: TVShow.ID, page: Int? = nil) async throws -> TVShowPageableList { - let tvShowList: TVShowPageableList + public func similar(toTVSeries tvSeriesID: TVSeries.ID, page: Int? = nil) async throws -> TVSeriesPageableList { + let tvSeriesList: TVSeriesPageableList do { - tvShowList = try await apiClient.get(endpoint: TVShowsEndpoint.similar(tvShowID: tvShowID, page: page)) + tvSeriesList = try await apiClient.get( + endpoint: TVSeriesEndpoint.similar(tvSeriesID: tvSeriesID, page: page) + ) } catch let error { throw TMDbError(error: error) } - return tvShowList + return tvSeriesList } /// - /// Returns a list current popular TV shows. + /// Returns a list current popular TV series. /// /// [TMDb API - TV Series Lists: Popular](https://developer.themoviedb.org/reference/tv-series-popular-list) /// @@ -216,17 +219,17 @@ public final class TVShowService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Current popular TV shows as a pageable list. + /// - Returns: Current popular TV series as a pageable list. /// - public func popular(page: Int? = nil) async throws -> TVShowPageableList { - let tvShowList: TVShowPageableList + public func popular(page: Int? = nil) async throws -> TVSeriesPageableList { + let tvSeriesList: TVSeriesPageableList do { - tvShowList = try await apiClient.get(endpoint: TVShowsEndpoint.popular(page: page)) + tvSeriesList = try await apiClient.get(endpoint: TVSeriesEndpoint.popular(page: page)) } catch let error { throw TMDbError(error: error) } - return tvShowList + return tvSeriesList } } diff --git a/Sources/TMDb/TVShowEpisodes/Endpoints/TVShowEpisodesEndpoint.swift b/Sources/TMDb/TVShowEpisodes/Endpoints/TVShowEpisodesEndpoint.swift deleted file mode 100644 index 66cbb579..00000000 --- a/Sources/TMDb/TVShowEpisodes/Endpoints/TVShowEpisodesEndpoint.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation - -enum TVShowEpisodesEndpoint { - - case details(tvShowID: TVShow.ID, seasonNumber: Int, episodeNumber: Int) - case images(tvShowID: TVShow.ID, seasonNumber: Int, episodeNumber: Int) - case videos(tvShowID: TVShow.ID, seasonNumber: Int, episodeNumber: Int) - -} - -extension TVShowEpisodesEndpoint: Endpoint { - - private static func basePath(for tvShowID: TVShow.ID) -> URL { - TVShowsEndpoint.details(tvShowID: tvShowID).path - .appendingPathComponent("season") - } - - var path: URL { - switch self { - case .details(let tvShowID, let seasonNumber, let episodeNumber): - return Self.basePath(for: tvShowID) - .appendingPathComponent(seasonNumber) - .appendingPathComponent("episode") - .appendingPathComponent(episodeNumber) - - case .images(let tvShowID, let seasonNumber, let episodeNumber): - return Self.basePath(for: tvShowID) - .appendingPathComponent(seasonNumber) - .appendingPathComponent("episode") - .appendingPathComponent(episodeNumber) - .appendingPathComponent("images") - - case .videos(let tvShowID, let seasonNumber, let episodeNumber): - return Self.basePath(for: tvShowID) - .appendingPathComponent(seasonNumber) - .appendingPathComponent("episode") - .appendingPathComponent(episodeNumber) - .appendingPathComponent("videos") - } - } - -} diff --git a/Sources/TMDb/TVShowSeasons/Endpoints/TVShowSeasonsEndpoint.swift b/Sources/TMDb/TVShowSeasons/Endpoints/TVShowSeasonsEndpoint.swift deleted file mode 100644 index e689a1b5..00000000 --- a/Sources/TMDb/TVShowSeasons/Endpoints/TVShowSeasonsEndpoint.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation - -enum TVShowSeasonsEndpoint { - - case details(tvShowID: TVShow.ID, seasonNumber: Int) - case images(tvShowID: TVShow.ID, seasonNumber: Int, languageCode: String?) - case videos(tvShowID: TVShow.ID, seasonNumber: Int, languageCode: String?) - -} - -extension TVShowSeasonsEndpoint: Endpoint { - - private static func basePath(for tvShowID: TVShow.ID) -> URL { - TVShowsEndpoint.details(tvShowID: tvShowID).path - .appendingPathComponent("season") - } - - var path: URL { - switch self { - case .details(let tvShowID, let seasonNumber): - return Self.basePath(for: tvShowID) - .appendingPathComponent(seasonNumber) - - case .images(let tvShowID, let seasonNumber, let languageCode): - return Self.basePath(for: tvShowID) - .appendingPathComponent(seasonNumber) - .appendingPathComponent("images") - .appendingImageLanguage(languageCode) - - case .videos(let tvShowID, let seasonNumber, let languageCode): - return Self.basePath(for: tvShowID) - .appendingPathComponent(seasonNumber) - .appendingPathComponent("videos") - .appendingVideoLanguage(languageCode) - } - } - -} diff --git a/Sources/TMDb/TVShows/Endpoints/TVShowsEndpoint.swift b/Sources/TMDb/TVShows/Endpoints/TVShowsEndpoint.swift deleted file mode 100644 index 5d5e952e..00000000 --- a/Sources/TMDb/TVShows/Endpoints/TVShowsEndpoint.swift +++ /dev/null @@ -1,68 +0,0 @@ -import Foundation - -enum TVShowsEndpoint { - - case details(tvShowID: TVShow.ID) - case credits(tvShowID: TVShow.ID) - case reviews(tvShowID: TVShow.ID, page: Int? = nil) - case images(tvShowID: TVShow.ID, languageCode: String?) - case videos(tvShowID: TVShow.ID, languageCode: String?) - case recommendations(tvShowID: TVShow.ID, page: Int? = nil) - case similar(tvShowID: TVShow.ID, page: Int? = nil) - case popular(page: Int? = nil) - -} - -extension TVShowsEndpoint: Endpoint { - - private static let basePath = URL(string: "/tv")! - - var path: URL { - switch self { - case .details(let tvShowID): - return Self.basePath - .appendingPathComponent(tvShowID) - - case .credits(let tvShowID): - return Self.basePath - .appendingPathComponent(tvShowID) - .appendingPathComponent("credits") - - case .reviews(let tvShowID, let page): - return Self.basePath - .appendingPathComponent(tvShowID) - .appendingPathComponent("reviews") - .appendingPage(page) - - case .images(let tvShowID, let languageCode): - return Self.basePath - .appendingPathComponent(tvShowID) - .appendingPathComponent("images") - .appendingImageLanguage(languageCode) - - case .videos(let tvShowID, let languageCode): - return Self.basePath - .appendingPathComponent(tvShowID) - .appendingPathComponent("videos") - .appendingVideoLanguage(languageCode) - - case .recommendations(let tvShowID, let page): - return Self.basePath - .appendingPathComponent(tvShowID) - .appendingPathComponent("recommendations") - .appendingPage(page) - - case .similar(let tvShowID, let page): - return Self.basePath - .appendingPathComponent(tvShowID) - .appendingPathComponent("similar") - .appendingPage(page) - - case .popular(let page): - return Self.basePath - .appendingPathComponent("popular") - .appendingPage(page) - } - } - -} diff --git a/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift b/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift index 944bfa52..d41ed1a0 100644 --- a/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift +++ b/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift @@ -3,7 +3,7 @@ import Foundation enum TrendingEndpoint { case movies(timeWindow: TrendingTimeWindowFilterType = .day, page: Int? = nil) - case tvShows(timeWindow: TrendingTimeWindowFilterType = .day, page: Int? = nil) + case tvSeries(timeWindow: TrendingTimeWindowFilterType = .day, page: Int? = nil) case people(timeWindow: TrendingTimeWindowFilterType = .day, page: Int? = nil) } @@ -20,7 +20,7 @@ extension TrendingEndpoint: Endpoint { .appendingPathComponent(timeWindow) .appendingPage(page) - case .tvShows(let timeWindow, let page): + case .tvSeries(let timeWindow, let page): return Self.basePath .appendingPathComponent("tv") .appendingPathComponent(timeWindow) diff --git a/Sources/TMDb/Trending/TrendingService.swift b/Sources/TMDb/Trending/TrendingService.swift index 8c478c09..fa65d69c 100644 --- a/Sources/TMDb/Trending/TrendingService.swift +++ b/Sources/TMDb/Trending/TrendingService.swift @@ -1,7 +1,7 @@ import Foundation /// -/// Provides an interface for finding trending movies, TV shows and people from TMDb. +/// Provides an interface for finding trending movies, TV series and people from TMDb. /// @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) public final class TrendingService { @@ -52,10 +52,10 @@ public final class TrendingService { } /// - /// Returns a list of the daily or weekly trending TV shows. + /// Returns a list of the daily or weekly trending TV series. /// - /// The daily trending list tracks TV shows over the period of a day while TV shows have a 24 hour half life. The - /// weekly list tracks TV shows over a 7 day period, with a 7 day half life. + /// The daily trending list tracks TV series over the period of a day while TV series have a 24 hour half life. The + /// weekly list tracks TV series over a 7 day period, with a 7 day half life. /// /// [TMDb API - Trending: TV](https://developer.themoviedb.org/reference/trending-tv) /// @@ -67,18 +67,20 @@ public final class TrendingService { /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Trending TV shows in a time window as a pageable list. + /// - Returns: Trending TV series in a time window as a pageable list. /// - public func tvShows(inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, - page: Int? = nil) async throws -> TVShowPageableList { - let tvShowList: TVShowPageableList + public func tvSeries(inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, + page: Int? = nil) async throws -> TVSeriesPageableList { + let tvSeriesList: TVSeriesPageableList do { - tvShowList = try await apiClient.get(endpoint: TrendingEndpoint.tvShows(timeWindow: timeWindow, page: page)) + tvSeriesList = try await apiClient.get( + endpoint: TrendingEndpoint.tvSeries(timeWindow: timeWindow, page: page) + ) } catch let error { throw TMDbError(error: error) } - return tvShowList + return tvSeriesList } /// diff --git a/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift b/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift index a179eae2..f290c575 100644 --- a/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift +++ b/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift @@ -1,6 +1,6 @@ import Foundation -/// Sort specifier when fetching TV shows. +/// Sort specifier when fetching TV series. public enum TrendingTimeWindowFilterType: String { /// Day time window filter. diff --git a/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift b/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift index db02ce73..1edf38e7 100644 --- a/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift +++ b/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift @@ -4,7 +4,7 @@ enum WatchProviderEndpoint { case regions case movie(regionCode: String?) - case tvShow(regionCode: String?) + case tvSeries(regionCode: String?) } @@ -23,7 +23,7 @@ extension WatchProviderEndpoint: Endpoint { .appendingPathComponent("movie") .appendingWatchRegion(regionCode) - case .tvShow(let regionCode): + case .tvSeries(let regionCode): return Self.basePath .appendingPathComponent("tv") .appendingWatchRegion(regionCode) diff --git a/Sources/TMDb/WatchProviders/WatchProviderService.swift b/Sources/TMDb/WatchProviders/WatchProviderService.swift index 4950d265..90316831 100644 --- a/Sources/TMDb/WatchProviders/WatchProviderService.swift +++ b/Sources/TMDb/WatchProviders/WatchProviderService.swift @@ -68,20 +68,20 @@ public final class WatchProviderService { } /// - /// Returns a list of the watch provider (OTT/streaming) data TMDb have available for TV shows. + /// Returns a list of the watch provider (OTT/streaming) data TMDb have available for TV series. /// /// [TMDb API - Watch Providers: TV Providers](https://developer.themoviedb.org/reference/watch-provider-tv-list) /// /// - Throws: TMDb error ``TMDbError``. /// - /// - Returns: Watch providers for TV shows. + /// - Returns: Watch providers for TV series. /// - public func tvShowWatchProviders() async throws -> [WatchProvider] { + public func tvSeriesWatchProviders() async throws -> [WatchProvider] { let regionCode = localeProvider().regionCode let result: WatchProviderResult do { result = try await apiClient.get( - endpoint: WatchProviderEndpoint.tvShow(regionCode: regionCode) + endpoint: WatchProviderEndpoint.tvSeries(regionCode: regionCode) ) } catch let error { throw TMDbError(error: error) diff --git a/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift b/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift index e32a1d94..954abe68 100644 --- a/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift @@ -24,8 +24,8 @@ final class CertificationIntegrationTests: XCTestCase { XCTAssertEqual(gbCertifications.count, 7) } - func testTVShowCertifications() async throws { - let certifications = try await certificationService.tvShowCertifications() + func testTVSeriesCertifications() async throws { + let certifications = try await certificationService.tvSeriesCertifications() let gbCertifications = try XCTUnwrap(certifications["GB"]) diff --git a/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift b/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift index e0f9964e..8490c6c3 100644 --- a/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift @@ -22,10 +22,10 @@ final class DiscoverIntegrationTests: XCTestCase { XCTAssertFalse(movieList.results.isEmpty) } - func testTVShows() async throws { - let tvShowList = try await discoverService.tvShows() + func testTVSeries() async throws { + let tvSeriesList = try await discoverService.tvSeries() - XCTAssertFalse(tvShowList.results.isEmpty) + XCTAssertFalse(tvSeriesList.results.isEmpty) } } diff --git a/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift b/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift index 4032af94..c373c083 100644 --- a/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift @@ -22,8 +22,8 @@ final class GenreIntegrationTests: XCTestCase { XCTAssertFalse(genres.isEmpty) } - func testTVShowGenres() async throws { - let genres = try await genreService.tvShowGenres() + func testTVSeriesGenres() async throws { + let genres = try await genreService.tvSeriesGenres() XCTAssertFalse(genres.isEmpty) } diff --git a/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift b/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift index 2b1ac720..121629c2 100644 --- a/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift @@ -45,10 +45,10 @@ final class PersonIntegrationTests: XCTestCase { XCTAssertFalse(credits.crew.isEmpty) } - func testTVShowCredits() async throws { + func testTVSeriesCredits() async throws { let personID = 500 - let credits = try await personService.tvShowCredits(forPerson: personID) + let credits = try await personService.tvSeriesCredits(forPerson: personID) XCTAssertEqual(credits.id, personID) XCTAssertFalse(credits.cast.isEmpty) diff --git a/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift b/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift index 55a76d94..31b75368 100644 --- a/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift @@ -32,12 +32,12 @@ final class SearchIntegrationTests: XCTestCase { XCTAssertFalse(movieList.results.isEmpty) } - func testSearchTVShows() async throws { + func testSearchTVSeries() async throws { let query = "game of thrones" - let tvShowList = try await searchService.searchTVShows(query: query) + let tvSeriesList = try await searchService.searchTVSeries(query: query) - XCTAssertFalse(tvShowList.results.isEmpty) + XCTAssertFalse(tvSeriesList.results.isEmpty) } func testSearchPeople() async throws { diff --git a/Tests/TMDbIntegrationTests/TVShowEpisodeServiceTests.swift b/Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift similarity index 59% rename from Tests/TMDbIntegrationTests/TVShowEpisodeServiceTests.swift rename to Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift index 52c18988..d18c6479 100644 --- a/Tests/TMDbIntegrationTests/TVShowEpisodeServiceTests.swift +++ b/Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift @@ -1,28 +1,28 @@ import TMDb import XCTest -final class TVShowEpisodeServiceTests: XCTestCase { +final class TVEpisodeServiceTests: XCTestCase { - var tvShowEpisodeService: TVShowEpisodeService! + var tvEpisodeService: TVEpisodeService! override func setUpWithError() throws { try super.setUpWithError() try configureTMDb() - tvShowEpisodeService = TVShowEpisodeService() + tvEpisodeService = TVEpisodeService() } override func tearDown() { - tvShowEpisodeService = nil + tvEpisodeService = nil super.tearDown() } func testDetails() async throws { let episodeNumber = 3 let seasonNumber = 2 - let tvShowID = 1399 + let tvSeriesID = 1399 - let episode = try await tvShowEpisodeService.details(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVShow: tvShowID) + let episode = try await tvEpisodeService.details(forEpisode: episodeNumber, inSeason: seasonNumber, + inTVSeries: tvSeriesID) XCTAssertEqual(episode.id, 63068) XCTAssertEqual(episode.episodeNumber, episodeNumber) @@ -33,10 +33,10 @@ final class TVShowEpisodeServiceTests: XCTestCase { func testImages() async throws { let episodeNumber = 3 let seasonNumber = 2 - let tvShowID = 1399 + let tvSeriesID = 1399 - let imageCollection = try await tvShowEpisodeService.images(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVShow: tvShowID) + let imageCollection = try await tvEpisodeService.images(forEpisode: episodeNumber, inSeason: seasonNumber, + inTVSeries: tvSeriesID) XCTAssertEqual(imageCollection.id, 63068) XCTAssertFalse(imageCollection.stills.isEmpty) @@ -45,10 +45,10 @@ final class TVShowEpisodeServiceTests: XCTestCase { func testVideos() async throws { let episodeNumber = 3 let seasonNumber = 1 - let tvShowID = 1399 + let tvSeriesID = 1399 - let videoCollection = try await tvShowEpisodeService.videos(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVShow: tvShowID) + let videoCollection = try await tvEpisodeService.videos(forEpisode: episodeNumber, inSeason: seasonNumber, + inTVSeries: tvSeriesID) XCTAssertEqual(videoCollection.id, 63058) XCTAssertFalse(videoCollection.results.isEmpty) diff --git a/Tests/TMDbIntegrationTests/TVShowSeasonService.swift b/Tests/TMDbIntegrationTests/TVSeasonService.swift similarity index 53% rename from Tests/TMDbIntegrationTests/TVShowSeasonService.swift rename to Tests/TMDbIntegrationTests/TVSeasonService.swift index c2344e17..bcef86a5 100644 --- a/Tests/TMDbIntegrationTests/TVShowSeasonService.swift +++ b/Tests/TMDbIntegrationTests/TVSeasonService.swift @@ -1,26 +1,26 @@ import TMDb import XCTest -final class TVShowSeasonServiceTests: XCTestCase { +final class TVSeasonServiceTests: XCTestCase { - var tvShowSeasonService: TVShowSeasonService! + var tvSeasonService: TVSeasonService! override func setUpWithError() throws { try super.setUpWithError() try configureTMDb() - tvShowSeasonService = TVShowSeasonService() + tvSeasonService = TVSeasonService() } override func tearDown() { - tvShowSeasonService = nil + tvSeasonService = nil super.tearDown() } func testDetails() async throws { let seasonNumber = 2 - let tvShowID = 1399 + let tvSeriesID = 1399 - let season = try await tvShowSeasonService.details(forSeason: seasonNumber, inTVShow: tvShowID) + let season = try await tvSeasonService.details(forSeason: seasonNumber, inTVSeries: tvSeriesID) XCTAssertEqual(season.seasonNumber, seasonNumber) XCTAssertFalse((season.episodes ?? []).isEmpty) @@ -28,9 +28,9 @@ final class TVShowSeasonServiceTests: XCTestCase { func testImages() async throws { let seasonNumber = 1 - let tvShowID = 1399 + let tvSeriesID = 1399 - let videoCollection = try await tvShowSeasonService.videos(forSeason: seasonNumber, inTVShow: tvShowID) + let videoCollection = try await tvSeasonService.videos(forSeason: seasonNumber, inTVSeries: tvSeriesID) XCTAssertFalse(videoCollection.results.isEmpty) } diff --git a/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift b/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift new file mode 100644 index 00000000..73c79dfb --- /dev/null +++ b/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift @@ -0,0 +1,87 @@ +import TMDb +import XCTest + +final class TVSeriesServiceTests: XCTestCase { + + var tvSeriesService: TVSeriesService! + + override func setUpWithError() throws { + try super.setUpWithError() + try configureTMDb() + tvSeriesService = TVSeriesService() + } + + override func tearDown() { + tvSeriesService = nil + super.tearDown() + } + + func testDetails() async throws { + let tvSeriesID = 84958 + + let tvSeries = try await tvSeriesService.details(forTVSeries: tvSeriesID) + + XCTAssertEqual(tvSeries.id, tvSeriesID) + XCTAssertEqual(tvSeries.name, "Loki") + } + + func testCredits() async throws { + let tvSeriesID = 4604 + + let credits = try await tvSeriesService.credits(forTVSeries: tvSeriesID) + + XCTAssertFalse(credits.cast.isEmpty) + XCTAssertFalse(credits.crew.isEmpty) + } + + func testReviews() async throws { + let tvSeriesID = 76479 + + let reviewList = try await tvSeriesService.reviews(forTVSeries: tvSeriesID) + + XCTAssertFalse(reviewList.results.isEmpty) + } + + func testImages() async throws { + let tvSeriesID = 76479 + + let imageCollection = try await tvSeriesService.images(forTVSeries: tvSeriesID) + + XCTAssertEqual(imageCollection.id, tvSeriesID) + XCTAssertFalse(imageCollection.backdrops.isEmpty) + XCTAssertFalse(imageCollection.logos.isEmpty) + XCTAssertFalse(imageCollection.posters.isEmpty) + } + + func testVideos() async throws { + let tvSeriesID = 76479 + + let videoCollection = try await tvSeriesService.videos(forTVSeries: tvSeriesID) + + XCTAssertEqual(videoCollection.id, tvSeriesID) + XCTAssertFalse(videoCollection.results.isEmpty) + } + + func testRecommendations() async throws { + let tvSeriesID = 76479 + + let tvSeriesList = try await tvSeriesService.recommendations(forTVSeries: tvSeriesID) + + XCTAssertFalse(tvSeriesList.results.isEmpty) + } + + func testSimilar() async throws { + let tvSeriesID = 76479 + + let tvSeriesList = try await tvSeriesService.similar(toTVSeries: tvSeriesID) + + XCTAssertFalse(tvSeriesList.results.isEmpty) + } + + func testPopular() async throws { + let tvSeriesList = try await tvSeriesService.popular() + + XCTAssertFalse(tvSeriesList.results.isEmpty) + } + +} diff --git a/Tests/TMDbIntegrationTests/TVShowServiceTests.swift b/Tests/TMDbIntegrationTests/TVShowServiceTests.swift deleted file mode 100644 index 3e14ace8..00000000 --- a/Tests/TMDbIntegrationTests/TVShowServiceTests.swift +++ /dev/null @@ -1,87 +0,0 @@ -import TMDb -import XCTest - -final class TVShowServiceTests: XCTestCase { - - var tvShowService: TVShowService! - - override func setUpWithError() throws { - try super.setUpWithError() - try configureTMDb() - tvShowService = TVShowService() - } - - override func tearDown() { - tvShowService = nil - super.tearDown() - } - - func testDetails() async throws { - let tvShowID = 84958 - - let tvShow = try await tvShowService.details(forTVShow: tvShowID) - - XCTAssertEqual(tvShow.id, tvShowID) - XCTAssertEqual(tvShow.name, "Loki") - } - - func testCredits() async throws { - let tvShowID = 4604 - - let credits = try await tvShowService.credits(forTVShow: tvShowID) - - XCTAssertFalse(credits.cast.isEmpty) - XCTAssertFalse(credits.crew.isEmpty) - } - - func testReviews() async throws { - let tvShowID = 76479 - - let reviewList = try await tvShowService.reviews(forTVShow: tvShowID) - - XCTAssertFalse(reviewList.results.isEmpty) - } - - func testImages() async throws { - let tvShowID = 76479 - - let imageCollection = try await tvShowService.images(forTVShow: tvShowID) - - XCTAssertEqual(imageCollection.id, tvShowID) - XCTAssertFalse(imageCollection.backdrops.isEmpty) - XCTAssertFalse(imageCollection.logos.isEmpty) - XCTAssertFalse(imageCollection.posters.isEmpty) - } - - func testVideos() async throws { - let tvShowID = 76479 - - let videoCollection = try await tvShowService.videos(forTVShow: tvShowID) - - XCTAssertEqual(videoCollection.id, tvShowID) - XCTAssertFalse(videoCollection.results.isEmpty) - } - - func testRecommendations() async throws { - let tvShowID = 76479 - - let tvShowList = try await tvShowService.recommendations(forTVShow: tvShowID) - - XCTAssertFalse(tvShowList.results.isEmpty) - } - - func testSimilar() async throws { - let tvShowID = 76479 - - let tvShowList = try await tvShowService.similar(toTVShow: tvShowID) - - XCTAssertFalse(tvShowList.results.isEmpty) - } - - func testPopular() async throws { - let tvShowList = try await tvShowService.popular() - - XCTAssertFalse(tvShowList.results.isEmpty) - } - -} diff --git a/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift b/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift index 2894fa9d..27f35b25 100644 --- a/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift @@ -28,16 +28,16 @@ final class TrendingIntegrationTests: XCTestCase { XCTAssertFalse(movieList.results.isEmpty) } - func testTVShowsTrendingByDay() async throws { - let tvShowList = try await trendingService.tvShows(inTimeWindow: .day) + func testTVSeriesTrendingByDay() async throws { + let tvSeriesList = try await trendingService.tvSeries(inTimeWindow: .day) - XCTAssertFalse(tvShowList.results.isEmpty) + XCTAssertFalse(tvSeriesList.results.isEmpty) } - func testTVShowTrendingByWeek() async throws { - let tvShowList = try await trendingService.tvShows(inTimeWindow: .week) + func testTVSeriesTrendingByWeek() async throws { + let tvSeriesList = try await trendingService.tvSeries(inTimeWindow: .week) - XCTAssertFalse(tvShowList.results.isEmpty) + XCTAssertFalse(tvSeriesList.results.isEmpty) } func testPeopleTrendingByDay() async throws { diff --git a/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift b/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift index 7f73045b..2fc87687 100644 --- a/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift @@ -28,8 +28,8 @@ final class WatchProviderIntegrationTests: XCTestCase { XCTAssertFalse(watchProviders.isEmpty) } - func testTVShowWatchProviders() async throws { - let watchProviders = try await watchProviderService.tvShowWatchProviders() + func testTVSeriesWatchProviders() async throws { + let watchProviders = try await watchProviderService.tvSeriesWatchProviders() XCTAssertFalse(watchProviders.isEmpty) } diff --git a/Tests/TMDbTests/Certifications/CertificationServiceTests.swift b/Tests/TMDbTests/Certifications/CertificationServiceTests.swift index 21b7def8..0c268517 100644 --- a/Tests/TMDbTests/Certifications/CertificationServiceTests.swift +++ b/Tests/TMDbTests/Certifications/CertificationServiceTests.swift @@ -30,16 +30,16 @@ final class CertificationServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, CertificationsEndpoint.movie.path) } - func testTVShowCertificationsReturnsTVShowCertifications() async throws { + func testTVSeriesCertificationsReturnsTVSeriesCertifications() async throws { let certifications = Certifications.gbAndUS let expectedResult = certifications.certifications apiClient.result = .success(certifications) - let result = try await service.tvShowCertifications() + let result = try await service.tvSeriesCertifications() XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, CertificationsEndpoint.tvShow.path) + XCTAssertEqual(apiClient.lastPath, CertificationsEndpoint.tvSeries.path) } } diff --git a/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift b/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift index 8c7439d2..9732e8ea 100644 --- a/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift +++ b/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift @@ -11,10 +11,10 @@ final class CertificationsEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testTVShowEndpointReturnsURL() throws { + func testTVSeriesEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/certification/tv/list")) - let url = CertificationsEndpoint.tvShow.path + let url = CertificationsEndpoint.tvSeries.path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/Discover/DiscoverServiceTests.swift b/Tests/TMDbTests/Discover/DiscoverServiceTests.swift index 7abbe798..758f49d2 100644 --- a/Tests/TMDbTests/Discover/DiscoverServiceTests.swift +++ b/Tests/TMDbTests/Discover/DiscoverServiceTests.swift @@ -84,58 +84,58 @@ final class DiscoverServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.movies(sortedBy: sortBy, people: people, page: page).path) } - func testTVShowsWithDefaultParametersReturnsTVShows() async throws { - let expectedResult = TVShowPageableList.mock() + func testTVSeriesWithDefaultParametersReturnsTVSeries() async throws { + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.tvShows() + let result = try await service.tvSeries() XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvShows().path) + XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvSeries().path) } - func testTVShowsReturnsTVShows() async throws { - let expectedResult = TVShowPageableList.mock() + func testTVSeriesReturnsTVSeries() async throws { + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.tvShows(sortedBy: nil, page: nil) + let result = try await service.tvSeries(sortedBy: nil, page: nil) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvShows().path) + XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvSeries().path) } - func testTVShowsWithSortByReturnsTVShows() async throws { - let sortBy = TVShowSort.firstAirDate(descending: false) - let expectedResult = TVShowPageableList.mock() + func testTVSeriesWithSortByReturnsTVSeries() async throws { + let sortBy = TVSeriesSort.firstAirDate(descending: false) + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.tvShows(sortedBy: sortBy, page: nil) + let result = try await service.tvSeries(sortedBy: sortBy, page: nil) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvShows(sortedBy: sortBy).path) + XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvSeries(sortedBy: sortBy).path) } - func testTVShowsWithPageReturnsTVShows() async throws { - let expectedResult = TVShowPageableList.mock() + func testTVSeriesWithPageReturnsTVSeries() async throws { + let expectedResult = TVSeriesPageableList.mock() let page = expectedResult.page apiClient.result = .success(expectedResult) - let result = try await service.tvShows(sortedBy: nil, page: page) + let result = try await service.tvSeries(sortedBy: nil, page: page) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvShows(page: page).path) + XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvSeries(page: page).path) } - func testTVShowsWithSortByAndPageReturnsTVShows() async throws { - let sortBy = TVShowSort.firstAirDate(descending: false) - let expectedResult = TVShowPageableList.mock() + func testTVSeriesWithSortByAndPageReturnsTVSeries() async throws { + let sortBy = TVSeriesSort.firstAirDate(descending: false) + let expectedResult = TVSeriesPageableList.mock() let page = expectedResult.page apiClient.result = .success(expectedResult) - let result = try await service.tvShows(sortedBy: sortBy, page: page) + let result = try await service.tvSeries(sortedBy: sortBy, page: page) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvShows(sortedBy: sortBy, page: page).path) + XCTAssertEqual(apiClient.lastPath, DiscoverEndpoint.tvSeries(sortedBy: sortBy, page: page).path) } } diff --git a/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift b/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift index b1770a8b..c092e601 100644 --- a/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift +++ b/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift @@ -45,34 +45,34 @@ final class DiscoverEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testTVShowsEndpointReturnsURL() throws { + func testTVSeriesEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/discover/tv")) - let url = DiscoverEndpoint.tvShows().path + let url = DiscoverEndpoint.tvSeries().path XCTAssertEqual(url, expectedURL) } - func testTVShowsEndpointWithSortedByReturnsURL() throws { + func testTVSeriesEndpointWithSortedByReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/discover/tv?sort_by=first_air_date.asc")) - let url = DiscoverEndpoint.tvShows(sortedBy: .firstAirDate(descending: false)).path + let url = DiscoverEndpoint.tvSeries(sortedBy: .firstAirDate(descending: false)).path XCTAssertEqual(url, expectedURL) } - func testTVShowsEndpointWithPageReturnsURL() throws { + func testTVSeriesEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/discover/tv?page=1")) - let url = DiscoverEndpoint.tvShows(page: 1).path + let url = DiscoverEndpoint.tvSeries(page: 1).path XCTAssertEqual(url, expectedURL) } - func testTVShowsEndpointWithSortedByAndPageReturnsURL() throws { + func testTVSeriesEndpointWithSortedByAndPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/discover/tv?sort_by=first_air_date.asc&page=1")) - let url = DiscoverEndpoint.tvShows(sortedBy: .firstAirDate(descending: false), page: 1).path + let url = DiscoverEndpoint.tvSeries(sortedBy: .firstAirDate(descending: false), page: 1).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/Discover/TVShowSortTests.swift b/Tests/TMDbTests/Discover/TVSeriesSortTests.swift similarity index 70% rename from Tests/TMDbTests/Discover/TVShowSortTests.swift rename to Tests/TMDbTests/Discover/TVSeriesSortTests.swift index 29abcbca..961295e0 100644 --- a/Tests/TMDbTests/Discover/TVShowSortTests.swift +++ b/Tests/TMDbTests/Discover/TVSeriesSortTests.swift @@ -1,12 +1,12 @@ @testable import TMDb import XCTest -final class TVShowSortTests: XCTestCase { +final class TVSeriesSortTests: XCTestCase { func testPopularityAscendingReturnsRawValue() { let expectedResult = "popularity.asc" - let result = TVShowSort.popularity(descending: false).description + let result = TVSeriesSort.popularity(descending: false).description XCTAssertEqual(result, expectedResult) } @@ -14,7 +14,7 @@ final class TVShowSortTests: XCTestCase { func testPopularityDescendingReturnsRawValue() { let expectedResult = "popularity.desc" - let result = TVShowSort.popularity(descending: true).description + let result = TVSeriesSort.popularity(descending: true).description XCTAssertEqual(result, expectedResult) } @@ -22,7 +22,7 @@ final class TVShowSortTests: XCTestCase { func testFirstAirDateAscendingReturnsRawValue() { let expectedResult = "first_air_date.asc" - let result = TVShowSort.firstAirDate(descending: false).description + let result = TVSeriesSort.firstAirDate(descending: false).description XCTAssertEqual(result, expectedResult) } @@ -30,7 +30,7 @@ final class TVShowSortTests: XCTestCase { func testFirstAirDateDescendingReturnsRawValue() { let expectedResult = "first_air_date.desc" - let result = TVShowSort.firstAirDate(descending: true).description + let result = TVSeriesSort.firstAirDate(descending: true).description XCTAssertEqual(result, expectedResult) } @@ -38,7 +38,7 @@ final class TVShowSortTests: XCTestCase { func testVoteAverageAscendingReturnsRawValue() { let expectedResult = "vote_average.asc" - let result = TVShowSort.voteAverage(descending: false).description + let result = TVSeriesSort.voteAverage(descending: false).description XCTAssertEqual(result, expectedResult) } @@ -46,20 +46,20 @@ final class TVShowSortTests: XCTestCase { func testVoteAverageDescendingReturnsRawValue() { let expectedResult = "vote_average.desc" - let result = TVShowSort.voteAverage(descending: true).description + let result = TVSeriesSort.voteAverage(descending: true).description XCTAssertEqual(result, expectedResult) } } -extension TVShowSortTests { +extension TVSeriesSortTests { func testURLAppendingSortByReturnsURL() throws { let expectedResult = try XCTUnwrap(URL(string: "/some/path?sort_by=popularity.asc")) let result = try XCTUnwrap(URL(string: "/some/path")) - .appendingSortBy(TVShowSort.popularity(descending: false)) + .appendingSortBy(TVSeriesSort.popularity(descending: false)) XCTAssertEqual(result, expectedResult) } @@ -68,7 +68,7 @@ extension TVShowSortTests { let expectedResult = try XCTUnwrap(URL(string: "/some/path")) let result = try XCTUnwrap(URL(string: "/some/path")) - .appendingSortBy(nil as TVShowSort?) + .appendingSortBy(nil as TVSeriesSort?) XCTAssertEqual(result, expectedResult) } diff --git a/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift b/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift index a1710998..22857f5c 100644 --- a/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift +++ b/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift @@ -11,10 +11,10 @@ final class GenresEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testTVShowEndpointReturnsURL() throws { + func testTVSeriesEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/genre/tv/list")) - let url = GenresEndpoint.tvShow.path + let url = GenresEndpoint.tvSeries.path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/Genres/GenreServiceTests.swift b/Tests/TMDbTests/Genres/GenreServiceTests.swift index 0862659f..0c310607 100644 --- a/Tests/TMDbTests/Genres/GenreServiceTests.swift +++ b/Tests/TMDbTests/Genres/GenreServiceTests.swift @@ -29,15 +29,15 @@ final class GenreServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, GenresEndpoint.movie.path) } - func testTVShowGenresReturnsGenres() async throws { + func testTVSeriesGenresReturnsGenres() async throws { let genreList = GenreList.mock() let expectedResult = genreList.genres apiClient.result = .success(genreList) - let result = try await service.tvShowGenres() + let result = try await service.tvSeriesGenres() XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, GenresEndpoint.tvShow.path) + XCTAssertEqual(apiClient.lastPath, GenresEndpoint.tvSeries.path) } } diff --git a/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift index e8b94869..7304081b 100644 --- a/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift @@ -15,10 +15,10 @@ extension Array where Element == Media { [ .movie(.bulletTrain), .movie(.topGunMaverick), - .tvShow(.strangerThings), - .tvShow(.theSandman), + .tvSeries(.strangerThings), + .tvSeries(.theSandman), .movie(.jurassicWorldDominion), - .tvShow(.sheHulk) + .tvSeries(.sheHulk) ] } diff --git a/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift index 0d3c92f0..b03155dc 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift @@ -7,14 +7,14 @@ extension PersonCombinedCredits { id: Int = .randomID, cast: [Show] = [ .movie(.jurassicWorldDominion), - .tvShow(.theSandman), + .tvSeries(.theSandman), .movie(.topGunMaverick), - .tvShow(.sheHulk), - .tvShow(.strangerThings) + .tvSeries(.sheHulk), + .tvSeries(.strangerThings) ], crew: [Show] = [ .movie(.bulletTrain), - .tvShow(.theSandman), + .tvSeries(.theSandman), .movie(.thorLoveAndThunder) ] ) -> Self { diff --git a/Tests/TMDbTests/Mocks/Models/PersonTVShowCredits+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift similarity index 66% rename from Tests/TMDbTests/Mocks/Models/PersonTVShowCredits+Mocks.swift rename to Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift index 1f66137a..2e384fef 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonTVShowCredits+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift @@ -1,12 +1,12 @@ import Foundation import TMDb -extension PersonTVShowCredits { +extension PersonTVSeriesCredits { static func mock( id: Int = .randomID, - cast: [TVShow] = .mocks, - crew: [TVShow] = .mocks + cast: [TVSeries] = .mocks, + crew: [TVSeries] = .mocks ) -> Self { .init( id: id, diff --git a/Tests/TMDbTests/Mocks/Models/TVShowEpisode+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift similarity index 88% rename from Tests/TMDbTests/Mocks/Models/TVShowEpisode+Mocks.swift rename to Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift index 08c55586..3b9f9858 100644 --- a/Tests/TMDbTests/Mocks/Models/TVShowEpisode+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift @@ -1,7 +1,7 @@ import Foundation import TMDb -extension TVShowEpisode { +extension TVEpisode { static func mock( id: Int = .randomID, @@ -19,7 +19,7 @@ extension TVShowEpisode { ) -> Self { .init( id: id, - name: name ?? "TV Show Episode \(id)", + name: name ?? "TV Episode \(id)", episodeNumber: episodeNumber, seasonNumber: seasonNumber, overview: overview, @@ -35,7 +35,7 @@ extension TVShowEpisode { } -extension Array where Element == TVShowEpisode { +extension Array where Element == TVEpisode { static var mocks: [Element] { [.mock(), .mock(), .mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/TVShowEpisodeImageCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift similarity index 84% rename from Tests/TMDbTests/Mocks/Models/TVShowEpisodeImageCollection+Mocks.swift rename to Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift index 9d27e285..59a71635 100644 --- a/Tests/TMDbTests/Mocks/Models/TVShowEpisodeImageCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift @@ -1,7 +1,7 @@ import Foundation import TMDb -extension TVShowEpisodeImageCollection { +extension TVEpisodeImageCollection { static func mock( id: Int = .randomID, diff --git a/Tests/TMDbTests/Mocks/Models/TVShowSeason+Mock.swift b/Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift similarity index 81% rename from Tests/TMDbTests/Mocks/Models/TVShowSeason+Mock.swift rename to Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift index d9f0f44e..96c6ab03 100644 --- a/Tests/TMDbTests/Mocks/Models/TVShowSeason+Mock.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift @@ -1,7 +1,7 @@ import Foundation import TMDb -extension TVShowSeason { +extension TVSeason { static func mock( id: Int = .randomID, @@ -10,11 +10,11 @@ extension TVShowSeason { overview: String? = .randomString, airDate: Date? = .random, posterPath: URL? = nil, - episodes: [TVShowEpisode]? = .mocks + episodes: [TVEpisode]? = .mocks ) -> Self { .init( id: id, - name: name ?? "TV Show Season \(id)", + name: name ?? "TV Season \(id)", seasonNumber: seasonNumber, overview: overview, airDate: airDate, diff --git a/Tests/TMDbTests/Mocks/Models/TVShowSeasonImageCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift similarity index 84% rename from Tests/TMDbTests/Mocks/Models/TVShowSeasonImageCollection+Mocks.swift rename to Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift index 5d8ce32b..35eab851 100644 --- a/Tests/TMDbTests/Mocks/Models/TVShowSeasonImageCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift @@ -1,7 +1,7 @@ import Foundation import TMDb -extension TVShowSeasonImageCollection { +extension TVSeasonImageCollection { static func mock( id: Int = .randomID, diff --git a/Tests/TMDbTests/Mocks/Models/TVShow+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift similarity index 95% rename from Tests/TMDbTests/Mocks/Models/TVShow+Mocks.swift rename to Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift index b4beaa63..030e8df4 100644 --- a/Tests/TMDbTests/Mocks/Models/TVShow+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift @@ -1,7 +1,7 @@ import Foundation @testable import TMDb -extension TVShow { +extension TVSeries { static func mock( id: Int = .randomID, @@ -12,7 +12,7 @@ extension TVShow { episodeRunTime: [Int]? = nil, numberOfSeasons: Int? = nil, numberOfEpisodes: Int? = nil, - seasons: [TVShowSeason]? = nil, + seasons: [TVSeason]? = nil, genres: [Genre]? = nil, firstAirDate: Date? = .random, originCountry: [String]? = nil, @@ -32,7 +32,7 @@ extension TVShow { ) -> Self { .init( id: id, - name: name ?? "TV Show \(id)", + name: name ?? "TV Series \(id)", originalName: originalName, originalLanguage: originalLanguage, overview: overview, @@ -88,7 +88,7 @@ extension TVShow { } -extension Array where Element == TVShow { +extension Array where Element == TVSeries { static var mocks: [Element] { [.sheHulk, .theSandman, .strangerThings] diff --git a/Tests/TMDbTests/Mocks/Models/TVShowPageableList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift similarity index 84% rename from Tests/TMDbTests/Mocks/Models/TVShowPageableList+Mocks.swift rename to Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift index 957b01bb..d2e59309 100644 --- a/Tests/TMDbTests/Mocks/Models/TVShowPageableList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift @@ -1,11 +1,11 @@ import Foundation import TMDb -extension TVShowPageableList { +extension TVSeriesPageableList { static func mock( page: Int = Int.random(in: 1...5), - results: [TVShow] = .mocks, + results: [TVSeries] = .mocks, totalResults: Int? = Int.random(in: 1...100), totalPages: Int? = Int.random(in: 1...5) ) -> Self { diff --git a/Tests/TMDbTests/Models/MediaPageableListTests.swift b/Tests/TMDbTests/Models/MediaPageableListTests.swift index 5987f434..3aa16529 100644 --- a/Tests/TMDbTests/Models/MediaPageableListTests.swift +++ b/Tests/TMDbTests/Models/MediaPageableListTests.swift @@ -17,7 +17,7 @@ final class MediaPageableListTests: XCTestCase { page: 1, results: [ .movie(Movie(id: 1, title: "Fight Club")), - .tvShow(TVShow(id: 2, name: "The Mrs Bradley Mysteries")), + .tvSeries(TVSeries(id: 2, name: "The Mrs Bradley Mysteries")), .person(Person(id: 51329, name: "Bradley Cooper", gender: .unknown)) ], totalResults: 3, diff --git a/Tests/TMDbTests/Models/MediaTests.swift b/Tests/TMDbTests/Models/MediaTests.swift index 63772434..5befdb81 100644 --- a/Tests/TMDbTests/Models/MediaTests.swift +++ b/Tests/TMDbTests/Models/MediaTests.swift @@ -7,7 +7,7 @@ final class MediaTests: XCTestCase { XCTAssertEqual(medias[0].id, 1) } - func testIDWhenTVShowReturnsID() { + func testIDWhenTVSeriesReturnsID() { XCTAssertEqual(medias[1].id, 2) } @@ -23,7 +23,7 @@ final class MediaTests: XCTestCase { private let medias: [Media] = [ .movie(Movie(id: 1, title: "Fight Club")), - .tvShow(TVShow(id: 2, name: "The Mrs Bradley Mysteries")), + .tvSeries(TVSeries(id: 2, name: "The Mrs Bradley Mysteries")), .person(Person(id: 51329, name: "Bradley Cooper", gender: .unknown)) ] diff --git a/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift b/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift index edeec41b..68093188 100644 --- a/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift +++ b/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift @@ -16,7 +16,7 @@ final class PersonCombinedCreditsTests: XCTestCase { private let personCombinedCredits = PersonCombinedCredits( id: 287, cast: [ - .tvShow(TVShow( + .tvSeries(TVSeries( id: 54, name: "Growing Pains", originalName: "Growing Pains", @@ -47,7 +47,7 @@ final class PersonCombinedCreditsTests: XCTestCase { )) ], crew: [ - .tvShow(TVShow( + .tvSeries(TVSeries( id: 69061, name: "The OA", originalName: "The OA", diff --git a/Tests/TMDbTests/Models/PersonTVShowCreditsTests.swift b/Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift similarity index 72% rename from Tests/TMDbTests/Models/PersonTVShowCreditsTests.swift rename to Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift index 5998dc0c..2b668f17 100644 --- a/Tests/TMDbTests/Models/PersonTVShowCreditsTests.swift +++ b/Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift @@ -1,23 +1,23 @@ @testable import TMDb import XCTest -final class PersonTVShowCreditsTests: XCTestCase { +final class PersonTVSeriesCreditsTests: XCTestCase { - func testDecodeReturnsPersonTVShowCredits() throws { + func testDecodeReturnsPersonTVSeriesCredits() throws { let result = try JSONDecoder.theMovieDatabase - .decode(PersonTVShowCredits.self, fromResource: "person-tv-show-credits") + .decode(PersonTVSeriesCredits.self, fromResource: "person-tv-series-credits") - XCTAssertEqual(result.id, personTVShowCredits.id) - XCTAssertEqual(result.cast, personTVShowCredits.cast) - XCTAssertEqual(result.crew, personTVShowCredits.crew) + XCTAssertEqual(result.id, personTVSeriesCredits.id) + XCTAssertEqual(result.cast, personTVSeriesCredits.cast) + XCTAssertEqual(result.crew, personTVSeriesCredits.crew) } func testAllShows() { - let tvShow1 = TVShow(id: 1, name: "TV Show 1") - let tvShow2 = TVShow(id: 2, name: "TV Show 2") - let credits = PersonTVShowCredits(id: 999, cast: [tvShow1, tvShow2], crew: [tvShow1]) + let tvSeries1 = TVSeries(id: 1, name: "TV Series 1") + let tvSeries2 = TVSeries(id: 2, name: "TV Series 2") + let credits = PersonTVSeriesCredits(id: 999, cast: [tvSeries1, tvSeries2], crew: [tvSeries1]) - let expectedResult = [tvShow1, tvShow2] + let expectedResult = [tvSeries1, tvSeries2] let result = credits.allShows @@ -25,10 +25,10 @@ final class PersonTVShowCreditsTests: XCTestCase { } // swiftlint:disable line_length - private let personTVShowCredits = PersonTVShowCredits( + private let personTVSeriesCredits = PersonTVSeriesCredits( id: 287, cast: [ - TVShow( + TVSeries( id: 54, name: "Growing Pains", originalName: "Growing Pains", @@ -44,7 +44,7 @@ final class PersonTVShowCreditsTests: XCTestCase { ) ], crew: [ - TVShow( + TVSeries( id: 69061, name: "The OA", originalName: "The OA", diff --git a/Tests/TMDbTests/Models/ShowTests.swift b/Tests/TMDbTests/Models/ShowTests.swift index 7c17868d..4153d5a6 100644 --- a/Tests/TMDbTests/Models/ShowTests.swift +++ b/Tests/TMDbTests/Models/ShowTests.swift @@ -7,16 +7,16 @@ final class ShowTests: XCTestCase { XCTAssertEqual(movieShow.id, 109091) } - func testIDWhenTVShowReturnsTVShowID() { - XCTAssertEqual(tvShowShow.id, 54) + func testIDWhenTVSeriesReturnsTVSeriesID() { + XCTAssertEqual(tvSeriesShow.id, 54) } func testPopularityWhenMovieReturnsMoviePopularity() { XCTAssertEqual(movieShow.popularity, 3.597124) } - func testPopularityWhenTVShowReturnsTVShowPopularity() { - XCTAssertEqual(tvShowShow.popularity, 2.883124) + func testPopularityWhenTVSeriesReturnsTVSeriesPopularity() { + XCTAssertEqual(tvSeriesShow.popularity, 2.883124) } func testDateWhenMovieReturnsMovieReleaseDate() { @@ -24,9 +24,9 @@ final class ShowTests: XCTestCase { XCTAssertEqual(movieShow.date, expectedResult) } - func testDateWhenTVShowReturnsTVShowFirstAirDate() { + func testDateWhenTVSeriesReturnsTVSeriesFirstAirDate() { let expectedResult = DateFormatter.theMovieDatabase.date(from: "1985-09-24") - XCTAssertEqual(tvShowShow.date, expectedResult) + XCTAssertEqual(tvSeriesShow.date, expectedResult) } func testDecodeReturnsMovie() throws { @@ -35,10 +35,10 @@ final class ShowTests: XCTestCase { XCTAssertEqual(result, movieShow) } - func testDecodeReturnsTVShow() throws { - let result = try JSONDecoder.theMovieDatabase.decode(Show.self, fromResource: "show-tv-show") + func testDecodeReturnsTVSeries() throws { + let result = try JSONDecoder.theMovieDatabase.decode(Show.self, fromResource: "show-tv-series") - XCTAssertEqual(result, tvShowShow) + XCTAssertEqual(result, tvSeriesShow) } } @@ -66,8 +66,8 @@ extension ShowTests { ) } - private var tvShowShow: Show { - .tvShow( + private var tvSeriesShow: Show { + .tvSeries( .init( id: 54, name: "Growing Pains", diff --git a/Tests/TMDbTests/Models/TVShowEpisodeImageCollectionTests.swift b/Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift similarity index 70% rename from Tests/TMDbTests/Models/TVShowEpisodeImageCollectionTests.swift rename to Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift index a033163f..d297a7ff 100644 --- a/Tests/TMDbTests/Models/TVShowEpisodeImageCollectionTests.swift +++ b/Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift @@ -1,19 +1,19 @@ @testable import TMDb import XCTest -final class TVShowEpisodeImageCollectionTests: XCTestCase { +final class TVEpisodeImageCollectionTests: XCTestCase { func testDecodeReturnsImageCollection() throws { let result = try JSONDecoder.theMovieDatabase.decode( - TVShowEpisodeImageCollection.self, - fromResource: "tv-show-episode-image-collection" + TVEpisodeImageCollection.self, + fromResource: "tv-episode-image-collection" ) XCTAssertEqual(result.id, episodeImageCollection.id) XCTAssertEqual(result.stills, episodeImageCollection.stills) } - private let episodeImageCollection = TVShowEpisodeImageCollection( + private let episodeImageCollection = TVEpisodeImageCollection( id: 66633, stills: [ ImageMetadata(filePath: URL(string: "/rLSUjr725ez1cK7SKVxC9udO03Y.jpg")!, width: 1920, height: 1080, diff --git a/Tests/TMDbTests/Models/TVShowEpisodeTests.swift b/Tests/TMDbTests/Models/TVEpisodeTests.swift similarity index 57% rename from Tests/TMDbTests/Models/TVShowEpisodeTests.swift rename to Tests/TMDbTests/Models/TVEpisodeTests.swift index 6d9393f7..e25b3490 100644 --- a/Tests/TMDbTests/Models/TVShowEpisodeTests.swift +++ b/Tests/TMDbTests/Models/TVEpisodeTests.swift @@ -1,27 +1,27 @@ @testable import TMDb import XCTest -final class TVShowEpisodeTests: XCTestCase { +final class TVTests: XCTestCase { - func testDecodeReturnsTVShowEpisode() throws { - let result = try JSONDecoder.theMovieDatabase.decode(TVShowEpisode.self, fromResource: "tv-show-episode") + func testDecodeReturnsTVEpisode() throws { + let result = try JSONDecoder.theMovieDatabase.decode(TVEpisode.self, fromResource: "tv-episode") - XCTAssertEqual(result.id, tvShowEpisode.id) - XCTAssertEqual(result.name, tvShowEpisode.name) - XCTAssertEqual(result.episodeNumber, tvShowEpisode.episodeNumber) - XCTAssertEqual(result.seasonNumber, tvShowEpisode.seasonNumber) - XCTAssertEqual(result.overview, tvShowEpisode.overview) - XCTAssertEqual(result.airDate, tvShowEpisode.airDate) - XCTAssertEqual(result.productionCode, tvShowEpisode.productionCode) - XCTAssertEqual(result.stillPath, tvShowEpisode.stillPath) - XCTAssertEqual(result.crew, tvShowEpisode.crew) - XCTAssertEqual(result.guestStars, tvShowEpisode.guestStars) - XCTAssertEqual(result.voteAverage, tvShowEpisode.voteAverage) - XCTAssertEqual(result.voteCount, tvShowEpisode.voteCount) + XCTAssertEqual(result.id, tvEpisode.id) + XCTAssertEqual(result.name, tvEpisode.name) + XCTAssertEqual(result.episodeNumber, tvEpisode.episodeNumber) + XCTAssertEqual(result.seasonNumber, tvEpisode.seasonNumber) + XCTAssertEqual(result.overview, tvEpisode.overview) + XCTAssertEqual(result.airDate, tvEpisode.airDate) + XCTAssertEqual(result.productionCode, tvEpisode.productionCode) + XCTAssertEqual(result.stillPath, tvEpisode.stillPath) + XCTAssertEqual(result.crew, tvEpisode.crew) + XCTAssertEqual(result.guestStars, tvEpisode.guestStars) + XCTAssertEqual(result.voteAverage, tvEpisode.voteAverage) + XCTAssertEqual(result.voteCount, tvEpisode.voteCount) } // swiftlint:disable line_length - private let tvShowEpisode = TVShowEpisode( + private let tvEpisode = TVEpisode( id: 63056, name: "Winter Is Coming", episodeNumber: 1, diff --git a/Tests/TMDbTests/Models/TVShowSeasonTests.swift b/Tests/TMDbTests/Models/TVSeasonTests.swift similarity index 64% rename from Tests/TMDbTests/Models/TVShowSeasonTests.swift rename to Tests/TMDbTests/Models/TVSeasonTests.swift index ca528b5b..d050ff10 100644 --- a/Tests/TMDbTests/Models/TVShowSeasonTests.swift +++ b/Tests/TMDbTests/Models/TVSeasonTests.swift @@ -1,22 +1,22 @@ @testable import TMDb import XCTest -final class TVShowSeasonTests: XCTestCase { +final class TVSeasonTests: XCTestCase { - func testDecodeReturnsTVShowSeason() throws { - let result = try JSONDecoder.theMovieDatabase.decode(TVShowSeason.self, fromResource: "tv-show-season") + func testDecodeReturnsTVSeason() throws { + let result = try JSONDecoder.theMovieDatabase.decode(TVSeason.self, fromResource: "tv-season") - XCTAssertEqual(result.id, tvShowSeason.id) - XCTAssertEqual(result.name, tvShowSeason.name) - XCTAssertEqual(result.seasonNumber, tvShowSeason.seasonNumber) - XCTAssertEqual(result.overview, tvShowSeason.overview) - XCTAssertEqual(result.airDate, tvShowSeason.airDate) - XCTAssertEqual(result.posterPath, tvShowSeason.posterPath) - XCTAssertEqual(result.episodes, tvShowSeason.episodes) + XCTAssertEqual(result.id, tvSeason.id) + XCTAssertEqual(result.name, tvSeason.name) + XCTAssertEqual(result.seasonNumber, tvSeason.seasonNumber) + XCTAssertEqual(result.overview, tvSeason.overview) + XCTAssertEqual(result.airDate, tvSeason.airDate) + XCTAssertEqual(result.posterPath, tvSeason.posterPath) + XCTAssertEqual(result.episodes, tvSeason.episodes) } // swiftlint:disable line_length - private let tvShowSeason = TVShowSeason( + private let tvSeason = TVSeason( id: 3624, name: "Season 1", seasonNumber: 1, diff --git a/Tests/TMDbTests/Models/TVShowPageableListTests.swift b/Tests/TMDbTests/Models/TVSeriesPageableListTests.swift similarity index 52% rename from Tests/TMDbTests/Models/TVShowPageableListTests.swift rename to Tests/TMDbTests/Models/TVSeriesPageableListTests.swift index 8a013453..81a0da31 100644 --- a/Tests/TMDbTests/Models/TVShowPageableListTests.swift +++ b/Tests/TMDbTests/Models/TVSeriesPageableListTests.swift @@ -1,11 +1,11 @@ @testable import TMDb import XCTest -final class TVShowPageableListTests: XCTestCase { +final class TVSeriesPageableListTests: XCTestCase { - func testDecodeReturnsTVShowPageableList() throws { + func testDecodeReturnsTVSeriesPageableList() throws { let result = try JSONDecoder.theMovieDatabase - .decode(TVShowPageableList.self, fromResource: "tv-show-pageable-list") + .decode(TVSeriesPageableList.self, fromResource: "tv-series-pageable-list") XCTAssertEqual(result.page, list.page) XCTAssertEqual(result.results, list.results) @@ -13,12 +13,12 @@ final class TVShowPageableListTests: XCTestCase { XCTAssertEqual(result.totalPages, list.totalPages) } - private let list = TVShowPageableList( + private let list = TVSeriesPageableList( page: 1, results: [ - TVShow(id: 1, name: "TV Show 1"), - TVShow(id: 2, name: "TV Show 2"), - TVShow(id: 3, name: "TV Show 3") + TVSeries(id: 1, name: "TV Series 1"), + TVSeries(id: 2, name: "TV Series 2"), + TVSeries(id: 3, name: "TV Series 3") ], totalResults: 3, totalPages: 1 diff --git a/Tests/TMDbTests/Models/TVShowTests.swift b/Tests/TMDbTests/Models/TVSeriesTests.swift similarity index 90% rename from Tests/TMDbTests/Models/TVShowTests.swift rename to Tests/TMDbTests/Models/TVSeriesTests.swift index 70d56bd9..5de03827 100644 --- a/Tests/TMDbTests/Models/TVShowTests.swift +++ b/Tests/TMDbTests/Models/TVSeriesTests.swift @@ -1,17 +1,17 @@ @testable import TMDb import XCTest -final class TVShowTests: XCTestCase { +final class TVSeriesTests: XCTestCase { - func testDecodeReturnsTVShow() throws { - let result = try JSONDecoder.theMovieDatabase.decode(TVShow.self, fromResource: "tv-show") + func testDecodeReturnsTVSeries() throws { + let result = try JSONDecoder.theMovieDatabase.decode(TVSeries.self, fromResource: "tv-series") - XCTAssertEqual(result, tvShow) + XCTAssertEqual(result, tvSeries) } - func testDecodeWhenHomepageIsEmptyStringReturnsTVShow() throws { - let result = try JSONDecoder.theMovieDatabase.decode(TVShow.self, - fromResource: "tv-show-blank-homepage-first-air-date") + func testDecodeWhenHomepageIsEmptyStringReturnsTVSeries() throws { + let result = try JSONDecoder.theMovieDatabase.decode(TVSeries.self, + fromResource: "tv-series-blank-homepage-first-air-date") XCTAssertNil(result.homepageURL) XCTAssertNil(result.firstAirDate) @@ -19,10 +19,10 @@ final class TVShowTests: XCTestCase { } -extension TVShowTests { +extension TVSeriesTests { // swiftlint:disable line_length - private var tvShow: TVShow { + private var tvSeries: TVSeries { .init( id: 1399, name: "Game of Thrones", @@ -33,7 +33,7 @@ extension TVShowTests { numberOfSeasons: 7, numberOfEpisodes: 67, seasons: [ - TVShowSeason( + TVSeason( id: 3624, name: "Season 1", seasonNumber: 1, diff --git a/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift b/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift index 8938829e..71a5f0e3 100644 --- a/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift +++ b/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift @@ -27,10 +27,10 @@ final class PeopleEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testPersonTVShowCreditsEndpointReturnsURL() throws { + func testPersonTVSeriesCreditsEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/person/1/tv_credits")) - let url = PeopleEndpoint.tvShowCredits(personID: 1).path + let url = PeopleEndpoint.tvSeriesCredits(personID: 1).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/People/PersonServiceTests.swift b/Tests/TMDbTests/People/PersonServiceTests.swift index 6e7c66b0..03cf2d6d 100644 --- a/Tests/TMDbTests/People/PersonServiceTests.swift +++ b/Tests/TMDbTests/People/PersonServiceTests.swift @@ -53,16 +53,16 @@ final class PersonServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, PeopleEndpoint.movieCredits(personID: personID).path) } - func testTVShowCreditsReturnsTVShowCredits() async throws { - let mock = PersonTVShowCredits.mock() - let expectedResult = PersonTVShowCredits(id: mock.id, cast: mock.cast, crew: mock.crew) + func testTVSeriesCreditsReturnsTVSeriesCredits() async throws { + let mock = PersonTVSeriesCredits.mock() + let expectedResult = PersonTVSeriesCredits(id: mock.id, cast: mock.cast, crew: mock.crew) let personID = expectedResult.id apiClient.result = .success(expectedResult) - let result = try await service.tvShowCredits(forPerson: personID) + let result = try await service.tvSeriesCredits(forPerson: personID) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, PeopleEndpoint.tvShowCredits(personID: personID).path) + XCTAssertEqual(apiClient.lastPath, PeopleEndpoint.tvSeriesCredits(personID: personID).path) } func testImagesReturnsImageCollection() async throws { diff --git a/Tests/TMDbTests/Resources/json/person-tv-show-credits.json b/Tests/TMDbTests/Resources/json/person-tv-series-credits.json similarity index 100% rename from Tests/TMDbTests/Resources/json/person-tv-show-credits.json rename to Tests/TMDbTests/Resources/json/person-tv-series-credits.json diff --git a/Tests/TMDbTests/Resources/json/show-tv-show.json b/Tests/TMDbTests/Resources/json/show-tv-series.json similarity index 100% rename from Tests/TMDbTests/Resources/json/show-tv-show.json rename to Tests/TMDbTests/Resources/json/show-tv-series.json diff --git a/Tests/TMDbTests/Resources/json/tv-show-episode-image-collection.json b/Tests/TMDbTests/Resources/json/tv-episode-image-collection.json similarity index 100% rename from Tests/TMDbTests/Resources/json/tv-show-episode-image-collection.json rename to Tests/TMDbTests/Resources/json/tv-episode-image-collection.json diff --git a/Tests/TMDbTests/Resources/json/tv-show-episode.json b/Tests/TMDbTests/Resources/json/tv-episode.json similarity index 100% rename from Tests/TMDbTests/Resources/json/tv-show-episode.json rename to Tests/TMDbTests/Resources/json/tv-episode.json diff --git a/Tests/TMDbTests/Resources/json/tv-show-season.json b/Tests/TMDbTests/Resources/json/tv-season.json similarity index 100% rename from Tests/TMDbTests/Resources/json/tv-show-season.json rename to Tests/TMDbTests/Resources/json/tv-season.json diff --git a/Tests/TMDbTests/Resources/json/tv-show-blank-homepage-first-air-date.json b/Tests/TMDbTests/Resources/json/tv-series-blank-homepage-first-air-date.json similarity index 100% rename from Tests/TMDbTests/Resources/json/tv-show-blank-homepage-first-air-date.json rename to Tests/TMDbTests/Resources/json/tv-series-blank-homepage-first-air-date.json diff --git a/Tests/TMDbTests/Resources/json/tv-show-pageable-list.json b/Tests/TMDbTests/Resources/json/tv-series-pageable-list.json similarity index 66% rename from Tests/TMDbTests/Resources/json/tv-show-pageable-list.json rename to Tests/TMDbTests/Resources/json/tv-series-pageable-list.json index 606af21a..499a2394 100644 --- a/Tests/TMDbTests/Resources/json/tv-show-pageable-list.json +++ b/Tests/TMDbTests/Resources/json/tv-series-pageable-list.json @@ -3,17 +3,17 @@ "results": [ { "id": 1, - "name": "TV Show 1" + "name": "TV Series 1" }, { "id": 2, - "name": "TV Show 2" + "name": "TV Series 2" }, { "id": 3, - "name": "TV Show 3" + "name": "TV Series 3" } ], "total_pages": 1, "total_results": 3 -} \ No newline at end of file +} diff --git a/Tests/TMDbTests/Resources/json/tv-show.json b/Tests/TMDbTests/Resources/json/tv-series.json similarity index 100% rename from Tests/TMDbTests/Resources/json/tv-show.json rename to Tests/TMDbTests/Resources/json/tv-series.json diff --git a/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift b/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift index e7248966..e2b8c049 100644 --- a/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift +++ b/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift @@ -51,34 +51,34 @@ final class SearchEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testTVShowsSearchEndpointReturnsURL() throws { + func testTVSeriesSearchEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/search/tv?query=The%20Boys")) - let url = SearchEndpoint.tvShows(query: "The Boys").path + let url = SearchEndpoint.tvSeries(query: "The Boys").path XCTAssertEqual(url, expectedURL) } - func testTVShowsSearchEndpointWithFirstAirDateYearReturnsURL() throws { + func testTVSeriesSearchEndpointWithFirstAirDateYearReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/search/tv?query=The%20Boys&first_air_date_year=2020")) - let url = SearchEndpoint.tvShows(query: "The Boys", firstAirDateYear: 2020).path + let url = SearchEndpoint.tvSeries(query: "The Boys", firstAirDateYear: 2020).path XCTAssertEqual(url, expectedURL) } - func testTVShowsSearchEndpointWithPageReturnsURL() throws { + func testTVSeriesSearchEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/search/tv?query=The%20Boys&page=2")) - let url = SearchEndpoint.tvShows(query: "The Boys", page: 2).path + let url = SearchEndpoint.tvSeries(query: "The Boys", page: 2).path XCTAssertEqual(url, expectedURL) } - func testTVShowsSearchEndpointWithYearAndPageReturnsURL() throws { + func testTVSeriesSearchEndpointWithYearAndPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/search/tv?query=The%20Boys&first_air_date_year=2020&page=2")) - let url = SearchEndpoint.tvShows(query: "The Boys", firstAirDateYear: 2020, page: 2).path + let url = SearchEndpoint.tvSeries(query: "The Boys", firstAirDateYear: 2020, page: 2).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/Search/SearchServiceTests.swift b/Tests/TMDbTests/Search/SearchServiceTests.swift index 4471a15b..8406b029 100644 --- a/Tests/TMDbTests/Search/SearchServiceTests.swift +++ b/Tests/TMDbTests/Search/SearchServiceTests.swift @@ -112,64 +112,64 @@ final class SearchServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, SearchEndpoint.movies(query: query, year: year, page: page).path) } - func testSearchTVShowsWithDefaultParametersReturnsTVShows() async throws { + func testSearchTVSeriesWithDefaultParametersReturnsTVSeries() async throws { let query = String.randomString - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.searchTVShows(query: query) + let result = try await service.searchTVSeries(query: query) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvShows(query: query).path) + XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvSeries(query: query).path) } - func testSearchTVShowsReturnsTVShows() async throws { + func testSearchTVSeriesReturnsTVSeries() async throws { let query = String.randomString - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.searchTVShows(query: query, firstAirDateYear: nil, page: nil) + let result = try await service.searchTVSeries(query: query, firstAirDateYear: nil, page: nil) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvShows(query: query).path) + XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvSeries(query: query).path) } - func testSearchTVShowsWithFirstAirDateYearReturnsTVShows() async throws { + func testSearchTVSeriesWithFirstAirDateYearReturnsTVSeries() async throws { let query = String.randomString let year = 2020 - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.searchTVShows(query: query, firstAirDateYear: year, page: nil) + let result = try await service.searchTVSeries(query: query, firstAirDateYear: year, page: nil) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvShows(query: query, firstAirDateYear: year).path) + XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvSeries(query: query, firstAirDateYear: year).path) } - func testSearchTVShowsWithPageReturnsTVShows() async throws { + func testSearchTVSeriesWithPageReturnsTVSeries() async throws { let query = String.randomString - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() let page = expectedResult.page apiClient.result = .success(expectedResult) - let result = try await service.searchTVShows(query: query, firstAirDateYear: nil, page: page) + let result = try await service.searchTVSeries(query: query, firstAirDateYear: nil, page: page) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvShows(query: query, page: page).path) + XCTAssertEqual(apiClient.lastPath, SearchEndpoint.tvSeries(query: query, page: page).path) } - func testSearchTVShowsWithFirstAirDateYearANdPageReturnsTVShows() async throws { + func testSearchTVSeriesWithFirstAirDateYearANdPageReturnsTVSeries() async throws { let query = String.randomString let year = 2020 - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() let page = expectedResult.page apiClient.result = .success(expectedResult) - let result = try await service.searchTVShows(query: query, firstAirDateYear: year, page: page) + let result = try await service.searchTVSeries(query: query, firstAirDateYear: year, page: page) XCTAssertEqual(result, expectedResult) XCTAssertEqual(apiClient.lastPath, - SearchEndpoint.tvShows(query: query, firstAirDateYear: year, page: page).path) + SearchEndpoint.tvSeries(query: query, firstAirDateYear: year, page: page).path) } func testSearchPeopleWithDefaultParametersReturnsPeople() async throws { diff --git a/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift b/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift new file mode 100644 index 00000000..9b7939f8 --- /dev/null +++ b/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift @@ -0,0 +1,30 @@ +@testable import TMDb +import XCTest + +final class TVEpisodesEndpointTests: XCTestCase { + + func testTVEpisodeDetailsEndpointReturnsURL() throws { + let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2/episode/3")) + + let url = TVEpisodesEndpoint.details(tvSeriesID: 1, seasonNumber: 2, episodeNumber: 3).path + + XCTAssertEqual(url, expectedURL) + } + + func testTVEpisodeImagesEndpointReturnsURL() throws { + let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2/episode/3/images")) + + let url = TVEpisodesEndpoint.images(tvSeriesID: 1, seasonNumber: 2, episodeNumber: 3).path + + XCTAssertEqual(url, expectedURL) + } + + func testTVSeasonVideosEndpointReturnsURL() throws { + let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2/episode/3/videos")) + + let url = TVEpisodesEndpoint.videos(tvSeriesID: 1, seasonNumber: 2, episodeNumber: 3).path + + XCTAssertEqual(url, expectedURL) + } + +} diff --git a/Tests/TMDbTests/TVShowEpisodes/TVShowEpisodeServiceTests.swift b/Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift similarity index 53% rename from Tests/TMDbTests/TVShowEpisodes/TVShowEpisodeServiceTests.swift rename to Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift index e1dc2b51..1c3d72e7 100644 --- a/Tests/TMDbTests/TVShowEpisodes/TVShowEpisodeServiceTests.swift +++ b/Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift @@ -1,15 +1,15 @@ @testable import TMDb import XCTest -final class TVShowEpisodeServiceTests: XCTestCase { +final class TVEpisodeServiceTests: XCTestCase { - var service: TVShowEpisodeService! + var service: TVEpisodeService! var apiClient: MockAPIClient! override func setUp() { super.setUp() apiClient = MockAPIClient() - service = TVShowEpisodeService(apiClient: apiClient) + service = TVEpisodeService(apiClient: apiClient) } override func tearDown() { @@ -18,58 +18,58 @@ final class TVShowEpisodeServiceTests: XCTestCase { super.tearDown() } - func testDetailsReturnsTVShowSeason() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowEpisode.mock() + func testDetailsReturnsTVSeason() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVEpisode.mock() let seasonNumber = expectedResult.seasonNumber let episodeNumber = expectedResult.episodeNumber apiClient.result = .success(expectedResult) let result = try await service.details(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVShow: tvShowID) + inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) XCTAssertEqual(apiClient.lastPath, - TVShowEpisodesEndpoint.details(tvShowID: tvShowID, - seasonNumber: seasonNumber, - episodeNumber: episodeNumber).path) + TVEpisodesEndpoint.details(tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + episodeNumber: episodeNumber).path) } func testImagesReturnsImages() async throws { let episodeNumber = Int.randomID let seasonNumber = Int.randomID - let tvShowID = Int.randomID - let expectedResult = TVShowEpisodeImageCollection.mock() + let tvSeriesID = Int.randomID + let expectedResult = TVEpisodeImageCollection.mock() apiClient.result = .success(expectedResult) let result = try await service.images(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVShow: tvShowID) + inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) XCTAssertEqual(apiClient.lastPath, - TVShowEpisodesEndpoint.images(tvShowID: tvShowID, - seasonNumber: seasonNumber, - episodeNumber: episodeNumber).path) + TVEpisodesEndpoint.images(tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + episodeNumber: episodeNumber).path) } func testVideosReturnsVideos() async throws { let episodeNumber = Int.randomID let seasonNumber = Int.randomID - let tvShowID = Int.randomID + let tvSeriesID = Int.randomID let expectedResult = VideoCollection.mock() apiClient.result = .success(expectedResult) let result = try await service.videos(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVShow: tvShowID) + inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) XCTAssertEqual(apiClient.lastPath, - TVShowEpisodesEndpoint.videos(tvShowID: tvShowID, - seasonNumber: seasonNumber, - episodeNumber: episodeNumber).path) + TVEpisodesEndpoint.videos(tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + episodeNumber: episodeNumber).path) } } diff --git a/Tests/TMDbTests/TVShowSeasons/Endpoints/TVShowSeasonsEndpointTests.swift b/Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift similarity index 53% rename from Tests/TMDbTests/TVShowSeasons/Endpoints/TVShowSeasonsEndpointTests.swift rename to Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift index 8bc04311..30f42723 100644 --- a/Tests/TMDbTests/TVShowSeasons/Endpoints/TVShowSeasonsEndpointTests.swift +++ b/Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift @@ -1,34 +1,34 @@ @testable import TMDb import XCTest -final class TVShowSeasonsEndpointTests: XCTestCase { +final class TVSeasonsEndpointTests: XCTestCase { - func testTVShowSeasonDetailsEndpointReturnsURL() throws { + func testTVSeasonDetailsEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2")) - let url = TVShowSeasonsEndpoint.details(tvShowID: 1, seasonNumber: 2).path + let url = TVSeasonsEndpoint.details(tvSeriesID: 1, seasonNumber: 2).path XCTAssertEqual(url, expectedURL) } - func testTVShowSeasonImagesEndpointReturnsURL() throws { + func testTVSeasonImagesEndpointReturnsURL() throws { let languageCode = "en" let expectedURL = try XCTUnwrap(URL( string: "/tv/1/season/2/images?include_image_language=\(languageCode),null" )) - let url = TVShowSeasonsEndpoint.images(tvShowID: 1, seasonNumber: 2, languageCode: languageCode).path + let url = TVSeasonsEndpoint.images(tvSeriesID: 1, seasonNumber: 2, languageCode: languageCode).path XCTAssertEqual(url, expectedURL) } - func testTVShowSeasonVideosEndpointReturnsURL() throws { + func testTVSeasonVideosEndpointReturnsURL() throws { let languageCode = "en" let expectedURL = try XCTUnwrap(URL( string: "/tv/1/season/2/videos?include_video_language=\(languageCode),null" )) - let url = TVShowSeasonsEndpoint.videos(tvShowID: 1, seasonNumber: 2, languageCode: languageCode).path + let url = TVSeasonsEndpoint.videos(tvSeriesID: 1, seasonNumber: 2, languageCode: languageCode).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/TVShowSeasons/TVShowSeasonServiceTests.swift b/Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift similarity index 66% rename from Tests/TMDbTests/TVShowSeasons/TVShowSeasonServiceTests.swift rename to Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift index 2b424d15..410921c7 100644 --- a/Tests/TMDbTests/TVShowSeasons/TVShowSeasonServiceTests.swift +++ b/Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift @@ -1,9 +1,9 @@ @testable import TMDb import XCTest -final class TVShowSeasonServiceTests: XCTestCase { +final class TVSeasonServiceTests: XCTestCase { - var service: TVShowSeasonService! + var service: TVSeasonService! var apiClient: MockAPIClient! var locale: Locale! @@ -11,7 +11,7 @@ final class TVShowSeasonServiceTests: XCTestCase { super.setUp() apiClient = MockAPIClient() locale = Locale(identifier: "en_GB") - service = TVShowSeasonService(apiClient: apiClient, localeProvider: { [unowned self] in locale }) + service = TVSeasonService(apiClient: apiClient, localeProvider: { [unowned self] in locale }) } override func tearDown() { @@ -20,47 +20,47 @@ final class TVShowSeasonServiceTests: XCTestCase { super.tearDown() } - func testDetailsReturnsTVShowSeason() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowSeason.mock() + func testDetailsReturnsTVSeason() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeason.mock() let seasonNumber = expectedResult.seasonNumber apiClient.result = .success(expectedResult) - let result = try await service.details(forSeason: seasonNumber, inTVShow: tvShowID) + let result = try await service.details(forSeason: seasonNumber, inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) XCTAssertEqual(apiClient.lastPath, - TVShowSeasonsEndpoint.details(tvShowID: tvShowID, seasonNumber: seasonNumber).path) + TVSeasonsEndpoint.details(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber).path) } func testImagesReturnsImages() async throws { let seasonNumber = Int.randomID - let tvShowID = Int.randomID - let expectedResult = TVShowSeasonImageCollection.mock() + let tvSeriesID = Int.randomID + let expectedResult = TVSeasonImageCollection.mock() apiClient.result = .success(expectedResult) - let result = try await service.images(forSeason: seasonNumber, inTVShow: tvShowID) + let result = try await service.images(forSeason: seasonNumber, inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) XCTAssertEqual( apiClient.lastPath, - TVShowSeasonsEndpoint.images(tvShowID: tvShowID, seasonNumber: seasonNumber, + TVSeasonsEndpoint.images(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, languageCode: locale.languageCode).path ) } func testVideosReturnsVideos() async throws { let seasonNumber = Int.randomID - let tvShowID = Int.randomID + let tvSeriesID = Int.randomID let expectedResult = VideoCollection.mock() apiClient.result = .success(expectedResult) - let result = try await service.videos(forSeason: seasonNumber, inTVShow: tvShowID) + let result = try await service.videos(forSeason: seasonNumber, inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) XCTAssertEqual( apiClient.lastPath, - TVShowSeasonsEndpoint.videos(tvShowID: tvShowID, seasonNumber: seasonNumber, + TVSeasonsEndpoint.videos(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, languageCode: locale.languageCode).path ) } diff --git a/Tests/TMDbTests/TVShows/Endpoints/TVShowsEndpointTests.swift b/Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift similarity index 50% rename from Tests/TMDbTests/TVShows/Endpoints/TVShowsEndpointTests.swift rename to Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift index 057ce573..22f549f5 100644 --- a/Tests/TMDbTests/TVShows/Endpoints/TVShowsEndpointTests.swift +++ b/Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift @@ -1,104 +1,104 @@ @testable import TMDb import XCTest -final class TVShowsEndpointTests: XCTestCase { +final class TVSeriesEndpointTests: XCTestCase { - func testTVShowDetailsEndpointReturnsURL() throws { + func testTVSeriesDetailsEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1")) - let url = TVShowsEndpoint.details(tvShowID: 1).path + let url = TVSeriesEndpoint.details(tvSeriesID: 1).path XCTAssertEqual(url, expectedURL) } - func testTVShowCreditsEndpointReturnsURL() throws { + func testTVSeriesCreditsEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/credits")) - let url = TVShowsEndpoint.credits(tvShowID: 1).path + let url = TVSeriesEndpoint.credits(tvSeriesID: 1).path XCTAssertEqual(url, expectedURL) } - func testTVShowReviewsEndpointReturnsURL() throws { + func testTVSeriesReviewsEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/reviews")) - let url = TVShowsEndpoint.reviews(tvShowID: 1).path + let url = TVSeriesEndpoint.reviews(tvSeriesID: 1).path XCTAssertEqual(url, expectedURL) } - func testTVShowReviewsEndpointWithPageReturnsURL() throws { + func testTVSeriesReviewsEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/reviews?page=2")) - let url = TVShowsEndpoint.reviews(tvShowID: 1, page: 2).path + let url = TVSeriesEndpoint.reviews(tvSeriesID: 1, page: 2).path XCTAssertEqual(url, expectedURL) } - func testTVShowImagesEndpointReturnsURL() throws { + func testTVSeriesImagesEndpointReturnsURL() throws { let languageCode = "en" let expectedURL = try XCTUnwrap(URL(string: "/tv/1/images?include_image_language=\(languageCode),null")) - let url = TVShowsEndpoint.images(tvShowID: 1, languageCode: languageCode).path + let url = TVSeriesEndpoint.images(tvSeriesID: 1, languageCode: languageCode).path XCTAssertEqual(url, expectedURL) } - func testTVShowVideosEndpointReturnsURL() throws { + func testTVSeriesVideosEndpointReturnsURL() throws { let languageCode = "en" let expectedURL = try XCTUnwrap(URL( string: "/tv/1/videos?include_video_language=\(languageCode),null" )) - let url = TVShowsEndpoint.videos(tvShowID: 1, languageCode: languageCode).path + let url = TVSeriesEndpoint.videos(tvSeriesID: 1, languageCode: languageCode).path XCTAssertEqual(url, expectedURL) } - func testTVShowRecommendationsEndpointReturnsURL() throws { + func testTVSeriesRecommendationsEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/recommendations")) - let url = TVShowsEndpoint.recommendations(tvShowID: 1).path + let url = TVSeriesEndpoint.recommendations(tvSeriesID: 1).path XCTAssertEqual(url, expectedURL) } - func testTVShowRecommendationsEndpointWithPageReturnsURL() throws { + func testTVSeriesRecommendationsEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/recommendations?page=2")) - let url = TVShowsEndpoint.recommendations(tvShowID: 1, page: 2).path + let url = TVSeriesEndpoint.recommendations(tvSeriesID: 1, page: 2).path XCTAssertEqual(url, expectedURL) } - func testTVShowSimilarEndpointReturnsURL() throws { + func testTVSeriesSimilarEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/similar")) - let url = TVShowsEndpoint.similar(tvShowID: 1).path + let url = TVSeriesEndpoint.similar(tvSeriesID: 1).path XCTAssertEqual(url, expectedURL) } - func testTVShowSimilarEndpointWithPageReturnsURL() throws { + func testTVSeriesSimilarEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/1/similar?page=2")) - let url = TVShowsEndpoint.similar(tvShowID: 1, page: 2).path + let url = TVSeriesEndpoint.similar(tvSeriesID: 1, page: 2).path XCTAssertEqual(url, expectedURL) } - func testTVShowPopularEndpointReturnsURL() throws { + func testTVSeriesPopularEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/popular")) - let url = TVShowsEndpoint.popular().path + let url = TVSeriesEndpoint.popular().path XCTAssertEqual(url, expectedURL) } - func testTVShowPopularEndpointWithPageReturnsURL() throws { + func testTVSeriesPopularEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/tv/popular?page=1")) - let url = TVShowsEndpoint.popular(page: 1).path + let url = TVSeriesEndpoint.popular(page: 1).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift b/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift new file mode 100644 index 00000000..1c4508d9 --- /dev/null +++ b/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift @@ -0,0 +1,207 @@ +@testable import TMDb +import XCTest + +final class TVSeriesServiceTests: XCTestCase { + + var service: TVSeriesService! + var apiClient: MockAPIClient! + var locale: Locale! + + override func setUp() { + super.setUp() + apiClient = MockAPIClient() + locale = Locale(identifier: "en_GB") + service = TVSeriesService(apiClient: apiClient, localeProvider: { [unowned self] in locale }) + } + + override func tearDown() { + apiClient = nil + locale = nil + service = nil + super.tearDown() + } + + func testDetailsReturnsTVSeries() async throws { + let expectedResult = TVSeries.theSandman + let tvSeriesID = expectedResult.id + apiClient.result = .success(expectedResult) + + let result = try await service.details(forTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.details(tvSeriesID: tvSeriesID).path) + } + + func testCreditsReturnsShowsCredits() async throws { + let expectedResult = ShowCredits.mock() + let tvSeriesID = expectedResult.id + apiClient.result = .success(expectedResult) + + let result = try await service.credits(forTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.credits(tvSeriesID: tvSeriesID).path) + } + + func testReviewsWithDefaultParametersReturnsReviews() async throws { + let tvSeriesID = Int.randomID + let expectedResult = ReviewPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.reviews(forTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.reviews(tvSeriesID: tvSeriesID).path) + } + + func testReviewsReturnsReviews() async throws { + let tvSeriesID = Int.randomID + let expectedResult = ReviewPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.reviews(forTVSeries: tvSeriesID, page: nil) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.reviews(tvSeriesID: tvSeriesID).path) + } + + func testReviewsWithPageReturnsReviews() async throws { + let tvSeriesID = Int.randomID + let expectedResult = ReviewPageableList.mock() + let page = expectedResult.page + apiClient.result = .success(expectedResult) + + let result = try await service.reviews(forTVSeries: tvSeriesID, page: page) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.reviews(tvSeriesID: tvSeriesID, page: page).path) + } + + func testImagesReturnsImages() async throws { + let tvSeriesID = Int.randomID + let expectedResult = ImageCollection.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.images(forTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual( + apiClient.lastPath, + TVSeriesEndpoint.images(tvSeriesID: tvSeriesID, languageCode: locale.languageCode).path + ) + } + + func testVideosReturnsVideos() async throws { + let expectedResult = VideoCollection.mock() + let tvSeriesID = expectedResult.id + apiClient.result = .success(expectedResult) + + let result = try await service.videos(forTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual( + apiClient.lastPath, + TVSeriesEndpoint.videos(tvSeriesID: tvSeriesID, languageCode: locale.languageCode).path + ) + } + + func testRecommendationsWithDefaultParametersReturnsTVSeries() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeriesPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.recommendations(forTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.recommendations(tvSeriesID: tvSeriesID).path) + } + + func testRecommendationsReturnsTVSeries() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeriesPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.recommendations(forTVSeries: tvSeriesID, page: nil) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.recommendations(tvSeriesID: tvSeriesID).path) + } + + func testRecommendationsWithPageReturnsTVSeries() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeriesPageableList.mock() + let page = expectedResult.page + apiClient.result = .success(expectedResult) + + let result = try await service.recommendations(forTVSeries: tvSeriesID, page: page) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.recommendations(tvSeriesID: tvSeriesID, page: page).path) + } + + func testSimilarWithDefaultParametersReturnsTVSeries() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeriesPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.similar(toTVSeries: tvSeriesID) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.similar(tvSeriesID: tvSeriesID).path) + } + + func testSimilarReturnsTVSeries() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeriesPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.similar(toTVSeries: tvSeriesID, page: nil) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.similar(tvSeriesID: tvSeriesID).path) + } + + func testSimilarWithPageReturnsTVSeries() async throws { + let tvSeriesID = Int.randomID + let expectedResult = TVSeriesPageableList.mock() + let page = expectedResult.page + apiClient.result = .success(expectedResult) + + let result = try await service.similar(toTVSeries: tvSeriesID, page: page) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.similar(tvSeriesID: tvSeriesID, page: page).path) + } + + func testPopularWithDefaultParametersReturnsTVSeries() async throws { + let expectedResult = TVSeriesPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.popular() + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.popular().path) + } + + func testPopularReturnsTVSeries() async throws { + let expectedResult = TVSeriesPageableList.mock() + apiClient.result = .success(expectedResult) + + let result = try await service.popular(page: nil) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.popular().path) + } + + func testPopularWithPageReturnsTVSeries() async throws { + let expectedResult = TVSeriesPageableList.mock() + let page = expectedResult.page + apiClient.result = .success(expectedResult) + + let result = try await service.popular(page: page) + + XCTAssertEqual(result, expectedResult) + XCTAssertEqual(apiClient.lastPath, TVSeriesEndpoint.popular(page: page).path) + } + +} diff --git a/Tests/TMDbTests/TVShowEpisodes/ENdpoints/TVShowEpisodesEndpointTests.swift b/Tests/TMDbTests/TVShowEpisodes/ENdpoints/TVShowEpisodesEndpointTests.swift deleted file mode 100644 index f0bc9f07..00000000 --- a/Tests/TMDbTests/TVShowEpisodes/ENdpoints/TVShowEpisodesEndpointTests.swift +++ /dev/null @@ -1,30 +0,0 @@ -@testable import TMDb -import XCTest - -final class TVShowEpisodesEndpointTests: XCTestCase { - - func testTVShowEpisodeDetailsEndpointReturnsURL() throws { - let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2/episode/3")) - - let url = TVShowEpisodesEndpoint.details(tvShowID: 1, seasonNumber: 2, episodeNumber: 3).path - - XCTAssertEqual(url, expectedURL) - } - - func testTVShowEpisodeImagesEndpointReturnsURL() throws { - let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2/episode/3/images")) - - let url = TVShowEpisodesEndpoint.images(tvShowID: 1, seasonNumber: 2, episodeNumber: 3).path - - XCTAssertEqual(url, expectedURL) - } - - func testTVShowSeasonVideosEndpointReturnsURL() throws { - let expectedURL = try XCTUnwrap(URL(string: "/tv/1/season/2/episode/3/videos")) - - let url = TVShowEpisodesEndpoint.videos(tvShowID: 1, seasonNumber: 2, episodeNumber: 3).path - - XCTAssertEqual(url, expectedURL) - } - -} diff --git a/Tests/TMDbTests/TVShows/TVShowServiceTests.swift b/Tests/TMDbTests/TVShows/TVShowServiceTests.swift deleted file mode 100644 index 6f601eb0..00000000 --- a/Tests/TMDbTests/TVShows/TVShowServiceTests.swift +++ /dev/null @@ -1,207 +0,0 @@ -@testable import TMDb -import XCTest - -final class TVShowServiceTests: XCTestCase { - - var service: TVShowService! - var apiClient: MockAPIClient! - var locale: Locale! - - override func setUp() { - super.setUp() - apiClient = MockAPIClient() - locale = Locale(identifier: "en_GB") - service = TVShowService(apiClient: apiClient, localeProvider: { [unowned self] in locale }) - } - - override func tearDown() { - apiClient = nil - locale = nil - service = nil - super.tearDown() - } - - func testDetailsReturnsTVShow() async throws { - let expectedResult = TVShow.theSandman - let tvShowID = expectedResult.id - apiClient.result = .success(expectedResult) - - let result = try await service.details(forTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.details(tvShowID: tvShowID).path) - } - - func testCreditsReturnsShowsCredits() async throws { - let expectedResult = ShowCredits.mock() - let tvShowID = expectedResult.id - apiClient.result = .success(expectedResult) - - let result = try await service.credits(forTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.credits(tvShowID: tvShowID).path) - } - - func testReviewsWithDefaultParametersReturnsReviews() async throws { - let tvShowID = Int.randomID - let expectedResult = ReviewPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.reviews(forTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.reviews(tvShowID: tvShowID).path) - } - - func testReviewsReturnsReviews() async throws { - let tvShowID = Int.randomID - let expectedResult = ReviewPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.reviews(forTVShow: tvShowID, page: nil) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.reviews(tvShowID: tvShowID).path) - } - - func testReviewsWithPageReturnsReviews() async throws { - let tvShowID = Int.randomID - let expectedResult = ReviewPageableList.mock() - let page = expectedResult.page - apiClient.result = .success(expectedResult) - - let result = try await service.reviews(forTVShow: tvShowID, page: page) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.reviews(tvShowID: tvShowID, page: page).path) - } - - func testImagesReturnsImages() async throws { - let tvShowID = Int.randomID - let expectedResult = ImageCollection.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.images(forTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual( - apiClient.lastPath, - TVShowsEndpoint.images(tvShowID: tvShowID, languageCode: locale.languageCode).path - ) - } - - func testVideosReturnsVideos() async throws { - let expectedResult = VideoCollection.mock() - let tvShowID = expectedResult.id - apiClient.result = .success(expectedResult) - - let result = try await service.videos(forTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual( - apiClient.lastPath, - TVShowsEndpoint.videos(tvShowID: tvShowID, languageCode: locale.languageCode).path - ) - } - - func testRecommendationsWithDefaultParametersReturnsTVShows() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.recommendations(forTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.recommendations(tvShowID: tvShowID).path) - } - - func testRecommendationsReturnsTVShows() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.recommendations(forTVShow: tvShowID, page: nil) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.recommendations(tvShowID: tvShowID).path) - } - - func testRecommendationsWithPageReturnsTVShows() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowPageableList.mock() - let page = expectedResult.page - apiClient.result = .success(expectedResult) - - let result = try await service.recommendations(forTVShow: tvShowID, page: page) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.recommendations(tvShowID: tvShowID, page: page).path) - } - - func testSimilarWithDefaultParametersReturnsTVShows() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.similar(toTVShow: tvShowID) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.similar(tvShowID: tvShowID).path) - } - - func testSimilarReturnsTVShows() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.similar(toTVShow: tvShowID, page: nil) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.similar(tvShowID: tvShowID).path) - } - - func testSimilarWithPageReturnsTVShows() async throws { - let tvShowID = Int.randomID - let expectedResult = TVShowPageableList.mock() - let page = expectedResult.page - apiClient.result = .success(expectedResult) - - let result = try await service.similar(toTVShow: tvShowID, page: page) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.similar(tvShowID: tvShowID, page: page).path) - } - - func testPopularWithDefaultParametersReturnsTVShows() async throws { - let expectedResult = TVShowPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.popular() - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.popular().path) - } - - func testPopularReturnsTVShows() async throws { - let expectedResult = TVShowPageableList.mock() - apiClient.result = .success(expectedResult) - - let result = try await service.popular(page: nil) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.popular().path) - } - - func testPopularWithPageReturnsTVShows() async throws { - let expectedResult = TVShowPageableList.mock() - let page = expectedResult.page - apiClient.result = .success(expectedResult) - - let result = try await service.popular(page: page) - - XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TVShowsEndpoint.popular(page: page).path) - } - -} diff --git a/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift b/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift index 3c7dcc3b..15f5cc6f 100644 --- a/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift +++ b/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift @@ -51,50 +51,50 @@ final class TrendingEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testTrendingTVShowsEndpointReturnsURL() throws { + func testTrendingTVSeriesEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/trending/tv/day")) - let url = TrendingEndpoint.tvShows().path + let url = TrendingEndpoint.tvSeries().path XCTAssertEqual(url, expectedURL) } - func testTrendingTVShowsEndpointWithPageReturnsURL() throws { + func testTrendingTVSeriesEndpointWithPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/trending/tv/day?page=1")) - let url = TrendingEndpoint.tvShows(page: 1).path + let url = TrendingEndpoint.tvSeries(page: 1).path XCTAssertEqual(url, expectedURL) } - func testTrendingTVShowsEndpointWithTimeWindowDayReturnsURL() throws { + func testTrendingTVSeriesEndpointWithTimeWindowDayReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/trending/tv/day")) - let url = TrendingEndpoint.tvShows(timeWindow: .day).path + let url = TrendingEndpoint.tvSeries(timeWindow: .day).path XCTAssertEqual(url, expectedURL) } - func testTrendingTVShowsEndpointWithTimeWindowDayAndPageReturnsURL() throws { + func testTrendingTVSeriesEndpointWithTimeWindowDayAndPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/trending/tv/day?page=1")) - let url = TrendingEndpoint.tvShows(timeWindow: .day, page: 1).path + let url = TrendingEndpoint.tvSeries(timeWindow: .day, page: 1).path XCTAssertEqual(url, expectedURL) } - func testTrendingTVShowsEndpointWithTimeWindowWeekReturnsURL() throws { + func testTrendingTVSeriesEndpointWithTimeWindowWeekReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/trending/tv/week")) - let url = TrendingEndpoint.tvShows(timeWindow: .week).path + let url = TrendingEndpoint.tvSeries(timeWindow: .week).path XCTAssertEqual(url, expectedURL) } - func testTrendingTVShowsEndpointWithTimeWindowWeekAndPageReturnsURL() throws { + func testTrendingTVSeriesEndpointWithTimeWindowWeekAndPageReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/trending/tv/week?page=1")) - let url = TrendingEndpoint.tvShows(timeWindow: .week, page: 1).path + let url = TrendingEndpoint.tvSeries(timeWindow: .week, page: 1).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/Trending/TrendingServiceTests.swift b/Tests/TMDbTests/Trending/TrendingServiceTests.swift index 9f720387..8c3f9f8d 100644 --- a/Tests/TMDbTests/Trending/TrendingServiceTests.swift +++ b/Tests/TMDbTests/Trending/TrendingServiceTests.swift @@ -75,61 +75,61 @@ final class TrendingServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.movies(timeWindow: timeWindow, page: page).path) } - func testTVShowsWithDefaultReturnsTVShows() async throws { + func testTVSeriesWithDefaultReturnsTVSeries() async throws { let timeWindow = TrendingTimeWindowFilterType.day - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.tvShows() + let result = try await service.tvSeries() XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvShows(timeWindow: timeWindow).path) + XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvSeries(timeWindow: timeWindow).path) } - func testTVShowsForDayReturnsTVShows() async throws { + func testTVSeriesForDayReturnsTVSeries() async throws { let timeWindow = TrendingTimeWindowFilterType.day - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.tvShows(inTimeWindow: timeWindow, page: nil) + let result = try await service.tvSeries(inTimeWindow: timeWindow, page: nil) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvShows(timeWindow: timeWindow).path) + XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvSeries(timeWindow: timeWindow).path) } - func testTVShowsForDayWithPageReturnsTVShows() async throws { + func testTVSeriesForDayWithPageReturnsTVSeries() async throws { let timeWindow = TrendingTimeWindowFilterType.day - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() let page = expectedResult.page apiClient.result = .success(expectedResult) - let result = try await service.tvShows(inTimeWindow: timeWindow, page: page) + let result = try await service.tvSeries(inTimeWindow: timeWindow, page: page) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvShows(timeWindow: timeWindow, page: page).path) + XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvSeries(timeWindow: timeWindow, page: page).path) } - func testTVShowsForWeekReturnsTVShows() async throws { + func testTVSeriesForWeekReturnsTVSeries() async throws { let timeWindow = TrendingTimeWindowFilterType.week - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() apiClient.result = .success(expectedResult) - let result = try await service.tvShows(inTimeWindow: timeWindow, page: nil) + let result = try await service.tvSeries(inTimeWindow: timeWindow, page: nil) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvShows(timeWindow: timeWindow).path) + XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvSeries(timeWindow: timeWindow).path) } - func testTVShowsForWeekWithPageReturnsTVShows() async throws { + func testTVSeriesForWeekWithPageReturnsTVSeries() async throws { let timeWindow = TrendingTimeWindowFilterType.week - let expectedResult = TVShowPageableList.mock() + let expectedResult = TVSeriesPageableList.mock() let page = expectedResult.page apiClient.result = .success(expectedResult) - let result = try await service.tvShows(inTimeWindow: timeWindow, page: page) + let result = try await service.tvSeries(inTimeWindow: timeWindow, page: page) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvShows(timeWindow: timeWindow, page: page).path) + XCTAssertEqual(apiClient.lastPath, TrendingEndpoint.tvSeries(timeWindow: timeWindow, page: page).path) } func testPeopleWithDefaultParametersReturnsPeople() async throws { diff --git a/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift b/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift index b82e0746..31a85911 100644 --- a/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift +++ b/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift @@ -28,19 +28,19 @@ final class WatchProviderEndpointTests: XCTestCase { XCTAssertEqual(url, expectedURL) } - func testTVShowWhenGivenRegionCodeEndpointReturnsURL() throws { + func testTVSeriesWhenGivenRegionCodeEndpointReturnsURL() throws { let regionCode = "GB" let expectedURL = try XCTUnwrap(URL(string: "/watch/providers/tv?watch_region=\(regionCode)")) - let url = WatchProviderEndpoint.tvShow(regionCode: regionCode).path + let url = WatchProviderEndpoint.tvSeries(regionCode: regionCode).path XCTAssertEqual(url, expectedURL) } - func testTVShowWhenNotGivenRegionCodeEndpointReturnsURL() throws { + func testTVSeriesWhenNotGivenRegionCodeEndpointReturnsURL() throws { let expectedURL = try XCTUnwrap(URL(string: "/watch/providers/tv")) - let url = WatchProviderEndpoint.tvShow(regionCode: nil).path + let url = WatchProviderEndpoint.tvSeries(regionCode: nil).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift b/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift index f9fb0736..211c16e0 100644 --- a/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift +++ b/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift @@ -43,15 +43,15 @@ final class WatchProviderServiceTests: XCTestCase { XCTAssertEqual(apiClient.lastPath, WatchProviderEndpoint.movie(regionCode: locale.regionCode).path) } - func testTVShowWatchProvidersReturnsWatchProviders() async throws { + func testTVSeriesWatchProvidersReturnsWatchProviders() async throws { let watchProviderResult = WatchProviderResult.mock let expectedResult = watchProviderResult.results apiClient.result = .success(watchProviderResult) - let result = try await service.tvShowWatchProviders() + let result = try await service.tvSeriesWatchProviders() XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, WatchProviderEndpoint.tvShow(regionCode: locale.regionCode).path) + XCTAssertEqual(apiClient.lastPath, WatchProviderEndpoint.tvSeries(regionCode: locale.regionCode).path) } }