2021-02-04 12:12:31 +00:00
|
|
|
# go-mangadex
|
|
|
|
|
2021-02-04 21:59:22 +00:00
|
|
|
Mangadex API client in Golang.
|
|
|
|
|
2021-02-13 12:04:50 +00:00
|
|
|
Stable version under **stable** branch. Latest development under **latest** branch.
|
|
|
|
|
2021-02-04 21:59:22 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
``` go
|
|
|
|
import (
|
2021-02-10 16:09:09 +00:00
|
|
|
"log"
|
|
|
|
|
2021-02-13 12:01:31 +00:00
|
|
|
"github.com/fmartingr/go-mangadex"
|
2021-02-04 21:59:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2021-02-10 16:09:09 +00:00
|
|
|
// Retrieve manga information
|
2021-02-04 21:59:22 +00:00
|
|
|
manga, err := mangadex.GetManga(123)
|
2021-02-10 16:09:09 +00:00
|
|
|
if errManga != nil {
|
|
|
|
log.Println("Error retrieving manga: %s", errManga)
|
2021-02-04 21:59:22 +00:00
|
|
|
}
|
|
|
|
|
2021-02-10 16:09:09 +00:00
|
|
|
// Retrieve a list of chapters
|
|
|
|
chaptersRequest := NewGetChaptersParams()
|
|
|
|
chapters, errChapterList = manga.getChapters(chaptersRequest)
|
|
|
|
if errChapterList != nil {
|
|
|
|
log.Println("Error retrieving chapters page %d: %s", chaptersRequest.Page, errChapterList)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disables chache reads for requests beyond this point
|
|
|
|
mangadex.DisableCache()
|
|
|
|
|
|
|
|
// Retrieve a specific chapter detail
|
|
|
|
// This will return more information than the list (the pages, server, etc)
|
|
|
|
chapter, err := manga.GetChapter(1)
|
|
|
|
if errChapter != nil {
|
|
|
|
log.Println("Error retrieving chapter: %s", errChapter)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Re-enables the cache
|
|
|
|
mangadex.EnableCache()
|
|
|
|
|
|
|
|
// Get all covers for this manga
|
|
|
|
covers, errCovers := manga.GetCovers()
|
|
|
|
if errCovers != nil {
|
|
|
|
log.Println("Error retreiving covers: %s", errCovers)
|
|
|
|
}
|
|
|
|
}
|
2021-02-04 21:59:22 +00:00
|
|
|
```
|