-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: TV Series aggregate credits (#174)
* TVSeriesAggregateCreditsRequest * Add method to TVSeriesService * FEATURE: TV Series aggregate credits * Update docs
- Loading branch information
1 parent
c32b6fd
commit a6cd279
Showing
18 changed files
with
890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// | ||
// AggregrateCastMember.swift | ||
// TMDb | ||
// | ||
// Copyright © 2024 Adam Young. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an AS IS BASIS, | ||
// WITHOUT 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 | ||
|
||
/// | ||
/// A model representing an aggregate cast member. | ||
/// | ||
public struct AggregrateCastMember: Identifiable, Codable, Equatable, Hashable, Sendable { | ||
|
||
/// | ||
/// Person identifier. | ||
/// | ||
public let id: Int | ||
|
||
/// | ||
/// Cast member's name. | ||
/// | ||
public let name: String | ||
|
||
/// | ||
/// Cast member's original name. | ||
/// | ||
public let originalName: String | ||
|
||
/// | ||
/// Cast member's gender. | ||
/// | ||
public let gender: Gender | ||
|
||
/// | ||
/// Cast member's profile image. | ||
/// | ||
/// To generate a full URL see <doc:/TMDb/GeneratingImageURLs>. | ||
/// | ||
public let profilePath: URL? | ||
|
||
/// | ||
/// Cast member's roles. | ||
/// | ||
public let roles: [CastRole] | ||
|
||
/// | ||
/// Department this person is known for. | ||
/// | ||
public let knownForDepartment: String? | ||
|
||
/// | ||
/// Is adult? | ||
/// | ||
public let adult: Bool? | ||
|
||
/// | ||
/// Total episodes this cast member appears in. | ||
/// | ||
public let totalEpisodeCount: Int | ||
|
||
/// | ||
/// Cast member's popularity. | ||
/// | ||
public let popularity: Double? | ||
|
||
/// | ||
/// Creates an aggregate cast member's role object. | ||
/// | ||
/// - Parameters: | ||
/// - id: Person identifier. | ||
/// - name: Cast member's name. | ||
/// - originalName: Cast member's original name. | ||
/// - gender: Cast member's gender. | ||
/// - profilePath: Cast member's profile image. | ||
/// - roles: Cast member's roles. | ||
/// - knownForDepartment: Department this person is known for. | ||
/// - adult: Is adult? | ||
/// - totalEpisodeCount: Total episodes this cast member appears in. | ||
/// - popularity: Cast member's popularity. | ||
/// | ||
public init( | ||
id: Int, | ||
name: String, | ||
originalName: String, | ||
gender: Gender, | ||
profilePath: URL?, | ||
roles: [CastRole], | ||
knownForDepartment: String?, | ||
adult: Bool?, | ||
totalEpisodeCount: Int, | ||
popularity: Double? | ||
) { | ||
self.id = id | ||
self.name = name | ||
self.originalName = originalName | ||
self.gender = gender | ||
self.profilePath = profilePath | ||
self.roles = roles | ||
self.knownForDepartment = knownForDepartment | ||
self.adult = adult | ||
self.totalEpisodeCount = totalEpisodeCount | ||
self.popularity = popularity | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// | ||
// AggregrateCrewMember.swift | ||
// TMDb | ||
// | ||
// Copyright © 2024 Adam Young. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an AS IS BASIS, | ||
// WITHOUT 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 | ||
|
||
/// | ||
/// A model representing an aggregate crew member. | ||
/// | ||
public struct AggregrateCrewMember: Identifiable, Codable, Equatable, Hashable, Sendable { | ||
|
||
/// | ||
/// Person identifier. | ||
/// | ||
public let id: Int | ||
|
||
/// | ||
/// Crew member's name. | ||
/// | ||
public let name: String | ||
|
||
/// | ||
/// Crew member's original name. | ||
/// | ||
public let originalName: String | ||
|
||
/// | ||
/// Cast member's gender. | ||
/// | ||
public let gender: Gender | ||
|
||
/// | ||
/// Cast member's profile image. | ||
/// | ||
/// To generate a full URL see <doc:/TMDb/GeneratingImageURLs>. | ||
/// | ||
public let profilePath: URL? | ||
|
||
/// | ||
/// Cast member's roles. | ||
/// | ||
public let jobs: [CrewJob] | ||
|
||
/// | ||
/// Department this person is known for. | ||
/// | ||
public let knownForDepartment: String? | ||
|
||
/// | ||
/// Is adult? | ||
/// | ||
public let adult: Bool? | ||
|
||
/// | ||
/// Total episodes the crew member worked on. | ||
/// | ||
public let totalEpisodeCount: Int | ||
|
||
/// | ||
/// Cast member's popularity. | ||
/// | ||
public let popularity: Double? | ||
|
||
/// | ||
/// Creates an aggregate cast member's role object. | ||
/// | ||
/// - Parameters: | ||
/// - id: Person identifier. | ||
/// - name: Crew member's name. | ||
/// - originalName: Crew member's original name. | ||
/// - gender: Crew member's gender. | ||
/// - profilePath: Crew member's profile image. | ||
/// - jobs: Crew member's job. | ||
/// - knownForDepartment: Department this person is known for. | ||
/// - adult: Is adult? | ||
/// - totalEpisodeCount: Total episodes this crew member appears in. | ||
/// - popularity: Crew member's popularity. | ||
/// | ||
public init( | ||
id: Int, | ||
name: String, | ||
originalName: String, | ||
gender: Gender, | ||
profilePath: URL?, | ||
jobs: [CrewJob], | ||
knownForDepartment: String?, | ||
adult: Bool?, | ||
totalEpisodeCount: Int, | ||
popularity: Double? | ||
) { | ||
self.id = id | ||
self.name = name | ||
self.originalName = originalName | ||
self.gender = gender | ||
self.profilePath = profilePath | ||
self.jobs = jobs | ||
self.knownForDepartment = knownForDepartment | ||
self.adult = adult | ||
self.totalEpisodeCount = totalEpisodeCount | ||
self.popularity = popularity | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// CastRole.swift | ||
// TMDb | ||
// | ||
// Copyright © 2024 Adam Young. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an AS IS BASIS, | ||
// WITHOUT 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 | ||
|
||
/// | ||
/// A model representing an aggregate cast member's role. | ||
/// | ||
public struct CastRole: Codable, Equatable, Hashable, Sendable { | ||
|
||
/// | ||
/// Credit identifier. | ||
/// | ||
public let creditID: String | ||
|
||
/// | ||
/// Cast member's character. | ||
/// | ||
public let character: String | ||
|
||
/// | ||
/// Number of episodes this cast member appeared in in this role. | ||
/// | ||
public let episodeCount: Int | ||
|
||
/// | ||
/// Creates an aggregate cast member's role object. | ||
/// | ||
/// - Parameters: | ||
/// - creditID: Credit identifier. | ||
/// - character: Cast member's character. | ||
/// - episodeCount: Number of episodes this cast member appeared in in | ||
/// this role. | ||
/// | ||
public init( | ||
creditID: String, | ||
character: String, | ||
episodeCount: Int | ||
) { | ||
self.creditID = creditID | ||
self.character = character | ||
self.episodeCount = episodeCount | ||
} | ||
|
||
} | ||
|
||
extension CastRole { | ||
|
||
private enum CodingKeys: String, CodingKey { | ||
case creditID = "creditId" | ||
case character | ||
case episodeCount | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// CrewJob.swift | ||
// TMDb | ||
// | ||
// Copyright © 2024 Adam Young. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an AS IS BASIS, | ||
// WITHOUT 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 | ||
|
||
/// | ||
/// A model representing an aggregate crew member's job. | ||
/// | ||
public struct CrewJob: Codable, Equatable, Hashable, Sendable { | ||
|
||
/// | ||
/// Credit identifier. | ||
/// | ||
public let creditID: String | ||
|
||
/// | ||
/// Crew member's job. | ||
/// | ||
public let job: String | ||
|
||
/// | ||
/// Number of episodes this crew member appeared in in this role. | ||
/// | ||
public let episodeCount: Int | ||
|
||
/// | ||
/// Creates an aggregate crew member's role object. | ||
/// | ||
/// - Parameters: | ||
/// - creditID: Credit identifier. | ||
/// - job: Crew member's job. | ||
/// - episodeCount: Number of episodes this crew member appeared in in | ||
/// this role. | ||
/// | ||
public init( | ||
creditID: String, | ||
job: String, | ||
episodeCount: Int | ||
) { | ||
self.creditID = creditID | ||
self.job = job | ||
self.episodeCount = episodeCount | ||
} | ||
|
||
} | ||
|
||
extension CrewJob { | ||
|
||
private enum CodingKeys: String, CodingKey { | ||
case creditID = "creditId" | ||
case job | ||
case episodeCount | ||
} | ||
|
||
} |
Oops, something went wrong.