1.3.0 • Published 4 years ago
@ruffpuff/celestia v1.3.0
Table of Contents
The package that comes with this API uses GraphQL Code Generator for full typings of the API.
npm install @ruffpuff/celestiayarn add @ruffpuff/celestiaHere is some example usage with the API, using the package @ruffpuff/celestia
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));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));Meta
Donating helps ensure that I can keep this project going. Thank you for supporting :D
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!