diff options
Diffstat (limited to 'content/docs/mal2go/v4/tips-and-tricks/_index.md')
-rw-r--r-- | content/docs/mal2go/v4/tips-and-tricks/_index.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/content/docs/mal2go/v4/tips-and-tricks/_index.md b/content/docs/mal2go/v4/tips-and-tricks/_index.md new file mode 100644 index 0000000..b172763 --- /dev/null +++ b/content/docs/mal2go/v4/tips-and-tricks/_index.md @@ -0,0 +1,28 @@ +--- +title: "Tips and Tricks" +description: "Some tips and best practises for using MAL2Go (optional)" +weight: 4 +--- + +These are some tips and best practises, and other notes for using MAL2Go. Following this is optional but might make your life easier! + +## Better ways to store/read auth tokens: + +- Use [godotenv](https://github.com/joho/godotenv) to read the auth token from a config file +- [Viper](https://github.com/spf13/viper) can do the same thing, but can also write to the file easily; also with viper you can locate the file anywhere on your system +- [go-keyring](https://github.com/zalando/go-keyring) can be used to read/write the secret token to the system's keyring. It is by far the most secure way but only works on some systems (windows, macos and linux with gnome-keyring) + +## SearchManga and SearchAnime functions are quirky! + +While you *can* specify fields to these functions, in order to get specific data, searching for some reason only returns limited fields most of the times. +It's not like it just doesn't support all of the fields but many times it just.. doesn't. So if you want to search *and* get ALL fields about an anime, or just +be sure that the data is complete, use [`SearchAnime`](/docs/mal2go/v4/anime/search-for-an-anime/)/[`SearchManga`](/docs/mal2go/v4/manga/search-for-a-manga/) +just to get the ID. After that, use [`GetAnimeById`](/docs/mal2go/v4/anime/get-anime-by-id/)/[`GetMangaById`](/docs/mal2go/v4/manga/get-manga-by-id/). + +## macli has a good example on how to generate your own tokens with go + +MAL2Go was made for my other project, [macli](https://github.com/MikunoNaka/macli). +Macli's `auth` package uses [`github.com/zalando/go-keyring`](https://github.com/zalando/go-keyring) +and the `net/http` package to prompt the user and generate an auth token with the given client id. + +You can look at [the code](https://github.com/MikunoNaka/macli/tree/master/auth) to see how it works. |