Added Fetcher

This commit is contained in:
Artyom Belousov 2021-02-07 10:33:16 +03:00
parent b823cffe69
commit 40f1687972
10 changed files with 36 additions and 19 deletions

View file

@ -12,7 +12,7 @@ import (
const ScryfallUrl = "https://api.scryfall.com"
func GetNameByCardId(set string, number string) string {
func (f *Fetcher) GetNameByCardId(set string, number string) string {
/*
Note: number is string because some cards contain letters in their numbers.
*/
@ -20,7 +20,7 @@ func GetNameByCardId(set string, number string) string {
return GetCardByUrl(path)
}
func GetOriginalName(name string, dict io.Reader) string {
func (f *Fetcher) GetOriginalName(name string, dict io.Reader) string {
path := ScryfallUrl + "/cards/named?fuzzy=" + ApplyFilters(name)
result := GetCardByUrl(path)
if result == "" && dict != nil {