@genql/swapi
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@genql/swapi

Your awesome graphql client ❤️

Example usage

import { createClient } from '@genql/swapi'
const client = createClient()



client
  .query({
    allAssets: {
      handle: true,
      mimeType: true,
      size: true,
      url: true,
    },
    allFilms: {
      director: true,
      openingCrawl: true,
      title: true,
      updatedAt: true,
    },
    allPersons: {
      gender: true,
      hairColor: true,
      id: true,
      mass: true,
      name: true,
    },
    allSpecies: {
      _peopleMeta: {
        count: true,
      },
      _filmsMeta: {
        count: true,
      },
      averageHeight: true,
      averageLifespan: true,
      eyeColor: true,
      id: true,
      isPublished: true,
      language: true,
      name: true,
    },
    _allFilmsMeta: {
      count: true,
    },
    _allPlanetsMeta: {
      count: true,
    },
    _allSpeciesMeta: {
      count: true,
    },
    Film: {
      _speciesMeta: {
        count: true,
      },
      characters: {
        homeworld: {
          diameter: true,
          gravity: true,
          id: true,
          orbitalPeriod: true,
          rotationPeriod: true,
          surfaceWater: true,
          terrain: true,
        },
        films: {
          _starshipsMeta: {
            count: true,
          },
          starships: {
            consumables: true,
            id: true,
            length: true,
            maxAtmospheringSpeed: true,
            mglt: true,
            name: true,
          },
          _charactersMeta: {
            count: true,
          },
          _planetsMeta: {
            count: true,
          },
          _vehiclesMeta: {
            count: true,
          },
          createdAt: true,
          director: true,
          episodeId: true,
          id: true,
          releaseDate: true,
          title: true,
          updatedAt: true,
        },
        species: {
          _filmsMeta: {
            count: true,
          },
          films: {
            createdAt: true,
            director: true,
            id: true,
            openingCrawl: true,
            producers: true,
            title: true,
          },
          people: {
            createdAt: true,
            gender: true,
            hairColor: true,
            id: true,
            name: true,
            skinColor: true,
            updatedAt: true,
          },
          averageHeight: true,
          averageLifespan: true,
          createdAt: true,
          id: true,
          isPublished: true,
          language: true,
        },
        _filmsMeta: {
          count: true,
        },
        _starshipsMeta: {
          count: true,
        },
        _vehiclesMeta: {
          count: true,
        },
        eyeColor: true,
        gender: true,
        hairColor: true,
        isPublished: true,
        mass: true,
        updatedAt: true,
      },
      planets: {
        residents: {
          _filmsMeta: {
            count: true,
          },
          films: {
            createdAt: true,
            director: true,
            id: true,
            producers: true,
            releaseDate: true,
          },
          homeworld: {
            createdAt: true,
            diameter: true,
            isPublished: true,
            name: true,
            population: true,
            rotationPeriod: true,
            terrain: true,
          },
          _speciesMeta: {
            count: true,
          },
          birthYear: true,
          createdAt: true,
          isPublished: true,
          mass: true,
          name: true,
        },
        films: {
          vehicles: {
            class: true,
            consumables: true,
            costInCredits: true,
            createdAt: true,
            id: true,
            length: true,
            manufacturer: true,
            model: true,
            name: true,
            passengers: true,
          },
          planets: {
            createdAt: true,
            diameter: true,
            gravity: true,
            id: true,
            isPublished: true,
            orbitalPeriod: true,
            population: true,
            updatedAt: true,
          },
          starships: {
            class: true,
            consumables: true,
            costInCredits: true,
            createdAt: true,
            crew: true,
            isPublished: true,
            manufacturer: true,
            mglt: true,
            passengers: true,
            updatedAt: true,
          },
          _charactersMeta: {
            count: true,
          },
          _speciesMeta: {
            count: true,
          },
          _vehiclesMeta: {
            count: true,
          },
          episodeId: true,
          producers: true,
          releaseDate: true,
          updatedAt: true,
        },
        _residentsMeta: {
          count: true,
        },
        diameter: true,
        id: true,
        isPublished: true,
        orbitalPeriod: true,
        surfaceWater: true,
        updatedAt: true,
      },
      _planetsMeta: {
        count: true,
      },
      _starshipsMeta: {
        count: true,
      },
      createdAt: true,
      episodeId: true,
      openingCrawl: true,
      releaseDate: true,
    },
    Person: {
      gender: true,
      height: true,
      skinColor: true,
    },
    Planet: {
      createdAt: true,
      diameter: true,
      id: true,
      name: true,
      rotationPeriod: true,
      updatedAt: true,
    },
    Starship: {
      pilots: {
        _speciesMeta: {
          count: true,
        },
        films: {
          planets: {
            climate: true,
            diameter: true,
            gravity: true,
            name: true,
            surfaceWater: true,
            terrain: true,
            updatedAt: true,
          },
          characters: {
            birthYear: true,
            createdAt: true,
            eyeColor: true,
            hairColor: true,
            id: true,
            isPublished: true,
            updatedAt: true,
          },
          species: {
            averageHeight: true,
            averageLifespan: true,
            classification: true,
            createdAt: true,
            designation: true,
            eyeColor: true,
            hairColor: true,
            id: true,
            isPublished: true,
            name: true,
          },
          _charactersMeta: {
            count: true,
          },
          _starshipsMeta: {
            count: true,
          },
          _vehiclesMeta: {
            count: true,
          },
          createdAt: true,
          director: true,
          id: true,
          isPublished: true,
          openingCrawl: true,
          producers: true,
          releaseDate: true,
          title: true,
        },
        homeworld: {
          _residentsMeta: {
            count: true,
          },
          films: {
            director: true,
            id: true,
            isPublished: true,
            openingCrawl: true,
            title: true,
          },
          _filmsMeta: {
            count: true,
          },
          climate: true,
          createdAt: true,
          gravity: true,
          isPublished: true,
          name: true,
          orbitalPeriod: true,
          population: true,
          rotationPeriod: true,
          surfaceWater: true,
          terrain: true,
        },
        species: {
          averageHeight: true,
          averageLifespan: true,
          createdAt: true,
          designation: true,
          eyeColor: true,
          hairColor: true,
          id: true,
          isPublished: true,
          skinColor: true,
        },
        birthYear: true,
        createdAt: true,
        eyeColor: true,
        mass: true,
      },
      films: {
        _starshipsMeta: {
          count: true,
        },
        planets: {
          gravity: true,
          isPublished: true,
          rotationPeriod: true,
          surfaceWater: true,
        },
        species: {
          designation: true,
          id: true,
          language: true,
          name: true,
          skinColor: true,
          updatedAt: true,
        },
        vehicles: {
          _filmsMeta: {
            count: true,
          },
          films: {
            createdAt: true,
            director: true,
            episodeId: true,
            id: true,
            openingCrawl: true,
            releaseDate: true,
            updatedAt: true,
          },
          cargoCapacity: true,
          createdAt: true,
          length: true,
          maxAtmospheringSpeed: true,
          name: true,
          passengers: true,
          updatedAt: true,
        },
        _planetsMeta: {
          count: true,
        },
        _vehiclesMeta: {
          count: true,
        },
        episodeId: true,
        isPublished: true,
        openingCrawl: true,
        updatedAt: true,
      },
      _filmsMeta: {
        count: true,
      },
      _pilotsMeta: {
        count: true,
      },
      cargoCapacity: true,
      createdAt: true,
      hyperdriveRating: true,
      id: true,
      manufacturer: true,
      updatedAt: true,
    },
    Vehicle: {
      cargoCapacity: true,
      createdAt: true,
      crew: true,
      id: true,
      isPublished: true,
      name: true,
      passengers: true,
      updatedAt: true,
    },
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))




client
  .query({
    Planet: {
      diameter: true,
      orbitalPeriod: true,
      population: true,
      rotationPeriod: true,
      terrain: true,
    },
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))




client
  .query({
    allAssets: {
      createdAt: true,
      fileName: true,
      handle: true,
      height: true,
      mimeType: true,
      updatedAt: true,
      width: true,
    },
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))




client
  .query({
    allFilms: {
      _vehiclesMeta: {
        count: true,
      },
      characters: {
        birthYear: true,
        updatedAt: true,
      },
      starships: {
        films: {
          planets: {
            climate: true,
            diameter: true,
            name: true,
            orbitalPeriod: true,
            population: true,
            rotationPeriod: true,
            surfaceWater: true,
            terrain: true,
            updatedAt: true,
          },
          characters: {
            birthYear: true,
            eyeColor: true,
            gender: true,
            height: true,
            id: true,
            mass: true,
            skinColor: true,
          },
          vehicles: {
            consumables: true,
            length: true,
            manufacturer: true,
            passengers: true,
            updatedAt: true,
          },
          _charactersMeta: {
            count: true,
          },
          _planetsMeta: {
            count: true,
          },
          _speciesMeta: {
            count: true,
          },
          _starshipsMeta: {
            count: true,
          },
          director: true,
          episodeId: true,
          producers: true,
          updatedAt: true,
        },
        _filmsMeta: {
          count: true,
        },
        _pilotsMeta: {
          count: true,
        },
        class: true,
        createdAt: true,
        isPublished: true,
        manufacturer: true,
        maxAtmospheringSpeed: true,
        mglt: true,
      },
      vehicles: {
        _pilotsMeta: {
          count: true,
        },
        cargoCapacity: true,
        consumables: true,
        id: true,
        isPublished: true,
        manufacturer: true,
        passengers: true,
      },
      _starshipsMeta: {
        count: true,
      },
      createdAt: true,
      director: true,
      producers: true,
    },
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))

Readme

Keywords

none

Package Sidebar

Install

npm i @genql/swapi

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

837 kB

Total Files

10

Last publish

Collaborators

  • xmorse