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

[WIP] plugins/pkm: update api from v1 to v2 #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyle-discher
Copy link

@kyle-discher kyle-discher commented Jul 26, 2021

This is a simple update from v1 -> v2.

Regressions:
Text was renamed to Rules, but was not implemented in the go-sdk-v2 PokemonCard object. I commented it out for now, assuming a future implementation in the go-sdk-v2.

Question:
The Attack struct was removed in the v2 sdk. On line 64 of plugins/pkm/util_test.go I tried replacing this with struct and with pokemontcgsdk.PokemonCard.Attack. What would be the best way to change this test/access the Attack struct?

@jeandeaual
Copy link
Owner

@kyle-discher Thanks for the contribution, and sorry I didn't get back earlier!

Regressions:
Text was renamed to Rules, but was not implemented in the go-sdk-v2 PokemonCard object. I commented it out for now, assuming a future implementation in the go-sdk-v2.

Ideally we should create an issue or PR upstream to add the feature, but for now that's fine.

Question:
The Attack struct was removed in the v2 sdk. On line 64 of plugins/pkm/util_test.go I tried replacing this with struct and with pokemontcgsdk.PokemonCard.Attack. What would be the best way to change this test/access the Attack struct?

It's a bit confusing, but according to https://github.com/PokemonTCG/pokemon-tcg-sdk-go-v2/blob/9293c9ff8ca182e35917089ed59271fafb7fedb5/pkg/card.go#L25, you should be able to do:

Attacks: []struct {
	Name string
	Cost []string
	ConvertedEnergyCost int
	Damage string
	Text string
}{
	{
		Name:  "Test",
		Cost: []string{"Psychic", "Colorless"},
		Damage: "50",
		Text: "Test",
	},
	{
		Name: "Test",
		Cost: []string{"Colorless"},
	},
}

@jeandeaual jeandeaual added dependencies Pull requests that update a dependency file enhancement New feature or request labels Oct 14, 2021
@jeandeaual jeandeaual self-requested a review December 25, 2021 00:52
@jeandeaual
Copy link
Owner

Regarding the Rules field, github.com/jeandeaual/pokemon-tcg-sdk-go-v2 can be used for now instead of github.com/PokemonTCG/pokemon-tcg-sdk-go-v2 until PokemonTCG/pokemon-tcg-sdk-go-v2#1 gets merged.

@kyle-discher Do you still want to work on this? I can finish your implementation if you'd prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants