# gery

> Minimal graphql client

Latest version **1.1.3** (published 2018-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install gery
pnpm add gery
yarn add gery
bun add gery
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2018-12-15 |
| First published | 2018-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | forsigner |
| Maintainers | forsigner |

## Links

- npm: https://www.npmjs.com/package/gery
- Repository: https://github.com/forsigner/gery
- Homepage: https://github.com/forsigner/gery#README
- Issues: https://github.com/forsigner/gery/issues
- npm.io page: https://npm.io/package/gery

## Dependencies (1)

- [cross-fetch](https://npm.io/package/cross-fetch.md) ^2.2.3

## Recent versions

- 1.1.3 (latest) — 2018-12-15
- 1.1.2 — 2018-12-07
- 1.1.1 — 2018-12-06
- 1.1.0 — 2018-12-06
- 1.0.3 — 2018-11-30
- 1.0.2 — 2018-11-30
- 1.0.1 — 2018-11-30
- 1.0.0 — 2018-11-30

## README

# Gery

[![npm](https://img.shields.io/npm/v/gery.svg)](https://www.npmjs.com/package/gery) [![Build Status](https://travis-ci.org/forsigner/gery.svg?branch=master)](https://travis-ci.org/forsigner/gery) [![Coverage Status](https://coveralls.io/repos/github/forsigner/gery/badge.svg?branch=master)](https://coveralls.io/github/forsigner/gery?branch=master)
[![npm](https://img.shields.io/badge/TypeScript-%E2%9C%93-007ACC.svg)](https://www.typescriptlang.org/) [![GitHub license](https://img.shields.io/github/license/forsigner/gery.svg)](https://github.com/forsigner/gery/blob/master/LICENSE)

> A light weight GraphQL GraphQLClient

## Installation

```sh
yarn add gery
```

## Quick start

```js
import { query } from 'graphql-request'
import { gql } from 'gql-tag' // editor helper

const GET_PERSONS = gql`
  {
    allPersons {
      id
      name
    }
  }
`

const endpoint = 'https://api.graph.cool/simple/v1/swapi'

query(endpoint, GET_PERSONS).then(data => console.log(data))
```

## Use Client

```js
import { GraphQLClient } from 'gery'
import { gql } from 'gql-tag' // editor helper

const GET_PERSONS = gql`
  {
    allPersons {
      id
      name
    }
  }
`
const GraphQLClient = new GraphQLClient({
  endpoint: 'https://api.graph.cool/simple/v1/swapi',
})

GraphQLClient.query(GET_PERSONS).then(data => console.log(data))
```

## Variables

```js
const GET_PERSON = gql`
  query getPerson($id: ID) {
    Person(id: $id) {
      id
      name
    }
  }
`

const data = await query(endpoint, GET_PERSON, {
  id: 'cj0nv9peiewhf013011i9a4h2',
})
```

## Typescript

```js
interface Person {
  Person: {
    id: string
    name: string
  }
}

const GET_PERSON = gql`
  query getPerson($id: ID) {
    Person(id: $id) {
      id
      name
    }
  }
`

const data = await query<Person>(endpoint, GET_PERSON, {
  id: 'cj0nv9peiewhf013011i9a4h2',
})
```

## License

[MIT License](https://github.com/forsigner/gery/blob/master/LICENSE)

---
_Source: https://npm.io/package/gery · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
