{"id":26066515,"url":"https://github.com/fireisgood/pokemon-location-pokemon","last_synced_at":"2025-06-12T05:34:37.404Z","repository":{"id":279157464,"uuid":"937862210","full_name":"FireIsGood/pokemon-location-pokemon","owner":"FireIsGood","description":"Wrapper around PokeAPI to get Pokemon catchable from a given city or region+route","archived":false,"fork":false,"pushed_at":"2025-02-24T20:52:05.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T20:53:13.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FireIsGood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-24T03:01:12.000Z","updated_at":"2025-03-01T02:32:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2514603-ccbd-45e1-b6e5-c26ef58fba1d","html_url":"https://github.com/FireIsGood/pokemon-location-pokemon","commit_stats":null,"previous_names":["fireisgood/pokemon-location-pokemon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FireIsGood/pokemon-location-pokemon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireIsGood%2Fpokemon-location-pokemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireIsGood%2Fpokemon-location-pokemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireIsGood%2Fpokemon-location-pokemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireIsGood%2Fpokemon-location-pokemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FireIsGood","download_url":"https://codeload.github.com/FireIsGood/pokemon-location-pokemon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireIsGood%2Fpokemon-location-pokemon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259405474,"owners_count":22852426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-08T20:52:29.778Z","updated_at":"2025-06-12T05:34:37.398Z","avatar_url":"https://github.com/FireIsGood.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pokemon Location Pokemon API\n\nWrapper around the [PokeAPI](https://pokeapi.co) location API to get Pokemon from a city or route in a region.\n\n## API Overview\n\nThe API has two separate routes:\n\n- `/city` takes a city name via post request\n- `/route` takes a region and route number via post request\n\n### `/city` endpoint\n\n- Get Pokemon from location\n  - `location` (string): Location name (e.g. `castelia-city`)\n- Returns\n  - `pokemon` (array of strings): All catchable Pokemon in the area.\n\n```json\n{\n  \"location\": \"castelia-city\"\n}\n```\n\nOutput:\n\n```json\n{\n  \"pokemon\": [\n    \"rattata\",\n    \"eevee\",\n    \"skitty\",\n    \"delcatty\",\n    \"buneary\",\n    \"lopunny\",\n    \"pidove\",\n    \"audino\",\n    \"cottonee\",\n    \"whimsicott\",\n    \"petilil\",\n    \"lilligant\",\n    \"zorua\"\n  ]\n}\n```\n\n### `/route` endpoint\n\n- Get Pokemon from region's route\n  - `region` (string): Region name (e.g. `hoenn`)\n  - `routeNumber` (int): Route number (e.g. `113`)\n- Returns\n  - `pokemon` (array of strings): All catchable Pokemon in the route\n\n```json\n{\n  \"region\": \"hoenn\",\n  \"routeNumber\": \"113\"\n}\n```\n\nOutput:\n\n```json\n{\n  \"pokemon\": [\"sandshrew\", \"slugma\", \"skarmory\", \"spinda\"]\n}\n```\n\n### Errors\n\nErrors are returned as 400 level status codes.\n\n- `400`: You messed up the input data shape\n- `404`: You messed up the region name or something else caused the PokeAPI to explode\n\n## Installation\n\nThis project uses npm, you can check if it is installed via:\n\n```bash\nnpm -v\n```\n\nAfter you clone the repo, install the npm packages:\n\n```bash\nnpm install\n```\n\nYou can then run the program via the provided npm script:\n\n```bash\nnpm run dev\n```\n\nYou should get a response telling you where the server is running:\n\n```shell\n$ npm run dev\n\n  \u003e dev\n  \u003e tsx watch src/index.ts\n\n  Server is running on http://localhost:4978\n```\n\n### Usage\n\nAccess the API via post requests to the API endpoints. Here is a simple python example using the\n[requests library](https://requests.readthedocs.io/en/latest/):\n\n```py\nimport requests\n\n\nendpoint = \"city\"\ndata = {\"location\": \"castelia-city\"}\nr = requests.post(f\"http://localhost:4978/{endpoint}\", json=data)\nif r.status_code == 200:\n    response = r.json()\n    print(response)\nelse:\n    print(\"Something went wrong:\", r.reason)\n\nendpoint = \"route\"\ndata = {\"region\": \"hoenn\", \"routeNumber\": 113}\nr = requests.post(f\"http://localhost:4978/{endpoint}\", json=data)\nif r.status_code == 200:\n    response = r.json()\n    print(response)\nelse:\n    print(\"Something went wrong:\", r.reason)\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eFull Example\u003c/summary\u003e\n\n```py\nimport requests\n\n\ndef test_post(endpoint: str, data: dict):\n    print(f\"POST: /{endpoint} and {data}\")\n    r = requests.post(f\"http://localhost:4978/{endpoint}\", json=data)\n    if r.status_code == 200:\n        response = r.json()\n        print(\"-\u003e\", r.status_code, response)\n    else:\n        print(\"-\u003e\", r.status_code, r.reason)\n\n\nprint(\"\\n== Location endpoints! ==\\n\")\n\n# Correct call\ndata = {\"location\": \"castelia-city\"}\ntest_post(\"city\", data)\n\n# Bad call: incorrect data format\ndata = {\"test\": \"uhh\"}\ntest_post(\"city\", data)\n\n# Bad call: nonexistent location\ndata = {\"location\": \"testfalse\"}\ntest_post(\"city\", data)\n\n\nprint(\"\\n== Region route endpoints! ==\\n\")\n\n# Correct call\ndata = {\"region\": \"kanto\", \"routeNumber\": 1}\ntest_post(\"route\", data)\n\n# Another Correct call\ndata = {\"region\": \"hoenn\", \"routeNumber\": 113}\ntest_post(\"route\", data)\n\n# Bad call: incorrect data format\ndata = {\"test\": \"uhh\"}\ntest_post(\"route\", data)\n\n# Bad call: nonexistent region\ndata = {\"region\": \"thisregionisnotreal\", \"routeNumber\": 1}\ntest_post(\"route\", data)\n\n# Bad call: nonexistent route\ndata = {\"region\": \"kanto\", \"routeNumber\": 4000}\ntest_post(\"route\", data)\n```\n\n\u003c/details\u003e\n\n## UML Diagram\n\nCalling the `/city` endpoint.\n\n```mermaid\nsequenceDiagram\n    Client-\u003e\u003e+PLP: \"/city\" {\"location\": \"...\"}\n    PLP-\u003e\u003e+PokeAPI: P.getLocationByName(...)\n    PokeAPI-\u003e\u003e-PLP: ['list','of','areas']\n    PLP-\u003e\u003e+PokeAPI: P.getLocationAreaByName(...)\n    PokeAPI-\u003e\u003e-PLP: ['list','of','pokemon']\n    PLP-\u003e\u003e-Client: ['list','of','pokemon']\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eimage\u003c/summary\u003e\n\n![City endpoint UML diagram](./city_uml.svg)\n\n\u003c/details\u003e\n\nCalling the `/route` endpoint.\n\n```mermaid\nsequenceDiagram\n    Client-\u003e\u003e+PLP: \"/city\" {\"region\": \"...\", \"routeNumber\": ...}\n    PLP-\u003e\u003e+PokeAPI: P.getLocationAreaByName(...)\n    PokeAPI-\u003e\u003e-PLP: ['list','of','pokemon']\n    PLP-\u003e\u003e-Client: ['list','of','pokemon']\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eimage\u003c/summary\u003e\n\n![Route endpoint UML diagram](./route_uml.svg)\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffireisgood%2Fpokemon-location-pokemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffireisgood%2Fpokemon-location-pokemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffireisgood%2Fpokemon-location-pokemon/lists"}