Go to file
Felipe M f23ff3d03e
Fix README typo
2021-03-10 12:07:44 +01:00
test_outputs Added test JSON files 2021-02-05 11:12:58 +01:00
.gitignore Restructured code 2021-02-12 14:26:08 +01:00
LICENSE Added LICENSE 2021-02-13 13:01:01 +01:00
README.md Fix README typo 2021-03-10 12:07:44 +01:00
cache.go Cache also request query parameters 2021-03-10 12:07:32 +01:00
go.mod code.fmartingr.dev -> github.com 2021-02-13 13:01:31 +01:00
go.sum Logging improvements 2021-02-06 18:31:15 +01:00
http.go Moved cache log lines to trace level 2021-02-21 22:14:37 +01:00
public.go Naming refactor. Added comments. 2021-02-13 12:49:16 +01:00
types.go Naming refactor. Added comments. 2021-02-13 12:49:16 +01:00

README.md

go-mangadex

Mangadex API client in Golang.

Stable version under stable branch. Latest development under latest branch.

Usage

import (
    "log"

    "github.com/fmartingr/go-mangadex"
)

func main() {
    // Retrieve manga information
    manga, errManga := mangadex.GetManga(123)
    if errManga != nil {
        log.Println("Error retrieving manga: %s", errManga)
    }

    // 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)
    }
}