{"name":"graphql-client","version":"1.0.4","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":"a908bccc6c06e4d015eb52b901adf1313d2b19c0","bugs":{"url":"https://github.com/nordsimon/graphql-client/issues"},"homepage":"https://github.com/nordsimon/graphql-client#readme","_id":"graphql-client@1.0.4","_shasum":"d442ca71a04595a94ecd51e4fffe41e98cef887e","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.1.0","_npmUser":{"name":"nordsimon","email":"simon@nord.org"},"dist":{"shasum":"d442ca71a04595a94ecd51e4fffe41e98cef887e","tarball":"http://registry-npm.ywwl.com/graphql-client/download/graphql-client-1.0.4.tgz","integrity":"sha512-tR+tsSyBM1n54ZHeLG7PUtLWTerQ+0Hc3YH5/fmKdgegiqwUbUhiYsjnOPdl58xRUkOyEcd5iuI35r/j8cSt/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEt0fVKdQuqRbA6xkS4KjwFcH+KFKoJDb9orXGqO6FFCAiEA96dAL3bwvdTvg2x+/8r968cQ92CuyBLlG551bPgOeIQ="}],"size":1386,"noattachment":false,"key":"/graphql-client/-/graphql-client-1.0.4.tgz"},"maintainers":[{"name":"simon.nord","email":"simon@nord.org"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/graphql-client-1.0.4.tgz_1464117539825_0.5570900598540902"},"directories":{},"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":1464117541000,"_cnpm_publish_time":1464117541000,"dist-tags":{"latest":"2.0.1"}}