go get github.com/xligenda/spworldsДля начала вам нужно указать ID и Token вашей карты, найти их можно здесь
package main
import (
"fmt"
"github.com/xligenda/spworlds"
)
func main() {
api := spworlds.NewClient("card id", "card token")
resp, err := api.Me()
if err != nil || resp == nil {
panic(err)
}
fmt.Printf("Никнейм владельца карточки: %s", *resp.Username)
}Перевод АРов на другую карту
package main
import (
"fmt"
"github.com/xligenda/spworlds"
)
func main() {
api := spworlds.NewClient("card id", "card token")
// Перевод 10 АР на карту с номером OSTER, с комментарием "Подарок"
resp, err := api.CreateTransaction(spworlds.CreateTransactionOptions{
Receiver: "OSTER",
Amount: 10,
Comment: "Подарок",
})
if err != nil || resp == nil {
panic(err)
}
fmt.Printf("Оставшийся баланс карты: %d", resp.Balance)
}