MDApi
public class MDApi : NSObject
The main MangaDex API class, which should be used to access the framework’s capabilities
-
Base URL for the MangaDex website
Declaration
Swift
public static let websiteBaseURL: String -
Base URL for the MangaDex API
Declaration
Swift
public static let apiBaseURL: String -
Base URL for the MangaDex network API
Declaration
Swift
public static let networkBaseURL: String -
Base URL for MangaDex uploaded resources
Declaration
Swift
public static let uploadsBaseURL: String -
Default value appended after the default User-Agent for all requests made by the MangaDexLib
Declaration
Swift
public static let defaultUserAgent: String -
Instance of
MDRequestHandlerused to perform all requestsDeclaration
Swift
public let requestHandler: MDRequestHandler -
Session token provided by the API after login
Note
This token is valid for 15 minutes and must be refreshed afterwardsDeclaration
Swift
public internal(set) var sessionJwt: String? { get set } -
Refresh token provided by the API after login
Note
This token is valid for 1 month and can be used to obtain a newsessionJwtDeclaration
Swift
public internal(set) var refreshJwt: String? { get } -
Setter for the User-Agent to use for requests
Declaration
Swift
public func setUserAgent(_ userAgent: String) -
Create a new account with the given information
Declaration
Swift
public func createAccount(info: MDAccountInfo, completion: @escaping (MDResult<MDUser>?, MDApiError?) -> Void)Parameters
infoThe account information
completionThe completion block called once the request is done
-
Activate an account
Declaration
Swift
public func activateAccount(activationCode: String, completion: @escaping (MDApiError?) -> Void)Parameters
activationCodeThe activation code sent to the provided email address
completionThe completion block called once the request is done
-
Ask for an activation code to be resent
Declaration
Swift
public func resendActivationCode(email: String, completion: @escaping (MDApiError?) -> Void)Parameters
emailThe account email
completionThe completion block called once the request is done
-
Start the recovery process for an account
Declaration
Swift
public func requestAccountRecovery(email: String, completion: @escaping (MDApiError?) -> Void)Parameters
emailThe account email
completionThe completion block called once the request is done
-
Commplete the recovery process for an account
Precondition
Having calledrequestAccountRecoveryDeclaration
Swift
public func completeAccountRecovery(recoveryCode: String, newPassword: String, completion: @escaping (MDApiError?) -> Void)Parameters
recoveryCodeThe recovery code sent to the account’s email address
newPasswordThe new password to set for the account
completionThe completion block called once the request is done
-
Login to MangaDex
Precondition
The user must not be logged-inDeclaration
Swift
public func login(credentials: MDAuthCredentials, completion: @escaping (MDApiError?) -> Void)Parameters
credentialsThe user’s credentials
completionThe completion block called once the request is done
-
Logout of MangaDex
Precondition
The user must be logged-inDeclaration
Swift
public func logout(completion: @escaping (MDApiError?) -> Void)Parameters
completionThe completion block called once the request is done
-
Check that the current session token is valid and get its information
Declaration
Swift
public func checkToken(completion: @escaping (MDAuthInfo?, MDApiError?) -> Void)Parameters
completionThe completion block called once the request is done
-
Refresh the current session token
This should be called every 15 minutes, as the session JWT will have expired
Precondition
The user must be logged-inDeclaration
Swift
public func refreshToken(completion: @escaping (MDApiError?) -> Void)Parameters
completionThe completion block called once the request is done
-
Get the list of authors
Declaration
Swift
public func getAuthorList(filter: MDAuthorFilter? = nil, includes: [MDObjectType]? = nil, completion: @escaping (MDResultList<MDAuthor>?, MDApiError?) -> Void)Parameters
filterThe filter to use
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Create an author with the specified information
Precondition
The user must be logged-inDeclaration
Swift
public func createAuthor(info: MDAuthor, completion: @escaping (MDResult<MDAuthor>?, MDApiError?) -> Void)Parameters
infoThe author information
completionThe completion block called once the request is done
-
View the specified author’s information
Declaration
Swift
public func viewAuthor(authorId: String, includes: [MDObjectType]? = nil, completion: @escaping (MDResult<MDAuthor>?, MDApiError?) -> Void)Parameters
authorIdThe id of the author
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Update the specified author’s information
Precondition
The user must be logged-inDeclaration
Swift
public func updateAuthor(authorId: String, info: MDAuthor, completion: @escaping (MDResult<MDAuthor>?, MDApiError?) -> Void)Parameters
authorIdThe id of the author
infoThe author information
completionThe completion block called once the request is done
-
Delete the specified author
Precondition
The user must be logged-inDeclaration
Swift
public func deleteAuthor(authorId: String, completion: @escaping (MDApiError?) -> Void)Parameters
authorIdThe id of the author
completionThe completion block called once the request is done
-
Get the list of latest published chapters
Declaration
Swift
public func getChapterList(filter: MDChapterFilter? = nil, includes: [MDObjectType]? = nil, completion: @escaping (MDResultList<MDChapter>?, MDApiError?) -> Void)Parameters
filterThe filter to use
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
View the specified chapter’s information
Declaration
Swift
public func viewChapter(chapterId: String, includes: [MDObjectType]? = nil, completion: @escaping (MDResult<MDChapter>?, MDApiError?) -> Void)Parameters
chapterIdThe id of the chapter
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Update the specified chapter’s information
Precondition
The user must be logged-inDeclaration
Swift
public func updateChapter(chapterId: String, info: MDChapter, completion: @escaping (MDResult<MDChapter>?, MDApiError?) -> Void)Parameters
chapterIdThe id of the chapter
infoThe chapter information
completionThe completion block called once the request is done
-
Delete the specified chapter
Precondition
The user must be logged-inDeclaration
Swift
public func deleteChapter(chapterId: String, completion: @escaping (MDApiError?) -> Void)Parameters
chapterIdThe id of the chapter
completionThe completion block called once the request is done
-
Mark the specified chapter as read
Precondition
The user must be logged-inDeclaration
Swift
public func markChapterRead(chapterId: String, completion: @escaping (MDApiError?) -> Void)Parameters
chapterIdThe id of the chapter
completionThe completion block called once the request is done
-
Mark the specified chapter as unread
Precondition
The user must be logged-inDeclaration
Swift
public func markChapterUnread(chapterId: String, completion: @escaping (MDApiError?) -> Void)Parameters
chapterIdThe id of the chapter
completionThe completion block called once the request is done
-
Get the list of latest published covers
Declaration
Swift
public func getCoverList(filter: MDCoverFilter? = nil, includes: [MDObjectType]? = nil, completion: @escaping (MDResultList<MDCover>?, MDApiError?) -> Void)Parameters
filterThe filter to use
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
View the specified cover’s information
Declaration
Swift
public func viewCover(coverId: String, includes: [MDObjectType]? = nil, completion: @escaping (MDResult<MDCover>?, MDApiError?) -> Void)Parameters
coverIdThe id of the cover
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Update the specified cover’s information
Precondition
The user must be logged-inDeclaration
Swift
public func updateCover(coverId: String, info: MDCover, completion: @escaping (MDResult<MDCover>?, MDApiError?) -> Void)Parameters
coverIdThe id of the cover
infoThe cover information
completionThe completion block called once the request is done
-
Delete the specified cover
Precondition
The user must be logged-inDeclaration
Swift
public func deleteCover(coverId: String, completion: @escaping (MDApiError?) -> Void)Parameters
coverIdThe id of the cover
completionThe completion block called once the request is done
-
Create a custom list with the specified information
Precondition
The user must be logged-inDeclaration
Swift
public func createCustomList(info: MDCustomList, completion: @escaping (MDResult<MDCustomList>?, MDApiError?) -> Void)Parameters
infoThe list information
completionThe completion block called once the request is done
-
View the specified custom list’s information
Precondition
The user must be logged-inDeclaration
Swift
public func viewCustomList(listId: String, completion: @escaping (MDResult<MDCustomList>?, MDApiError?) -> Void)Parameters
listIdThe id of the custom list
completionThe completion block called once the request is done
-
Update the specified custom list’s information
Precondition
The user must be logged-inDeclaration
Swift
public func updateCustomList(listId: String, info: MDCustomList, completion: @escaping (MDResult<MDCustomList>?, MDApiError?) -> Void)Parameters
listIdThe id of the custom list
infoThe custom list information
completionThe completion block called once the request is done
-
Delete the specified custom list
Precondition
The user must be logged-inDeclaration
Swift
public func deleteCustomList(listId: String, completion: @escaping (MDApiError?) -> Void)Parameters
listIdThe id of the custom list
completionThe completion block called once the request is done
-
Get the specified custom list’s feed (aka its list of chapters)
Precondition
The user must be logged-inDeclaration
Swift
public func getCustomListFeed(listId: String, filter: MDFeedFilter? = nil, completion: @escaping (MDResultList<MDChapter>?, MDApiError?) -> Void)Parameters
listIdThe id of the custom list
filterThe filter to apply
completionThe completion block called once the request is done
-
Get the list of scanlation groups
Declaration
Swift
public func getGroupList(filter: MDGroupFilter? = nil, includes: [MDObjectType]? = nil, completion: @escaping (MDResultList<MDGroup>?, MDApiError?) -> Void)Parameters
filterThe filter to use
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Create a scanlation group with the specified information
Precondition
The user must be logged-inDeclaration
Swift
public func createGroup(info: MDGroup, completion: @escaping (MDResult<MDGroup>?, MDApiError?) -> Void)Parameters
infoThe scanlation group information
completionThe completion block called once the request is done
-
View the specified scanlation group’s information
Declaration
Swift
public func viewGroup(groupId: String, includes: [MDObjectType]? = nil, completion: @escaping (MDResult<MDGroup>?, MDApiError?) -> Void)Parameters
groupIdThe id of the scanlation group
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Update the specified scanlation group’s information
Precondition
The user must be logged-inDeclaration
Swift
public func updateGroup(groupId: String, info: MDGroup, completion: @escaping (MDResult<MDGroup>?, MDApiError?) -> Void)Parameters
groupIdThe scanlation group’s id
infoThe scanlation group information
completionThe completion block called once the request is done
-
Delete the specified scanlation group
Precondition
The user must be logged-inDeclaration
Swift
public func deleteGroup(groupId: String, completion: @escaping (MDApiError?) -> Void)Parameters
groupIdThe id of the scanlation group
completionThe completion block called once the request is done
-
Follow the specified scanlation group
Precondition
The user must be logged-inDeclaration
Swift
public func followGroup(groupId: String, completion: @escaping (MDApiError?) -> Void)Parameters
groupIdThe id of the scanlation group
completionThe completion block called once the request is done
-
Unfollow the specified scanlation group
Precondition
The user must be logged-inDeclaration
Swift
public func unfollowGroup(groupId: String, completion: @escaping (MDApiError?) -> Void)Parameters
groupIdThe id of the scanlation group
completionThe completion block called once the request is done
-
Get the MD@Home node URL hosting the specified chapter’s page images
If you do not want to use a MD@Home node, you can use one of the values of the
MDImageServerenum Also seeMDChapter.getPageUrlsPrecondition
The user must be logged-inDeclaration
Swift
public func getChapterServer(chapterId: String, forcePort443: Bool = false, completion: @escaping (MDAtHomeNode?, MDApiError?) -> Void)Parameters
chapterIdThe id of the chapter
forcePort443Force selecting from MangaDex@Home servers that use the standard HTTPS port 443. This might be useful for networks with aggressive firewalls (e.g. school/office networks)
completionThe completion block called once the request is done
-
Send a report after fetching an image from a MD@Home node
Declaration
Swift
public func sendAtHomeReport(info: MDAtHomeReport, completion: @escaping (MDApiError?) -> Void)Parameters
infoThe report information
completionThe completion block called once the request is done
-
Get the mapping between legacy object IDs and new object IDs
Declaration
Swift
public func getLegacyMapping(query: MDMappingQuery, completion: @escaping ([MDResult<MDMapping>]?, MDApiError?) -> Void)Parameters
queryThe mappings to ask for
completionThe completion block called once the request is done
-
Ping the MangaDex website to ensure it is up
Declaration
Swift
public func ping(completion: @escaping (MDApiError?) -> Void)Parameters
completionThe completion block called once the request is done
-
Solve a captcha challenge sent by MangaDex
Declaration
Swift
public func solveCaptcha(challenge: String, completion: @escaping (MDApiError?) -> Void)Parameters
challengeThe solution to the challenge
completionThe completion block called once the request is done
-
Get the list of latest updated mangas
Declaration
Swift
public func getMangaList(filter: MDMangaFilter? = nil, includes: [MDObjectType]? = nil, completion: @escaping (MDResultList<MDManga>?, MDApiError?) -> Void)Parameters
filterThe filter to use
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Get the list of existing tags for mangas
Declaration
Swift
public func getMangaTagList(completion: @escaping ([MDResult<MDTag>]?, MDApiError?) -> Void)Parameters
completionThe completion block called once the request is done
-
Get a random manga
Declaration
Swift
public func getRandomManga(includes: [MDObjectType]? = nil, completion: @escaping (MDResult<MDManga>?, MDApiError?) -> Void)Parameters
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Create a new manga with the specified information
Precondition
The user must be logged-inDeclaration
Swift
public func createManga(info: MDManga, completion: @escaping (MDResult<MDManga>?, MDApiError?) -> Void)Parameters
infoThe manga information
completionThe completion block called once the request is done
-
View the specified manga’s information
Declaration
Swift
public func viewManga(mangaId: String, includes: [MDObjectType]? = nil, completion: @escaping (MDResult<MDManga>?, MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Update the specified manga’s information
Precondition
The user must be logged-inDeclaration
Swift
public func updateManga(mangaId: String, info: MDManga, completion: @escaping (MDResult<MDManga>?, MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
infoThe manga information
completionThe completion block called once the request is done
-
Delete the specified manga
Precondition
The user must be logged-inDeclaration
Swift
public func deleteManga(mangaId: String, completion: @escaping (MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
completionThe completion block called once the request is done
-
Follow the specified manga
Precondition
The user must be logged-inDeclaration
Swift
public func followManga(mangaId: String, completion: @escaping (MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
completionThe completion block called once the request is done
-
Unfollow the specified manga
Precondition
The user must be logged-inDeclaration
Swift
public func unfollowManga(mangaId: String, completion: @escaping (MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
completionThe completion block called once the request is done
-
Add the specified manga to the logged-in user’s custom list
Precondition
The user must be logged-inDeclaration
Swift
public func addMangaToCustomList(mangaId: String, listId: String, completion: @escaping (MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
listIdThe id of the custom list
completionThe completion block called once the request is done
-
Remove the specified manga from the logged-in user’s custom list
Precondition
The user must be logged-inDeclaration
Swift
public func removeMangaFromCustomList(mangaId: String, listId: String, completion: @escaping (MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
listIdThe id of the custom list
completionThe completion block called once the request is done
-
Get the specified manga’s feed (aka its list of chapters)
Declaration
Swift
public func getMangaFeed(mangaId: String, filter: MDFeedFilter? = nil, includes: [MDObjectType]? = nil, completion: @escaping (MDResultList<MDChapter>?, MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
filterThe filter to apply
includesThe additional relationships to load (see Reference Expansion)
completionThe completion block called once the request is done
-
Get the specified manga’s aggregation of volumes and chapters
Declaration
Swift
public func getMangaVolumesAndChapters(mangaId: String, languages: [Locale]? = nil, completion: @escaping (MDAggregate?, MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
languagesThe list of translated languages to filter on
Return Value
The MangaDex URL
-
Get a list of chapter ids that are marked as read for the specified manga and the logged-in user
Precondition
The user must be logged-inDeclaration
Swift
public func getMangaReadMarkers(mangaId: String, completion: @escaping (MDReadMarkers?, MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
completionThe completion block called once the request is done
-
Get a list of chapter ids that are marked as read for the specified mangas and the logged-in user
Precondition
The user must be logged-inDeclaration
Swift
public func getMangasReadMarkers(mangaIds: [String], completion: @escaping (MDReadMarkers?, MDApiError?) -> Void)Parameters
mangaIdsThe list of manga ids
completionThe completion block called once the request is done
-
Get all of the logged-in user’s reading statuses
Precondition
The user must be logged-inDeclaration
Swift
public func getReadingStatuses(filter: MDReadingStatus? = nil, completion: @escaping (MDReadingStatuses?, MDApiError?) -> Void)Parameters
filterThe filter to apply
completionThe completion block called once the request is done
-
Get all of the logged-in user’s reading statuses
Precondition
The user must be logged-inDeclaration
Swift
public func getMangaReadingStatus(mangaId: String, completion: @escaping (MDReadingStatus?, MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
completionThe completion block called once the request is done
-
Update the logged-in user’s reading status for the specified manga
Precondition
The user must be logged-inNote
Setting the reading status tonilwill remove itDeclaration
Swift
public func updateMangaReadingStatus(mangaId: String, status: MDReadingStatus?, completion: @escaping (MDApiError?) -> Void)Parameters
mangaIdThe id of the manga
statusThe new reading status
completionThe completion block called once the request is done
-
Get the list of users
Precondition
The user must be logged-inDeclaration
Swift
public func getUserList(filter: MDUserFilter? = nil, completion: @escaping (MDResultList<MDUser>?, MDApiError?) -> Void)Parameters
filterThe filter to use
completionThe completion block called once the request is done
-
View the specified user’s information
Declaration
Swift
public func viewUser(userId: String, completion: @escaping (MDResult<MDUser>?, MDApiError?) -> Void)Parameters
userIdThe id of the user
completionThe completion block called once the request is done
-
View the specified user’s custom lists
Precondition
The user must be logged-inDeclaration
Swift
public func getUserCustomLists(userId: String, pagination: MDPaginationFilter? = nil, completion: @escaping (MDResultList<MDCustomList>?, MDApiError?) -> Void)Parameters
userIdThe id of the user
paginationThe pagination filter to apply
completionThe completion block called once the request is done
-
View the logged-in user’s information
Precondition
The user must be logged-inDeclaration
Swift
public func viewLoggedUser(completion: @escaping (MDResult<MDUser>?, MDApiError?) -> Void)Parameters
completionThe completion block called once the request is done
-
Update the logged-in user’s password
Precondition
The user must be logged-inDeclaration
Swift
public func updateLoggedUserPassword(old: String, new: String, completion: @escaping (MDApiError?) -> Void)Parameters
oldThe user’s old password
newThe user’s new password
completionThe completion block called once the request is done
-
Update the logged-in user’s email address
Precondition
The user must be logged-inDeclaration
Swift
public func updateLoggedUserEmail(email: String, completion: @escaping (MDApiError?) -> Void)Parameters
newThe user’s new email address
completionThe completion block called once the request is done
-
Get the list of mangas followed by the logged-in user
Precondition
The user must be logged-inDeclaration
Swift
public func getLoggedUserFollowedMangaList(pagination: MDPaginationFilter? = nil, completion: @escaping (MDResultList<MDManga>?, MDApiError?) -> Void)Parameters
paginationThe pagination filter to apply
completionThe completion block called once the request is done
-
Get the logged-in user’s followed manga feed (aka their list of recent chapters)
Precondition
The user must be logged-inDeclaration
Swift
public func getLoggedUserFollowedMangaFeed(filter: MDFeedFilter? = nil, completion: @escaping (MDResultList<MDChapter>?, MDApiError?) -> Void)Parameters
filterThe filter to apply
completionThe completion block called once the request is done
-
Get the list of scanlation groups followed by the logged-in user
Precondition
The user must be logged-inDeclaration
Swift
public func getLoggedUserFollowedGroupList(pagination: MDPaginationFilter? = nil, completion: @escaping (MDResultList<MDGroup>?, MDApiError?) -> Void)Parameters
paginationThe pagination filter to apply
completionThe completion block called once the request is done
-
Get the list of users followed by the logged-in user
Precondition
The user must be logged-inDeclaration
Swift
public func getLoggedUserFollowedUserList(pagination: MDPaginationFilter? = nil, completion: @escaping (MDResultList<MDUser>?, MDApiError?) -> Void)Parameters
paginationThe pagination filter to apply
completionThe completion block called once the request is done
-
Get the logged-in user’s custom lists
Precondition
The user must be logged-inDeclaration
Swift
public func getLoggedUserCustomLists(pagination: MDPaginationFilter? = nil, completion: @escaping (MDResultList<MDCustomList>?, MDApiError?) -> Void)Parameters
paginationThe pagination filter to apply
completionThe completion block called once the request is done
View on GitHub
MDApi Class Reference