MDChapter
public struct MDChapter
extension MDChapter: Decodable
extension MDChapter: Encodable
Structure representing a manga chapter returned by MangaDex
This is passed in the data
property of an MDObject
-
The chapter’s title
Declaration
Swift
public let title: String
-
The volume this chapter belongs to, if entered by the uploader
Declaration
Swift
public let volume: String?
-
The chapter in the printed manga which corresponds to this chapter
Note
This may benil
string if the uploader did not provide a chapter number (e.g. for oneshots)Declaration
Swift
public let chapter: String?
-
The language in which this chapter was translated
Declaration
Swift
public let language: Locale?
-
The chapter’s hash, used to fetch the pages when using MangaDex@Home
Declaration
Swift
public let hash: String
-
The list of page file names
Use
getPageUrls
to get the list of URLs for these filesDeclaration
Swift
public let pages: [String]
-
The list of low resolution page file names
Use
getPageUrls
and set thelowRes
parameter totrue
to get the list of URLs for these filesDeclaration
Swift
public let pagesLowRes: [String]
-
The date at which this chapter entry was created on MangaDex
Declaration
Swift
public let createdDate: Date
-
The date of the last update made to this chapter entry on MangaDex
Note
This property will benil
if the chapter was never modified after being createdDeclaration
Swift
public let updatedDate: Date?
-
The date at which this chapter will be or has been published
Note
This may differ from thecreatedDate
property as scanlation groups might impose delaysDeclaration
Swift
public let publishDate: Date?
-
The version of this type of object in the MangaDex API
Declaration
Swift
public let version: Int
-
The list of page URLs for this chapter using the specified node
Declaration
Swift
public func getPageUrls(node: MDAtHomeNode, lowRes: Bool = false) -> [URL]
Parameters
node
The MD@Home node serving the images
lowRes
Whether to get the low resolution version of the image or not
-
The list of page URLs for this chapter using the specified “official” image server
Declaration
Swift
public func getPageUrls(node: MDImageServer, lowRes: Bool = false) -> [URL]
Parameters
node
The image server serving the images
lowRes
Whether to get the low resolution version of the image or not
-
Custom
init
implementation to handle decoding thelanguage
attributeDeclaration
Swift
public init(from decoder: Decoder) throws
-
Convenience
init
used for update endpointsDeclaration
Swift
public init(title: String, volume: String? = nil, chapter: String? = nil, language: Locale, pages: [String], pagesLowRes: [String])
-
Custom
encode
implementation to handle encoding thelanguage
attributeThe MangaDex API does not expect the same thing when encoding an
MDChapter
as when decoding it, which makes this a bit awkward. See https://api.mangadex.org/docs.html#operation/put-chapter for more detailsDeclaration
Swift
public func encode(to encoder: Encoder) throws