Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't unmarshal #5

Open
lexfrei opened this issue Mar 3, 2019 · 2 comments
Open

Can't unmarshal #5

lexfrei opened this issue Mar 3, 2019 · 2 comments

Comments

@lexfrei
Copy link
Contributor

lexfrei commented Mar 3, 2019

Seems like something goes wrong.

My code:

package main

import (
	"fmt"
	"os"

	mtg "github.com/MagicTheGathering/mtg-sdk-go"
)

func main() {
	cards, err := mtg.NewQuery().Where(mtg.CardLanguage, "Russian").All()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println(len(cards))
}

My error:

lex@desktop MINGW64 ~/go/src/github.com/lexfrei/goscgp (master)
$ go run requester/maim.go
json: cannot unmarshal string into Go struct field Card.hand of type int
exit status 1
@rahvin74
Copy link

rahvin74 commented Mar 29, 2019

I'm having this same issue. My assumption is that the json API has changed.

@Reid-E
Copy link

Reid-E commented May 18, 2019

This error in particular is because of the addition of the hand property of Vanguard cards which modify starting hand and life totals. The SDK needs to be updated to reflect this change, among others. Paulo Luculano fixed a few of these in January, but there is still more to do.

If you're not interested in Vanguard cards, or silver-border cards (which will also definitely create problems), you could use the gameFormat API parameter, and limit your search to Vintage legal cards. Since Vintage allows all non-silver-border cards, for example https://api.magicthegathering.io/v1/cards?gameFormat=Vintage&types=Vanguard returns an empty list, and https://api.magicthegathering.io/v1/cards?gameFormat=Vintage&set=UGL returns a list of basic lands.

Also, I think the language parameter only functions if you use a non-English card name, I don't think it actually filters beyond that, though I may be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants