Celerium_PokeAPI
Buy me a coffee
Whether you use this project, have learned something from it, or just like it, please consider supporting it by buying me a coffee, so I can dedicate more time on open-source projects like this :)
About The Project
The PokeAPI offers users the ability to extract data from Poke into third-party reporting tools and aims to abstract away the details of interacting with Poke’s API endpoints in such a way that is consistent with PowerShell nomenclature. This gives system administrators and PowerShell developers a convenient and familiar way of using Poke’s API to create documentation scripts, automation, and integrations.
- :book: Project documentation can be found on Github Pages
- :book: Poke’s REST API documentation on their website here.
Poke features a REST API that makes use of common HTTP request methods. In order to maintain PowerShell best practices, only approved verbs are used.
- GET -> Get-
Additionally, PowerShell’s verb-noun
nomenclature is respected. Each noun is prefixed with Poke
in an attempt to prevent naming problems.
For example, one might access the /pokemon/
endpoint by running the following PowerShell command with the appropriate parameters:
Get-PokePokemon -id 1
Install
This module can be installed directly from the PowerShell Gallery with the following command:
Install-Module -Name PokeAPI
- :information_source: This module supports PowerShell 5.0+ and should work in PowerShell Core.
- :information_source: If you are running an older version of PowerShell, or if PowerShellGet is unavailable, you can manually download the main branch and place the PokeAPI folder into the (default)
C:\Program Files\WindowsPowerShell\Modules
folder.
Project documentation can be found on Github Pages
- A full list of functions can be retrieved by running
Get-Command -Module PokeAPI
. - Help info and a list of parameters can be found by running
Get-Help <command name>
, such as:
Get-Help Get-PokePokemon
Get-Help Get-PokePokemon -Full
Initial Setup
After installing this module, you will need to configure the base URI that are used to talk with the Poke API.
- Run
Add-PokeBaseURI
- By default, Poke’s
https://pokeapi.co/api/v2
URI is used. - If you have your own API gateway or proxy, you may put in your own custom URI by specifying the
-base_uri
parameter:Add-PokeBaseURI -base_uri http://myapi.gateway.celerium.org
- By default, Poke’s
- [optional] Run
Export-PokeModuleSettings
- This will create a config file at
%UserProfile%\PokeAPI
that holds the base uri information. - Next time you run
Import-Module -Name PokeAPI
, this configuration file will automatically be loaded.
- This will create a config file at
Usage
Calling an API resource is as simple as running Get-Poke<resourceName>
- The following is a table of supported functions and their corresponding API resources:
- Table entries with [
-
] indicate that the functionality is NOT supported by the Poke API at this time.
Category | EndpointUri | Method | Function |
---|---|---|---|
berry | /berry/ | GET | Get-PokeBerry |
berry | /berry/{id or name}/ | GET | Get-PokeBerry |
berry | /berry-firmness | GET | Get-PokeBerryFirmness |
berry | /berry-firmness/{id or name}/ | GET | Get-PokeBerryFirmness |
berry | /berry-flavor/ | GET | Get-PokeBerryFlavor |
berry | /berry-flavor/{id or name}/ | GET | Get-PokeBerryFlavor |
contest | /contest-type/ | GET | Get-PokeContestType |
contest | /contest-type/{id or name}/ | GET | Get-PokeContestType |
contest | /contest-effect/ | GET | Get-PokeContestEffect |
contest | /contest-effect/{id}/ | GET | Get-PokeContestEffect |
contest | /super-contest-effect/ | GET | Get-PokeContestSuperEffect |
contest | /super-contest-effect/{id}/ | GET | Get-PokeContestSuperEffect |
encounter | /encounter-method/ | GET | Get-PokeEncounterMethod |
encounter | /encounter-method/{id or name}/ | GET | Get-PokeEncounterMethod |
encounter | /encounter-condition/ | GET | Get-PokeEncounterCondition |
encounter | /encounter-condition/{id or name}/ | GET | Get-PokeEncounterCondition |
encounter | /encounter-condition-value/{id or name}/ | GET | Get-PokeEncounterConditionValue |
encounter | /encounter-condition-value/{id or name}/ | GET | Get-PokeEncounterConditionValue |
evolution | /evolution-chain/ | GET | Get-PokeEvolutionChain |
evolution | /evolution-chain/{id}/ | GET | Get-PokeEvolutionChain |
evolution | /evolution-trigger/ | GET | Get-PokeEvolutionTrigger |
evolution | /evolution-trigger/{id or name}/ | GET | Get-PokeEvolutionTrigger |
game | /generation/ | GET | Get-PokeGameGeneration |
game | /generation/{id or name}/ | GET | Get-PokeGameGeneration |
game | /pokedex/ | GET | Get-PokeGamePokedex |
game | /pokedex/{id or name}/ | GET | Get-PokeGamePokedex |
game | /version/ | GET | Get-PokeGameVersion |
game | /version/{id or name}/ | GET | Get-PokeGameVersion |
game | /version-group/ | GET | Get-PokeGameVersionGroup |
game | /version-group/{id or name}/ | GET | Get-PokeGameVersionGroup |
Internal | POST | Add-PokeBaseURI | |
Internal | PUT | ConvertTo-PokeQueryString | |
Internal | GET | Export-PokeModuleSettings | |
Internal | GET | Get-PokeBaseURI | |
Internal | GET | Get-PokeMetaData | |
Internal | GET | Get-PokeModuleSettings | |
Internal | SET | Import-PokeModuleSettings | |
Internal | GET | Invoke-PokeRequest | |
Internal | DELETE | Remove-PokeBaseURI | |
Internal | DELETE | Remove-PokeModuleSettings | |
item | /item/ | GET | Get-PokeItem |
item | /item/{id or name}/ | GET | Get-PokeItem |
item | /item-attribute/ | GET | Get-PokeItemAttribute |
item | /item-attribute/{id or name}/ | GET | Get-PokeItemAttribute |
item | /item-category/ | GET | Get-PokeItemCategory |
item | /item-category/{id or name}/ | GET | Get-PokeItemCategory |
item | /item-fling-effect/ | GET | Get-PokeItemFlingEffect |
item | /item-fling-effect/{id or name}/ | GET | Get-PokeItemFlingEffect |
item | /item-pocket/ | GET | Get-PokeItemPocket |
item | /item-pocket/{id or name}/ | GET | Get-PokeItemPocket |
location | /location/ | GET | Get-PokeLocation |
location | /location/{id or name}/ | GET | Get-PokeLocation |
location | /location-area/ | GET | Get-PokeLocationArea |
location | /location-area/{id or name}/ | GET | Get-PokeLocationArea |
location | /pal-park-area/ | GET | Get-PokeLocationPalParkArea |
location | /pal-park-area/{id or name}/ | GET | Get-PokeLocationPalParkArea |
location | /region/ | GET | Get-PokeLocationRegion |
location | /region/{id or name}/ | GET | Get-PokeLocationRegion |
machine | /machine/ | GET | Get-PokeMachine |
machine | /machine/{id}/ | GET | Get-PokeMachine |
move | /move/ | GET | Get-PokeMove |
move | /move/{id or name}/ | GET | Get-PokeMove |
move | /move-ailment/ | GET | Get-PokeMoveAilment |
move | /move-ailment/{id or name}/ | GET | Get-PokeMoveAilment |
move | /move-battle-style/ | GET | Get-PokeMoveBattleStyle |
move | /move-battle-style/{id or name}/ | GET | Get-PokeMoveBattleStyle |
move | /move-category/ | GET | Get-PokeMoveCategory |
move | /move-category/{id or name}/ | GET | Get-PokeMoveCategory |
move | /move-damage-class/ | GET | Get-PokeMoveDamageClass |
move | /move-damage-class/{id or name}/ | GET | Get-PokeMoveDamageClass |
move | /move-learn-method/ | GET | Get-PokeMoveLearnMethod |
move | /move-learn-method/{id or name}/ | GET | Get-PokeMoveLearnMethod |
move | /move-target/ | GET | Get-PokeMoveTarget |
move | /move-target/{id or name}/ | GET | Get-PokeMoveTarget |
pokemon | /ability/ | GET | Get-PokePokemonAbility |
pokemon | /ability/{id or name}/ | GET | Get-PokePokemonAbility |
pokemon | /characteristic/ | GET | Get-PokePokemonCharacteristic |
pokemon | /characteristic/{id}/ | GET | Get-PokePokemonCharacteristic |
pokemon | /egg-group/ | GET | Get-PokePokemonEggGroup |
pokemon | /egg-group/{id or name}/ | GET | Get-PokePokemonEggGroup |
pokemon | /gender/ | GET | Get-PokePokemonGender |
pokemon | /gender/{id or name}/ | GET | Get-PokePokemonGender |
pokemon | /growth-rate/ | GET | Get-PokePokemonGrowthRate |
pokemon | /growth-rate/{id or name}/ | GET | Get-PokePokemonGrowthRate |
pokemon | /nature/ | GET | Get-PokePokemonNature |
pokemon | /nature/{id or name}/ | GET | Get-PokePokemonNature |
pokemon | /pokeathlon-stat/ | GET | Get-PokePokemonPokeathlonStat |
pokemon | /pokeathlon-stat/{id or name}/ | GET | Get-PokePokemonPokeathlonStat |
pokemon | /pokemon/ | GET | Get-PokePokemon |
pokemon | /pokemon/{id or name}/ | GET | Get-PokePokemon |
pokemon | /pokemon/{id or name}/encounters | GET | Get-PokePokemonEncounter |
pokemon | /pokemon-color/ | GET | Get-PokePokemonColor |
pokemon | /pokemon-color/{id or name}/ | GET | Get-PokePokemonColor |
pokemon | /pokemon-form/ | GET | Get-PokePokemonForm |
pokemon | /pokemon-form/{id or name}/ | GET | Get-PokePokemonForm |
pokemon | /pokemon-habitat/ | GET | Get-PokePokemonHabitat |
pokemon | /pokemon-habitat/{id or name}/ | GET | Get-PokePokemonHabitat |
pokemon | /pokemon-shape/ | GET | Get-PokePokemonShape |
pokemon | /pokemon-shape/{id or name}/ | GET | Get-PokePokemonShape |
pokemon | /pokemon-species/ | GET | Get-PokePokemonSpecies |
pokemon | /pokemon-species/{id or name}/ | GET | Get-PokePokemonSpecies |
pokemon | /stat/ | GET | Get-PokePokemonStat |
pokemon | /stat/{id or name}/ | GET | Get-PokePokemonStat |
pokemon | /type/ | GET | Get-PokePokemonType |
pokemon | /type/{id or name}/ | GET | Get-PokePokemonType |
utility | /language/ | GET | Get-PokeLanguage |
utility | /language/{id or name}/ | GET | Get-PokeLanguage |
utility | / | GET | Get-PokeEndpoint |
Each Get-Poke*
function will respond with the raw data that Poke’s API provides.
Roadmap
- Add Changelog
- Build more robust Pester & ScriptAnalyzer tests
- Figure out how to do CI & PowerShell gallery automation
- Add example scripts & automation
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag “enhancement”. Don’t forget to give the project a star! Thanks again!
See the CONTRIBUTING guide for more information about contributing.
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Acknowledgments
Big thank you to the following people and services as they have provided me with lots of helpful information as I continue this project!