• Stars
    star
    105
  • Rank 326,106 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convenience wrapper for got to interact with GraphQL

graphql-got Build Status

Convenience wrapper for got to interact with GraphQL

A lightweight alternative to apollo-client and relay.

Install

$ npm install graphql-got

Usage

const graphqlGot = require('graphql-got');

const query = `{
	unicorn(name: "Foo Bar") {
		id
		name
	}
}`;

graphqlGot('api.graphql.unicorn', {query}).then(response => {
	console.log(response.body);
	/*
	{
		unicorn: {
			id: 0,
			name: 'Foo Bar'
		}
	}
	*/
});

API

Same as got, but with some additional options below. URLs without protocol will be prepended with https://.

query

Required
Type: string

The query to send to GraphQL.

variables

Type: Object

Variables to be used in your query. Read more here.

operationName

Type: string

If your query contains multiple operations, this option is required to decide which operation to run.

token

Type: string

If defined, an Authorization header with bearer ${TOKEN} will be sent.

License

MIT © Kevin Mårtensson

More Repositories

1

download

Download and extract files
JavaScript
1,254
star
2

wifi-password

Get current wifi password
JavaScript
607
star
3

decompress

Extracting archives made easy
JavaScript
398
star
4

url-regex

Regular expression for matching URLs
JavaScript
343
star
5

wifi-password-cli

Get current wifi password
JavaScript
288
star
6

screenshot-stream

Capture screenshot of a website and return it as a stream
JavaScript
234
star
7

brightness-cli

Change the screen brightness
JavaScript
202
star
8

brightness

Change screen brightness
JavaScript
191
star
9

bin-wrapper

Binary wrapper that makes your programs seamlessly available as local dependencies
JavaScript
151
star
10

to-ico

Convert PNG to ICO in memory
JavaScript
137
star
11

pid-from-port

Get PID from a port
JavaScript
80
star
12

credit-card-regex

Regular expression for matching credit card numbers
JavaScript
79
star
13

download-cli

Download and extract files
JavaScript
78
star
14

ink-image

Image component for Ink
JavaScript
72
star
15

is-positive

Check if something is a positive number
JavaScript
65
star
16

instagram-analytics

Get user stats from Instagram
JavaScript
62
star
17

resize-img

Resize images in memory
JavaScript
62
star
18

strict-uri-encode

A stricter URI encode adhering to RFC 3986
JavaScript
60
star
19

viewport-list-cli

Return a list of devices and their viewports
JavaScript
59
star
20

imgur-uploader-cli

Upload images to imgur
JavaScript
57
star
21

wifi-name

Get current wifi name
JavaScript
54
star
22

squeak

A tiny stream log
JavaScript
53
star
23

viewport-list

Return a list of devices and their viewports
JavaScript
49
star
24

github-gists

Get all gists from a GitHub user
JavaScript
45
star
25

caw

Construct HTTP/HTTPS agents for tunneling proxies
JavaScript
44
star
26

dir-glob

Convert directories to glob compatible strings
JavaScript
44
star
27

to-ico-cli

Convert PNG to ICO
JavaScript
43
star
28

imgur-uploader

Upload images to imgur
JavaScript
43
star
29

npm-user-packages

Get packages by a npm user
JavaScript
42
star
30

micro-access

Easy CORS handling for micro
JavaScript
39
star
31

npm-conf

Get the npm config
JavaScript
37
star
32

bin-build

Easily build binaries
JavaScript
36
star
33

github-repositories

Get all GitHub repos from a user or an organization
JavaScript
36
star
34

instagram-user

Get Instagram user info
JavaScript
35
star
35

instagram-posts

Get Instagram posts from a user
JavaScript
35
star
36

astral-regex

Regular expression for matching astral symbols
JavaScript
34
star
37

kap-streamable

Kap plugin - Share on Streamable
JavaScript
33
star
38

executable

Check if a file is executable
JavaScript
29
star
39

github-markdown-render

Render markdown using the GitHub Markdown API
JavaScript
26
star
40

download-status

Progress bar plugin for download
JavaScript
26
star
41

archive-type

Detect the archive type of a Buffer/Uint8Array
JavaScript
24
star
42

is-iexplorer

Check if browser is Internet Explorer
JavaScript
24
star
43

ext-name

Get the file extension and MIME type from a file
JavaScript
24
star
44

decompress-unzip

zip plugin for decompress
JavaScript
24
star
45

github-remove-forks

Remove all forked repositories
JavaScript
23
star
46

github-add-collab

Add collaborators to GitHub repos
JavaScript
23
star
47

is-gzip

Check if a Buffer/Uint8Array is a GZIP file
JavaScript
23
star
48

shebang-command

Get the command from a shebang
JavaScript
22
star
49

claim

Tiny assertion library
JavaScript
22
star
50

kap-imgur

Kap plugin - Share GIFs on Imgur
JavaScript
21
star
51

calc-percent

Calculate percentage
JavaScript
20
star
52

bitcoin-regex

Regular expression for matching Bitcoin addresses
JavaScript
20
star
53

base64-regex

Regular expression for matching base64 encoded strings
JavaScript
19
star
54

resize-img-cli

Resize images in memory
JavaScript
19
star
55

ink-confirm-input

Confirmation input component for Ink
JavaScript
17
star
56

github-search-repos

Search GitHub repositories
JavaScript
17
star
57

elm-bin

elm-platform bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
17
star
58

logalot

Tiny log utility
JavaScript
17
star
59

gulp-shorthand

Makes your CSS files lighter and more readable
JavaScript
17
star
60

obj-to-table

Create a table from an array of objects
JavaScript
17
star
61

animal-sounds

Get animal sounds
JavaScript
16
star
62

gulp-decompress

Extract TAR, TAR.BZ2, TAR.GZ and ZIP archives
JavaScript
16
star
63

exec-buffer

Run a Buffer through a child process
JavaScript
16
star
64

instagram-latest-posts

Service to get the latest Instagram posts from a user
JavaScript
16
star
65

to-webp

Service for converting images to WebP
JavaScript
15
star
66

kap-clipboard

[DEPRECATED] Kap plugin - Copy GIFs to clipboard
JavaScript
15
star
67

is-zip

Check if a Buffer/Uint8Array is a ZIP file
JavaScript
15
star
68

macos-model

Get your Mac model
JavaScript
15
star
69

play-animal-sounds

Play animal sounds
JavaScript
15
star
70

control-access

Easy CORS handling
JavaScript
15
star
71

github-search-repos-cli

Search GitHub repositories
JavaScript
15
star
72

get-res

Get ten most popular screen resolutions
JavaScript
15
star
73

parse-png

Parse a PNG
JavaScript
14
star
74

get-proxy

Get configured proxy
JavaScript
14
star
75

decompress-targz

tar.gz plugin for decompress
JavaScript
14
star
76

p-one

Test whether some promise passes a testing function
JavaScript
14
star
77

decompress-tar

tar plugin for decompress
JavaScript
13
star
78

is-negative

Check if something is a negative number
JavaScript
13
star
79

vinyl-assign

Apply custom attributes to vinyl files
JavaScript
13
star
80

linux-battery

Get info about your battery in Linux
JavaScript
13
star
81

match-condition

Check if a value matches a condition
JavaScript
12
star
82

decompress-tarxz

tar.xz plugin for decompress
JavaScript
12
star
83

splice-buffer

Remove or replace part of a Buffer like Array#splice
JavaScript
12
star
84

mouse-hash

Generate a hash by moving your mouse
JavaScript
12
star
85

intl-currency

Convert numbers to currencies
JavaScript
12
star
86

osx-wifi-password

Get current wifi password on OS X
JavaScript
12
star
87

p-every

Test whether all promises passes a testing function
JavaScript
12
star
88

bin-check

Check if a binary is working by checking its exit code
JavaScript
12
star
89

lnfs

Safely force create symlinks
JavaScript
12
star
90

is-tar

Check if a Buffer/Uint8Array is a TAR file
JavaScript
12
star
91

decompress-tarbz2

tar.bz2 plugin for decompress
JavaScript
12
star
92

linux-distro

Get current Linux distro
JavaScript
12
star
93

argvments

Parse command line arguments
JavaScript
12
star
94

xdg-brightness

Change screen brightness on Linux systems
JavaScript
11
star
95

github-token-user

Get the GitHub user from a token
JavaScript
11
star
96

buffer-to-vinyl

Create a vinyl file or stream from a buffer
JavaScript
11
star
97

ama

Ask me anything
11
star
98

sort-keys-length

Sort object keys by length
JavaScript
10
star
99

xdg-default-browser

Get default browser on Linux
JavaScript
10
star
100

compare-week

Check if two dates are within the same week
JavaScript
10
star