npm package: @ruffpuff/celestia
Description: <div align='center'>   <img src='https://cdn.ruffpuff.dev/celestia.png' width='140' height='140' />   <h1>Celestia ✨</h1>   <blockquote>A GraphQL API for fetching Animal Crossing villager & amiibo data.</blockquote>
Author: @ruffpuff1
Latest version: 1.3.0

<div align='center'>
  <img src='https://cdn.ruffpuff.dev/celestia.png' width='140' height='140' />
  <h1>Celestia ✨</h1>
  <blockquote>A GraphQL API for fetching Animal Crossing villager & amiibo data.</blockquote>

  <br />

  [![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/ruffpuff&logoColor=FFFFFF)](https://ko-fi.com/ruffpuff)
  [![Continuous Deployment](https://github.com/Ruffpuff1/celestia/actions/workflows/continuous-deployment.yml/badge.svg)](https://github.com/Ruffpuff1/celestia/actions/workflows/continuous-deployment.yml)
  <a href="https://wakatime.com/badge/user/72bf611d-9557-4a85-aa1d-46f6a3346744/project/5913d88c-e3b8-4841-a066-c00231cc3b3e"><img src="https://wakatime.com/badge/user/72bf611d-9557-4a85-aa1d-46f6a3346744/project/5913d88c-e3b8-4841-a066-c00231cc3b3e.svg" alt="wakatime"></a>
  [![npm](https://img.shields.io/npm/v/@ruffpuff/celestia?color=crimson&logo=npm&style=flat-square&label=celestia)](https://www.npmjs.com/package/@ruffpuff/celestia)


<hr />
 
</div>

<strong>Table of Contents</strong>
- [Package](#package)
  - [Installation](#installation)
    - [Using Npm](#using-npm)
    - [Using Yarn](#using-yarn)
- [Usage](#usage)
  - [Using Fetch](#using-fetch)
  - [Using Centra](#using-centra)
- [Meta](#meta)

<hr />

<h2>Package</h2>

The package that comes with this API uses <a href='https://www.graphql-code-generator.com'>GraphQL Code Generator</a> for full typings of the API.

<h3>Installation</h3>

<h4>Using Npm</h4>

```shell
npm install @ruffpuff/celestia
```

<h4>Using Yarn</h4>

```shell
yarn add @ruffpuff/celestia
```

<h2>Usage</h2>

Here is some example usage with the API, using the package <a href='https://www.npmjs.com/package/@ruffpuff/celestia'>`@ruffpuff/celestia`</a>

<h3>Using Fetch</h3>

```ts
import type { Query } from '@ruffpuff/celestia';

interface AnimalCrossingResponse<K extends keyof Omit<Query, '__typename'>> {
  data: Record<K, Omit<Query[K], '__typename'>>;
}

fetch('http://localhost:0617', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: `
      {
        getVillagerByName(villager: bob) {
          key
          keyJp
          art
          species
          catchphrase
        }
      }
    `
  })
})
  .then(res => res.json() as Promise<AnimalCrossingResponse<'getVillagerByName'>>)
  .then(json => console.log(json.data));
```

<h3>Using @foxxie/fetch</h3>

```ts
import type { Query } from '@ruffpuff/celestia';
import { fetch } from '@foxxie/fetch';

interface AnimalCrossingResponse<K extends keyof Omit<Query, '__typename'>> {
  data: Record<K, Omit<Query[K], '__typename'>>;
}

fetch('http://localhost:0617')
  .body({
    query: `
        {
          getVillagerByName(villager: bob) {
            key
            keyJp
            art
            species
            catchphrase
          }
        }
    `
   })
  .post()
  .json<AnimalCrossingResponse<'getVillagerByName'>>()
    .then(json => console.log(json.data));
```

<hr />

## Meta

<h2>Donating 💰</h2>

Donating helps ensure that I can keep this project going. Thank you for supporting :D

<a href='https://ko-fi.com/D1D63NVS8' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

### Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tr>
    <td align="center"><a href="https://ruff.cafe"><img src="https://avatars.githubusercontent.com/u/73779441?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ruff</b></sub></a><br /><a href="https://github.com/Ruffpuff1/celestia/commits?author=Ruffpuff1" title="Code">💻</a> <a href="#content-Ruffpuff1" title="Content">🖋</a> <a href="#ideas-Ruffpuff1" title="Ideas, Planning, & Feedback">🤔</a> <a href="#example-Ruffpuff1" title="Examples">💡</a> <a href="#financial-Ruffpuff1" title="Financial">💵</a></td>
    <td align="center"><a href="https://github.com/Raindrop-Droptop"><img src="https://avatars.githubusercontent.com/u/81828616?v=4?s=100" width="100px;" alt=""/><br /><sub><b>raindrop-droptop</b></sub></a><br /><a href="#ideas-raindrop-droptop" title="Ideas, Planning, & Feedback">🤔</a> <a href="#financial-raindrop-droptop" title="Financial">💵</a></td>
  </tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->


This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!