/gokemon

Golang wrapper for PokeAPI

Primary LanguageGo

Gokemon

A Golang wrapper for PokeAPI

GoDoc

Installation

	go get github.com/argandas/gokemon

Usage

package main

import (
	"fmt"
	"github.com/argandas/gokemon"
)

func main() {
	// Get info about Charizard
	charizard, err := gokemon.GetPokemon("charizard")
	if err != nil {
		panic(err)
	}
	fmt.Println(charizard)
	// Get Charizard types
	for _, type := range charizard.Types {
		fmt.Println(type)
	}
}

Pokedex

	// Get Pokedex
	pokedex, err := gokemon.GetPokedex()
	if err != nil {
		panic(err)
	}
	// Print first 3 pokemons
	for _, pokemon := range pokedex.Pokemon[:3] {
		fmt.Println(pokemon.Get())
	}

Pokemons

	// Get info about Blastoise
	blastoise, err := gokemon.GetPokemonByID(9)
	if err != nil {
		panic(err)
	}
	fmt.Println(blastoise)

	// Get info about Charizard
	charizard, err := gokemon.GetPokemon("charizard")
	if err != nil {
		panic(err)
	}
	fmt.Println(charizard)

Abilities

	// Get Ability
	swarm, err := gokemon.GetAbility(68)
	if err != nil {
		panic(err)
	}
	fmt.Println(swarm)

Types

	// Get Type
	flying, err := gokemon.GetType(3)
	if err != nil {
		panic(err)
	}
	fmt.Println(flying)

Moves

	// Get Move
	dragonTail, err := gokemon.GetMove(525)
	if err != nil {
		panic(err)
	}
	fmt.Println(dragonTail)

Eggs

	// Get Egg
	monster, err := gokemon.GetEgg(1)
	if err != nil {
		panic(err)
	}
	fmt.Println(monster)

Descriptions

	// Get Description
	desc, err := gokemon.GetDescription(200)
	if err != nil {
		panic(err)
	}
	fmt.Println(desc)

Sprites

	// Get Sprite
	sprite, err := gokemon.GetSprite(77)
	if err != nil {
		panic(err)
	}
	fmt.Println(sprite)

Games

	// Get Game
	yellow, err := gokemon.GetGame(6)
	if err != nil {
		panic(err)
	}
	fmt.Println(yellow)