aboutsummaryrefslogtreecommitdiff
path: root/mal
diff options
context:
space:
mode:
Diffstat (limited to 'mal')
-rw-r--r--mal/delete.go14
-rw-r--r--mal/mal.go10
-rw-r--r--mal/search.go8
-rw-r--r--mal/status.go24
-rw-r--r--mal/user.go11
5 files changed, 44 insertions, 23 deletions
diff --git a/mal/delete.go b/mal/delete.go
index 27ffbe6..863e9f3 100644
--- a/mal/delete.go
+++ b/mal/delete.go
@@ -21,19 +21,25 @@ package mal
import (
"fmt"
// "os"
- a "github.com/MikunoNaka/MAL2Go/anime"
- m "github.com/MikunoNaka/MAL2Go/manga"
+ a "github.com/MikunoNaka/MAL2Go/v2/anime"
+ m "github.com/MikunoNaka/MAL2Go/v2/manga"
)
func DeleteAnime(anime a.Anime) {
- res := userAnimeClient.DeleteAnime(anime.Id)
+ res, err := userAnimeClient.DeleteAnime(anime.Id)
+ if err != nil {
+ fmt.Println("Error While Deleting " + anime.Title + ":", err)
+ }
if res != "200" {
fmt.Println("Error: MyAnimeList Returned " + res + " while deleting " + anime.Title)
}
}
func DeleteManga(manga m.Manga) {
- res := userMangaClient.DeleteManga(manga.Id)
+ res, err := userMangaClient.DeleteManga(manga.Id)
+ if err != nil {
+ fmt.Println("Error While Deleting " + manga.Title + ":", err)
+ }
if res != "200" {
fmt.Println("Error: MyAnimeList Returned " + res + " while deleting " + manga.Title)
}
diff --git a/mal/mal.go b/mal/mal.go
index 362b51b..ff915ac 100644
--- a/mal/mal.go
+++ b/mal/mal.go
@@ -20,11 +20,11 @@ package mal
import (
"github.com/MikunoNaka/macli/auth"
- a "github.com/MikunoNaka/MAL2Go/anime"
- m "github.com/MikunoNaka/MAL2Go/manga"
- u "github.com/MikunoNaka/MAL2Go/user"
- ua "github.com/MikunoNaka/MAL2Go/user/anime"
- um "github.com/MikunoNaka/MAL2Go/user/manga"
+ a "github.com/MikunoNaka/MAL2Go/v2/anime"
+ m "github.com/MikunoNaka/MAL2Go/v2/manga"
+ u "github.com/MikunoNaka/MAL2Go/v2/user"
+ ua "github.com/MikunoNaka/MAL2Go/v2/user/anime"
+ um "github.com/MikunoNaka/MAL2Go/v2/user/manga"
)
var animeClient a.Client
diff --git a/mal/search.go b/mal/search.go
index 703cdb4..8fee461 100644
--- a/mal/search.go
+++ b/mal/search.go
@@ -21,8 +21,8 @@ package mal
import (
"fmt"
"os"
- a "github.com/MikunoNaka/MAL2Go/anime"
- m "github.com/MikunoNaka/MAL2Go/manga"
+ a "github.com/MikunoNaka/MAL2Go/v2/anime"
+ m "github.com/MikunoNaka/MAL2Go/v2/manga"
)
func SearchAnime(searchString string) []a.Anime {
@@ -36,7 +36,7 @@ func SearchAnime(searchString string) []a.Anime {
os.Exit(1)
}
- return res.Animes
+ return res
}
func SearchManga(searchString string) []m.Manga {
@@ -50,5 +50,5 @@ func SearchManga(searchString string) []m.Manga {
os.Exit(1)
}
- return res.Mangas
+ return res
}
diff --git a/mal/status.go b/mal/status.go
index 1e11106..4a581df 100644
--- a/mal/status.go
+++ b/mal/status.go
@@ -29,10 +29,14 @@ func SetAnimeStatus(animeId int, status string) {
fmt.Println("Error while parsing status:", err.Error())
os.Exit(1)
}
- if resp.Error != "" {
- fmt.Println("MyAnimeList reported error on setting anime status", resp.Error, resp.Message)
- os.Exit(1)
- }
+ // TODO: do something with resp
+ fmt.Println(resp)
+
+ // not needed with MAL2Go v2.... probably
+ // if resp.Error != "" {
+ // fmt.Println("MyAnimeList reported error on setting anime status", resp.Error, resp.Message)
+ // os.Exit(1)
+ // }
}
func SetMangaStatus(mangaId int, status string) {
@@ -41,8 +45,12 @@ func SetMangaStatus(mangaId int, status string) {
fmt.Println("Error while parsing status:", err.Error())
os.Exit(1)
}
- if resp.Error != "" {
- fmt.Println("MyAnimeList reported error on setting manga status", resp.Error, resp.Message)
- os.Exit(1)
- }
+ // TODO: do something with resp
+ fmt.Println(resp)
+
+ // not needed with MAL2Go v2.... probably
+ // if resp.Error != "" {
+ // fmt.Println("MyAnimeList reported error on setting manga status", resp.Error, resp.Message)
+ // os.Exit(1)
+ // }
}
diff --git a/mal/user.go b/mal/user.go
index 4d7aa45..f6e9ce7 100644
--- a/mal/user.go
+++ b/mal/user.go
@@ -19,9 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package mal
import (
- u "github.com/MikunoNaka/MAL2Go/user"
+ u "github.com/MikunoNaka/MAL2Go/v2/user"
+ "fmt"
+ "os"
)
func GetUserInfo() u.UserInfo {
- return userClient.GetSelfUserInfo()
+ userInfo, err := userClient.GetSelfUserInfo()
+ if err != nil {
+ fmt.Println("Error fetching User Information:", err)
+ os.Exit(1)
+ }
+ return userInfo
}