aboutsummaryrefslogtreecommitdiff
path: root/manga
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-04 00:54:35 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-04 00:54:35 +0530
commit72989b8e2fb6060f89cee60d32a0c84660792116 (patch)
treeb3de54f1f2476dd0da831f0a5b9409ea31f4387d /manga
parent2a1dc51d0bf9e4d440e33dc01f86947985aff787 (diff)
Breaking Change: supporting NSFW titles
Diffstat (limited to 'manga')
-rw-r--r--manga/client.go2
-rw-r--r--manga/manga.go16
-rw-r--r--manga/manga.structs.go2
-rw-r--r--manga/request_handler.go2
4 files changed, 11 insertions, 11 deletions
diff --git a/manga/client.go b/manga/client.go
index 4622835..5847ed8 100644
--- a/manga/client.go
+++ b/manga/client.go
@@ -17,7 +17,7 @@
package manga
import (
- "github.com/MikunoNaka/MAL2Go/v2/util"
+ "github.com/MikunoNaka/MAL2Go/v3/util"
)
type Client util.DefaultClient
diff --git a/manga/manga.go b/manga/manga.go
index 576526c..a4a1505 100644
--- a/manga/manga.go
+++ b/manga/manga.go
@@ -19,14 +19,14 @@ package manga
import (
"encoding/json"
"strconv"
- e "github.com/MikunoNaka/MAL2Go/v2/errhandlers"
- u "github.com/MikunoNaka/MAL2Go/v2/util"
+ e "github.com/MikunoNaka/MAL2Go/v3/errhandlers"
+ u "github.com/MikunoNaka/MAL2Go/v3/util"
)
const BASE_URL string = "https://api.myanimelist.net/v2/manga"
// in MAL documentation this is named Get Manga List
-func (c Client) SearchManga(searchString string, limit, offset int, fields []string) ([]Manga, error) {
+func (c Client) SearchManga(searchString string, limit, offset int, nsfw bool, fields []string) ([]Manga, error) {
var searchResults []Manga
// error handling for limit
@@ -44,8 +44,8 @@ func (c Client) SearchManga(searchString string, limit, offset int, fields []str
// generate endpoint url with custom params
endpoint, _ := u.UrlGenerator(
BASE_URL,
- []string{"q", "limit", "offset", "fields"},
- [][]string{{searchString}, {strconv.Itoa(limit)}, {strconv.Itoa(offset)}, fields},
+ []string{"q", "limit", "offset", "fields", "nsfw"},
+ [][]string{{searchString}, {strconv.Itoa(limit)}, {strconv.Itoa(offset)}, fields, {strconv.FormatBool(nsfw)}},
true,
)
@@ -91,7 +91,7 @@ func (c Client) GetMangaById(mangaId int, fields []string) (Manga, error) {
}
// Ranking is a list of manga sorted by their rank
-func (c Client) GetMangaRanking(rankingType string, limit, offset int, fields []string) ([]rManga, error) {
+func (c Client) GetMangaRanking(rankingType string, limit, offset int, nsfw bool, fields []string) ([]rManga, error) {
var mangaRanking []rManga
// error handling for limit
@@ -113,8 +113,8 @@ func (c Client) GetMangaRanking(rankingType string, limit, offset int, fields []
endpoint, _ := u.UrlGenerator(
BASE_URL + "/ranking",
- []string{"ranking_type", "limit", "offset", "fields"},
- [][]string{{rankingType}, {strconv.Itoa(limit)}, {strconv.Itoa(offset)}, fields},
+ []string{"ranking_type", "limit", "offset", "fields", "nsfw"},
+ [][]string{{rankingType}, {strconv.Itoa(limit)}, {strconv.Itoa(offset)}, fields, {strconv.FormatBool(nsfw)}},
true,
)
diff --git a/manga/manga.structs.go b/manga/manga.structs.go
index 2e79362..37d69d2 100644
--- a/manga/manga.structs.go
+++ b/manga/manga.structs.go
@@ -17,7 +17,7 @@
package manga
import (
- "github.com/MikunoNaka/MAL2Go/v2/util"
+ "github.com/MikunoNaka/MAL2Go/v3/util"
)
type Author struct {
diff --git a/manga/request_handler.go b/manga/request_handler.go
index 070ea6b..ae95313 100644
--- a/manga/request_handler.go
+++ b/manga/request_handler.go
@@ -21,7 +21,7 @@ import (
"log"
"net/http"
"encoding/json"
- "github.com/MikunoNaka/MAL2Go/v2/util"
+ "github.com/MikunoNaka/MAL2Go/v3/util"
"errors"
)