{"name":"graphql-client","version":"2.0.1","description":"Small http client based on the fetch api. Uses isomorphic-fetch for wider support","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/nordsimon/graphql-client.git"},"keywords":[],"author":"","license":"ISC","dependencies":{"isomorphic-fetch":"^2.2.1"},"gitHead":"7d7b7dcb8a7f3aaec01d48ed0998d5e46689d452","bugs":{"url":"https://github.com/nordsimon/graphql-client/issues"},"homepage":"https://github.com/nordsimon/graphql-client#readme","_id":"graphql-client@2.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"nordsimon","email":"simon@nord.org"},"dist":{"integrity":"sha512-XXdjUD3mwsBDcUB7g+iXQeRt+3gmIbvA/Yx1nE5aq2RQmaJwiH4hEoYw27AW8cDR90pCrPlHJAb1jJq3zUMbZA==","shasum":"d4a85a9fd2b04a0ef732e242250fac132579a4da","tarball":"http://registry-npm.ywwl.com/graphql-client/download/graphql-client-2.0.1.tgz","fileCount":3,"unpackedSize":3169,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHCOLmWv4aZHr9A7BUM5gp8El1z5qq7CNRVsheauKFzlAiEA6q/C2nBymJUmzEKX8k+6wbsWDQl7F2FYv6Jp1Ud/jfo="}],"size":1534,"noattachment":false,"key":"/graphql-client/-/graphql-client-2.0.1.tgz"},"maintainers":[{"email":"simon@nord.org","name":"nordsimon"},{"email":"simon@nord.org","name":"simon.nord"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-client_2.0.1_1518713043540_0.6306809759768293"},"_hasShrinkwrap":false,"readme":"# Simple GraphQL Client\nSmall http client based on the fetch api. Uses isomorphic-fetch for wider support\n\nIf query fails, errors are thrown with messages and query highlight for easy debug\n\n## Install\n```javascript\nnpm install graphql-client -S\n```\n\n## How To\n\nInitialize the client\n\n```javascript\nvar client = require('graphql-client')({\n  url: 'http://your-host/graphql',\n  headers: {\n    Authorization: 'Bearer ' + token\n  }\n})\n```\n\nUse the promise API\n\nWARNING: Make sure the Promise API is polyfilled for older browsers, you can use [es6-promise](https://github.com/jakearchibald/es6-promise)\n\n  ```javascript\n  var variables = {\n    query: \"Search Query\",\n    limit: 100,\n    from: 200\n  }\n\n  client.query(`\n  query search ($query: String, $from: Int, $limit: Int) {\n    search(query: $query, from: $from, limit: $limit) {\n      took,\n      totalHits,\n      hits {\n        name\n      }\n    }\n  }`, variables, function(req, res) {\n    if(res.status === 401) {\n      throw new Error('Not authorized')\n    }\n  })\n  .then(function(body) {\n    console.log(body)\n  })\n  .catch(function(err) {\n    console.log(err.message)\n  })\n  ```\n","publish_time":1518713044198,"_cnpm_publish_time":1518713044198,"dist-tags":{"latest":"2.0.1"}}