diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23fd459c..465cde2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,6 @@ jobs: destination: platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.2 - name: tvOS destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=17.2 - steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7be786ae..8babe4ba 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,6 +26,18 @@ jobs: - name: Swiftlint run: swiftlint --strict --reporter github-actions-logging + swiftformt: + name: SwiftFormat + runs-on: ubuntu-latest + container: + image: docker://ghcr.io/nicklockwood/swiftformat:latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: SwiftFormat + run: swiftformat --lint . + markdownlint: name: Markdownlint runs-on: ubuntu-latest diff --git a/.swift-version b/.swift-version new file mode 100644 index 00000000..b883184b --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +5.9 \ No newline at end of file diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 00000000..b8ae05aa --- /dev/null +++ b/.swiftformat @@ -0,0 +1,11 @@ +--typeblanklines preserve +--indent 4 +--commas inline +--self init-only +--wraparguments before-first +--xcodeindentation enabled + +--disable wrapMultilineStatementBraces +--disable redundantLetError + +--header \n {file}\n TMDb\n\n Copyright © 2023 Adam Young.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n diff --git a/Sources/TMDb/Certifications/CertificationService.swift b/Sources/TMDb/Certifications/CertificationService.swift index 150adf28..5221294d 100644 --- a/Sources/TMDb/Certifications/CertificationService.swift +++ b/Sources/TMDb/Certifications/CertificationService.swift @@ -1,3 +1,22 @@ +// +// CertificationService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -29,7 +48,7 @@ public final class CertificationService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: A dictionary of movie certifications. - /// + /// public func movieCertifications() async throws -> [String: [Certification]] { let certifications: Certifications do { diff --git a/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift b/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift index ea7e8142..9626c500 100644 --- a/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift +++ b/Sources/TMDb/Certifications/Endpoints/CertificationsEndpoint.swift @@ -1,3 +1,22 @@ +// +// CertificationsEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum CertificationsEndpoint { @@ -14,12 +33,12 @@ extension CertificationsEndpoint: Endpoint { var path: URL { switch self { case .movie: - return Self.basePath + Self.basePath .appendingPathComponent("movie") .appendingPathComponent("list") case .tvSeries: - return Self.basePath + Self.basePath .appendingPathComponent("tv") .appendingPathComponent("list") } diff --git a/Sources/TMDb/Company/CompanyService.swift b/Sources/TMDb/Company/CompanyService.swift index 1d05d994..67385757 100644 --- a/Sources/TMDb/Company/CompanyService.swift +++ b/Sources/TMDb/Company/CompanyService.swift @@ -1,3 +1,22 @@ +// +// CompanyService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Company/Endpoints/CompanyEndpoint.swift b/Sources/TMDb/Company/Endpoints/CompanyEndpoint.swift index c169bda5..8a8b4b40 100644 --- a/Sources/TMDb/Company/Endpoints/CompanyEndpoint.swift +++ b/Sources/TMDb/Company/Endpoints/CompanyEndpoint.swift @@ -1,3 +1,22 @@ +// +// CompanyEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum CompanyEndpoint { @@ -12,8 +31,8 @@ extension CompanyEndpoint: Endpoint { var path: URL { switch self { - case .details(let companyID): - return Self.basePath + case let .details(companyID): + Self.basePath .appendingPathComponent(companyID) } } diff --git a/Sources/TMDb/Configuration/ConfigurationService.swift b/Sources/TMDb/Configuration/ConfigurationService.swift index ea0b6e23..68102854 100644 --- a/Sources/TMDb/Configuration/ConfigurationService.swift +++ b/Sources/TMDb/Configuration/ConfigurationService.swift @@ -1,3 +1,22 @@ +// +// ConfigurationService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -30,7 +49,7 @@ public final class ConfigurationService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The API configuration. - /// + /// public func apiConfiguration() async throws -> APIConfiguration { let apiConfiguration: APIConfiguration do { @@ -50,7 +69,7 @@ public final class ConfigurationService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Countries used throughout TMDb, - /// + /// public func countries() async throws -> [Country] { let countries: [Country] do { @@ -70,7 +89,7 @@ public final class ConfigurationService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Jobs and departments used on TMDb. - /// + /// public func jobsByDepartment() async throws -> [Department] { let departments: [Department] do { diff --git a/Sources/TMDb/Configuration/Endpoint/ConfigurationEndpoint.swift b/Sources/TMDb/Configuration/Endpoint/ConfigurationEndpoint.swift index ee741f36..385f2095 100644 --- a/Sources/TMDb/Configuration/Endpoint/ConfigurationEndpoint.swift +++ b/Sources/TMDb/Configuration/Endpoint/ConfigurationEndpoint.swift @@ -1,3 +1,22 @@ +// +// ConfigurationEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum ConfigurationEndpoint { @@ -16,18 +35,18 @@ extension ConfigurationEndpoint: Endpoint { var path: URL { switch self { case .api: - return Self.basePath + Self.basePath case .countries: - return Self.basePath + Self.basePath .appendingPathComponent("countries") case .jobs: - return Self.basePath + Self.basePath .appendingPathComponent("jobs") case .languages: - return Self.basePath + Self.basePath .appendingPathComponent("languages") } } diff --git a/Sources/TMDb/Discover/DiscoverService.swift b/Sources/TMDb/Discover/DiscoverService.swift index 1f93f5eb..5b4b61c8 100644 --- a/Sources/TMDb/Discover/DiscoverService.swift +++ b/Sources/TMDb/Discover/DiscoverService.swift @@ -1,3 +1,22 @@ +// +// DiscoverService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -36,9 +55,12 @@ public final class DiscoverService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Matching movies as a pageable list. - /// - public func movies(sortedBy: MovieSort? = nil, withPeople people: [Person.ID]? = nil, - page: Int? = nil) async throws -> MoviePageableList { + /// + public func movies( + sortedBy: MovieSort? = nil, + withPeople people: [Person.ID]? = nil, + page: Int? = nil + ) async throws -> MoviePageableList { let movieList: MoviePageableList do { movieList = try await apiClient.get( diff --git a/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift b/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift index 560939f0..5a28ac37 100644 --- a/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift +++ b/Sources/TMDb/Discover/Endpoints/DiscoverEndpoint.swift @@ -1,3 +1,22 @@ +// +// DiscoverEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum DiscoverEndpoint { @@ -13,15 +32,15 @@ extension DiscoverEndpoint: Endpoint { var path: URL { switch self { - case .movies(let sortedBy, let people, let page): - return Self.basePath + case let .movies(sortedBy, people, page): + Self.basePath .appendingPathComponent("movie") .appendingSortBy(sortedBy) .appendingWithPeople(people) .appendingPage(page) - case .tvSeries(let sortedBy, let page): - return Self.basePath + case let .tvSeries(sortedBy, page): + Self.basePath .appendingPathComponent("tv") .appendingSortBy(sortedBy) .appendingPage(page) diff --git a/Sources/TMDb/Extensions/DateFormatter+TMDb.swift b/Sources/TMDb/Extensions/DateFormatter+TMDb.swift index d2d656fb..6c3fce5b 100644 --- a/Sources/TMDb/Extensions/DateFormatter+TMDb.swift +++ b/Sources/TMDb/Extensions/DateFormatter+TMDb.swift @@ -1,3 +1,22 @@ +// +// DateFormatter+TMDb.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension DateFormatter { diff --git a/Sources/TMDb/Extensions/JSONDecoder+TMDb.swift b/Sources/TMDb/Extensions/JSONDecoder+TMDb.swift index 4920945f..04f3df9c 100644 --- a/Sources/TMDb/Extensions/JSONDecoder+TMDb.swift +++ b/Sources/TMDb/Extensions/JSONDecoder+TMDb.swift @@ -1,3 +1,22 @@ +// +// JSONDecoder+TMDb.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension JSONDecoder { diff --git a/Sources/TMDb/Extensions/Sequence+Uniqued.swift b/Sources/TMDb/Extensions/Sequence+Uniqued.swift index 241d1cc2..742aa4ae 100644 --- a/Sources/TMDb/Extensions/Sequence+Uniqued.swift +++ b/Sources/TMDb/Extensions/Sequence+Uniqued.swift @@ -1,3 +1,22 @@ +// +// Sequence+Uniqued.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension Sequence where Element: Hashable, Element: Identifiable { diff --git a/Sources/TMDb/Extensions/URL+QueryItem.swift b/Sources/TMDb/Extensions/URL+QueryItem.swift index 8e118a86..b1702dbd 100644 --- a/Sources/TMDb/Extensions/URL+QueryItem.swift +++ b/Sources/TMDb/Extensions/URL+QueryItem.swift @@ -1,3 +1,22 @@ +// +// URL+QueryItem.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension URL { @@ -66,7 +85,7 @@ extension URL { } func appendingPage(_ page: Int?) -> Self { - guard var page = page else { + guard var page else { return self } diff --git a/Sources/TMDb/Extensions/URL+TMDb.swift b/Sources/TMDb/Extensions/URL+TMDb.swift index ab5b30b6..b2aa3e41 100644 --- a/Sources/TMDb/Extensions/URL+TMDb.swift +++ b/Sources/TMDb/Extensions/URL+TMDb.swift @@ -1,3 +1,22 @@ +// +// URL+TMDb.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension URL { diff --git a/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift b/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift index 4bd56a5d..58358903 100644 --- a/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift +++ b/Sources/TMDb/Genres/Endpoints/GenresEndpoint.swift @@ -1,3 +1,22 @@ +// +// GenresEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum GenresEndpoint { @@ -14,12 +33,12 @@ extension GenresEndpoint: Endpoint { var path: URL { switch self { case .movie: - return Self.basePath + Self.basePath .appendingPathComponent("movie") .appendingPathComponent("list") case .tvSeries: - return Self.basePath + Self.basePath .appendingPathComponent("tv") .appendingPathComponent("list") } diff --git a/Sources/TMDb/Genres/GenreService.swift b/Sources/TMDb/Genres/GenreService.swift index 9b82e274..d339e81d 100644 --- a/Sources/TMDb/Genres/GenreService.swift +++ b/Sources/TMDb/Genres/GenreService.swift @@ -1,3 +1,22 @@ +// +// GenreService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -49,7 +68,7 @@ public final class GenreService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: A list of genres. - /// + /// public func tvSeriesGenres() async throws -> [Genre] { let genreList: GenreList do { diff --git a/Sources/TMDb/Helpers/LocaleProvider.swift b/Sources/TMDb/Helpers/LocaleProvider.swift index c1590ab5..7848bdca 100644 --- a/Sources/TMDb/Helpers/LocaleProvider.swift +++ b/Sources/TMDb/Helpers/LocaleProvider.swift @@ -1,28 +1,47 @@ +// +// LocaleProvider.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation final class LocaleProvider: LocaleProviding { var languageCode: String? { #if os(Linux) - locale.languageCode - #else - if #available(macOS 13.0, *) { - locale.language.languageCode?.identifier - } else { locale.languageCode - } + #else + if #available(macOS 13.0, *) { + locale.language.languageCode?.identifier + } else { + locale.languageCode + } #endif } var regionCode: String? { #if os(Linux) - locale.regionCode - #else - if #available(macOS 13.0, *) { - locale.region?.identifier - } else { locale.regionCode - } + #else + if #available(macOS 13.0, *) { + locale.region?.identifier + } else { + locale.regionCode + } #endif } diff --git a/Sources/TMDb/LocaleProviding.swift b/Sources/TMDb/LocaleProviding.swift index 0d74bf11..f9d12d0a 100644 --- a/Sources/TMDb/LocaleProviding.swift +++ b/Sources/TMDb/LocaleProviding.swift @@ -1,3 +1,22 @@ +// +// LocaleProviding.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation protocol LocaleProviding { diff --git a/Sources/TMDb/Models/APIConfiguration.swift b/Sources/TMDb/Models/APIConfiguration.swift index 0aaa7205..c189877a 100644 --- a/Sources/TMDb/Models/APIConfiguration.swift +++ b/Sources/TMDb/Models/APIConfiguration.swift @@ -1,3 +1,22 @@ +// +// APIConfiguration.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/CastMember.swift b/Sources/TMDb/Models/CastMember.swift index 15034deb..80b8dce2 100644 --- a/Sources/TMDb/Models/CastMember.swift +++ b/Sources/TMDb/Models/CastMember.swift @@ -1,3 +1,22 @@ +// +// CastMember.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -59,7 +78,7 @@ public struct CastMember: Identifiable, Codable, Equatable, Hashable { /// - gender: Cast member's gender. /// - profilePath: Cast member's profile image. /// - order: Order number in the cast list. - /// + /// public init( id: Int, castID: Int? = nil, diff --git a/Sources/TMDb/Models/Certification.swift b/Sources/TMDb/Models/Certification.swift index a4ebadda..b63fd914 100644 --- a/Sources/TMDb/Models/Certification.swift +++ b/Sources/TMDb/Models/Certification.swift @@ -1,3 +1,22 @@ +// +// Certification.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -22,7 +41,7 @@ public struct Certification: Identifiable, Codable, Equatable, Hashable { /// /// Order number of certification in list. - /// + /// public let order: Int /// diff --git a/Sources/TMDb/Models/Certifications.swift b/Sources/TMDb/Models/Certifications.swift index f4b5186c..94b4b171 100644 --- a/Sources/TMDb/Models/Certifications.swift +++ b/Sources/TMDb/Models/Certifications.swift @@ -1,3 +1,22 @@ +// +// Certifications.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation struct Certifications: Codable, Equatable, Hashable { diff --git a/Sources/TMDb/Models/Company.swift b/Sources/TMDb/Models/Company.swift index 20bf42e6..73957a62 100644 --- a/Sources/TMDb/Models/Company.swift +++ b/Sources/TMDb/Models/Company.swift @@ -1,3 +1,22 @@ +// +// Company.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -82,12 +101,12 @@ public struct Company: Identifiable, Codable, Equatable, Hashable { } -extension Company { +public extension Company { /// /// A model representing a parent company. /// - public struct Parent: Identifiable, Codable, Equatable, Hashable { + struct Parent: Identifiable, Codable, Equatable, Hashable { /// /// Company identifier. @@ -113,7 +132,7 @@ extension Company { /// - id: Company identifier. /// - name: Company name. /// - logoPath: Company's logo path. - /// + /// public init( id: Company.ID, name: String, diff --git a/Sources/TMDb/Models/Country.swift b/Sources/TMDb/Models/Country.swift index f2e07e9b..a1f6e4bb 100644 --- a/Sources/TMDb/Models/Country.swift +++ b/Sources/TMDb/Models/Country.swift @@ -1,3 +1,22 @@ +// +// Country.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -45,7 +64,7 @@ extension Country { private enum CodingKeys: String, CodingKey { case countryCode = "iso31661" case name = "nativeName" - case englishName = "englishName" + case englishName } } diff --git a/Sources/TMDb/Models/CrewMember.swift b/Sources/TMDb/Models/CrewMember.swift index 1c614d90..e8cb4dfe 100644 --- a/Sources/TMDb/Models/CrewMember.swift +++ b/Sources/TMDb/Models/CrewMember.swift @@ -1,3 +1,22 @@ +// +// CrewMember.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Department.swift b/Sources/TMDb/Models/Department.swift index 59dda83b..347c2e3d 100644 --- a/Sources/TMDb/Models/Department.swift +++ b/Sources/TMDb/Models/Department.swift @@ -1,3 +1,22 @@ +// +// Department.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ExternalLink.swift b/Sources/TMDb/Models/ExternalLink.swift index 2e3e3dd9..e43bdc8b 100644 --- a/Sources/TMDb/Models/ExternalLink.swift +++ b/Sources/TMDb/Models/ExternalLink.swift @@ -1,3 +1,22 @@ +// +// ExternalLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/FacebookLink.swift b/Sources/TMDb/Models/FacebookLink.swift index a12335e3..3f6c946c 100644 --- a/Sources/TMDb/Models/FacebookLink.swift +++ b/Sources/TMDb/Models/FacebookLink.swift @@ -1,3 +1,22 @@ +// +// FacebookLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Gender.swift b/Sources/TMDb/Models/Gender.swift index ab2af2d3..c8007807 100644 --- a/Sources/TMDb/Models/Gender.swift +++ b/Sources/TMDb/Models/Gender.swift @@ -1,3 +1,22 @@ +// +// Gender.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Genre.swift b/Sources/TMDb/Models/Genre.swift index 6a39b419..fc798cc4 100644 --- a/Sources/TMDb/Models/Genre.swift +++ b/Sources/TMDb/Models/Genre.swift @@ -1,3 +1,22 @@ +// +// Genre.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -21,7 +40,7 @@ public struct Genre: Identifiable, Codable, Equatable, Hashable { /// - Parameters: /// - id: Genre Identifier. /// - name: Genre name. - /// + /// public init(id: Int, name: String) { self.id = id self.name = name diff --git a/Sources/TMDb/Models/GenreList.swift b/Sources/TMDb/Models/GenreList.swift index 154e4e00..b9dc44d3 100644 --- a/Sources/TMDb/Models/GenreList.swift +++ b/Sources/TMDb/Models/GenreList.swift @@ -1,3 +1,22 @@ +// +// GenreList.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation struct GenreList: Codable { diff --git a/Sources/TMDb/Models/IMDbLink.swift b/Sources/TMDb/Models/IMDbLink.swift index 18e4b85e..cf0e8110 100644 --- a/Sources/TMDb/Models/IMDbLink.swift +++ b/Sources/TMDb/Models/IMDbLink.swift @@ -1,3 +1,22 @@ +// +// IMDbLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ImageCollection.swift b/Sources/TMDb/Models/ImageCollection.swift index 2bfce7ac..16f7ebfe 100644 --- a/Sources/TMDb/Models/ImageCollection.swift +++ b/Sources/TMDb/Models/ImageCollection.swift @@ -1,3 +1,22 @@ +// +// ImageCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -34,7 +53,7 @@ public struct ImageCollection: Codable, Equatable, Hashable { /// - id: Movie or TV series identifier for these images. /// - posters: Poster images. /// - backdrops: Backdrop images. - /// + /// public init( id: Int, posters: [ImageMetadata], diff --git a/Sources/TMDb/Models/ImageMetadata.swift b/Sources/TMDb/Models/ImageMetadata.swift index 7512b36d..e36a0aad 100644 --- a/Sources/TMDb/Models/ImageMetadata.swift +++ b/Sources/TMDb/Models/ImageMetadata.swift @@ -1,3 +1,22 @@ +// +// ImageMetadata.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ImagesConfiguration+URLs.swift b/Sources/TMDb/Models/ImagesConfiguration+URLs.swift index 7e3b749c..67ae1f0b 100644 --- a/Sources/TMDb/Models/ImagesConfiguration+URLs.swift +++ b/Sources/TMDb/Models/ImagesConfiguration+URLs.swift @@ -1,6 +1,25 @@ +// +// ImagesConfiguration+URLs.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation -extension ImagesConfiguration { +public extension ImagesConfiguration { /// /// Generates the fully qualified URL for a backdrop image. @@ -12,7 +31,7 @@ extension ImagesConfiguration { /// /// - Returns: A fully qualified URL to a backdrop image. /// - public func backdropURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { + func backdropURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { imageURL(for: path, idealWidth: width, sizes: backdropSizes) } @@ -26,7 +45,7 @@ extension ImagesConfiguration { /// /// - Returns: A fully qualified URL to a logo image. /// - public func logoURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { + func logoURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { imageURL(for: path, idealWidth: width, sizes: logoSizes) } @@ -40,7 +59,7 @@ extension ImagesConfiguration { /// /// - Returns: A fully qualified URL to a poster image. /// - public func posterURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { + func posterURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { imageURL(for: path, idealWidth: width, sizes: posterSizes) } @@ -54,7 +73,7 @@ extension ImagesConfiguration { /// /// - Returns: A fully qualified URL to a profile image. /// - public func profileURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { + func profileURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { imageURL(for: path, idealWidth: width, sizes: profileSizes) } @@ -68,7 +87,7 @@ extension ImagesConfiguration { /// /// - Returns: A fully qualified URL to a still image. /// - public func stillURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { + func stillURL(for path: URL?, idealWidth width: Int = Int.max) -> URL? { imageURL(for: path, idealWidth: width, sizes: stillSizes) } diff --git a/Sources/TMDb/Models/ImagesConfiguration.swift b/Sources/TMDb/Models/ImagesConfiguration.swift index cb00bbd5..f4561ab2 100644 --- a/Sources/TMDb/Models/ImagesConfiguration.swift +++ b/Sources/TMDb/Models/ImagesConfiguration.swift @@ -1,3 +1,22 @@ +// +// ImagesConfiguration.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/InstagramLink.swift b/Sources/TMDb/Models/InstagramLink.swift index 58498fd1..990d12ae 100644 --- a/Sources/TMDb/Models/InstagramLink.swift +++ b/Sources/TMDb/Models/InstagramLink.swift @@ -1,3 +1,22 @@ +// +// InstagramLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Language.swift b/Sources/TMDb/Models/Language.swift index 5516010f..01ea3b5f 100644 --- a/Sources/TMDb/Models/Language.swift +++ b/Sources/TMDb/Models/Language.swift @@ -1,3 +1,22 @@ +// +// Language.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Media.swift b/Sources/TMDb/Models/Media.swift index 9d23ed8b..bd005fed 100644 --- a/Sources/TMDb/Models/Media.swift +++ b/Sources/TMDb/Models/Media.swift @@ -1,3 +1,22 @@ +// +// Media.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -10,14 +29,14 @@ public enum Media: Identifiable, Codable, Equatable, Hashable { /// public var id: Int { switch self { - case .movie(let movie): - return movie.id + case let .movie(movie): + movie.id - case .tvSeries(let tvSeries): - return tvSeries.id + case let .tvSeries(tvSeries): + tvSeries.id - case .person(let person): - return person.id + case let .person(person): + person.id } } @@ -56,13 +75,13 @@ extension Media { switch mediaType { case .movie: - self = .movie(try Movie(from: decoder)) + self = try .movie(Movie(from: decoder)) case .tvSeries: - self = .tvSeries(try TVSeries(from: decoder)) + self = try .tvSeries(TVSeries(from: decoder)) case .person: - self = .person(try Person(from: decoder)) + self = try .person(Person(from: decoder)) } } @@ -70,13 +89,13 @@ extension Media { var singleContainer = encoder.singleValueContainer() switch self { - case .movie(let movie): + case let .movie(movie): try singleContainer.encode(movie) - case .tvSeries(let tvSeries): + case let .tvSeries(tvSeries): try singleContainer.encode(tvSeries) - case .person(let person): + case let .person(person): try singleContainer.encode(person) } } diff --git a/Sources/TMDb/Models/MediaPageableList.swift b/Sources/TMDb/Models/MediaPageableList.swift index 8e563f0e..2852b139 100644 --- a/Sources/TMDb/Models/MediaPageableList.swift +++ b/Sources/TMDb/Models/MediaPageableList.swift @@ -1,3 +1,22 @@ +// +// MediaPageableList.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Movie.swift b/Sources/TMDb/Models/Movie.swift index 288f20ae..a8d346d5 100644 --- a/Sources/TMDb/Models/Movie.swift +++ b/Sources/TMDb/Models/Movie.swift @@ -1,3 +1,22 @@ +// +// Movie.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/MovieExternalLinksCollection.swift b/Sources/TMDb/Models/MovieExternalLinksCollection.swift index f7068357..9f583291 100644 --- a/Sources/TMDb/Models/MovieExternalLinksCollection.swift +++ b/Sources/TMDb/Models/MovieExternalLinksCollection.swift @@ -1,3 +1,22 @@ +// +// MovieExternalLinksCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -73,16 +92,16 @@ public struct MovieExternalLinksCollection: Identifiable, Codable, Equatable, Ha public static func == (lhs: MovieExternalLinksCollection, rhs: MovieExternalLinksCollection) -> Bool { lhs.id == rhs.id - && lhs.imdb == rhs.imdb - && lhs.wikiData == rhs.wikiData - && lhs.facebook == rhs.facebook - && lhs.instagram == rhs.instagram - && lhs.twitter == rhs.twitter + && lhs.imdb == rhs.imdb + && lhs.wikiData == rhs.wikiData + && lhs.facebook == rhs.facebook + && lhs.instagram == rhs.instagram + && lhs.twitter == rhs.twitter } } -extension MovieExternalLinksCollection { +public extension MovieExternalLinksCollection { private enum CodingKeys: String, CodingKey { case id @@ -93,7 +112,7 @@ extension MovieExternalLinksCollection { case twitterID = "twitterId" } - public init(from decoder: Decoder) throws { + init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let id = try container.decode(Movie.ID.self, forKey: .id) @@ -120,7 +139,7 @@ extension MovieExternalLinksCollection { ) } - public func encode(to encoder: Encoder) throws { + func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) diff --git a/Sources/TMDb/Models/MoviePageableList.swift b/Sources/TMDb/Models/MoviePageableList.swift index 4f73ad27..e2ff3161 100644 --- a/Sources/TMDb/Models/MoviePageableList.swift +++ b/Sources/TMDb/Models/MoviePageableList.swift @@ -1,3 +1,22 @@ +// +// MoviePageableList.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/MovieSort.swift b/Sources/TMDb/Models/MovieSort.swift index 1b964372..e1f10f80 100644 --- a/Sources/TMDb/Models/MovieSort.swift +++ b/Sources/TMDb/Models/MovieSort.swift @@ -1,3 +1,22 @@ +// +// MovieSort.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -51,50 +70,50 @@ extension MovieSort { private var fieldName: String { switch self { case .popularity: - return "popularity" + "popularity" case .releaseDate: - return "release_date" + "release_date" case .primaryReleaseDate: - return "primary_release_date" + "primary_release_date" case .revenue: - return "revenue" + "revenue" case .originalTitle: - return "original_title" + "original_title" case .voteAverage: - return "vote_average" + "vote_average" case .voteCount: - return "vote_count" + "vote_count" } } private var isDescending: Bool { switch self { - case .popularity(let descending): - return descending + case let .popularity(descending): + descending - case .releaseDate(let descending): - return descending + case let .releaseDate(descending): + descending - case .revenue(let descending): - return descending + case let .revenue(descending): + descending - case .primaryReleaseDate(let descending): - return descending + case let .primaryReleaseDate(descending): + descending - case .originalTitle(let descending): - return descending + case let .originalTitle(descending): + descending - case .voteAverage(let descending): - return descending + case let .voteAverage(descending): + descending - case .voteCount(let descending): - return descending + case let .voteCount(descending): + descending } } diff --git a/Sources/TMDb/Models/Network.swift b/Sources/TMDb/Models/Network.swift index 200b4bc2..b4bcfc85 100644 --- a/Sources/TMDb/Models/Network.swift +++ b/Sources/TMDb/Models/Network.swift @@ -1,3 +1,22 @@ +// +// Network.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/PageableListResult.swift b/Sources/TMDb/Models/PageableListResult.swift index 65958654..ec099823 100644 --- a/Sources/TMDb/Models/PageableListResult.swift +++ b/Sources/TMDb/Models/PageableListResult.swift @@ -1,3 +1,22 @@ +// +// PageableListResult.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Person.swift b/Sources/TMDb/Models/Person.swift index 53db9fa5..e78422ea 100644 --- a/Sources/TMDb/Models/Person.swift +++ b/Sources/TMDb/Models/Person.swift @@ -1,3 +1,22 @@ +// +// Person.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/PersonCombinedCredits.swift b/Sources/TMDb/Models/PersonCombinedCredits.swift index 14ce2198..6d75610c 100644 --- a/Sources/TMDb/Models/PersonCombinedCredits.swift +++ b/Sources/TMDb/Models/PersonCombinedCredits.swift @@ -1,3 +1,22 @@ +// +// PersonCombinedCredits.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/PersonExternalLinksCollection.swift b/Sources/TMDb/Models/PersonExternalLinksCollection.swift index 9a05c6be..8e2706fa 100644 --- a/Sources/TMDb/Models/PersonExternalLinksCollection.swift +++ b/Sources/TMDb/Models/PersonExternalLinksCollection.swift @@ -1,3 +1,22 @@ +// +// PersonExternalLinksCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -82,17 +101,17 @@ public struct PersonExternalLinksCollection: Identifiable, Codable, Equatable, H public static func == (lhs: PersonExternalLinksCollection, rhs: PersonExternalLinksCollection) -> Bool { lhs.id == rhs.id - && lhs.imdb == rhs.imdb - && lhs.wikiData == rhs.wikiData - && lhs.facebook == rhs.facebook - && lhs.instagram == rhs.instagram - && lhs.twitter == rhs.twitter - && lhs.tikTok == rhs.tikTok + && lhs.imdb == rhs.imdb + && lhs.wikiData == rhs.wikiData + && lhs.facebook == rhs.facebook + && lhs.instagram == rhs.instagram + && lhs.twitter == rhs.twitter + && lhs.tikTok == rhs.tikTok } } -extension PersonExternalLinksCollection { +public extension PersonExternalLinksCollection { private enum CodingKeys: String, CodingKey { case id @@ -104,7 +123,7 @@ extension PersonExternalLinksCollection { case tikTokID = "tiktokId" } - public init(from decoder: Decoder) throws { + init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let id = try container.decode(Person.ID.self, forKey: .id) @@ -134,7 +153,7 @@ extension PersonExternalLinksCollection { ) } - public func encode(to encoder: Encoder) throws { + func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) diff --git a/Sources/TMDb/Models/PersonImageCollection.swift b/Sources/TMDb/Models/PersonImageCollection.swift index a78bdfcc..4d67aec9 100644 --- a/Sources/TMDb/Models/PersonImageCollection.swift +++ b/Sources/TMDb/Models/PersonImageCollection.swift @@ -1,3 +1,22 @@ +// +// PersonImageCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/PersonMovieCredits.swift b/Sources/TMDb/Models/PersonMovieCredits.swift index a7d6b5d7..831e1c00 100644 --- a/Sources/TMDb/Models/PersonMovieCredits.swift +++ b/Sources/TMDb/Models/PersonMovieCredits.swift @@ -1,3 +1,22 @@ +// +// PersonMovieCredits.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/PersonPageableList.swift b/Sources/TMDb/Models/PersonPageableList.swift index ee0c5b77..8c31076d 100644 --- a/Sources/TMDb/Models/PersonPageableList.swift +++ b/Sources/TMDb/Models/PersonPageableList.swift @@ -1,3 +1,22 @@ +// +// PersonPageableList.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/PersonTVSeriesCredits.swift b/Sources/TMDb/Models/PersonTVSeriesCredits.swift index 3ce1773e..4f811a0c 100644 --- a/Sources/TMDb/Models/PersonTVSeriesCredits.swift +++ b/Sources/TMDb/Models/PersonTVSeriesCredits.swift @@ -1,3 +1,22 @@ +// +// PersonTVSeriesCredits.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ProductionCompany.swift b/Sources/TMDb/Models/ProductionCompany.swift index 74bb74e0..7ad08b18 100644 --- a/Sources/TMDb/Models/ProductionCompany.swift +++ b/Sources/TMDb/Models/ProductionCompany.swift @@ -1,3 +1,22 @@ +// +// ProductionCompany.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ProductionCountry.swift b/Sources/TMDb/Models/ProductionCountry.swift index 9a15302e..91c4489c 100644 --- a/Sources/TMDb/Models/ProductionCountry.swift +++ b/Sources/TMDb/Models/ProductionCountry.swift @@ -1,3 +1,22 @@ +// +// ProductionCountry.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Review.swift b/Sources/TMDb/Models/Review.swift index efc66b2c..3129ad38 100644 --- a/Sources/TMDb/Models/Review.swift +++ b/Sources/TMDb/Models/Review.swift @@ -1,3 +1,22 @@ +// +// Review.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ReviewPageableList.swift b/Sources/TMDb/Models/ReviewPageableList.swift index 93b2fd7f..d9f6053f 100644 --- a/Sources/TMDb/Models/ReviewPageableList.swift +++ b/Sources/TMDb/Models/ReviewPageableList.swift @@ -1,3 +1,22 @@ +// +// ReviewPageableList.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Show.swift b/Sources/TMDb/Models/Show.swift index 45edfeac..ce159723 100644 --- a/Sources/TMDb/Models/Show.swift +++ b/Sources/TMDb/Models/Show.swift @@ -1,3 +1,22 @@ +// +// Show.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -10,11 +29,11 @@ public enum Show: Identifiable, Codable, Equatable, Hashable { /// public var id: Int { switch self { - case .movie(let movie): - return movie.id + case let .movie(movie): + movie.id - case .tvSeries(let tvSeries): - return tvSeries.id + case let .tvSeries(tvSeries): + tvSeries.id } } @@ -23,11 +42,11 @@ public enum Show: Identifiable, Codable, Equatable, Hashable { /// var popularity: Double? { switch self { - case .movie(let movie): - return movie.popularity + case let .movie(movie): + movie.popularity - case .tvSeries(let tvSeries): - return tvSeries.popularity + case let .tvSeries(tvSeries): + tvSeries.popularity } } @@ -36,11 +55,11 @@ public enum Show: Identifiable, Codable, Equatable, Hashable { /// var date: Date? { switch self { - case .movie(let movie): - return movie.releaseDate + case let .movie(movie): + movie.releaseDate - case .tvSeries(let tvSeries): - return tvSeries.firstAirDate + case let .tvSeries(tvSeries): + tvSeries.firstAirDate } } @@ -73,10 +92,10 @@ extension Show { switch mediaType { case .movie: - self = .movie(try Movie(from: decoder)) + self = try .movie(Movie(from: decoder)) case .tvSeries: - self = .tvSeries(try TVSeries(from: decoder)) + self = try .tvSeries(TVSeries(from: decoder)) } } @@ -84,10 +103,10 @@ extension Show { var singleContainer = encoder.singleValueContainer() switch self { - case .movie(let movie): + case let .movie(movie): try singleContainer.encode(movie) - case .tvSeries(let tvSeries): + case let .tvSeries(tvSeries): try singleContainer.encode(tvSeries) } } diff --git a/Sources/TMDb/Models/ShowCredits.swift b/Sources/TMDb/Models/ShowCredits.swift index d8065094..719b4d66 100644 --- a/Sources/TMDb/Models/ShowCredits.swift +++ b/Sources/TMDb/Models/ShowCredits.swift @@ -1,3 +1,22 @@ +// +// ShowCredits.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/ShowWatchProviderResult.swift b/Sources/TMDb/Models/ShowWatchProviderResult.swift index 9eb28d45..cd948c10 100644 --- a/Sources/TMDb/Models/ShowWatchProviderResult.swift +++ b/Sources/TMDb/Models/ShowWatchProviderResult.swift @@ -1,8 +1,20 @@ // // ShowWatchProviderResult.swift +// TMDb // +// Copyright © 2023 Adam Young. // -// Created by Mikko Kuivanen on 5.9.2023. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // import Foundation diff --git a/Sources/TMDb/Models/SpokenLanguage.swift b/Sources/TMDb/Models/SpokenLanguage.swift index d8774e71..539ee4d8 100644 --- a/Sources/TMDb/Models/SpokenLanguage.swift +++ b/Sources/TMDb/Models/SpokenLanguage.swift @@ -1,3 +1,22 @@ +// +// SpokenLanguage.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/Status.swift b/Sources/TMDb/Models/Status.swift index 4c0b2494..ef824dd2 100644 --- a/Sources/TMDb/Models/Status.swift +++ b/Sources/TMDb/Models/Status.swift @@ -1,3 +1,22 @@ +// +// Status.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TMDbError+TMDbAPIError.swift b/Sources/TMDb/Models/TMDbError+TMDbAPIError.swift index e15508eb..e85d7cc2 100644 --- a/Sources/TMDb/Models/TMDbError+TMDbAPIError.swift +++ b/Sources/TMDb/Models/TMDbError+TMDbAPIError.swift @@ -1,3 +1,22 @@ +// +// TMDbError+TMDbAPIError.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension TMDbError { @@ -12,7 +31,7 @@ extension TMDbError { case .notFound: self = .notFound - case .network(let error): + case let .network(error): self = .network(error) default: diff --git a/Sources/TMDb/Models/TMDbError.swift b/Sources/TMDb/Models/TMDbError.swift index a141c32a..dd214759 100644 --- a/Sources/TMDb/Models/TMDbError.swift +++ b/Sources/TMDb/Models/TMDbError.swift @@ -1,3 +1,22 @@ +// +// TMDbError.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation public enum TMDbError: Equatable, LocalizedError { @@ -14,34 +33,34 @@ public enum TMDbError: Equatable, LocalizedError { public static func == (lhs: TMDbError, rhs: TMDbError) -> Bool { switch (lhs, rhs) { case (.notFound, .notFound): - return true + true case (.network, .network): - return true + true case (.unknown, .unknown): - return true + true default: - return false + false } } } -extension TMDbError { +public extension TMDbError { /// A localized message describing what error occurred. - public var errorDescription: String? { + var errorDescription: String? { switch self { case .notFound: - return "Not found" + "Not found" case .network: - return "Network error" + "Network error" case .unknown: - return "Unknown" + "Unknown" } } diff --git a/Sources/TMDb/Models/TVEpisode.swift b/Sources/TMDb/Models/TVEpisode.swift index 4d786dbf..082a8c29 100644 --- a/Sources/TMDb/Models/TVEpisode.swift +++ b/Sources/TMDb/Models/TVEpisode.swift @@ -1,3 +1,22 @@ +// +// TVEpisode.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TVEpisodeImageCollection.swift b/Sources/TMDb/Models/TVEpisodeImageCollection.swift index e0be9dc8..2addd4f0 100644 --- a/Sources/TMDb/Models/TVEpisodeImageCollection.swift +++ b/Sources/TMDb/Models/TVEpisodeImageCollection.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeImageCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TVSeason.swift b/Sources/TMDb/Models/TVSeason.swift index c5af942a..e180d261 100644 --- a/Sources/TMDb/Models/TVSeason.swift +++ b/Sources/TMDb/Models/TVSeason.swift @@ -1,3 +1,22 @@ +// +// TVSeason.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TVSeasonImageCollection.swift b/Sources/TMDb/Models/TVSeasonImageCollection.swift index b933eea6..5b976947 100644 --- a/Sources/TMDb/Models/TVSeasonImageCollection.swift +++ b/Sources/TMDb/Models/TVSeasonImageCollection.swift @@ -1,3 +1,22 @@ +// +// TVSeasonImageCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TVSeries.swift b/Sources/TMDb/Models/TVSeries.swift index 0956b562..05b9c034 100644 --- a/Sources/TMDb/Models/TVSeries.swift +++ b/Sources/TMDb/Models/TVSeries.swift @@ -1,3 +1,22 @@ +// +// TVSeries.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TVSeriesExternalLinksCollection.swift b/Sources/TMDb/Models/TVSeriesExternalLinksCollection.swift index 8c4c6740..707110b1 100644 --- a/Sources/TMDb/Models/TVSeriesExternalLinksCollection.swift +++ b/Sources/TMDb/Models/TVSeriesExternalLinksCollection.swift @@ -1,3 +1,22 @@ +// +// TVSeriesExternalLinksCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -73,16 +92,16 @@ public struct TVSeriesExternalLinksCollection: Identifiable, Codable, Equatable, public static func == (lhs: TVSeriesExternalLinksCollection, rhs: TVSeriesExternalLinksCollection) -> Bool { lhs.id == rhs.id - && lhs.imdb == rhs.imdb - && lhs.wikiData == rhs.wikiData - && lhs.facebook == rhs.facebook - && lhs.instagram == rhs.instagram - && lhs.twitter == rhs.twitter + && lhs.imdb == rhs.imdb + && lhs.wikiData == rhs.wikiData + && lhs.facebook == rhs.facebook + && lhs.instagram == rhs.instagram + && lhs.twitter == rhs.twitter } } -extension TVSeriesExternalLinksCollection { +public extension TVSeriesExternalLinksCollection { private enum CodingKeys: String, CodingKey { case id @@ -93,7 +112,7 @@ extension TVSeriesExternalLinksCollection { case twitterID = "twitterId" } - public init(from decoder: Decoder) throws { + init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let id = try container.decode(TVSeries.ID.self, forKey: .id) @@ -120,7 +139,7 @@ extension TVSeriesExternalLinksCollection { ) } - public func encode(to encoder: Encoder) throws { + func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) diff --git a/Sources/TMDb/Models/TVSeriesPageableList.swift b/Sources/TMDb/Models/TVSeriesPageableList.swift index 303a4150..68604d41 100644 --- a/Sources/TMDb/Models/TVSeriesPageableList.swift +++ b/Sources/TMDb/Models/TVSeriesPageableList.swift @@ -1,3 +1,22 @@ +// +// TVSeriesPageableList.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TVSeriesSort.swift b/Sources/TMDb/Models/TVSeriesSort.swift index bd3c43be..24bab6a1 100644 --- a/Sources/TMDb/Models/TVSeriesSort.swift +++ b/Sources/TMDb/Models/TVSeriesSort.swift @@ -1,3 +1,22 @@ +// +// TVSeriesSort.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -37,26 +56,26 @@ extension TVSeriesSort { private var fieldName: String { switch self { case .popularity: - return FieldName.popularity + FieldName.popularity case .firstAirDate: - return FieldName.firstAirDate + FieldName.firstAirDate case .voteAverage: - return FieldName.voteAverage + FieldName.voteAverage } } private var isDescending: Bool { switch self { - case .popularity(let descending): - return descending + case let .popularity(descending): + descending - case .firstAirDate(let descending): - return descending + case let .firstAirDate(descending): + descending - case .voteAverage(let descending): - return descending + case let .voteAverage(descending): + descending } } diff --git a/Sources/TMDb/Models/TikTokLink.swift b/Sources/TMDb/Models/TikTokLink.swift index 983a60a3..23ba3710 100644 --- a/Sources/TMDb/Models/TikTokLink.swift +++ b/Sources/TMDb/Models/TikTokLink.swift @@ -1,3 +1,22 @@ +// +// TikTokLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/TwitterLink.swift b/Sources/TMDb/Models/TwitterLink.swift index b26171da..66eab721 100644 --- a/Sources/TMDb/Models/TwitterLink.swift +++ b/Sources/TMDb/Models/TwitterLink.swift @@ -1,3 +1,22 @@ +// +// TwitterLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/VideoCollection.swift b/Sources/TMDb/Models/VideoCollection.swift index 1343f13b..ae091951 100644 --- a/Sources/TMDb/Models/VideoCollection.swift +++ b/Sources/TMDb/Models/VideoCollection.swift @@ -1,3 +1,22 @@ +// +// VideoCollection.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/VideoMetadata.swift b/Sources/TMDb/Models/VideoMetadata.swift index 97756e0f..f20df297 100644 --- a/Sources/TMDb/Models/VideoMetadata.swift +++ b/Sources/TMDb/Models/VideoMetadata.swift @@ -1,3 +1,22 @@ +// +// VideoMetadata.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/VideoSize.swift b/Sources/TMDb/Models/VideoSize.swift index 9f6e0b0a..878ffd07 100644 --- a/Sources/TMDb/Models/VideoSize.swift +++ b/Sources/TMDb/Models/VideoSize.swift @@ -1,3 +1,22 @@ +// +// VideoSize.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/VideoType.swift b/Sources/TMDb/Models/VideoType.swift index 36a34371..9f77cbc1 100644 --- a/Sources/TMDb/Models/VideoType.swift +++ b/Sources/TMDb/Models/VideoType.swift @@ -1,3 +1,22 @@ +// +// VideoType.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/WatchProvider.swift b/Sources/TMDb/Models/WatchProvider.swift index d4bd7afa..268b1e23 100644 --- a/Sources/TMDb/Models/WatchProvider.swift +++ b/Sources/TMDb/Models/WatchProvider.swift @@ -1,3 +1,22 @@ +// +// WatchProvider.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Models/WatchProviderRegions.swift b/Sources/TMDb/Models/WatchProviderRegions.swift index bbfc2b41..5744f337 100644 --- a/Sources/TMDb/Models/WatchProviderRegions.swift +++ b/Sources/TMDb/Models/WatchProviderRegions.swift @@ -1,3 +1,22 @@ +// +// WatchProviderRegions.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation struct WatchProviderRegions: Decodable { diff --git a/Sources/TMDb/Models/WatchProviderResult.swift b/Sources/TMDb/Models/WatchProviderResult.swift index 3f40c402..441ccbdc 100644 --- a/Sources/TMDb/Models/WatchProviderResult.swift +++ b/Sources/TMDb/Models/WatchProviderResult.swift @@ -1,3 +1,22 @@ +// +// WatchProviderResult.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation struct WatchProviderResult: Decodable, Equatable { diff --git a/Sources/TMDb/Models/WikiDataLink.swift b/Sources/TMDb/Models/WikiDataLink.swift index f4c0f2dc..65632bff 100644 --- a/Sources/TMDb/Models/WikiDataLink.swift +++ b/Sources/TMDb/Models/WikiDataLink.swift @@ -1,3 +1,22 @@ +// +// WikiDataLink.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Movies/Endpoints/MoviesEndpoint.swift b/Sources/TMDb/Movies/Endpoints/MoviesEndpoint.swift index d633ac95..49491d2e 100644 --- a/Sources/TMDb/Movies/Endpoints/MoviesEndpoint.swift +++ b/Sources/TMDb/Movies/Endpoints/MoviesEndpoint.swift @@ -1,3 +1,22 @@ +// +// MoviesEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum MoviesEndpoint { @@ -24,72 +43,72 @@ extension MoviesEndpoint: Endpoint { var path: URL { switch self { - case .details(let movieID): - return Self.basePath + case let .details(movieID): + Self.basePath .appendingPathComponent(movieID) - case .credits(let movieID): - return Self.basePath + case let .credits(movieID): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("credits") - case .reviews(let movieID, let page): - return Self.basePath + case let .reviews(movieID, page): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("reviews") .appendingPage(page) - case .images(let movieID, let languageCode): - return Self.basePath + case let .images(movieID, languageCode): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("images") .appendingImageLanguage(languageCode) - case .videos(let movieID, let languageCode): - return Self.basePath + case let .videos(movieID, languageCode): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("videos") .appendingVideoLanguage(languageCode) - case .recommendations(let movieID, let page): - return Self.basePath + case let .recommendations(movieID, page): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("recommendations") .appendingPage(page) - case .similar(let movieID, let page): - return Self.basePath + case let .similar(movieID, page): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("similar") .appendingPage(page) - case .nowPlaying(let page): - return Self.basePath + case let .nowPlaying(page): + Self.basePath .appendingPathComponent("now_playing") .appendingPage(page) - case .popular(let page): - return Self.basePath + case let .popular(page): + Self.basePath .appendingPathComponent("popular") .appendingPage(page) - case .topRated(let page): - return Self.basePath + case let .topRated(page): + Self.basePath .appendingPathComponent("top_rated") .appendingPage(page) - case .upcoming(let page): - return Self.basePath + case let .upcoming(page): + Self.basePath .appendingPathComponent("upcoming") .appendingPage(page) - case .watch(let movieID): - return Self.basePath + case let .watch(movieID): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("watch/providers") - case .externalIDs(let movieID): - return Self.basePath + case let .externalIDs(movieID): + Self.basePath .appendingPathComponent(movieID) .appendingPathComponent("external_ids") } diff --git a/Sources/TMDb/Movies/MovieService.swift b/Sources/TMDb/Movies/MovieService.swift index bcb08a00..844d6bc1 100644 --- a/Sources/TMDb/Movies/MovieService.swift +++ b/Sources/TMDb/Movies/MovieService.swift @@ -1,3 +1,22 @@ +// +// MovieService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -35,7 +54,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The matching movie. - /// + /// public func details(forMovie id: Movie.ID) async throws -> Movie { let movie: Movie do { @@ -58,7 +77,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Credits for the matching movie. - /// + /// public func credits(forMovie movieID: Movie.ID) async throws -> ShowCredits { let credits: ShowCredits do { @@ -84,7 +103,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Reviews for the matching movie as a pageable list. - /// + /// public func reviews(forMovie movieID: Movie.ID, page: Int? = nil) async throws -> ReviewPageableList { let reviewList: ReviewPageableList do { @@ -107,7 +126,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Collection of images for the matching movie. - /// + /// public func images(forMovie movieID: Movie.ID) async throws -> ImageCollection { let languageCode = localeProvider.languageCode let imageCollection: ImageCollection @@ -162,7 +181,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Recommended movies for the matching movie as a pageable list. - /// + /// public func recommendations(forMovie movieID: Movie.ID, page: Int? = nil) async throws -> MoviePageableList { let movieList: MoviePageableList do { @@ -190,7 +209,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Similar movies for the matching movie as a pageable list. - /// + /// public func similar(toMovie movieID: Movie.ID, page: Int? = nil) async throws -> MoviePageableList { let movieList: MoviePageableList do { @@ -215,7 +234,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Now playing movies as a pageable list. - /// + /// public func nowPlaying(page: Int? = nil) async throws -> MoviePageableList { let movieList: MoviePageableList do { @@ -240,7 +259,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Current popular movies as a pageable list. - /// + /// public func popular(page: Int? = nil) async throws -> MoviePageableList { let movieList: MoviePageableList do { @@ -265,7 +284,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Top rated movies as a pageable list. - /// + /// public func topRated(page: Int? = nil) async throws -> MoviePageableList { let movieList: MoviePageableList do { @@ -290,7 +309,7 @@ public final class MovieService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Upcoming movies as a pageable list. - /// + /// public func upcoming(page: Int? = nil) async throws -> MoviePageableList { let movieList: MoviePageableList do { @@ -327,7 +346,7 @@ public final class MovieService { return result.results[regionCode] } - /// + /// /// Returns a collection of media databases and social links for a movie. /// /// [TMDb API - Movie: External IDs](https://developer.themoviedb.org/reference/movie-external-ids) diff --git a/Sources/TMDb/Networking/APIClient/APIClient.swift b/Sources/TMDb/Networking/APIClient/APIClient.swift index 727bf1f6..eb9826a4 100644 --- a/Sources/TMDb/Networking/APIClient/APIClient.swift +++ b/Sources/TMDb/Networking/APIClient/APIClient.swift @@ -1,3 +1,22 @@ +// +// APIClient.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation protocol APIClient { diff --git a/Sources/TMDb/Networking/APIClient/Endpoint.swift b/Sources/TMDb/Networking/APIClient/Endpoint.swift index 6c8649b1..81daf192 100644 --- a/Sources/TMDb/Networking/APIClient/Endpoint.swift +++ b/Sources/TMDb/Networking/APIClient/Endpoint.swift @@ -1,3 +1,22 @@ +// +// Endpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation protocol Endpoint { diff --git a/Sources/TMDb/Networking/APIClient/HTTPResponse.swift b/Sources/TMDb/Networking/APIClient/HTTPResponse.swift index 4c58d8cb..b3876ab4 100644 --- a/Sources/TMDb/Networking/APIClient/HTTPResponse.swift +++ b/Sources/TMDb/Networking/APIClient/HTTPResponse.swift @@ -1,3 +1,22 @@ +// +// HTTPResponse.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Networking/APIClient/Serialiser.swift b/Sources/TMDb/Networking/APIClient/Serialiser.swift index 982bfd1d..42be5b12 100644 --- a/Sources/TMDb/Networking/APIClient/Serialiser.swift +++ b/Sources/TMDb/Networking/APIClient/Serialiser.swift @@ -1,3 +1,22 @@ +// +// Serialiser.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation actor Serialiser { diff --git a/Sources/TMDb/Networking/APIClient/TMDbAPIClient.swift b/Sources/TMDb/Networking/APIClient/TMDbAPIClient.swift index bfaa28e3..41611c22 100644 --- a/Sources/TMDb/Networking/APIClient/TMDbAPIClient.swift +++ b/Sources/TMDb/Networking/APIClient/TMDbAPIClient.swift @@ -1,3 +1,22 @@ +// +// TMDbAPIClient.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation final class TMDbAPIClient: APIClient { @@ -32,7 +51,7 @@ final class TMDbAPIClient: APIClient { do { response = try await httpClient.get(url: url, headers: headers) - } catch { + } catch let error { throw TMDbAPIError.network(error) } @@ -72,7 +91,7 @@ extension TMDbAPIClient { private func validate(response: HTTPResponse) async throws { let statusCode = response.statusCode - if (200...299).contains(statusCode) { + if (200 ... 299).contains(statusCode) { return } diff --git a/Sources/TMDb/Networking/APIClient/TMDbAPIError+HTTPStatusCode.swift b/Sources/TMDb/Networking/APIClient/TMDbAPIError+HTTPStatusCode.swift index 90bdab5b..ef73d2fd 100644 --- a/Sources/TMDb/Networking/APIClient/TMDbAPIError+HTTPStatusCode.swift +++ b/Sources/TMDb/Networking/APIClient/TMDbAPIError+HTTPStatusCode.swift @@ -1,3 +1,22 @@ +// +// TMDbAPIError+HTTPStatusCode.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension TMDbAPIError { diff --git a/Sources/TMDb/Networking/APIClient/TMDbAPIError.swift b/Sources/TMDb/Networking/APIClient/TMDbAPIError.swift index bd7dc61a..f7c70ed0 100644 --- a/Sources/TMDb/Networking/APIClient/TMDbAPIError.swift +++ b/Sources/TMDb/Networking/APIClient/TMDbAPIError.swift @@ -1,3 +1,22 @@ +// +// TMDbAPIError.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Networking/APIClient/TMDbStatusResponse.swift b/Sources/TMDb/Networking/APIClient/TMDbStatusResponse.swift index c9d3cca9..90832767 100644 --- a/Sources/TMDb/Networking/APIClient/TMDbStatusResponse.swift +++ b/Sources/TMDb/Networking/APIClient/TMDbStatusResponse.swift @@ -1,3 +1,22 @@ +// +// TMDbStatusResponse.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation struct TMDbStatusResponse: Decodable { diff --git a/Sources/TMDb/Networking/HTTPClient/HTTPClient.swift b/Sources/TMDb/Networking/HTTPClient/HTTPClient.swift index b1b58270..38fa56ed 100644 --- a/Sources/TMDb/Networking/HTTPClient/HTTPClient.swift +++ b/Sources/TMDb/Networking/HTTPClient/HTTPClient.swift @@ -1,3 +1,22 @@ +// +// HTTPClient.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/Networking/HTTPClient/URLSessionHTTPClientAdapter.swift b/Sources/TMDb/Networking/HTTPClient/URLSessionHTTPClientAdapter.swift index ffff651f..cb6ae68a 100644 --- a/Sources/TMDb/Networking/HTTPClient/URLSessionHTTPClientAdapter.swift +++ b/Sources/TMDb/Networking/HTTPClient/URLSessionHTTPClientAdapter.swift @@ -1,6 +1,25 @@ +// +// URLSessionHTTPClientAdapter.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif final class URLSessionHTTPClientAdapter: HTTPClient { @@ -40,28 +59,28 @@ final class URLSessionHTTPClientAdapter: HTTPClient { extension URLSessionHTTPClientAdapter { #if canImport(FoundationNetworking) - private func perform(_ urlRequest: URLRequest) async throws -> (Data, URLResponse) { - return try await withCheckedThrowingContinuation { continuation in - urlSession.dataTask(with: urlRequest) { data, response, error in - if let error { - continuation.resume(throwing: error) - return - } + private func perform(_ urlRequest: URLRequest) async throws -> (Data, URLResponse) { + try await withCheckedThrowingContinuation { continuation in + urlSession.dataTask(with: urlRequest) { data, response, error in + if let error { + continuation.resume(throwing: error) + return + } - guard let data, let response else { - continuation.resume(throwing: NSError(domain: "uk.co.adam-young.TMDb", code: -1)) - return - } + guard let data, let response else { + continuation.resume(throwing: NSError(domain: "uk.co.adam-young.TMDb", code: -1)) + return + } - continuation.resume(returning: (data, response)) + continuation.resume(returning: (data, response)) + } + .resume() } - .resume() } - } #else - private func perform(_ urlRequest: URLRequest) async throws -> (Data, URLResponse) { - try await urlSession.data(for: urlRequest) - } + private func perform(_ urlRequest: URLRequest) async throws -> (Data, URLResponse) { + try await urlSession.data(for: urlRequest) + } #endif } diff --git a/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift b/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift index b8fbcbd4..ad7872de 100644 --- a/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift +++ b/Sources/TMDb/People/Endpoints/PeopleEndpoint.swift @@ -1,3 +1,22 @@ +// +// PeopleEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum PeopleEndpoint { @@ -18,37 +37,37 @@ extension PeopleEndpoint: Endpoint { var path: URL { switch self { - case .details(let personID): - return Self.basePath + case let .details(personID): + Self.basePath .appendingPathComponent(personID) - case .combinedCredits(let personID): - return Self.basePath + case let .combinedCredits(personID): + Self.basePath .appendingPathComponent(personID) .appendingPathComponent("combined_credits") - case .movieCredits(let personID): - return Self.basePath + case let .movieCredits(personID): + Self.basePath .appendingPathComponent(personID) .appendingPathComponent("movie_credits") - case .tvSeriesCredits(let personID): - return Self.basePath + case let .tvSeriesCredits(personID): + Self.basePath .appendingPathComponent(personID) .appendingPathComponent("tv_credits") - case .images(let personID): - return Self.basePath + case let .images(personID): + Self.basePath .appendingPathComponent(personID) .appendingPathComponent("images") - case .popular(let page): - return Self.basePath + case let .popular(page): + Self.basePath .appendingPathComponent("popular") .appendingPage(page) - case .externalIDs(let personID): - return Self.basePath + case let .externalIDs(personID): + Self.basePath .appendingPathComponent(personID) .appendingPathComponent("external_ids") } diff --git a/Sources/TMDb/People/PersonService.swift b/Sources/TMDb/People/PersonService.swift index 35536b09..59b60205 100644 --- a/Sources/TMDb/People/PersonService.swift +++ b/Sources/TMDb/People/PersonService.swift @@ -1,3 +1,22 @@ +// +// PersonService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -34,7 +53,7 @@ public final class PersonService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The matching person. - /// + /// public func details(forPerson id: Person.ID) async throws -> Person { let person: Person do { @@ -57,7 +76,7 @@ public final class PersonService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The matching person's combined movie and TV series credits. - /// + /// public func combinedCredits(forPerson personID: Person.ID) async throws -> PersonCombinedCredits { let credits: PersonCombinedCredits do { @@ -80,7 +99,7 @@ public final class PersonService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The matching person's movie credits. - /// + /// public func movieCredits(forPerson personID: Person.ID) async throws -> PersonMovieCredits { let credits: PersonMovieCredits do { @@ -103,7 +122,7 @@ public final class PersonService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The matching person's TV series credits. - /// + /// public func tvSeriesCredits(forPerson personID: Person.ID) async throws -> PersonTVSeriesCredits { let credits: PersonTVSeriesCredits do { @@ -147,7 +166,7 @@ public final class PersonService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: The matching person's show credits. - /// + /// public func knownFor(forPerson personID: Person.ID) async throws -> [Show] { let credits: PersonCombinedCredits do { diff --git a/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift b/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift index f65cb47e..e7c1264c 100644 --- a/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift +++ b/Sources/TMDb/Search/Endpoints/SearchEndpoint.swift @@ -1,3 +1,22 @@ +// +// SearchEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum SearchEndpoint { @@ -19,29 +38,28 @@ extension SearchEndpoint: Endpoint { var path: URL { switch self { - - case .multi(let query, let page): - return Self.basePath + case let .multi(query, page): + Self.basePath .appendingPathComponent("multi") .appendingQueryItem(name: QueryItemName.query, value: query) .appendingPage(page) - case .movies(let query, let year, let page): - return Self.basePath + case let .movies(query, year, page): + Self.basePath .appendingPathComponent("movie") .appendingQueryItem(name: QueryItemName.query, value: query) .appendingYear(year) .appendingPage(page) - case .tvSeries(let query, let firstAirDateYear, let page): - return Self.basePath + case let .tvSeries(query, firstAirDateYear, page): + Self.basePath .appendingPathComponent("tv") .appendingQueryItem(name: QueryItemName.query, value: query) .appendingFirstAirDateYear(firstAirDateYear) .appendingPage(page) - case .people(let query, let page): - return Self.basePath + case let .people(query, page): + Self.basePath .appendingPathComponent("person") .appendingQueryItem(name: QueryItemName.query, value: query) .appendingPage(page) diff --git a/Sources/TMDb/Search/SearchService.swift b/Sources/TMDb/Search/SearchService.swift index abe45802..6491664a 100644 --- a/Sources/TMDb/Search/SearchService.swift +++ b/Sources/TMDb/Search/SearchService.swift @@ -1,3 +1,22 @@ +// +// SearchService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -35,7 +54,7 @@ public final class SearchService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Movies, TV series and people matching the query. - /// + /// public func searchAll(query: String, page: Int? = nil) async throws -> MediaPageableList { let mediaList: MediaPageableList do { @@ -90,8 +109,11 @@ public final class SearchService { /// /// - Returns: TV series matching the query. /// - public func searchTVSeries(query: String, firstAirDateYear: Int? = nil, - page: Int? = nil) async throws -> TVSeriesPageableList { + public func searchTVSeries( + query: String, + firstAirDateYear: Int? = nil, + page: Int? = nil + ) async throws -> TVSeriesPageableList { let tvSeriesList: TVSeriesPageableList do { tvSeriesList = try await apiClient.get( diff --git a/Sources/TMDb/TMDb.swift b/Sources/TMDb/TMDb.swift index 306ba8e9..14c972dd 100644 --- a/Sources/TMDb/TMDb.swift +++ b/Sources/TMDb/TMDb.swift @@ -1,3 +1,22 @@ +// +// TMDb.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -6,7 +25,7 @@ import Foundation @available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11.0, *) public final class TMDb { - static private(set) var configuration = TMDbConfiguration( + private(set) static var configuration = TMDbConfiguration( apiKey: { preconditionFailure("Configuration must first be set by calling TMDb.configure(_:).") }, @@ -15,7 +34,7 @@ public final class TMDb { } ) - private init() { } + private init() {} /// /// Sets the configuration to be used with TMDb services. diff --git a/Sources/TMDb/TMDbConfiguration.swift b/Sources/TMDb/TMDbConfiguration.swift index 7496a4fd..f205bfc2 100644 --- a/Sources/TMDb/TMDbConfiguration.swift +++ b/Sources/TMDb/TMDbConfiguration.swift @@ -1,3 +1,22 @@ +// +// TMDbConfiguration.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// diff --git a/Sources/TMDb/TMDbFactory.swift b/Sources/TMDb/TMDbFactory.swift index 898991aa..e7431eef 100644 --- a/Sources/TMDb/TMDbFactory.swift +++ b/Sources/TMDb/TMDbFactory.swift @@ -1,11 +1,30 @@ +// +// TMDbFactory.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif final class TMDbFactory { - private init() { } + private init() {} } @@ -45,17 +64,17 @@ extension TMDbFactory { configuration.timeoutIntervalForRequest = 30 #if !canImport(FoundationNetworking) - configuration.waitsForConnectivity = true - configuration.urlCache = urlCache + configuration.waitsForConnectivity = true + configuration.urlCache = urlCache #endif return configuration } #if !canImport(FoundationNetworking) - private static var urlCache: URLCache { - URLCache(memoryCapacity: 50_000_000, diskCapacity: 1_000_000_000) - } + private static var urlCache: URLCache { + URLCache(memoryCapacity: 50_000_000, diskCapacity: 1_000_000_000) + } #endif private static var serialiser: some Serialiser { diff --git a/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift b/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift index c2f0fb8b..3de8e141 100644 --- a/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift +++ b/Sources/TMDb/TVEpisodes/Endpoints/TVEpisodesEndpoint.swift @@ -1,3 +1,22 @@ +// +// TVEpisodesEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum TVEpisodesEndpoint { @@ -17,22 +36,22 @@ extension TVEpisodesEndpoint: Endpoint { var path: URL { switch self { - case .details(let tvSeriesID, let seasonNumber, let episodeNumber): - return Self.basePath(for: tvSeriesID) + case let .details(tvSeriesID, seasonNumber, episodeNumber): + Self.basePath(for: tvSeriesID) .appendingPathComponent(seasonNumber) .appendingPathComponent("episode") .appendingPathComponent(episodeNumber) - case .images(let tvSeriesID, let seasonNumber, let episodeNumber, let languageCode): - return Self.basePath(for: tvSeriesID) + case let .images(tvSeriesID, seasonNumber, episodeNumber, languageCode): + Self.basePath(for: tvSeriesID) .appendingPathComponent(seasonNumber) .appendingPathComponent("episode") .appendingPathComponent(episodeNumber) .appendingPathComponent("images") .appendingImageLanguage(languageCode) - case .videos(let tvSeriesID, let seasonNumber, let episodeNumber, let languageCode): - return Self.basePath(for: tvSeriesID) + case let .videos(tvSeriesID, seasonNumber, episodeNumber, languageCode): + Self.basePath(for: tvSeriesID) .appendingPathComponent(seasonNumber) .appendingPathComponent("episode") .appendingPathComponent(episodeNumber) diff --git a/Sources/TMDb/TVEpisodes/TVEpisodeService.swift b/Sources/TMDb/TVEpisodes/TVEpisodeService.swift index 92e682c1..55b36dc5 100644 --- a/Sources/TMDb/TVEpisodes/TVEpisodeService.swift +++ b/Sources/TMDb/TVEpisodes/TVEpisodeService.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -38,8 +57,11 @@ public final class TVEpisodeService { /// /// - Returns: A episode of the matching TV series. /// - public func details(forEpisode episodeNumber: Int, inSeason seasonNumber: Int, - inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVEpisode { + public func details( + forEpisode episodeNumber: Int, + inSeason seasonNumber: Int, + inTVSeries tvSeriesID: TVSeries.ID + ) async throws -> TVEpisode { let episode: TVEpisode do { episode = try await apiClient.get( @@ -70,8 +92,11 @@ public final class TVEpisodeService { /// /// - Returns: A collection of images for the matching TV's episode. /// - public func images(forEpisode episodeNumber: Int, inSeason seasonNumber: Int, - inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVEpisodeImageCollection { + public func images( + forEpisode episodeNumber: Int, + inSeason seasonNumber: Int, + inTVSeries tvSeriesID: TVSeries.ID + ) async throws -> TVEpisodeImageCollection { let languageCode = localeProvider.languageCode let imageCollection: TVEpisodeImageCollection do { @@ -104,8 +129,11 @@ public final class TVEpisodeService { /// /// - Returns: A collection of videos for the matching TV's episode. /// - public func videos(forEpisode episodeNumber: Int, inSeason seasonNumber: Int, - inTVSeries tvSeriesID: TVSeries.ID) async throws -> VideoCollection { + public func videos( + forEpisode episodeNumber: Int, + inSeason seasonNumber: Int, + inTVSeries tvSeriesID: TVSeries.ID + ) async throws -> VideoCollection { let languageCode = localeProvider.languageCode let videoCollection: VideoCollection do { diff --git a/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift b/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift index 15b59391..0f28a6a0 100644 --- a/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift +++ b/Sources/TMDb/TVSeasons/Endpoints/TVSeasonsEndpoint.swift @@ -1,3 +1,22 @@ +// +// TVSeasonsEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum TVSeasonsEndpoint { @@ -17,18 +36,18 @@ extension TVSeasonsEndpoint: Endpoint { var path: URL { switch self { - case .details(let tvSeriesID, let seasonNumber): - return Self.basePath(for: tvSeriesID) + case let .details(tvSeriesID, seasonNumber): + Self.basePath(for: tvSeriesID) .appendingPathComponent(seasonNumber) - case .images(let tvSeriesID, let seasonNumber, let languageCode): - return Self.basePath(for: tvSeriesID) + case let .images(tvSeriesID, seasonNumber, languageCode): + Self.basePath(for: tvSeriesID) .appendingPathComponent(seasonNumber) .appendingPathComponent("images") .appendingImageLanguage(languageCode) - case .videos(let tvSeriesID, let seasonNumber, let languageCode): - return Self.basePath(for: tvSeriesID) + case let .videos(tvSeriesID, seasonNumber, languageCode): + Self.basePath(for: tvSeriesID) .appendingPathComponent(seasonNumber) .appendingPathComponent("videos") .appendingVideoLanguage(languageCode) diff --git a/Sources/TMDb/TVSeasons/TVSeasonService.swift b/Sources/TMDb/TVSeasons/TVSeasonService.swift index 7c0631fb..09edc5df 100644 --- a/Sources/TMDb/TVSeasons/TVSeasonService.swift +++ b/Sources/TMDb/TVSeasons/TVSeasonService.swift @@ -1,3 +1,22 @@ +// +// TVSeasonService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -63,14 +82,19 @@ public final class TVSeasonService { /// /// - Returns: A collection of images for the matching TV's season. /// - public func images(forSeason seasonNumber: Int, - inTVSeries tvSeriesID: TVSeries.ID) async throws -> TVSeasonImageCollection { + public func images( + forSeason seasonNumber: Int, + inTVSeries tvSeriesID: TVSeries.ID + ) async throws -> TVSeasonImageCollection { let languageCode = localeProvider.languageCode let imageCollection: TVSeasonImageCollection do { imageCollection = try await apiClient.get( - endpoint: TVSeasonsEndpoint.images(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, - languageCode: languageCode) + endpoint: TVSeasonsEndpoint.images( + tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + languageCode: languageCode + ) ) } catch let error { throw TMDbError(error: error) @@ -92,14 +116,19 @@ public final class TVSeasonService { /// /// - Returns: A collection of videos for the matching TV series season. /// - public func videos(forSeason seasonNumber: Int, - inTVSeries tvSeriesID: TVSeries.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: TVSeasonsEndpoint.videos(tvSeriesID: tvSeriesID, 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 index 6eda6fb2..8a5ee96d 100644 --- a/Sources/TMDb/TVSeries/Endpoints/TVSeriesEndpoint.swift +++ b/Sources/TMDb/TVSeries/Endpoints/TVSeriesEndpoint.swift @@ -1,3 +1,22 @@ +// +// TVSeriesEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum TVSeriesEndpoint { @@ -21,57 +40,57 @@ extension TVSeriesEndpoint: Endpoint { var path: URL { switch self { - case .details(let tvSeriesID): - return Self.basePath + case let .details(tvSeriesID): + Self.basePath .appendingPathComponent(tvSeriesID) - case .credits(let tvSeriesID): - return Self.basePath + case let .credits(tvSeriesID): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("credits") - case .reviews(let tvSeriesID, let page): - return Self.basePath + case let .reviews(tvSeriesID, page): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("reviews") .appendingPage(page) - case .images(let tvSeriesID, let languageCode): - return Self.basePath + case let .images(tvSeriesID, languageCode): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("images") .appendingImageLanguage(languageCode) - case .videos(let tvSeriesID, let languageCode): - return Self.basePath + case let .videos(tvSeriesID, languageCode): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("videos") .appendingVideoLanguage(languageCode) - case .recommendations(let tvSeriesID, let page): - return Self.basePath + case let .recommendations(tvSeriesID, page): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("recommendations") .appendingPage(page) - case .similar(let tvSeriesID, let page): - return Self.basePath + case let .similar(tvSeriesID, page): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("similar") .appendingPage(page) - case .popular(let page): - return Self.basePath + case let .popular(page): + Self.basePath .appendingPathComponent("popular") .appendingPage(page) - case .watch(let tvSeriesID): - return Self.basePath + case let .watch(tvSeriesID): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("watch/providers") - case .externalIDs(let tvSeriesID): - return Self.basePath + case let .externalIDs(tvSeriesID): + Self.basePath .appendingPathComponent(tvSeriesID) .appendingPathComponent("external_ids") } diff --git a/Sources/TMDb/TVSeries/TVSeriesService.swift b/Sources/TMDb/TVSeries/TVSeriesService.swift index 10e4ed06..d04ddad3 100644 --- a/Sources/TMDb/TVSeries/TVSeriesService.swift +++ b/Sources/TMDb/TVSeries/TVSeriesService.swift @@ -1,3 +1,22 @@ +// +// TVSeriesService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -58,7 +77,7 @@ public final class TVSeriesService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Show credits for the matching TV series. - /// + /// public func credits(forTVSeries tvSeriesID: TVSeries.ID) async throws -> ShowCredits { let credits: ShowCredits do { @@ -84,7 +103,7 @@ public final class TVSeriesService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Reviews for the matching TV series as a pageable list. - /// + /// public func reviews(forTVSeries tvSeriesID: TVSeries.ID, page: Int? = nil) async throws -> ReviewPageableList { let reviewList: ReviewPageableList do { @@ -163,8 +182,10 @@ public final class TVSeriesService { /// /// - Returns: Recommended TV series for the matching TV series as a pageable list. /// - public func recommendations(forTVSeries tvSeriesID: TVSeries.ID, - page: Int? = nil) async throws -> TVSeriesPageableList { + public func recommendations( + forTVSeries tvSeriesID: TVSeries.ID, + page: Int? = nil + ) async throws -> TVSeriesPageableList { let tvSeriesList: TVSeriesPageableList do { tvSeriesList = try await apiClient.get( @@ -193,7 +214,7 @@ public final class TVSeriesService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Similar TV series for the matching TV series as a pageable list. - /// + /// public func similar(toTVSeries tvSeriesID: TVSeries.ID, page: Int? = nil) async throws -> TVSeriesPageableList { let tvSeriesList: TVSeriesPageableList do { diff --git a/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift b/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift index d41ed1a0..b289c652 100644 --- a/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift +++ b/Sources/TMDb/Trending/Endpoints/TrendingEndpoint.swift @@ -1,3 +1,22 @@ +// +// TrendingEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum TrendingEndpoint { @@ -14,20 +33,20 @@ extension TrendingEndpoint: Endpoint { var path: URL { switch self { - case .movies(let timeWindow, let page): - return Self.basePath + case let .movies(timeWindow, page): + Self.basePath .appendingPathComponent("movie") .appendingPathComponent(timeWindow) .appendingPage(page) - case .tvSeries(let timeWindow, let page): - return Self.basePath + case let .tvSeries(timeWindow, page): + Self.basePath .appendingPathComponent("tv") .appendingPathComponent(timeWindow) .appendingPage(page) - case .people(let timeWindow, let page): - return Self.basePath + case let .people(timeWindow, page): + Self.basePath .appendingPathComponent("person") .appendingPathComponent(timeWindow) .appendingPage(page) diff --git a/Sources/TMDb/Trending/TrendingService.swift b/Sources/TMDb/Trending/TrendingService.swift index 641547b0..ae005661 100644 --- a/Sources/TMDb/Trending/TrendingService.swift +++ b/Sources/TMDb/Trending/TrendingService.swift @@ -1,3 +1,22 @@ +// +// TrendingService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -39,8 +58,10 @@ public final class TrendingService { /// /// - Returns: Trending movies in a time window as a pageable list. /// - public func movies(inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, - page: Int? = nil) async throws -> MoviePageableList { + public func movies( + inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, + page: Int? = nil + ) async throws -> MoviePageableList { let movieList: MoviePageableList do { movieList = try await apiClient.get(endpoint: TrendingEndpoint.movies(timeWindow: timeWindow, page: page)) @@ -69,8 +90,10 @@ public final class TrendingService { /// /// - Returns: Trending TV series in a time window as a pageable list. /// - public func tvSeries(inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, - page: Int? = nil) async throws -> TVSeriesPageableList { + public func tvSeries( + inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, + page: Int? = nil + ) async throws -> TVSeriesPageableList { let tvSeriesList: TVSeriesPageableList do { tvSeriesList = try await apiClient.get( @@ -101,8 +124,10 @@ public final class TrendingService { /// /// - Returns: Trending people in a time window as a pageable list. /// - public func people(inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, - page: Int? = nil) async throws -> PersonPageableList { + public func people( + inTimeWindow timeWindow: TrendingTimeWindowFilterType = .day, + page: Int? = nil + ) async throws -> PersonPageableList { let peopleList: PersonPageableList do { peopleList = try await apiClient.get(endpoint: TrendingEndpoint.people(timeWindow: timeWindow, page: page)) diff --git a/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift b/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift index f290c575..ec1b3da2 100644 --- a/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift +++ b/Sources/TMDb/Trending/TrendingTimeWindowFilterType.swift @@ -1,3 +1,22 @@ +// +// TrendingTimeWindowFilterType.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// Sort specifier when fetching TV series. diff --git a/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift b/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift index 1edf38e7..ece04044 100644 --- a/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift +++ b/Sources/TMDb/WatchProviders/Endpoints/WatchProviderEndpoint.swift @@ -1,3 +1,22 @@ +// +// WatchProviderEndpoint.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation enum WatchProviderEndpoint { @@ -15,16 +34,16 @@ extension WatchProviderEndpoint: Endpoint { var path: URL { switch self { case .regions: - return Self.basePath + Self.basePath .appendingPathComponent("regions") - case .movie(let regionCode): - return Self.basePath + case let .movie(regionCode): + Self.basePath .appendingPathComponent("movie") .appendingWatchRegion(regionCode) - case .tvSeries(let regionCode): - return Self.basePath + case let .tvSeries(regionCode): + Self.basePath .appendingPathComponent("tv") .appendingWatchRegion(regionCode) } @@ -43,7 +62,7 @@ private extension URL { return self } - return self.appendingQueryItem(name: QueryItemName.watchRegion, value: regionCode) + return appendingQueryItem(name: QueryItemName.watchRegion, value: regionCode) } } diff --git a/Sources/TMDb/WatchProviders/WatchProviderService.swift b/Sources/TMDb/WatchProviders/WatchProviderService.swift index 0d8c2866..6368b1ee 100644 --- a/Sources/TMDb/WatchProviders/WatchProviderService.swift +++ b/Sources/TMDb/WatchProviders/WatchProviderService.swift @@ -1,3 +1,22 @@ +// +// WatchProviderService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation /// @@ -32,7 +51,7 @@ public final class WatchProviderService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Countries TMDb have watch provider data for. - /// + /// public func countries() async throws -> [Country] { let regions: WatchProviderRegions do { @@ -52,7 +71,7 @@ public final class WatchProviderService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Watch providers for movies. - /// + /// public func movieWatchProviders() async throws -> [WatchProvider] { let regionCode = localeProvider.regionCode let result: WatchProviderResult @@ -75,7 +94,7 @@ public final class WatchProviderService { /// - Throws: TMDb error ``TMDbError``. /// /// - Returns: Watch providers for TV series. - /// + /// public func tvSeriesWatchProviders() async throws -> [WatchProvider] { let regionCode = localeProvider.regionCode let result: WatchProviderResult diff --git a/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift b/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift index 954abe68..55994830 100644 --- a/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/CertificationIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// CertificationIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/CompanyIntegrationTests.swift b/Tests/TMDbIntegrationTests/CompanyIntegrationTests.swift index c6ca3f8f..edfe1131 100644 --- a/Tests/TMDbIntegrationTests/CompanyIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/CompanyIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// CompanyIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/ConfigurationIntegrationTests.swift b/Tests/TMDbIntegrationTests/ConfigurationIntegrationTests.swift index 32544bae..ea889467 100644 --- a/Tests/TMDbIntegrationTests/ConfigurationIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/ConfigurationIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// ConfigurationIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift b/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift index 8490c6c3..2592f9d7 100644 --- a/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/DiscoverIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// DiscoverIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift b/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift index c373c083..de20fa5d 100644 --- a/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/GenreIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// GenreIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/MovieIntegrationTests.swift b/Tests/TMDbIntegrationTests/MovieIntegrationTests.swift index 8bbfdd85..b86cecdd 100644 --- a/Tests/TMDbIntegrationTests/MovieIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/MovieIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// MovieIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest @@ -17,7 +36,7 @@ final class MovieIntegrationTests: XCTestCase { } func testDetails() async throws { - let movieID = 346698 + let movieID = 346_698 let movie = try await movieService.details(forMovie: movieID) @@ -26,7 +45,7 @@ final class MovieIntegrationTests: XCTestCase { } func testCredits() async throws { - let movieID = 346698 + let movieID = 346_698 let credits = try await movieService.credits(forMovie: movieID) @@ -36,7 +55,7 @@ final class MovieIntegrationTests: XCTestCase { } func testReviews() async throws { - let movieID = 346698 + let movieID = 346_698 let reviewList = try await movieService.reviews(forMovie: movieID) @@ -44,7 +63,7 @@ final class MovieIntegrationTests: XCTestCase { } func testImages() async throws { - let movieID = 346698 + let movieID = 346_698 let imageCollection = try await movieService.images(forMovie: movieID) @@ -55,7 +74,7 @@ final class MovieIntegrationTests: XCTestCase { } func testVideos() async throws { - let movieID = 346698 + let movieID = 346_698 let videoCollection = try await movieService.videos(forMovie: movieID) @@ -64,7 +83,7 @@ final class MovieIntegrationTests: XCTestCase { } func testRecommendations() async throws { - let movieID = 921636 + let movieID = 921_636 let recommendationList = try await movieService.recommendations(forMovie: movieID) @@ -72,7 +91,7 @@ final class MovieIntegrationTests: XCTestCase { } func testSimilar() async throws { - let movieID = 921636 + let movieID = 921_636 let movieList = try await movieService.similar(toMovie: movieID) @@ -104,7 +123,7 @@ final class MovieIntegrationTests: XCTestCase { } func testExternalLinks() async throws { - let movieID = 346698 + let movieID = 346_698 let linksCollection = try await movieService.externalLinks(forMovie: movieID) diff --git a/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift b/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift index a816164a..6d87da7b 100644 --- a/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/PersonIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// PersonIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest @@ -79,7 +98,7 @@ final class PersonIntegrationTests: XCTestCase { } func testExternalLinks() async throws { - let personID = 115440 + let personID = 115_440 let linksCollection = try await personService.externalLinks(forPerson: personID) diff --git a/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift b/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift index 31b75368..f2661e74 100644 --- a/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/SearchIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// SearchIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift b/Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift index d18c6479..c72e9ee8 100644 --- a/Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift +++ b/Tests/TMDbIntegrationTests/TVEpisodeServiceTests.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest @@ -21,8 +40,11 @@ final class TVEpisodeServiceTests: XCTestCase { let seasonNumber = 2 let tvSeriesID = 1399 - let episode = try await tvEpisodeService.details(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVSeries: tvSeriesID) + let episode = try await tvEpisodeService.details( + forEpisode: episodeNumber, + inSeason: seasonNumber, + inTVSeries: tvSeriesID + ) XCTAssertEqual(episode.id, 63068) XCTAssertEqual(episode.episodeNumber, episodeNumber) @@ -35,8 +57,11 @@ final class TVEpisodeServiceTests: XCTestCase { let seasonNumber = 2 let tvSeriesID = 1399 - let imageCollection = try await tvEpisodeService.images(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVSeries: tvSeriesID) + let imageCollection = try await tvEpisodeService.images( + forEpisode: episodeNumber, + inSeason: seasonNumber, + inTVSeries: tvSeriesID + ) XCTAssertEqual(imageCollection.id, 63068) XCTAssertFalse(imageCollection.stills.isEmpty) @@ -47,8 +72,11 @@ final class TVEpisodeServiceTests: XCTestCase { let seasonNumber = 1 let tvSeriesID = 1399 - let videoCollection = try await tvEpisodeService.videos(forEpisode: episodeNumber, inSeason: seasonNumber, - inTVSeries: tvSeriesID) + 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/TVSeasonService.swift b/Tests/TMDbIntegrationTests/TVSeasonService.swift index bcef86a5..551b529c 100644 --- a/Tests/TMDbIntegrationTests/TVSeasonService.swift +++ b/Tests/TMDbIntegrationTests/TVSeasonService.swift @@ -1,3 +1,22 @@ +// +// TVSeasonService.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift b/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift index d06619e6..7ec3caa8 100644 --- a/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift +++ b/Tests/TMDbIntegrationTests/TVSeriesServiceTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift b/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift index 27f35b25..d15e02a8 100644 --- a/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/TrendingIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// TrendingIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/Utility/XCTestCase+ConfigureTMDb.swift b/Tests/TMDbIntegrationTests/Utility/XCTestCase+ConfigureTMDb.swift index 5f5c22a9..d1ccb751 100644 --- a/Tests/TMDbIntegrationTests/Utility/XCTestCase+ConfigureTMDb.swift +++ b/Tests/TMDbIntegrationTests/Utility/XCTestCase+ConfigureTMDb.swift @@ -1,3 +1,22 @@ +// +// XCTestCase+ConfigureTMDb.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift b/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift index 2fc87687..5b570010 100644 --- a/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift +++ b/Tests/TMDbIntegrationTests/WatchProviderIntegrationTests.swift @@ -1,3 +1,22 @@ +// +// WatchProviderIntegrationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest diff --git a/Tests/TMDbTests/Certifications/CertificationServiceTests.swift b/Tests/TMDbTests/Certifications/CertificationServiceTests.swift index 0c268517..47156031 100644 --- a/Tests/TMDbTests/Certifications/CertificationServiceTests.swift +++ b/Tests/TMDbTests/Certifications/CertificationServiceTests.swift @@ -1,3 +1,22 @@ +// +// CertificationServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift b/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift index 9732e8ea..40302789 100644 --- a/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift +++ b/Tests/TMDbTests/Certifications/Endpoints/CertificationsEndpointTests.swift @@ -1,3 +1,22 @@ +// +// CertificationsEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Company/CompanyServiceTests.swift b/Tests/TMDbTests/Company/CompanyServiceTests.swift index dbbee9e3..c61bf092 100644 --- a/Tests/TMDbTests/Company/CompanyServiceTests.swift +++ b/Tests/TMDbTests/Company/CompanyServiceTests.swift @@ -1,3 +1,22 @@ +// +// CompanyServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Company/Endpoints/CompanyEndpointTests.swift b/Tests/TMDbTests/Company/Endpoints/CompanyEndpointTests.swift index 814c8348..aa44b1f0 100644 --- a/Tests/TMDbTests/Company/Endpoints/CompanyEndpointTests.swift +++ b/Tests/TMDbTests/Company/Endpoints/CompanyEndpointTests.swift @@ -1,3 +1,22 @@ +// +// CompanyEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Configuration/ConfigurationServiceTests.swift b/Tests/TMDbTests/Configuration/ConfigurationServiceTests.swift index bce600b2..5d595364 100644 --- a/Tests/TMDbTests/Configuration/ConfigurationServiceTests.swift +++ b/Tests/TMDbTests/Configuration/ConfigurationServiceTests.swift @@ -1,3 +1,22 @@ +// +// ConfigurationServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Configuration/Endpoints/ConfigurationEndpointTests.swift b/Tests/TMDbTests/Configuration/Endpoints/ConfigurationEndpointTests.swift index be4a4787..a1920b89 100644 --- a/Tests/TMDbTests/Configuration/Endpoints/ConfigurationEndpointTests.swift +++ b/Tests/TMDbTests/Configuration/Endpoints/ConfigurationEndpointTests.swift @@ -1,3 +1,22 @@ +// +// ConfigurationEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Discover/DiscoverServiceTests.swift b/Tests/TMDbTests/Discover/DiscoverServiceTests.swift index 758f49d2..373131dc 100644 --- a/Tests/TMDbTests/Discover/DiscoverServiceTests.swift +++ b/Tests/TMDbTests/Discover/DiscoverServiceTests.swift @@ -1,3 +1,22 @@ +// +// DiscoverServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift b/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift index c092e601..18b53e73 100644 --- a/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift +++ b/Tests/TMDbTests/Discover/Endpoints/DiscoverEndpointTests.swift @@ -1,3 +1,22 @@ +// +// DiscoverEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Discover/MovieSortTests.swift b/Tests/TMDbTests/Discover/MovieSortTests.swift index 118f67d1..f6ed8a05 100644 --- a/Tests/TMDbTests/Discover/MovieSortTests.swift +++ b/Tests/TMDbTests/Discover/MovieSortTests.swift @@ -1,3 +1,22 @@ +// +// MovieSortTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Discover/TVSeriesSortTests.swift b/Tests/TMDbTests/Discover/TVSeriesSortTests.swift index 961295e0..3ecc9f40 100644 --- a/Tests/TMDbTests/Discover/TVSeriesSortTests.swift +++ b/Tests/TMDbTests/Discover/TVSeriesSortTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesSortTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Extensions/DateFormatter+TMDbTests.swift b/Tests/TMDbTests/Extensions/DateFormatter+TMDbTests.swift index b55e691d..ee5716c1 100644 --- a/Tests/TMDbTests/Extensions/DateFormatter+TMDbTests.swift +++ b/Tests/TMDbTests/Extensions/DateFormatter+TMDbTests.swift @@ -1,3 +1,22 @@ +// +// DateFormatter+TMDbTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Extensions/JSONDecoder+TMDbTests.swift b/Tests/TMDbTests/Extensions/JSONDecoder+TMDbTests.swift index 81119be9..666957ee 100644 --- a/Tests/TMDbTests/Extensions/JSONDecoder+TMDbTests.swift +++ b/Tests/TMDbTests/Extensions/JSONDecoder+TMDbTests.swift @@ -1,3 +1,22 @@ +// +// JSONDecoder+TMDbTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Extensions/Sequence+UniquedTests.swift b/Tests/TMDbTests/Extensions/Sequence+UniquedTests.swift index 1cea52d8..cb1f674d 100644 --- a/Tests/TMDbTests/Extensions/Sequence+UniquedTests.swift +++ b/Tests/TMDbTests/Extensions/Sequence+UniquedTests.swift @@ -1,3 +1,22 @@ +// +// Sequence+UniquedTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Extensions/URL+QueryItemTests.swift b/Tests/TMDbTests/Extensions/URL+QueryItemTests.swift index a29ccb4b..fb0f4314 100644 --- a/Tests/TMDbTests/Extensions/URL+QueryItemTests.swift +++ b/Tests/TMDbTests/Extensions/URL+QueryItemTests.swift @@ -1,3 +1,22 @@ +// +// URL+QueryItemTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Extensions/URL+TMDbTests.swift b/Tests/TMDbTests/Extensions/URL+TMDbTests.swift index 5878a15f..35be2baa 100644 --- a/Tests/TMDbTests/Extensions/URL+TMDbTests.swift +++ b/Tests/TMDbTests/Extensions/URL+TMDbTests.swift @@ -1,3 +1,22 @@ +// +// URL+TMDbTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift b/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift index 22857f5c..2f77c462 100644 --- a/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift +++ b/Tests/TMDbTests/Genres/Endpoints/GenresEndpointTests.swift @@ -1,3 +1,22 @@ +// +// GenresEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Genres/GenreServiceTests.swift b/Tests/TMDbTests/Genres/GenreServiceTests.swift index 0c310607..caec82d9 100644 --- a/Tests/TMDbTests/Genres/GenreServiceTests.swift +++ b/Tests/TMDbTests/Genres/GenreServiceTests.swift @@ -1,3 +1,22 @@ +// +// GenreServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Helpers/Data+LoadFromFile.swift b/Tests/TMDbTests/Helpers/Data+LoadFromFile.swift index 192d0221..d390c3b0 100644 --- a/Tests/TMDbTests/Helpers/Data+LoadFromFile.swift +++ b/Tests/TMDbTests/Helpers/Data+LoadFromFile.swift @@ -1,3 +1,22 @@ +// +// Data+LoadFromFile.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension Data { diff --git a/Tests/TMDbTests/Helpers/Date+RandomDate.swift b/Tests/TMDbTests/Helpers/Date+RandomDate.swift index a9181164..5ad7c4da 100644 --- a/Tests/TMDbTests/Helpers/Date+RandomDate.swift +++ b/Tests/TMDbTests/Helpers/Date+RandomDate.swift @@ -1,10 +1,29 @@ +// +// Date+RandomDate.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension Date { static var random: Self { let date = Date().timeIntervalSince1970 - let timeInterval = Double.random(in: 1118839159...date) + let timeInterval = Double.random(in: 1_118_839_159 ... date) return Date(timeIntervalSince1970: timeInterval) } diff --git a/Tests/TMDbTests/Helpers/Int+RandomID.swift b/Tests/TMDbTests/Helpers/Int+RandomID.swift index f38ace6a..98ea9082 100644 --- a/Tests/TMDbTests/Helpers/Int+RandomID.swift +++ b/Tests/TMDbTests/Helpers/Int+RandomID.swift @@ -1,9 +1,28 @@ +// +// Int+RandomID.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension Int { static var randomID: Self { - .random(in: 1...10000000) + .random(in: 1 ... 10_000_000) } } diff --git a/Tests/TMDbTests/Helpers/JSONDecoder+DecodeFromFile.swift b/Tests/TMDbTests/Helpers/JSONDecoder+DecodeFromFile.swift index 125f37d2..0b62d84d 100644 --- a/Tests/TMDbTests/Helpers/JSONDecoder+DecodeFromFile.swift +++ b/Tests/TMDbTests/Helpers/JSONDecoder+DecodeFromFile.swift @@ -1,9 +1,31 @@ +// +// JSONDecoder+DecodeFromFile.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension JSONDecoder { - func decode(_ type: T.Type, fromResource fileName: String, - withExtension fileType: String = "json") throws -> T where T: Decodable { + func decode( + _: T.Type, + fromResource fileName: String, + withExtension fileType: String = "json" + ) throws -> T where T: Decodable { let data = try Data(fromResource: fileName, withExtension: fileType) return try decode(T.self, from: data) } diff --git a/Tests/TMDbTests/Helpers/JSONEncoder+TMDb.swift b/Tests/TMDbTests/Helpers/JSONEncoder+TMDb.swift index 0e983888..12ff86f3 100644 --- a/Tests/TMDbTests/Helpers/JSONEncoder+TMDb.swift +++ b/Tests/TMDbTests/Helpers/JSONEncoder+TMDb.swift @@ -1,3 +1,22 @@ +// +// JSONEncoder+TMDb.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Helpers/String+RandomID.swift b/Tests/TMDbTests/Helpers/String+RandomID.swift index c48a18bd..b2a01e95 100644 --- a/Tests/TMDbTests/Helpers/String+RandomID.swift +++ b/Tests/TMDbTests/Helpers/String+RandomID.swift @@ -1,3 +1,22 @@ +// +// String+RandomID.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension String { diff --git a/Tests/TMDbTests/Mocks/Client/MockAPIClient.swift b/Tests/TMDbTests/Mocks/Client/MockAPIClient.swift index 10f768f8..c11fb9a1 100644 --- a/Tests/TMDbTests/Mocks/Client/MockAPIClient.swift +++ b/Tests/TMDbTests/Mocks/Client/MockAPIClient.swift @@ -1,3 +1,22 @@ +// +// MockAPIClient.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -15,8 +34,8 @@ final class MockAPIClient: APIClient { } func get(path: URL) async throws -> Response { - self.lastPath = path - self.getCount += 1 + lastPath = path + getCount += 1 if requestTime > 0 { try await Task.sleep(nanoseconds: requestTime * 1_000_000_000) @@ -29,7 +48,6 @@ final class MockAPIClient: APIClient { do { guard let value = try result.get() as? Response else { preconditionFailure("Can't cast response to type \(String(describing: Response.self))") -// throw TMDbAPIError.unknown } return value diff --git a/Tests/TMDbTests/Mocks/LocaleMockProvider.swift b/Tests/TMDbTests/Mocks/LocaleMockProvider.swift index 5c71f4cd..69cff4aa 100644 --- a/Tests/TMDbTests/Mocks/LocaleMockProvider.swift +++ b/Tests/TMDbTests/Mocks/LocaleMockProvider.swift @@ -1,3 +1,22 @@ +// +// LocaleMockProvider.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/APIConfiguration+Mocks.swift b/Tests/TMDbTests/Mocks/Models/APIConfiguration+Mocks.swift index 5b7b9658..05a1a431 100644 --- a/Tests/TMDbTests/Mocks/Models/APIConfiguration+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/APIConfiguration+Mocks.swift @@ -1,3 +1,22 @@ +// +// APIConfiguration+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/CastMember+Mocks.swift b/Tests/TMDbTests/Mocks/Models/CastMember+Mocks.swift index 060fb032..1a10c9cb 100644 --- a/Tests/TMDbTests/Mocks/Models/CastMember+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/CastMember+Mocks.swift @@ -1,3 +1,22 @@ +// +// CastMember+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -8,10 +27,10 @@ extension CastMember { castID: Int? = .randomID, creditID: String = .randomID, name: String? = .randomString, - character: String? = .randomString, + character _: String? = .randomString, gender: Gender? = .male, profilePath: URL? = .randomImagePath, - order: Int = Int.random(in: 1...10) + order: Int = Int.random(in: 1 ... 10) ) -> Self { .init( id: id, @@ -53,7 +72,7 @@ extension CastMember { } -extension Array where Element == CastMember { +extension [CastMember] { static var mocks: [Element] { [ diff --git a/Tests/TMDbTests/Mocks/Models/Certification+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Certification+Mocks.swift index a81496bf..9fc66ed2 100644 --- a/Tests/TMDbTests/Mocks/Models/Certification+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Certification+Mocks.swift @@ -1,3 +1,22 @@ +// +// Certification+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -26,9 +45,11 @@ extension Certification { static var gbPG: Self { .mock( code: "PG", - meaning: "All ages admitted, but certain scenes may be unsuitable for young children. May contain mild " - + "language and sex/drugs references. May contain moderate violence if justified by context " - + "(e.g. fantasy).", + meaning: """ + All ages admitted, but certain scenes may be unsuitable for young children. May contain mild \ + language and sex/drugs references. May contain moderate violence if justified by context \ + (e.g. fantasy). + """, order: 2 ) } @@ -36,13 +57,15 @@ extension Certification { static var gb12A: Self { .mock( code: "12A", - meaning: "Films under this category are considered to be unsuitable for very young people. Those aged " - + "under 12 years are only admitted if accompanied by an adult, aged at least 18 years, at all times " - + "during the motion picture. However, it is generally not recommended that children under 12 years should " - + "watch the film. Films under this category can contain mature themes, discrimination, soft drugs, " - + "moderate swear words, infrequent strong language and moderate violence, sex references and nudity. " - + "Sexual activity may be briefly and discreetly portrayed. Sexual violence may be implied or briefly " - + "indicated.", + meaning: """ + Films under this category are considered to be unsuitable for very young people. Those aged \ + under 12 years are only admitted if accompanied by an adult, aged at least 18 years, at all times \ + during the motion picture. However, it is generally not recommended that children under 12 years should \ + watch the film. Films under this category can contain mature themes, discrimination, soft drugs, \ + moderate swear words, infrequent strong language and moderate violence, sex references and nudity. \ + Sexual activity may be briefly and discreetly portrayed. Sexual violence may be implied or briefly \ + indicated. + """, order: 2 ) } @@ -50,8 +73,10 @@ extension Certification { static var usG: Self { .mock( code: "G", - meaning: "All ages admitted. There is no content that would be objectionable to most parents. This is one " - + "of only two ratings dating back to 1968 that still exists today.", + meaning: """ + All ages admitted. There is no content that would be objectionable to most parents. This is one \ + of only two ratings dating back to 1968 that still exists today. + """, order: 1 ) } @@ -59,10 +84,12 @@ extension Certification { static var usPG13: Self { .mock( code: "PG-13", - meaning: "Some material may be inappropriate for children under 13. Films given this rating may contain " - + "sexual content, brief or partial nudity, some strong language and innuendo, humor, mature themes, " - + "political themes, terror and/or intense action violence. However, bloodshed is rarely present. This is " - + "the minimum rating at which drug content is present.", + meaning: """ + Some material may be inappropriate for children under 13. Films given this rating may contain \ + sexual content, brief or partial nudity, some strong language and innuendo, humor, mature themes, \ + political themes, terror and/or intense action violence. However, bloodshed is rarely present. This is \ + the minimum rating at which drug content is present. + """, order: 2 ) } diff --git a/Tests/TMDbTests/Mocks/Models/Certifications+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Certifications+Mocks.swift index c3356eb9..1dc7b84c 100644 --- a/Tests/TMDbTests/Mocks/Models/Certifications+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Certifications+Mocks.swift @@ -1,3 +1,22 @@ +// +// Certifications+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/Company+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Company+Mocks.swift index a9c5bf0e..eb4c5060 100644 --- a/Tests/TMDbTests/Mocks/Models/Company+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Company+Mocks.swift @@ -1,3 +1,22 @@ +// +// Company+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/Country+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Country+Mocks.swift index 79cc58e2..6165d0e2 100644 --- a/Tests/TMDbTests/Mocks/Models/Country+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Country+Mocks.swift @@ -1,3 +1,22 @@ +// +// Country+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -25,7 +44,7 @@ extension Country { } -extension Array where Element == Country { +extension [Country] { static var mocks: [Element] { [.unitedKingdom, .unitedStates] diff --git a/Tests/TMDbTests/Mocks/Models/CrewMember+Mocks.swift b/Tests/TMDbTests/Mocks/Models/CrewMember+Mocks.swift index 3c04d738..96b92304 100644 --- a/Tests/TMDbTests/Mocks/Models/CrewMember+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/CrewMember+Mocks.swift @@ -1,3 +1,22 @@ +// +// CrewMember+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -25,7 +44,7 @@ extension CrewMember { } -extension Array where Element == CrewMember { +extension [CrewMember] { static var mocks: [Element] { [] diff --git a/Tests/TMDbTests/Mocks/Models/Department+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Department+Mocks.swift index 59ffa889..ae88aba0 100644 --- a/Tests/TMDbTests/Mocks/Models/Department+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Department+Mocks.swift @@ -1,3 +1,22 @@ +// +// Department+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -36,7 +55,7 @@ extension Department { } -extension Array where Element == Department { +extension [Department] { static var mocks: [Department] { [.costumeAndMakeUp, .production] diff --git a/Tests/TMDbTests/Mocks/Models/Genre+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Genre+Mocks.swift index db58e761..7efa606f 100644 --- a/Tests/TMDbTests/Mocks/Models/Genre+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Genre+Mocks.swift @@ -1,3 +1,22 @@ +// +// Genre+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb @@ -27,7 +46,7 @@ extension Genre { } -extension Array where Element == Genre { +extension [Genre] { static var mocks: [Element] { [.action, .drama, .sciFi] diff --git a/Tests/TMDbTests/Mocks/Models/GenreList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/GenreList+Mocks.swift index 3a15857f..681ad7d0 100644 --- a/Tests/TMDbTests/Mocks/Models/GenreList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/GenreList+Mocks.swift @@ -1,3 +1,22 @@ +// +// GenreList+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/ImageCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ImageCollection+Mocks.swift index 0afe73c9..f5166745 100644 --- a/Tests/TMDbTests/Mocks/Models/ImageCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ImageCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// ImageCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/ImageMetadata+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ImageMetadata+Mocks.swift index 44be4480..86bf8114 100644 --- a/Tests/TMDbTests/Mocks/Models/ImageMetadata+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ImageMetadata+Mocks.swift @@ -1,3 +1,22 @@ +// +// ImageMetadata+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -5,11 +24,11 @@ extension ImageMetadata { static func mock( filePath: URL = .randomImagePath, - width: Int = Int.random(in: 10...100), - height: Int = Int.random(in: 10...100), - aspectRatio: Float = Float.random(in: 1.0...5.0), - voteAverage: Float = Float.random(in: 0.0...10.0), - voteCount: Int = Int.random(in: 0...1000), + width: Int = Int.random(in: 10 ... 100), + height: Int = Int.random(in: 10 ... 100), + aspectRatio: Float = Float.random(in: 1.0 ... 5.0), + voteAverage: Float = Float.random(in: 0.0 ... 10.0), + voteCount: Int = Int.random(in: 0 ... 1000), languageCode: String = "en" ) -> Self { .init( @@ -25,7 +44,7 @@ extension ImageMetadata { } -extension Array where Element == ImageMetadata { +extension [ImageMetadata] { static var mocks: [Element] { [.mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/ImagesConfiguration+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ImagesConfiguration+Mocks.swift index 2b55a939..f90b0718 100644 --- a/Tests/TMDbTests/Mocks/Models/ImagesConfiguration+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ImagesConfiguration+Mocks.swift @@ -1,3 +1,22 @@ +// +// ImagesConfiguration+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/Language+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Language+Mocks.swift index 6bd82851..37c52288 100644 --- a/Tests/TMDbTests/Mocks/Models/Language+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Language+Mocks.swift @@ -1,3 +1,22 @@ +// +// Language+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -33,7 +52,7 @@ extension Language { } -extension Array where Element == Language { +extension [Language] { static var mocks: [Language] { [.african, .hungarian, .irish, .english] diff --git a/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift index 7304081b..2ef74178 100644 --- a/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Media+Mocks.swift @@ -1,3 +1,22 @@ +// +// Media+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -9,7 +28,7 @@ extension Media { } -extension Array where Element == Media { +extension [Media] { static var mocks: [Element] { [ diff --git a/Tests/TMDbTests/Mocks/Models/MediaPageableList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/MediaPageableList+Mocks.swift index ec70d099..009eafe8 100644 --- a/Tests/TMDbTests/Mocks/Models/MediaPageableList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/MediaPageableList+Mocks.swift @@ -1,13 +1,32 @@ +// +// MediaPageableList+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb extension MediaPageableList { static func mock( - page: Int = Int.random(in: 1...5), + page: Int = Int.random(in: 1 ... 5), results: [Media] = .mocks, - totalResults: Int? = Int.random(in: 1...100), - totalPages: Int? = Int.random(in: 1...5) + totalResults: Int? = Int.random(in: 1 ... 100), + totalPages: Int? = Int.random(in: 1 ... 5) ) -> Self { .init( page: page, diff --git a/Tests/TMDbTests/Mocks/Models/Movie+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Movie+Mocks.swift index d531c2ef..3febc3c5 100644 --- a/Tests/TMDbTests/Mocks/Models/Movie+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Movie+Mocks.swift @@ -1,3 +1,22 @@ +// +// Movie+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb @@ -10,22 +29,22 @@ extension Movie { originalTitle: String? = nil, originalLanguage: String? = "en", overview: String? = .randomString, - runtime: Int? = Int.random(in: 60...240), + runtime: Int? = Int.random(in: 60 ... 240), genres: [Genre]? = .mocks, releaseDate: Date? = .random, posterPath: URL? = .randomImagePath, backdropPath: URL? = .randomImagePath, - budget: Double? = Double.random(in: 1000000...65000000), - revenue: Double? = Double.random(in: 1000000...65000000), + budget: Double? = Double.random(in: 1_000_000 ... 65_000_000), + revenue: Double? = Double.random(in: 1_000_000 ... 65_000_000), homepageURL: URL? = .randomWebSite, imdbID: String? = .randomID, status: Status? = .released, productionCompanies: [ProductionCompany]? = .mocks, productionCountries: [ProductionCountry]? = .mocks, spokenLanguages: [SpokenLanguage]? = .mocks, - popularity: Double? = Double.random(in: 1...10), - voteAverage: Double? = Double.random(in: 1...10), - voteCount: Int? = Int.random(in: 1...1000), + popularity: Double? = Double.random(in: 1 ... 10), + voteAverage: Double? = Double.random(in: 1 ... 10), + voteCount: Int? = Int.random(in: 1 ... 1000), hasVideo: Bool? = .random(), isAdultOnly: Bool? = .random() ) -> Self { @@ -59,55 +78,63 @@ extension Movie { static var bulletTrain: Self { .mock( - id: 718930, + id: 718_930, title: "Bullet Train", - overview: "Unlucky assassin Ladybug is determined to do his job peacefully after one too many gigs gone " - + "off the rails. Fate, however, may have other plans, as Ladybug's latest mission puts him on a collision " - + "course with lethal adversaries from around the globe—all with connected, yet conflicting, objectives—on " - + "the world's fastest train.", + overview: """ + Unlucky assassin Ladybug is determined to do his job peacefully after one too many gigs gone \ + off the rails. Fate, however, may have other plans, as Ladybug's latest mission puts him on a collision \ + course with lethal adversaries from around the globe—all with connected, yet conflicting, objectives—on \ + the world's fastest train. + """, releaseDate: DateFormatter.theMovieDatabase.date(from: "2022-07-03") ) } static var thorLoveAndThunder: Self { .mock( - id: 616037, + id: 616_037, title: "Thor: Love and Thunder", - overview: "After his retirement is interrupted by Gorr the God Butcher, a galactic killer who seeks the " - + "extinction of the gods, Thor Odinson enlists the help of King Valkyrie, Korg, and ex-girlfriend Jane " - + "Foster, who now inexplicably wields Mjolnir as the Relatively Mighty Girl Thor. Together they embark " - + "upon a harrowing cosmic adventure to uncover the mystery of the God Butcher’s vengeance and stop him " - + "before it’s too late.", + overview: """ + After his retirement is interrupted by Gorr the God Butcher, a galactic killer who seeks the \ + extinction of the gods, Thor Odinson enlists the help of King Valkyrie, Korg, and ex-girlfriend Jane \ + Foster, who now inexplicably wields Mjolnir as the Relatively Mighty Girl Thor. Together they embark \ + upon a harrowing cosmic adventure to uncover the mystery of the God Butcher's vengeance and stop him \ + before it's too late. + """, releaseDate: DateFormatter.theMovieDatabase.date(from: "2022-07-06") ) } static var jurassicWorldDominion: Self { .mock( - id: 507086, + id: 507_086, title: "Jurassic World Dominion", - overview: "Four years after Isla Nublar was destroyed, dinosaurs now live—and hunt—alongside humans all " - + "over the world. This fragile balance will reshape the future and determine, once and for all, whether " - + "human beings are to remain the apex predators on a planet they now share with history’s most fearsome " - + "creatures.", + overview: """ + Four years after Isla Nublar was destroyed, dinosaurs now live—and hunt—alongside humans all \ + over the world. This fragile balance will reshape the future and determine, once and for all, whether \ + human beings are to remain the apex predators on a planet they now share with history's most fearsome \ + creatures. + """, releaseDate: DateFormatter.theMovieDatabase.date(from: "2022-06-01") ) } static var topGunMaverick: Self { .mock( - id: 361743, + id: 361_743, title: "Top Gun: Maverick", - overview: "After more than thirty years of service as one of the Navy’s top aviators, and dodging the " - + "advancement in rank that would ground him, Pete “Maverick” Mitchell finds himself training a detachment " - + "of TOP GUN graduates for a specialized mission the likes of which no living pilot has ever seen.", + overview: """ + After more than thirty years of service as one of the Navy's top aviators, and dodging the \ + advancement in rank that would ground him, Pete “Maverick” Mitchell finds himself training a detachment \ + of TOP GUN graduates for a specialized mission the likes of which no living pilot has ever seen. + """, releaseDate: DateFormatter.theMovieDatabase.date(from: "2022-05-24") ) } } -extension Array where Element == Movie { +extension [Movie] { static var mocks: [Element] { [ diff --git a/Tests/TMDbTests/Mocks/Models/MovieExternalLinksCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/MovieExternalLinksCollection+Mocks.swift index 9553c3dd..cfd7f6cb 100644 --- a/Tests/TMDbTests/Mocks/Models/MovieExternalLinksCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/MovieExternalLinksCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// MovieExternalLinksCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb @@ -23,7 +42,7 @@ extension MovieExternalLinksCollection { static var barbie: MovieExternalLinksCollection { .mock( - id: 346698, + id: 346_698, imdb: IMDbLink(imdbTitleID: "tt1517268"), wikiData: WikiDataLink(wikiDataID: "Q55436290"), facebook: FacebookLink(facebookID: "BarbieTheMovie"), diff --git a/Tests/TMDbTests/Mocks/Models/MoviePageableList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/MoviePageableList+Mocks.swift index 661f41df..6cba2d7b 100644 --- a/Tests/TMDbTests/Mocks/Models/MoviePageableList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/MoviePageableList+Mocks.swift @@ -1,13 +1,32 @@ +// +// MoviePageableList+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb extension MoviePageableList { static func mock( - page: Int = .random(in: 1...5), + page: Int = .random(in: 1 ... 5), results: [Movie] = .mocks, - totalResults: Int = .random(in: 1...100), - totalPages: Int = .random(in: 1...5) + totalResults: Int = .random(in: 1 ... 100), + totalPages: Int = .random(in: 1 ... 5) ) -> Self { .init( page: page, diff --git a/Tests/TMDbTests/Mocks/Models/Person+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Person+Mocks.swift index 2bc33f36..45126f32 100644 --- a/Tests/TMDbTests/Mocks/Models/Person+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Person+Mocks.swift @@ -1,3 +1,22 @@ +// +// Person+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -14,7 +33,7 @@ extension Person { gender: Gender = .unknown, placeOfBirth: String? = .randomString, profilePath: URL? = .randomImagePath, - popularity: Double? = Double.random(in: 1...10), + popularity: Double? = Double.random(in: 1 ... 10), imdbID: String? = .randomString, homepageURL: URL? = .randomWebSite ) -> Self { @@ -53,7 +72,7 @@ extension Person { } -extension Array where Element == Person { +extension [Person] { static var mocks: [Element] { [ diff --git a/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift index b03155dc..366ce47d 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonCombinedCredits+Mocks.swift @@ -1,3 +1,22 @@ +// +// PersonCombinedCredits+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/PersonExternalLinksCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonExternalLinksCollection+Mocks.swift index 98e7c9fb..2f30ccc0 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonExternalLinksCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonExternalLinksCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// PersonExternalLinksCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb @@ -25,7 +44,7 @@ extension PersonExternalLinksCollection { static var sydneySweeney: PersonExternalLinksCollection { .mock( - id: 346698, + id: 346_698, imdb: IMDbLink(imdbNameID: "nm2858875"), wikiData: WikiDataLink(wikiDataID: "Q49561909"), facebook: FacebookLink(facebookID: "sydney_sweeney"), diff --git a/Tests/TMDbTests/Mocks/Models/PersonImageCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonImageCollection+Mocks.swift index 410c2dab..29e1049f 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonImageCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonImageCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// PersonImageCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/PersonMovieCredits+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonMovieCredits+Mocks.swift index 341e1d41..8bfae2ec 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonMovieCredits+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonMovieCredits+Mocks.swift @@ -1,3 +1,22 @@ +// +// PersonMovieCredits+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/PersonPageableList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonPageableList+Mocks.swift index 0b06e9bd..213152c3 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonPageableList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonPageableList+Mocks.swift @@ -1,13 +1,32 @@ +// +// PersonPageableList+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb extension PersonPageableList { static func mock( - page: Int = .random(in: 1...5), + page: Int = .random(in: 1 ... 5), results: [Person] = .mocks, - totalResults: Int = .random(in: 1...100), - totalPages: Int = .random(in: 1...5) + totalResults: Int = .random(in: 1 ... 100), + totalPages: Int = .random(in: 1 ... 5) ) -> Self { .init( page: page, diff --git a/Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift b/Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift index 2e384fef..64351b68 100644 --- a/Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/PersonTVSeriesCredits+Mocks.swift @@ -1,3 +1,22 @@ +// +// PersonTVSeriesCredits+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/ProductionCompany+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ProductionCompany+Mocks.swift index 9fef72ff..de365fda 100644 --- a/Tests/TMDbTests/Mocks/Models/ProductionCompany+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ProductionCompany+Mocks.swift @@ -1,3 +1,22 @@ +// +// ProductionCompany+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -19,7 +38,7 @@ extension ProductionCompany { } -extension Array where Element == ProductionCompany { +extension [ProductionCompany] { static var mocks: [Element] { [.mock(), .mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/ProductionCountry+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ProductionCountry+Mocks.swift index 5dfebd82..1f3d7aca 100644 --- a/Tests/TMDbTests/Mocks/Models/ProductionCountry+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ProductionCountry+Mocks.swift @@ -1,3 +1,22 @@ +// +// ProductionCountry+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -15,7 +34,7 @@ extension ProductionCountry { } -extension Array where Element == ProductionCountry { +extension [ProductionCountry] { static var mocks: [Element] { [.mock(), .mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/Review+Mocks.swift b/Tests/TMDbTests/Mocks/Models/Review+Mocks.swift index a80483a4..5a22f9b9 100644 --- a/Tests/TMDbTests/Mocks/Models/Review+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/Review+Mocks.swift @@ -1,3 +1,22 @@ +// +// Review+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -17,7 +36,7 @@ extension Review { } -extension Array where Element == Review { +extension [Review] { static var mocks: [Element] { [.mock(), .mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/ReviewPageableList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ReviewPageableList+Mocks.swift index dd53baa2..22c3ca14 100644 --- a/Tests/TMDbTests/Mocks/Models/ReviewPageableList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ReviewPageableList+Mocks.swift @@ -1,13 +1,32 @@ +// +// ReviewPageableList+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb extension ReviewPageableList { static func mock( - page: Int = .random(in: 1...5), + page: Int = .random(in: 1 ... 5), results: [Review] = .mocks, - totalResults: Int = .random(in: 1...100), - totalPages: Int = .random(in: 1...5) + totalResults: Int = .random(in: 1 ... 100), + totalPages: Int = .random(in: 1 ... 5) ) -> Self { .init( page: page, diff --git a/Tests/TMDbTests/Mocks/Models/ShowCredits+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ShowCredits+Mocks.swift index 7db65e52..73a21317 100644 --- a/Tests/TMDbTests/Mocks/Models/ShowCredits+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ShowCredits+Mocks.swift @@ -1,3 +1,22 @@ +// +// ShowCredits+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/ShowWatchProvider+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ShowWatchProvider+Mocks.swift index 189228f0..6ef4eba4 100644 --- a/Tests/TMDbTests/Mocks/Models/ShowWatchProvider+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ShowWatchProvider+Mocks.swift @@ -1,3 +1,22 @@ +// +// ShowWatchProvider+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/ShowWatchProviderResult+Mocks.swift b/Tests/TMDbTests/Mocks/Models/ShowWatchProviderResult+Mocks.swift index 57fc2478..11bc0180 100644 --- a/Tests/TMDbTests/Mocks/Models/ShowWatchProviderResult+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/ShowWatchProviderResult+Mocks.swift @@ -1,3 +1,22 @@ +// +// ShowWatchProviderResult+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/SpokenLanguage+Mocks.swift b/Tests/TMDbTests/Mocks/Models/SpokenLanguage+Mocks.swift index 99e26f52..3bd3769d 100644 --- a/Tests/TMDbTests/Mocks/Models/SpokenLanguage+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/SpokenLanguage+Mocks.swift @@ -1,3 +1,22 @@ +// +// SpokenLanguage+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -15,7 +34,7 @@ extension SpokenLanguage { } -extension Array where Element == SpokenLanguage { +extension [SpokenLanguage] { static var mocks: [Element] { [.mocks(), .mocks(), .mocks()] diff --git a/Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift index 3b9f9858..1759b3d0 100644 --- a/Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVEpisode+Mocks.swift @@ -1,3 +1,22 @@ +// +// TVEpisode+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -6,8 +25,8 @@ extension TVEpisode { static func mock( id: Int = .randomID, name: String? = nil, - episodeNumber: Int = .random(in: 0...23), - seasonNumber: Int = .random(in: 0...10), + episodeNumber: Int = .random(in: 0 ... 23), + seasonNumber: Int = .random(in: 0 ... 10), overview: String? = .randomString, airDate: Date? = .random, productionCode: String? = nil, @@ -35,7 +54,7 @@ extension TVEpisode { } -extension Array where Element == TVEpisode { +extension [TVEpisode] { static var mocks: [Element] { [.mock(), .mock(), .mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift index 59a71635..65a3cb38 100644 --- a/Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVEpisodeImageCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeImageCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift b/Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift index 96c6ab03..80bfc5cc 100644 --- a/Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeason+Mock.swift @@ -1,3 +1,22 @@ +// +// TVSeason+Mock.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -6,7 +25,7 @@ extension TVSeason { static func mock( id: Int = .randomID, name: String? = nil, - seasonNumber: Int = Int.random(in: 1...10), + seasonNumber: Int = Int.random(in: 1 ... 10), overview: String? = .randomString, airDate: Date? = .random, posterPath: URL? = nil, diff --git a/Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift index 35eab851..8c8fe94c 100644 --- a/Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeasonImageCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// TVSeasonImageCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift index 030e8df4..d2e84f7b 100644 --- a/Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeries+Mocks.swift @@ -1,3 +1,22 @@ +// +// TVSeries+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb @@ -88,7 +107,7 @@ extension TVSeries { } -extension Array where Element == TVSeries { +extension [TVSeries] { static var mocks: [Element] { [.sheHulk, .theSandman, .strangerThings] diff --git a/Tests/TMDbTests/Mocks/Models/TVSeriesExternalLinksCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeriesExternalLinksCollection+Mocks.swift index 382491c5..b99513b8 100644 --- a/Tests/TMDbTests/Mocks/Models/TVSeriesExternalLinksCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeriesExternalLinksCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// TVSeriesExternalLinksCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift b/Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift index d2e59309..6b9077a7 100644 --- a/Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/TVSeriesPageableList+Mocks.swift @@ -1,13 +1,32 @@ +// +// TVSeriesPageableList+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb extension TVSeriesPageableList { static func mock( - page: Int = Int.random(in: 1...5), + page: Int = Int.random(in: 1 ... 5), results: [TVSeries] = .mocks, - totalResults: Int? = Int.random(in: 1...100), - totalPages: Int? = Int.random(in: 1...5) + totalResults: Int? = Int.random(in: 1 ... 100), + totalPages: Int? = Int.random(in: 1 ... 5) ) -> Self { .init( page: page, diff --git a/Tests/TMDbTests/Mocks/Models/VideoCollection+Mocks.swift b/Tests/TMDbTests/Mocks/Models/VideoCollection+Mocks.swift index b37abd48..8b5b13df 100644 --- a/Tests/TMDbTests/Mocks/Models/VideoCollection+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/VideoCollection+Mocks.swift @@ -1,3 +1,22 @@ +// +// VideoCollection+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/VideoMetadata+Mocks.swift b/Tests/TMDbTests/Mocks/Models/VideoMetadata+Mocks.swift index 8080ab4f..6d3b28eb 100644 --- a/Tests/TMDbTests/Mocks/Models/VideoMetadata+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/VideoMetadata+Mocks.swift @@ -1,3 +1,22 @@ +// +// VideoMetadata+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb @@ -23,7 +42,7 @@ extension VideoMetadata { } -extension Array where Element == VideoMetadata { +extension [VideoMetadata] { static var mocks: [Element] { [.mock(), .mock(), .mock()] diff --git a/Tests/TMDbTests/Mocks/Models/WatchProvider+Mocks.swift b/Tests/TMDbTests/Mocks/Models/WatchProvider+Mocks.swift index eb3c45f0..a3b05289 100644 --- a/Tests/TMDbTests/Mocks/Models/WatchProvider+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/WatchProvider+Mocks.swift @@ -1,3 +1,22 @@ +// +// WatchProvider+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/WatchProviderRegions+Mocks.swift b/Tests/TMDbTests/Mocks/Models/WatchProviderRegions+Mocks.swift index e32a67c8..9a34b8bf 100644 --- a/Tests/TMDbTests/Mocks/Models/WatchProviderRegions+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/WatchProviderRegions+Mocks.swift @@ -1,3 +1,22 @@ +// +// WatchProviderRegions+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/Models/WatchProviderResult+Mocks.swift b/Tests/TMDbTests/Mocks/Models/WatchProviderResult+Mocks.swift index 426418cc..dde803de 100644 --- a/Tests/TMDbTests/Mocks/Models/WatchProviderResult+Mocks.swift +++ b/Tests/TMDbTests/Mocks/Models/WatchProviderResult+Mocks.swift @@ -1,3 +1,22 @@ +// +// WatchProviderResult+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation @testable import TMDb diff --git a/Tests/TMDbTests/Mocks/URL+Mocks.swift b/Tests/TMDbTests/Mocks/URL+Mocks.swift index 5f1235dd..20287522 100644 --- a/Tests/TMDbTests/Mocks/URL+Mocks.swift +++ b/Tests/TMDbTests/Mocks/URL+Mocks.swift @@ -1,3 +1,22 @@ +// +// URL+Mocks.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation extension URL { diff --git a/Tests/TMDbTests/Models/APIConfigurationTests.swift b/Tests/TMDbTests/Models/APIConfigurationTests.swift index fe53764b..ff23b98c 100644 --- a/Tests/TMDbTests/Models/APIConfigurationTests.swift +++ b/Tests/TMDbTests/Models/APIConfigurationTests.swift @@ -1,3 +1,22 @@ +// +// APIConfigurationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/CastMemberTests.swift b/Tests/TMDbTests/Models/CastMemberTests.swift index 04326f3a..74e7ba48 100644 --- a/Tests/TMDbTests/Models/CastMemberTests.swift +++ b/Tests/TMDbTests/Models/CastMemberTests.swift @@ -1,3 +1,22 @@ +// +// CastMemberTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/CertificationTests.swift b/Tests/TMDbTests/Models/CertificationTests.swift index ced7603c..242be58e 100644 --- a/Tests/TMDbTests/Models/CertificationTests.swift +++ b/Tests/TMDbTests/Models/CertificationTests.swift @@ -1,3 +1,22 @@ +// +// CertificationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/CertificationsTests.swift b/Tests/TMDbTests/Models/CertificationsTests.swift index df279a13..e226b1e9 100644 --- a/Tests/TMDbTests/Models/CertificationsTests.swift +++ b/Tests/TMDbTests/Models/CertificationsTests.swift @@ -1,3 +1,22 @@ +// +// CertificationsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/CompanyTests.swift b/Tests/TMDbTests/Models/CompanyTests.swift index f9089680..76d1c877 100644 --- a/Tests/TMDbTests/Models/CompanyTests.swift +++ b/Tests/TMDbTests/Models/CompanyTests.swift @@ -1,3 +1,22 @@ +// +// CompanyTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/CountryTests.swift b/Tests/TMDbTests/Models/CountryTests.swift index 19ec5a2b..1f22bff2 100644 --- a/Tests/TMDbTests/Models/CountryTests.swift +++ b/Tests/TMDbTests/Models/CountryTests.swift @@ -1,3 +1,22 @@ +// +// CountryTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/CrewMemberTests.swift b/Tests/TMDbTests/Models/CrewMemberTests.swift index c6a8769e..e40aa96c 100644 --- a/Tests/TMDbTests/Models/CrewMemberTests.swift +++ b/Tests/TMDbTests/Models/CrewMemberTests.swift @@ -1,3 +1,22 @@ +// +// CrewMemberTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/DepartmentTests.swift b/Tests/TMDbTests/Models/DepartmentTests.swift index f10a28e0..0f53c169 100644 --- a/Tests/TMDbTests/Models/DepartmentTests.swift +++ b/Tests/TMDbTests/Models/DepartmentTests.swift @@ -1,3 +1,22 @@ +// +// DepartmentTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -15,8 +34,10 @@ final class DepartmentTests: XCTestCase { ] ) - let result = try JSONDecoder.theMovieDatabase.decode(Department.self, - fromResource: "configuration-jobs-by-department") + let result = try JSONDecoder.theMovieDatabase.decode( + Department.self, + fromResource: "configuration-jobs-by-department" + ) XCTAssertEqual(result.id, expectedResult.name) XCTAssertEqual(result.name, expectedResult.name) diff --git a/Tests/TMDbTests/Models/FacebookLinkTests.swift b/Tests/TMDbTests/Models/FacebookLinkTests.swift index 99de3899..fbf9a6b3 100644 --- a/Tests/TMDbTests/Models/FacebookLinkTests.swift +++ b/Tests/TMDbTests/Models/FacebookLinkTests.swift @@ -1,3 +1,22 @@ +// +// FacebookLinkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/GenderTests.swift b/Tests/TMDbTests/Models/GenderTests.swift index 7c60edfc..06b03dd1 100644 --- a/Tests/TMDbTests/Models/GenderTests.swift +++ b/Tests/TMDbTests/Models/GenderTests.swift @@ -1,3 +1,22 @@ +// +// GenderTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/GenreListTests.swift b/Tests/TMDbTests/Models/GenreListTests.swift index b8ae75c5..eb18014d 100644 --- a/Tests/TMDbTests/Models/GenreListTests.swift +++ b/Tests/TMDbTests/Models/GenreListTests.swift @@ -1,3 +1,22 @@ +// +// GenreListTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/GenreTests.swift b/Tests/TMDbTests/Models/GenreTests.swift index 889d3156..47a1c4eb 100644 --- a/Tests/TMDbTests/Models/GenreTests.swift +++ b/Tests/TMDbTests/Models/GenreTests.swift @@ -1,3 +1,22 @@ +// +// GenreTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/IMDbLinkTests.swift b/Tests/TMDbTests/Models/IMDbLinkTests.swift index e666a60b..0b04a44d 100644 --- a/Tests/TMDbTests/Models/IMDbLinkTests.swift +++ b/Tests/TMDbTests/Models/IMDbLinkTests.swift @@ -1,3 +1,22 @@ +// +// IMDbLinkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ImageCollectionTests.swift b/Tests/TMDbTests/Models/ImageCollectionTests.swift index d95dcb9d..7467087e 100644 --- a/Tests/TMDbTests/Models/ImageCollectionTests.swift +++ b/Tests/TMDbTests/Models/ImageCollectionTests.swift @@ -1,3 +1,22 @@ +// +// ImageCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -15,16 +34,38 @@ final class ImageCollectionTests: XCTestCase { private let imageCollection = ImageCollection( id: 550, posters: [ - ImageMetadata(filePath: URL(string: "/fpemzjF623QVTe98pCVlwwtFC5N.jpg")!, width: 1200, height: 1800, - aspectRatio: 0.666666666666667, voteAverage: 5.21, voteCount: 3, languageCode: "en") + ImageMetadata( + filePath: URL(string: "/fpemzjF623QVTe98pCVlwwtFC5N.jpg")!, + width: 1200, + height: 1800, + aspectRatio: 0.666666666666667, + voteAverage: 5.21, + voteCount: 3, + languageCode: "en" + ) ], logos: [ - ImageMetadata(filePath: URL(string: "/fasasakfRaCRCTh8GqN30f8oyQF.jpg")!, width: 100, height: 400, - aspectRatio: 2.5, voteAverage: 5.31, voteCount: 345, languageCode: nil) + ImageMetadata( + filePath: URL(string: "/fasasakfRaCRCTh8GqN30f8oyQF.jpg")!, + width: 100, + height: 400, + aspectRatio: 2.5, + voteAverage: 5.31, + voteCount: 345, + languageCode: nil + ) ], backdrops: [ - ImageMetadata(filePath: URL(string: "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg")!, width: 1280, height: 720, - aspectRatio: 1.77777777777778, voteAverage: 1.21, voteCount: 435, languageCode: nil) - ]) + ImageMetadata( + filePath: URL(string: "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg")!, + width: 1280, + height: 720, + aspectRatio: 1.77777777777778, + voteAverage: 1.21, + voteCount: 435, + languageCode: nil + ) + ] + ) } diff --git a/Tests/TMDbTests/Models/ImageMetadataTests.swift b/Tests/TMDbTests/Models/ImageMetadataTests.swift index 3bdb899d..f920dd50 100644 --- a/Tests/TMDbTests/Models/ImageMetadataTests.swift +++ b/Tests/TMDbTests/Models/ImageMetadataTests.swift @@ -1,3 +1,22 @@ +// +// ImageMetadataTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ImagesConfiguration+URLsTests.swift b/Tests/TMDbTests/Models/ImagesConfiguration+URLsTests.swift index 97027ce0..de31c47c 100644 --- a/Tests/TMDbTests/Models/ImagesConfiguration+URLsTests.swift +++ b/Tests/TMDbTests/Models/ImagesConfiguration+URLsTests.swift @@ -1,3 +1,22 @@ +// +// ImagesConfiguration+URLsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import TMDb import XCTest @@ -53,7 +72,7 @@ final class ImagesConfigurationURLsTests: XCTestCase { let path = try XCTUnwrap(URL(string: "/image.jpg")) let expectedResult = try XCTUnwrap(URL(string: "https://image.tmdb.org/t/p/original/image.jpg")) - let result = configuration.backdropURL(for: path, idealWidth: 100000) + let result = configuration.backdropURL(for: path, idealWidth: 100_000) XCTAssertEqual(result, expectedResult) } @@ -107,7 +126,7 @@ final class ImagesConfigurationURLsTests: XCTestCase { let path = try XCTUnwrap(URL(string: "/image.jpg")) let expectedResult = try XCTUnwrap(URL(string: "https://image.tmdb.org/t/p/original/image.jpg")) - let result = configuration.logoURL(for: path, idealWidth: 100000) + let result = configuration.logoURL(for: path, idealWidth: 100_000) XCTAssertEqual(result, expectedResult) } @@ -161,7 +180,7 @@ final class ImagesConfigurationURLsTests: XCTestCase { let path = try XCTUnwrap(URL(string: "/image.jpg")) let expectedResult = try XCTUnwrap(URL(string: "https://image.tmdb.org/t/p/original/image.jpg")) - let result = configuration.posterURL(for: path, idealWidth: 100000) + let result = configuration.posterURL(for: path, idealWidth: 100_000) XCTAssertEqual(result, expectedResult) } @@ -215,7 +234,7 @@ final class ImagesConfigurationURLsTests: XCTestCase { let path = try XCTUnwrap(URL(string: "/image.jpg")) let expectedResult = try XCTUnwrap(URL(string: "https://image.tmdb.org/t/p/original/image.jpg")) - let result = configuration.profileURL(for: path, idealWidth: 100000) + let result = configuration.profileURL(for: path, idealWidth: 100_000) XCTAssertEqual(result, expectedResult) } @@ -269,7 +288,7 @@ final class ImagesConfigurationURLsTests: XCTestCase { let path = try XCTUnwrap(URL(string: "/image.jpg")) let expectedResult = try XCTUnwrap(URL(string: "https://image.tmdb.org/t/p/original/image.jpg")) - let result = configuration.stillURL(for: path, idealWidth: 100000) + let result = configuration.stillURL(for: path, idealWidth: 100_000) XCTAssertEqual(result, expectedResult) } diff --git a/Tests/TMDbTests/Models/ImagesConfigurationTests.swift b/Tests/TMDbTests/Models/ImagesConfigurationTests.swift index bea0eef5..0c7c960f 100644 --- a/Tests/TMDbTests/Models/ImagesConfigurationTests.swift +++ b/Tests/TMDbTests/Models/ImagesConfigurationTests.swift @@ -1,3 +1,22 @@ +// +// ImagesConfigurationTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/InstagramLinkTests.swift b/Tests/TMDbTests/Models/InstagramLinkTests.swift index e5fbfa03..f1f2c317 100644 --- a/Tests/TMDbTests/Models/InstagramLinkTests.swift +++ b/Tests/TMDbTests/Models/InstagramLinkTests.swift @@ -1,3 +1,22 @@ +// +// InstagramLinkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/LanguageTests.swift b/Tests/TMDbTests/Models/LanguageTests.swift index 9901c1ff..54b3a929 100644 --- a/Tests/TMDbTests/Models/LanguageTests.swift +++ b/Tests/TMDbTests/Models/LanguageTests.swift @@ -1,3 +1,22 @@ +// +// LanguageTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/MediaPageableListTests.swift b/Tests/TMDbTests/Models/MediaPageableListTests.swift index 3aa16529..1f724e98 100644 --- a/Tests/TMDbTests/Models/MediaPageableListTests.swift +++ b/Tests/TMDbTests/Models/MediaPageableListTests.swift @@ -1,3 +1,22 @@ +// +// MediaPageableListTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/MediaTests.swift b/Tests/TMDbTests/Models/MediaTests.swift index 5befdb81..5dc3133a 100644 --- a/Tests/TMDbTests/Models/MediaTests.swift +++ b/Tests/TMDbTests/Models/MediaTests.swift @@ -1,3 +1,22 @@ +// +// MediaTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/MovieExternalLinksCollectionTests.swift b/Tests/TMDbTests/Models/MovieExternalLinksCollectionTests.swift index a351ac4c..4900d061 100644 --- a/Tests/TMDbTests/Models/MovieExternalLinksCollectionTests.swift +++ b/Tests/TMDbTests/Models/MovieExternalLinksCollectionTests.swift @@ -1,3 +1,22 @@ +// +// MovieExternalLinksCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -5,7 +24,7 @@ final class MovieExternalLinksCollectionTests: XCTestCase { func testDecodeReturnsMovieExternalLinksCollection() throws { let expectedResult = MovieExternalLinksCollection( - id: 346698, + id: 346_698, imdb: IMDbLink(imdbTitleID: "tt1517268"), wikiData: WikiDataLink(wikiDataID: "Q55436290"), facebook: FacebookLink(facebookID: "BarbieTheMovie"), @@ -23,7 +42,7 @@ final class MovieExternalLinksCollectionTests: XCTestCase { func testEncodeAndDecodeReturnsMovieExternalLinksCollection() throws { let linksCollection = MovieExternalLinksCollection( - id: 346698, + id: 346_698, imdb: IMDbLink(imdbTitleID: "tt1517268"), wikiData: WikiDataLink(wikiDataID: "Q55436290"), facebook: FacebookLink(facebookID: "BarbieTheMovie"), diff --git a/Tests/TMDbTests/Models/MoviePageableListTests.swift b/Tests/TMDbTests/Models/MoviePageableListTests.swift index 7c60478c..5faa6fd9 100644 --- a/Tests/TMDbTests/Models/MoviePageableListTests.swift +++ b/Tests/TMDbTests/Models/MoviePageableListTests.swift @@ -1,3 +1,22 @@ +// +// MoviePageableListTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/MovieTests.swift b/Tests/TMDbTests/Models/MovieTests.swift index 4e1ef250..09898b77 100644 --- a/Tests/TMDbTests/Models/MovieTests.swift +++ b/Tests/TMDbTests/Models/MovieTests.swift @@ -1,3 +1,22 @@ +// +// MovieTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -10,8 +29,10 @@ final class MovieTests: XCTestCase { } func testDecodeWhenHomepageIsEmptyStringReturnsMovie() throws { - let result = try JSONDecoder.theMovieDatabase.decode(Movie.self, - fromResource: "movie-blank-homepage-release-date") + let result = try JSONDecoder.theMovieDatabase.decode( + Movie.self, + fromResource: "movie-blank-homepage-release-date" + ) XCTAssertNil(result.homepageURL) XCTAssertNil(result.releaseDate) @@ -37,8 +58,8 @@ extension MovieTests { releaseDate: DateFormatter.theMovieDatabase.date(from: "1999-10-12"), posterPath: nil, backdropPath: URL(string: "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg"), - budget: 63000000, - revenue: 100853753, + budget: 63_000_000, + revenue: 100_853_753, homepageURL: URL(string: ""), imdbID: "tt0137523", status: .released, diff --git a/Tests/TMDbTests/Models/NetworkTests.swift b/Tests/TMDbTests/Models/NetworkTests.swift index 09cd22fa..b3091057 100644 --- a/Tests/TMDbTests/Models/NetworkTests.swift +++ b/Tests/TMDbTests/Models/NetworkTests.swift @@ -1,3 +1,22 @@ +// +// NetworkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/PageableListResultTests.swift b/Tests/TMDbTests/Models/PageableListResultTests.swift index 5f40fea7..731d113a 100644 --- a/Tests/TMDbTests/Models/PageableListResultTests.swift +++ b/Tests/TMDbTests/Models/PageableListResultTests.swift @@ -1,3 +1,22 @@ +// +// PageableListResultTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift b/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift index 68093188..05819118 100644 --- a/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift +++ b/Tests/TMDbTests/Models/PersonCombinedCreditsTests.swift @@ -1,3 +1,22 @@ +// +// PersonCombinedCreditsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -31,7 +50,7 @@ final class PersonCombinedCreditsTests: XCTestCase { voteCount: 25 )), .movie(Movie( - id: 109091, + id: 109_091, title: "The Counselor", originalTitle: "The Counselor", originalLanguage: "en", @@ -61,7 +80,7 @@ final class PersonCombinedCreditsTests: XCTestCase { voteCount: 121 )), .movie(Movie( - id: 174349, + id: 174_349, title: "Big Men", originalTitle: "Big Men", originalLanguage: "en", diff --git a/Tests/TMDbTests/Models/PersonExternalLinksCollectionTests.swift b/Tests/TMDbTests/Models/PersonExternalLinksCollectionTests.swift index 93fbe4b6..bc5e6c7c 100644 --- a/Tests/TMDbTests/Models/PersonExternalLinksCollectionTests.swift +++ b/Tests/TMDbTests/Models/PersonExternalLinksCollectionTests.swift @@ -1,3 +1,22 @@ +// +// PersonExternalLinksCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -5,7 +24,7 @@ final class PersonExternalLinksCollectionTests: XCTestCase { func testDecodeReturnsPersonExternalLinksCollection() throws { let expectedResult = PersonExternalLinksCollection( - id: 115440, + id: 115_440, imdb: IMDbLink(imdbNameID: "nm2858875"), wikiData: WikiDataLink(wikiDataID: "Q49561909"), facebook: FacebookLink(facebookID: "sydney_sweeney"), @@ -24,7 +43,7 @@ final class PersonExternalLinksCollectionTests: XCTestCase { func testEncodeAndDecodeReturnsMovieExternalLinksCollection() throws { let linksCollection = PersonExternalLinksCollection( - id: 115440, + id: 115_440, imdb: IMDbLink(imdbNameID: "nm2858875"), wikiData: WikiDataLink(wikiDataID: "Q49561909"), facebook: FacebookLink(facebookID: "sydney_sweeney"), diff --git a/Tests/TMDbTests/Models/PersonImageCollectionTests.swift b/Tests/TMDbTests/Models/PersonImageCollectionTests.swift index 85d4a613..e75429a3 100644 --- a/Tests/TMDbTests/Models/PersonImageCollectionTests.swift +++ b/Tests/TMDbTests/Models/PersonImageCollectionTests.swift @@ -1,3 +1,22 @@ +// +// PersonImageCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/PersonMovieCreditsTests.swift b/Tests/TMDbTests/Models/PersonMovieCreditsTests.swift index 2551d5de..1ba9bead 100644 --- a/Tests/TMDbTests/Models/PersonMovieCreditsTests.swift +++ b/Tests/TMDbTests/Models/PersonMovieCreditsTests.swift @@ -1,3 +1,22 @@ +// +// PersonMovieCreditsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -29,7 +48,7 @@ final class PersonMovieCreditsTests: XCTestCase { id: 287, cast: [ Movie( - id: 109091, + id: 109_091, title: "The Counselor", originalTitle: "The Counselor", originalLanguage: "en", @@ -46,7 +65,7 @@ final class PersonMovieCreditsTests: XCTestCase { ], crew: [ Movie( - id: 174349, + id: 174_349, title: "Big Men", originalTitle: "Big Men", originalLanguage: "en", diff --git a/Tests/TMDbTests/Models/PersonPageableListTests.swift b/Tests/TMDbTests/Models/PersonPageableListTests.swift index 6dc9cde1..921bc5f8 100644 --- a/Tests/TMDbTests/Models/PersonPageableListTests.swift +++ b/Tests/TMDbTests/Models/PersonPageableListTests.swift @@ -1,3 +1,22 @@ +// +// PersonPageableListTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift b/Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift index 2b668f17..03c335fa 100644 --- a/Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift +++ b/Tests/TMDbTests/Models/PersonTVSeriesCreditsTests.swift @@ -1,3 +1,22 @@ +// +// PersonTVSeriesCreditsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/PersonTests.swift b/Tests/TMDbTests/Models/PersonTests.swift index 87e9729c..78abcef5 100644 --- a/Tests/TMDbTests/Models/PersonTests.swift +++ b/Tests/TMDbTests/Models/PersonTests.swift @@ -1,3 +1,22 @@ +// +// PersonTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ProductionCompanyTests.swift b/Tests/TMDbTests/Models/ProductionCompanyTests.swift index c8a88084..11f23744 100644 --- a/Tests/TMDbTests/Models/ProductionCompanyTests.swift +++ b/Tests/TMDbTests/Models/ProductionCompanyTests.swift @@ -1,3 +1,22 @@ +// +// ProductionCompanyTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ProductionCountryTests.swift b/Tests/TMDbTests/Models/ProductionCountryTests.swift index 0cf5fc5e..02d1c5cc 100644 --- a/Tests/TMDbTests/Models/ProductionCountryTests.swift +++ b/Tests/TMDbTests/Models/ProductionCountryTests.swift @@ -1,3 +1,22 @@ +// +// ProductionCountryTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ReviewPageableListTests.swift b/Tests/TMDbTests/Models/ReviewPageableListTests.swift index f2f33a43..329ced69 100644 --- a/Tests/TMDbTests/Models/ReviewPageableListTests.swift +++ b/Tests/TMDbTests/Models/ReviewPageableListTests.swift @@ -1,3 +1,22 @@ +// +// ReviewPageableListTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ReviewTests.swift b/Tests/TMDbTests/Models/ReviewTests.swift index d2eda745..ace6c1df 100644 --- a/Tests/TMDbTests/Models/ReviewTests.swift +++ b/Tests/TMDbTests/Models/ReviewTests.swift @@ -1,3 +1,22 @@ +// +// ReviewTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ShowCreditsTests.swift b/Tests/TMDbTests/Models/ShowCreditsTests.swift index d8c386bd..fe35d9ce 100644 --- a/Tests/TMDbTests/Models/ShowCreditsTests.swift +++ b/Tests/TMDbTests/Models/ShowCreditsTests.swift @@ -1,3 +1,22 @@ +// +// ShowCreditsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/ShowTests.swift b/Tests/TMDbTests/Models/ShowTests.swift index 4153d5a6..335e2dff 100644 --- a/Tests/TMDbTests/Models/ShowTests.swift +++ b/Tests/TMDbTests/Models/ShowTests.swift @@ -1,10 +1,29 @@ +// +// ShowTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest final class ShowTests: XCTestCase { func testIDWhenMovieReturnsMovieID() { - XCTAssertEqual(movieShow.id, 109091) + XCTAssertEqual(movieShow.id, 109_091) } func testIDWhenTVSeriesReturnsTVSeriesID() { @@ -49,7 +68,7 @@ extension ShowTests { private var movieShow: Show { .movie( .init( - id: 109091, + id: 109_091, title: "The Counselor", originalTitle: "The Counselor", originalLanguage: "en", diff --git a/Tests/TMDbTests/Models/SpokenLanguageTests.swift b/Tests/TMDbTests/Models/SpokenLanguageTests.swift index 2def10ad..d364837f 100644 --- a/Tests/TMDbTests/Models/SpokenLanguageTests.swift +++ b/Tests/TMDbTests/Models/SpokenLanguageTests.swift @@ -1,3 +1,22 @@ +// +// SpokenLanguageTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/StatusTests.swift b/Tests/TMDbTests/Models/StatusTests.swift index ba1f73e1..8afd1424 100644 --- a/Tests/TMDbTests/Models/StatusTests.swift +++ b/Tests/TMDbTests/Models/StatusTests.swift @@ -1,3 +1,22 @@ +// +// StatusTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift b/Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift index d297a7ff..8a683e88 100644 --- a/Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift +++ b/Tests/TMDbTests/Models/TVEpisodeImageCollectionTests.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeImageCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -16,8 +35,15 @@ final class TVEpisodeImageCollectionTests: XCTestCase { private let episodeImageCollection = TVEpisodeImageCollection( id: 66633, stills: [ - ImageMetadata(filePath: URL(string: "/rLSUjr725ez1cK7SKVxC9udO03Y.jpg")!, width: 1920, height: 1080, - aspectRatio: 1.77778, voteAverage: 5.3125, voteCount: 1, languageCode: nil) + ImageMetadata( + filePath: URL(string: "/rLSUjr725ez1cK7SKVxC9udO03Y.jpg")!, + width: 1920, + height: 1080, + aspectRatio: 1.77778, + voteAverage: 5.3125, + voteCount: 1, + languageCode: nil + ) ] ) diff --git a/Tests/TMDbTests/Models/TVEpisodeTests.swift b/Tests/TMDbTests/Models/TVEpisodeTests.swift index e25b3490..93221257 100644 --- a/Tests/TMDbTests/Models/TVEpisodeTests.swift +++ b/Tests/TMDbTests/Models/TVEpisodeTests.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -42,7 +61,7 @@ final class TVTests: XCTestCase { ], guestStars: [ CastMember( - id: 117642, + id: 117_642, creditID: "5256c8a219c2956ff6046f40", name: "Jason Momoa", character: "Khal Drogo", diff --git a/Tests/TMDbTests/Models/TVSeasonTests.swift b/Tests/TMDbTests/Models/TVSeasonTests.swift index d050ff10..82194c76 100644 --- a/Tests/TMDbTests/Models/TVSeasonTests.swift +++ b/Tests/TMDbTests/Models/TVSeasonTests.swift @@ -1,3 +1,22 @@ +// +// TVSeasonTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/TVSeriesExternalLinksCollectionTests.swift b/Tests/TMDbTests/Models/TVSeriesExternalLinksCollectionTests.swift index 97dd140e..901e243e 100644 --- a/Tests/TMDbTests/Models/TVSeriesExternalLinksCollectionTests.swift +++ b/Tests/TMDbTests/Models/TVSeriesExternalLinksCollectionTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesExternalLinksCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/TVSeriesPageableListTests.swift b/Tests/TMDbTests/Models/TVSeriesPageableListTests.swift index 81a0da31..6e5cc325 100644 --- a/Tests/TMDbTests/Models/TVSeriesPageableListTests.swift +++ b/Tests/TMDbTests/Models/TVSeriesPageableListTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesPageableListTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/TVSeriesTests.swift b/Tests/TMDbTests/Models/TVSeriesTests.swift index 5de03827..190e9164 100644 --- a/Tests/TMDbTests/Models/TVSeriesTests.swift +++ b/Tests/TMDbTests/Models/TVSeriesTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -10,8 +29,10 @@ final class TVSeriesTests: XCTestCase { } func testDecodeWhenHomepageIsEmptyStringReturnsTVSeries() throws { - let result = try JSONDecoder.theMovieDatabase.decode(TVSeries.self, - fromResource: "tv-series-blank-homepage-first-air-date") + let result = try JSONDecoder.theMovieDatabase.decode( + TVSeries.self, + fromResource: "tv-series-blank-homepage-first-air-date" + ) XCTAssertNil(result.homepageURL) XCTAssertNil(result.firstAirDate) diff --git a/Tests/TMDbTests/Models/TikTokLinkTests.swift b/Tests/TMDbTests/Models/TikTokLinkTests.swift index 90bf914f..fd660b10 100644 --- a/Tests/TMDbTests/Models/TikTokLinkTests.swift +++ b/Tests/TMDbTests/Models/TikTokLinkTests.swift @@ -1,3 +1,22 @@ +// +// TikTokLinkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/TwitterLinkTests.swift b/Tests/TMDbTests/Models/TwitterLinkTests.swift index 628d599d..4794e7a9 100644 --- a/Tests/TMDbTests/Models/TwitterLinkTests.swift +++ b/Tests/TMDbTests/Models/TwitterLinkTests.swift @@ -1,3 +1,22 @@ +// +// TwitterLinkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/VideoCollectionTests.swift b/Tests/TMDbTests/Models/VideoCollectionTests.swift index c0c2667a..6326eea7 100644 --- a/Tests/TMDbTests/Models/VideoCollectionTests.swift +++ b/Tests/TMDbTests/Models/VideoCollectionTests.swift @@ -1,3 +1,22 @@ +// +// VideoCollectionTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/VideoMetadataTests.swift b/Tests/TMDbTests/Models/VideoMetadataTests.swift index 5149e55d..b96ca887 100644 --- a/Tests/TMDbTests/Models/VideoMetadataTests.swift +++ b/Tests/TMDbTests/Models/VideoMetadataTests.swift @@ -1,3 +1,22 @@ +// +// VideoMetadataTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/VideoSizeTests.swift b/Tests/TMDbTests/Models/VideoSizeTests.swift index 8fec191a..8c5e6c0b 100644 --- a/Tests/TMDbTests/Models/VideoSizeTests.swift +++ b/Tests/TMDbTests/Models/VideoSizeTests.swift @@ -1,3 +1,22 @@ +// +// VideoSizeTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/VideoTypeTests.swift b/Tests/TMDbTests/Models/VideoTypeTests.swift index 1d3211fc..b1470865 100644 --- a/Tests/TMDbTests/Models/VideoTypeTests.swift +++ b/Tests/TMDbTests/Models/VideoTypeTests.swift @@ -1,3 +1,22 @@ +// +// VideoTypeTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/WatchProviderRegionsTests.swift b/Tests/TMDbTests/Models/WatchProviderRegionsTests.swift index bf915fd9..f64bc447 100644 --- a/Tests/TMDbTests/Models/WatchProviderRegionsTests.swift +++ b/Tests/TMDbTests/Models/WatchProviderRegionsTests.swift @@ -1,11 +1,32 @@ +// +// WatchProviderRegionsTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest final class WatchProviderRegionsTests: XCTestCase { func testDecodeReturnsWatchProviderRegions() throws { - let result = try JSONDecoder.theMovieDatabase.decode(WatchProviderRegions.self, - fromResource: "watch-provider-regions") + let result = try JSONDecoder.theMovieDatabase.decode( + WatchProviderRegions.self, + fromResource: "watch-provider-regions" + ) XCTAssertEqual(result.results, watchProviderRegions.results) } diff --git a/Tests/TMDbTests/Models/WatchProviderResultTests.swift b/Tests/TMDbTests/Models/WatchProviderResultTests.swift index 5b9bfee1..c1973175 100644 --- a/Tests/TMDbTests/Models/WatchProviderResultTests.swift +++ b/Tests/TMDbTests/Models/WatchProviderResultTests.swift @@ -1,11 +1,32 @@ +// +// WatchProviderResultTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest final class WatchProviderResultTests: XCTestCase { func testDecodeReturnsWatchProviderResult() throws { - let result = try JSONDecoder.theMovieDatabase.decode(WatchProviderResult.self, - fromResource: "watch-provider-result") + let result = try JSONDecoder.theMovieDatabase.decode( + WatchProviderResult.self, + fromResource: "watch-provider-result" + ) XCTAssertEqual(result, watchProviderResult) } diff --git a/Tests/TMDbTests/Models/WatchProviderTests.swift b/Tests/TMDbTests/Models/WatchProviderTests.swift index 61d1cf5f..fa885034 100644 --- a/Tests/TMDbTests/Models/WatchProviderTests.swift +++ b/Tests/TMDbTests/Models/WatchProviderTests.swift @@ -1,3 +1,22 @@ +// +// WatchProviderTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Models/WikiDataLinkTests.swift b/Tests/TMDbTests/Models/WikiDataLinkTests.swift index 0e676261..90240e03 100644 --- a/Tests/TMDbTests/Models/WikiDataLinkTests.swift +++ b/Tests/TMDbTests/Models/WikiDataLinkTests.swift @@ -1,3 +1,22 @@ +// +// WikiDataLinkTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Movies/Endpoints/MoviesEndpointTests.swift b/Tests/TMDbTests/Movies/Endpoints/MoviesEndpointTests.swift index a8d56fcc..a048ee52 100644 --- a/Tests/TMDbTests/Movies/Endpoints/MoviesEndpointTests.swift +++ b/Tests/TMDbTests/Movies/Endpoints/MoviesEndpointTests.swift @@ -1,3 +1,22 @@ +// +// MoviesEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Movies/MovieServiceTests.swift b/Tests/TMDbTests/Movies/MovieServiceTests.swift index 705f6e99..8f068a3a 100644 --- a/Tests/TMDbTests/Movies/MovieServiceTests.swift +++ b/Tests/TMDbTests/Movies/MovieServiceTests.swift @@ -1,3 +1,22 @@ +// +// MovieServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -304,14 +323,14 @@ final class MovieServiceTests: XCTestCase { let result = try await service.watchProviders(forMovie: movieID) - let regionCode = try XCTUnwrap(self.localeProvider.regionCode) + let regionCode = try XCTUnwrap(localeProvider.regionCode) XCTAssertEqual(result, expectedResult.results[regionCode]) XCTAssertEqual(apiClient.lastPath, MoviesEndpoint.watch(movieID: movieID).path) } func testExternalLinksReturnsExternalLinks() async throws { let expectedResult = MovieExternalLinksCollection.barbie - let movieID = 346698 + let movieID = 346_698 apiClient.result = .success(expectedResult) let result = try await service.externalLinks(forMovie: movieID) diff --git a/Tests/TMDbTests/Networking/APIClient/SerialiserTests.swift b/Tests/TMDbTests/Networking/APIClient/SerialiserTests.swift index 8b4d9a13..9c2a0b5b 100644 --- a/Tests/TMDbTests/Networking/APIClient/SerialiserTests.swift +++ b/Tests/TMDbTests/Networking/APIClient/SerialiserTests.swift @@ -1,3 +1,22 @@ +// +// SerialiserTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Networking/APIClient/TMDbAPIClientTests.swift b/Tests/TMDbTests/Networking/APIClient/TMDbAPIClientTests.swift index 8067e1b8..dadcafb4 100644 --- a/Tests/TMDbTests/Networking/APIClient/TMDbAPIClientTests.swift +++ b/Tests/TMDbTests/Networking/APIClient/TMDbAPIClientTests.swift @@ -1,7 +1,26 @@ +// +// TMDbAPIClientTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif final class TMDbAPIClientTests: XCTestCase { @@ -23,8 +42,13 @@ final class TMDbAPIClientTests: XCTestCase { httpClient = HTTPMockClient() serialiser = Serialiser(decoder: .theMovieDatabase) localeProvider = LocaleMockProvider(languageCode: "en", regionCode: "GB") - apiClient = TMDbAPIClient(apiKey: apiKey, baseURL: baseURL, httpClient: httpClient, serialiser: serialiser, - localeProvider: localeProvider) + apiClient = TMDbAPIClient( + apiKey: apiKey, + baseURL: baseURL, + httpClient: httpClient, + serialiser: serialiser, + localeProvider: localeProvider + ) } override func tearDown() { @@ -41,7 +65,7 @@ final class TMDbAPIClientTests: XCTestCase { httpClient.result = .success(HTTPResponse(statusCode: 401)) do { - _ = try await apiClient.get(path: URL(string: "/error")!) as String + _ = try await apiClient.get(path: URL(string: "/error")!) as String } catch let error as TMDbAPIError { switch error { case .unauthorised: @@ -59,7 +83,7 @@ final class TMDbAPIClientTests: XCTestCase { httpClient.result = .success(HTTPResponse(statusCode: 404)) do { - _ = try await apiClient.get(path: URL(string: "/error")!) as String + _ = try await apiClient.get(path: URL(string: "/error")!) as String } catch let error as TMDbAPIError { switch error { case .notFound: @@ -79,10 +103,10 @@ final class TMDbAPIClientTests: XCTestCase { httpClient.result = .success(HTTPResponse(statusCode: 404, data: statusResponse)) do { - _ = try await apiClient.get(path: URL(string: "/error")!) as String + _ = try await apiClient.get(path: URL(string: "/error")!) as String } catch let error as TMDbAPIError { switch error { - case .notFound(let message): + case let .notFound(message): XCTAssertEqual(message, expectedStatusMessage) return diff --git a/Tests/TMDbTests/Networking/APIClient/TMDbAPIErrorHTTPStatusCodeTests.swift b/Tests/TMDbTests/Networking/APIClient/TMDbAPIErrorHTTPStatusCodeTests.swift index ef213b34..db6da6e9 100644 --- a/Tests/TMDbTests/Networking/APIClient/TMDbAPIErrorHTTPStatusCodeTests.swift +++ b/Tests/TMDbTests/Networking/APIClient/TMDbAPIErrorHTTPStatusCodeTests.swift @@ -1,3 +1,22 @@ +// +// TMDbAPIErrorHTTPStatusCodeTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -10,7 +29,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .badRequest(let message): + case let .badRequest(message): XCTAssertEqual(message, expectedMessage) default: @@ -25,7 +44,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .unauthorised(let message): + case let .unauthorised(message): XCTAssertEqual(message, expectedMessage) default: @@ -40,7 +59,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .forbidden(let message): + case let .forbidden(message): XCTAssertEqual(message, expectedMessage) default: @@ -55,7 +74,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .notFound(let message): + case let .notFound(message): XCTAssertEqual(message, expectedMessage) default: @@ -70,7 +89,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .methodNotAllowed(let message): + case let .methodNotAllowed(message): XCTAssertEqual(message, expectedMessage) default: @@ -85,7 +104,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .notAcceptable(let message): + case let .notAcceptable(message): XCTAssertEqual(message, expectedMessage) default: @@ -100,7 +119,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .unprocessableContent(let message): + case let .unprocessableContent(message): XCTAssertEqual(message, expectedMessage) default: @@ -115,7 +134,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .tooManyRequests(let message): + case let .tooManyRequests(message): XCTAssertEqual(message, expectedMessage) default: @@ -130,7 +149,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .internalServerError(let message): + case let .internalServerError(message): XCTAssertEqual(message, expectedMessage) default: @@ -145,7 +164,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .notImplemented(let message): + case let .notImplemented(message): XCTAssertEqual(message, expectedMessage) default: @@ -160,7 +179,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .badGateway(let message): + case let .badGateway(message): XCTAssertEqual(message, expectedMessage) default: @@ -175,7 +194,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .serviceUnavailable(let message): + case let .serviceUnavailable(message): XCTAssertEqual(message, expectedMessage) default: @@ -190,7 +209,7 @@ final class TMDbAPIErrorHTTPStatusCodeTests: XCTestCase { let error = TMDbAPIError(statusCode: statusCode, message: expectedMessage) switch error { - case .gatewayTimeout(let message): + case let .gatewayTimeout(message): XCTAssertEqual(message, expectedMessage) default: diff --git a/Tests/TMDbTests/Networking/APIClient/TMDbStatusResponseTests.swift b/Tests/TMDbTests/Networking/APIClient/TMDbStatusResponseTests.swift index 9ab1ad9e..6f2ceb88 100644 --- a/Tests/TMDbTests/Networking/APIClient/TMDbStatusResponseTests.swift +++ b/Tests/TMDbTests/Networking/APIClient/TMDbStatusResponseTests.swift @@ -1,11 +1,32 @@ +// +// TMDbStatusResponseTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest final class TMDbStatusResponseTests: XCTestCase { func testDecodeReturnsStatusResponse() throws { - let result = try JSONDecoder.theMovieDatabase.decode(TMDbStatusResponse.self, - fromResource: "error-status-response") + let result = try JSONDecoder.theMovieDatabase.decode( + TMDbStatusResponse.self, + fromResource: "error-status-response" + ) XCTAssertEqual(result.success, statusResponse.success) XCTAssertEqual(result.statusCode, statusResponse.statusCode) diff --git a/Tests/TMDbTests/Networking/HTTPClient/URLSessionHTTPClientAdapterTests.swift b/Tests/TMDbTests/Networking/HTTPClient/URLSessionHTTPClientAdapterTests.swift index a0646fb3..0da4d36f 100644 --- a/Tests/TMDbTests/Networking/HTTPClient/URLSessionHTTPClientAdapterTests.swift +++ b/Tests/TMDbTests/Networking/HTTPClient/URLSessionHTTPClientAdapterTests.swift @@ -1,79 +1,98 @@ +// +// URLSessionHTTPClientAdapterTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif final class URLSessionHTTPClientAdapterTests: XCTestCase { - var httpClient: URLSessionHTTPClientAdapter! - var baseURL: URL! - var urlSession: URLSession! - - override func setUpWithError() throws { - try super.setUpWithError() - baseURL = try XCTUnwrap(URL(string: "https://some.domain.com/path")) - - let configuration = URLSessionConfiguration.default - configuration.protocolClasses = [MockURLProtocol.self] - urlSession = URLSession(configuration: configuration) - httpClient = URLSessionHTTPClientAdapter(urlSession: urlSession) - } - - override func tearDown() { - httpClient = nil - baseURL = nil - MockURLProtocol.reset() - super.tearDown() - } - - func testGetWhenResponseStatusCodeIs401ReturnsUnauthorisedError() async throws { - MockURLProtocol.responseStatusCode = 401 - - let response: HTTPResponse - do { - let url = try XCTUnwrap(URL(string: "/error")) - response = try await httpClient.get(url: url, headers: [:]) - } catch { - XCTFail("Unexpected error thrown") - return - } - - XCTAssertEqual(response.statusCode, 401) - } - - func testGetWhenResponseStatusCodeIs404ReturnsNotFoundError() async throws { - MockURLProtocol.responseStatusCode = 404 - - let response: HTTPResponse - do { - let url = try XCTUnwrap(URL(string: "/error")) - response = try await httpClient.get(url: url, headers: [:]) - } catch { - XCTFail("Unexpected error thrown") - return - } - - XCTAssertEqual(response.statusCode, 404) - } - - func testGetWhenResponseStatusCodeIs404AndHasStatusMessageErrorThrowsNotFoundErrorWithMessage() async throws { - MockURLProtocol.responseStatusCode = 404 - let expectedData = try Data(fromResource: "error-status-response", withExtension: "json") - MockURLProtocol.data = expectedData - - let response: HTTPResponse - do { - let url = try XCTUnwrap(URL(string: "/error")) - response = try await httpClient.get(url: url, headers: [:]) - } catch { - XCTFail("Unexpected error thrown") - return - } - - XCTAssertEqual(response.statusCode, 404) - XCTAssertEqual(response.data, expectedData) - } + var httpClient: URLSessionHTTPClientAdapter! + var baseURL: URL! + var urlSession: URLSession! + + override func setUpWithError() throws { + try super.setUpWithError() + baseURL = try XCTUnwrap(URL(string: "https://some.domain.com/path")) + + let configuration = URLSessionConfiguration.default + configuration.protocolClasses = [MockURLProtocol.self] + urlSession = URLSession(configuration: configuration) + httpClient = URLSessionHTTPClientAdapter(urlSession: urlSession) + } + + override func tearDown() { + httpClient = nil + baseURL = nil + MockURLProtocol.reset() + super.tearDown() + } + + func testGetWhenResponseStatusCodeIs401ReturnsUnauthorisedError() async throws { + MockURLProtocol.responseStatusCode = 401 + + let response: HTTPResponse + do { + let url = try XCTUnwrap(URL(string: "/error")) + response = try await httpClient.get(url: url, headers: [:]) + } catch { + XCTFail("Unexpected error thrown") + return + } + + XCTAssertEqual(response.statusCode, 401) + } + + func testGetWhenResponseStatusCodeIs404ReturnsNotFoundError() async throws { + MockURLProtocol.responseStatusCode = 404 + + let response: HTTPResponse + do { + let url = try XCTUnwrap(URL(string: "/error")) + response = try await httpClient.get(url: url, headers: [:]) + } catch { + XCTFail("Unexpected error thrown") + return + } + + XCTAssertEqual(response.statusCode, 404) + } + + func testGetWhenResponseStatusCodeIs404AndHasStatusMessageErrorThrowsNotFoundErrorWithMessage() async throws { + MockURLProtocol.responseStatusCode = 404 + let expectedData = try Data(fromResource: "error-status-response", withExtension: "json") + MockURLProtocol.data = expectedData + + let response: HTTPResponse + do { + let url = try XCTUnwrap(URL(string: "/error")) + response = try await httpClient.get(url: url, headers: [:]) + } catch { + XCTFail("Unexpected error thrown") + return + } + + XCTAssertEqual(response.statusCode, 404) + XCTAssertEqual(response.data, expectedData) + } func testGetWhenResponseHasValidDataReturnsDecodedObject() async throws { let expectedStatusCode = 200 @@ -88,39 +107,39 @@ final class URLSessionHTTPClientAdapterTests: XCTestCase { } #if !canImport(FoundationNetworking) - func testGetURLRequestHasCorrectURL() async throws { - let path = "/object?key1=value1&key2=value2" - let expectedURL = try XCTUnwrap(URL(string: path)) + func testGetURLRequestHasCorrectURL() async throws { + let path = "/object?key1=value1&key2=value2" + let expectedURL = try XCTUnwrap(URL(string: path)) - _ = try? await httpClient.get(url: expectedURL, headers: [:]) + _ = try? await httpClient.get(url: expectedURL, headers: [:]) - let result = MockURLProtocol.lastRequest?.url + let result = MockURLProtocol.lastRequest?.url - XCTAssertEqual(result, expectedURL) - } + XCTAssertEqual(result, expectedURL) + } #endif #if !canImport(FoundationNetworking) - func testGetWhenHeaderSetShouldBePresentInURLRequest() async throws { - let header1Name = "Accept" - let header1Value = "application/json" - let header2Name = "Content-Type" - let header2Value = "text/html" - - let url = try XCTUnwrap(URL(string: "/object")) - let headers = [ - header1Name: header1Value, - header2Name: header2Value - ] - _ = try? await httpClient.get(url: url, headers: headers) - - let lastURLRequest = try XCTUnwrap(MockURLProtocol.lastRequest) - let result1 = lastURLRequest.value(forHTTPHeaderField: header1Name) - let result2 = lastURLRequest.value(forHTTPHeaderField: header2Name) - - XCTAssertEqual(result1, header1Value) - XCTAssertEqual(result2, header2Value) - } + func testGetWhenHeaderSetShouldBePresentInURLRequest() async throws { + let header1Name = "Accept" + let header1Value = "application/json" + let header2Name = "Content-Type" + let header2Value = "text/html" + + let url = try XCTUnwrap(URL(string: "/object")) + let headers = [ + header1Name: header1Value, + header2Name: header2Value + ] + _ = try? await httpClient.get(url: url, headers: headers) + + let lastURLRequest = try XCTUnwrap(MockURLProtocol.lastRequest) + let result1 = lastURLRequest.value(forHTTPHeaderField: header1Name) + let result2 = lastURLRequest.value(forHTTPHeaderField: header2Name) + + XCTAssertEqual(result1, header1Value) + XCTAssertEqual(result2, header2Value) + } #endif - } +} diff --git a/Tests/TMDbTests/Networking/Mocks/HTTPMockClient.swift b/Tests/TMDbTests/Networking/Mocks/HTTPMockClient.swift index cc8e6a32..daa16a0a 100644 --- a/Tests/TMDbTests/Networking/Mocks/HTTPMockClient.swift +++ b/Tests/TMDbTests/Networking/Mocks/HTTPMockClient.swift @@ -1,3 +1,22 @@ +// +// HTTPMockClient.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -9,9 +28,9 @@ final class HTTPMockClient: HTTPClient { private(set) var getCount = 0 func get(url: URL, headers: [String: String]) async throws -> HTTPResponse { - self.lastURL = url - self.lastHeaders = headers - self.getCount += 1 + lastURL = url + lastHeaders = headers + getCount += 1 guard let result else { preconditionFailure("Result not set.") diff --git a/Tests/TMDbTests/Networking/Mocks/MockURLProtocol.swift b/Tests/TMDbTests/Networking/Mocks/MockURLProtocol.swift index fa94b32b..17bf9807 100644 --- a/Tests/TMDbTests/Networking/Mocks/MockURLProtocol.swift +++ b/Tests/TMDbTests/Networking/Mocks/MockURLProtocol.swift @@ -1,6 +1,25 @@ +// +// MockURLProtocol.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif final class MockURLProtocol: URLProtocol { @@ -8,9 +27,9 @@ final class MockURLProtocol: URLProtocol { static var data: Data? static var failError: Error? static var responseStatusCode: Int = 200 - static private(set) var lastRequest: URLRequest? + private(set) static var lastRequest: URLRequest? - override class func canInit(with request: URLRequest) -> Bool { + override class func canInit(with _: URLRequest) -> Bool { true } @@ -21,7 +40,7 @@ final class MockURLProtocol: URLProtocol { override func startLoading() { if let failError = Self.failError { - self.client?.urlProtocol(self, didFailWithError: failError) + client?.urlProtocol(self, didFailWithError: failError) return } @@ -30,16 +49,20 @@ final class MockURLProtocol: URLProtocol { } if let data = Self.data { - self.client?.urlProtocol(self, didLoad: data) + client?.urlProtocol(self, didLoad: data) } - let response = HTTPURLResponse(url: url, statusCode: Self.responseStatusCode, httpVersion: "2.0", - headerFields: nil)! - self.client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .notAllowed) - self.client?.urlProtocolDidFinishLoading(self) + let response = HTTPURLResponse( + url: url, + statusCode: Self.responseStatusCode, + httpVersion: "2.0", + headerFields: nil + )! + client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .notAllowed) + client?.urlProtocolDidFinishLoading(self) } - override func stopLoading() { } + override func stopLoading() {} static func reset() { data = nil diff --git a/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift b/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift index 2eaaee25..da100d05 100644 --- a/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift +++ b/Tests/TMDbTests/People/Endpoints/PeopleEndpointTests.swift @@ -1,3 +1,22 @@ +// +// PeopleEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/People/PersonServiceTests.swift b/Tests/TMDbTests/People/PersonServiceTests.swift index 509e7468..b0b60456 100644 --- a/Tests/TMDbTests/People/PersonServiceTests.swift +++ b/Tests/TMDbTests/People/PersonServiceTests.swift @@ -1,3 +1,22 @@ +// +// PersonServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -83,14 +102,14 @@ final class PersonServiceTests: XCTestCase { let topCastShows = Array(credits.cast.prefix(10)) let topCrewShows = Array(credits.crew.prefix(10)) var topShows = topCastShows + topCrewShows - topShows = topShows.reduce([], { shows, show in + topShows = topShows.reduce([]) { shows, show in var shows = shows if !shows.contains(where: { $0.id == show.id }) { shows.append(show) } return shows - }) + } topShows.sort { $0.popularity ?? 0 > $1.popularity ?? 0 } @@ -135,7 +154,7 @@ final class PersonServiceTests: XCTestCase { func testExternalLinksReturnsExternalLinks() async throws { let expectedResult = PersonExternalLinksCollection.sydneySweeney - let personID = 115440 + let personID = 115_440 apiClient.result = .success(expectedResult) let result = try await service.externalLinks(forPerson: personID) diff --git a/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift b/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift index e2b8c049..b220747a 100644 --- a/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift +++ b/Tests/TMDbTests/Search/Endpoints/SearchEndpointTests.swift @@ -1,3 +1,22 @@ +// +// SearchEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Search/SearchServiceTests.swift b/Tests/TMDbTests/Search/SearchServiceTests.swift index 8406b029..2f4ea598 100644 --- a/Tests/TMDbTests/Search/SearchServiceTests.swift +++ b/Tests/TMDbTests/Search/SearchServiceTests.swift @@ -1,3 +1,22 @@ +// +// SearchServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -168,8 +187,10 @@ final class SearchServiceTests: XCTestCase { let result = try await service.searchTVSeries(query: query, firstAirDateYear: year, page: page) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, - SearchEndpoint.tvSeries(query: query, firstAirDateYear: year, page: page).path) + XCTAssertEqual( + apiClient.lastPath, + SearchEndpoint.tvSeries(query: query, firstAirDateYear: year, page: page).path + ) } func testSearchPeopleWithDefaultParametersReturnsPeople() async throws { diff --git a/Tests/TMDbTests/TMDbTests.swift b/Tests/TMDbTests/TMDbTests.swift index c402576b..b3273738 100644 --- a/Tests/TMDbTests/TMDbTests.swift +++ b/Tests/TMDbTests/TMDbTests.swift @@ -1,3 +1,22 @@ +// +// TMDbTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -38,9 +57,9 @@ extension TMDbTest { private final class MockHTTPClient: HTTPClient { - init() { } + init() {} - func get(url: URL, headers: [String: String]) async throws -> HTTPResponse { + func get(url _: URL, headers _: [String: String]) async throws -> HTTPResponse { HTTPResponse() } } diff --git a/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift b/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift index 43096558..ffde659a 100644 --- a/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift +++ b/Tests/TMDbTests/TVEpisodes/ENdpoints/TVEpisodesEndpointTests.swift @@ -1,3 +1,22 @@ +// +// TVEpisodesEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -21,7 +40,8 @@ final class TVEpisodesEndpointTests: XCTestCase { tvSeriesID: 1, seasonNumber: 2, episodeNumber: 3, - languageCode: languageCode).path + languageCode: languageCode + ).path XCTAssertEqual(url, expectedURL) } @@ -36,7 +56,8 @@ final class TVEpisodesEndpointTests: XCTestCase { tvSeriesID: 1, seasonNumber: 2, episodeNumber: 3, - languageCode: languageCode).path + languageCode: languageCode + ).path XCTAssertEqual(url, expectedURL) } diff --git a/Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift b/Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift index 6788c9b7..e3b1a238 100644 --- a/Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift +++ b/Tests/TMDbTests/TVEpisodes/TVEpisodeServiceTests.swift @@ -1,3 +1,22 @@ +// +// TVEpisodeServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -28,15 +47,21 @@ final class TVEpisodeServiceTests: XCTestCase { let episodeNumber = expectedResult.episodeNumber apiClient.result = .success(expectedResult) - let result = try await service.details(forEpisode: episodeNumber, - inSeason: seasonNumber, - inTVSeries: tvSeriesID) + let result = try await service.details( + forEpisode: episodeNumber, + inSeason: seasonNumber, + inTVSeries: tvSeriesID + ) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, - TVEpisodesEndpoint.details(tvSeriesID: tvSeriesID, - seasonNumber: seasonNumber, - episodeNumber: episodeNumber).path) + XCTAssertEqual( + apiClient.lastPath, + TVEpisodesEndpoint.details( + tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + episodeNumber: episodeNumber + ).path + ) } func testImagesReturnsImages() async throws { @@ -46,16 +71,22 @@ final class TVEpisodeServiceTests: XCTestCase { let expectedResult = TVEpisodeImageCollection.mock() apiClient.result = .success(expectedResult) - let result = try await service.images(forEpisode: episodeNumber, - inSeason: seasonNumber, - inTVSeries: tvSeriesID) + let result = try await service.images( + forEpisode: episodeNumber, + inSeason: seasonNumber, + inTVSeries: tvSeriesID + ) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, - TVEpisodesEndpoint.images(tvSeriesID: tvSeriesID, - seasonNumber: seasonNumber, - episodeNumber: episodeNumber, - languageCode: localeProvider.languageCode).path) + XCTAssertEqual( + apiClient.lastPath, + TVEpisodesEndpoint.images( + tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + episodeNumber: episodeNumber, + languageCode: localeProvider.languageCode + ).path + ) } func testVideosReturnsVideos() async throws { @@ -65,16 +96,22 @@ final class TVEpisodeServiceTests: XCTestCase { let expectedResult = VideoCollection.mock() apiClient.result = .success(expectedResult) - let result = try await service.videos(forEpisode: episodeNumber, - inSeason: seasonNumber, - inTVSeries: tvSeriesID) + let result = try await service.videos( + forEpisode: episodeNumber, + inSeason: seasonNumber, + inTVSeries: tvSeriesID + ) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, - TVEpisodesEndpoint.videos(tvSeriesID: tvSeriesID, - seasonNumber: seasonNumber, - episodeNumber: episodeNumber, - languageCode: localeProvider.languageCode).path) + XCTAssertEqual( + apiClient.lastPath, + TVEpisodesEndpoint.videos( + tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + episodeNumber: episodeNumber, + languageCode: localeProvider.languageCode + ).path + ) } } diff --git a/Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift b/Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift index 30f42723..6bcf697f 100644 --- a/Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift +++ b/Tests/TMDbTests/TVSeasons/Endpoints/TVSeasonsEndpointTests.swift @@ -1,3 +1,22 @@ +// +// TVSeasonsEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift b/Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift index 6aaabc3c..cbfe9a5e 100644 --- a/Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift +++ b/Tests/TMDbTests/TVSeasons/TVSeasonServiceTests.swift @@ -1,3 +1,22 @@ +// +// TVSeasonServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest @@ -30,8 +49,10 @@ final class TVSeasonServiceTests: XCTestCase { let result = try await service.details(forSeason: seasonNumber, inTVSeries: tvSeriesID) XCTAssertEqual(result, expectedResult) - XCTAssertEqual(apiClient.lastPath, - TVSeasonsEndpoint.details(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber).path) + XCTAssertEqual( + apiClient.lastPath, + TVSeasonsEndpoint.details(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber).path + ) } func testImagesReturnsImages() async throws { @@ -45,8 +66,11 @@ final class TVSeasonServiceTests: XCTestCase { XCTAssertEqual(result, expectedResult) XCTAssertEqual( apiClient.lastPath, - TVSeasonsEndpoint.images(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, - languageCode: localeProvider.languageCode).path + TVSeasonsEndpoint.images( + tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + languageCode: localeProvider.languageCode + ).path ) } @@ -61,8 +85,11 @@ final class TVSeasonServiceTests: XCTestCase { XCTAssertEqual(result, expectedResult) XCTAssertEqual( apiClient.lastPath, - TVSeasonsEndpoint.videos(tvSeriesID: tvSeriesID, seasonNumber: seasonNumber, - languageCode: localeProvider.languageCode).path + TVSeasonsEndpoint.videos( + tvSeriesID: tvSeriesID, + seasonNumber: seasonNumber, + languageCode: localeProvider.languageCode + ).path ) } diff --git a/Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift b/Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift index 10213051..1f41f2c4 100644 --- a/Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift +++ b/Tests/TMDbTests/TVSeries/Endpoints/TVSeriesEndpointTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift b/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift index e4c4f515..49db4a32 100644 --- a/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift +++ b/Tests/TMDbTests/TVSeries/TVSeriesServiceTests.swift @@ -1,3 +1,22 @@ +// +// TVSeriesServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift b/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift index 15f5cc6f..d01eeffb 100644 --- a/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift +++ b/Tests/TMDbTests/Trending/Endpoints/TrendingEndpointTests.swift @@ -1,3 +1,22 @@ +// +// TrendingEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Trending/TrendingServiceTests.swift b/Tests/TMDbTests/Trending/TrendingServiceTests.swift index 8c3f9f8d..195660cf 100644 --- a/Tests/TMDbTests/Trending/TrendingServiceTests.swift +++ b/Tests/TMDbTests/Trending/TrendingServiceTests.swift @@ -1,3 +1,22 @@ +// +// TrendingServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/Trending/TrendingTimeWindowFilterTypeTests.swift b/Tests/TMDbTests/Trending/TrendingTimeWindowFilterTypeTests.swift index 05298a7e..456bafe4 100644 --- a/Tests/TMDbTests/Trending/TrendingTimeWindowFilterTypeTests.swift +++ b/Tests/TMDbTests/Trending/TrendingTimeWindowFilterTypeTests.swift @@ -1,3 +1,22 @@ +// +// TrendingTimeWindowFilterTypeTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift b/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift index 31a85911..bb6eeab4 100644 --- a/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift +++ b/Tests/TMDbTests/WatchProviders/Endpoints/WatchProviderEndpointTests.swift @@ -1,3 +1,22 @@ +// +// WatchProviderEndpointTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest diff --git a/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift b/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift index 44a66e66..9aef2e54 100644 --- a/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift +++ b/Tests/TMDbTests/WatchProviders/WatchProviderServiceTests.swift @@ -1,3 +1,22 @@ +// +// WatchProviderServiceTests.swift +// TMDb +// +// Copyright © 2023 Adam Young. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + @testable import TMDb import XCTest