{"_id":"@request/api","_rev":"11-1870130a7e42a6dcb7ec34645df6913c","name":"@request/api","description":"Sugar API for @request/interface consumers","dist-tags":{"latest":"0.6.0"},"versions":{"0.1.0":{"name":"@request/api","version":"0.1.0","description":"Sugar API for @request/core consumers","keywords":["request","http","https","curl","api"],"license":"Apache-2.0","homepage":"https://github.com/request/api","author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"dependencies":{},"devDependencies":{"@request/client":"^0.1.0","coveralls":"^2.11.6","istanbul":"^0.4.2","mocha":"^2.4.5","should":"^8.2.1"},"main":"index.js","files":["LICENSE","README.md","index.js"],"scripts":{"test":"npm run test-ci","test-ci":"mocha","test-cov":"istanbul cover _mocha"},"gitHead":"2064c287844c32645aaab7a557f089a12e743bac","bugs":{"url":"https://github.com/request/api/issues"},"_id":"@request/api@0.1.0","_shasum":"65a33c0787c96f4d88bccce5f88870acec171b10","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"request","email":"request@outofindex.com"},"dist":{"shasum":"65a33c0787c96f4d88bccce5f88870acec171b10","tarball":"https://registry.npmjs.org/@request/api/-/api-0.1.0.tgz","integrity":"sha512-tDQE97Rr9HnC42ut+Oh3GY5NmUYuwuKFEzx3gVPwzDBIaKPGbrlPtMohx1EDrlBevg4zKxoaYi1U8cKwWL0/mw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE46kw8v1deoB5QX9On6M0dPvHXb7dUZYzE7bh4W+kDxAiEA9fKdz6CTBT9fxHn2ezIlp/qwJghfTOsROsi72sjYJIk="}]},"maintainers":[{"name":"request","email":"request@outofindex.com"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/api-0.1.0.tgz_1454859208010_0.9961471527349204"}},"0.2.0":{"name":"@request/api","version":"0.2.0","description":"Sugar API for @request/core consumers","keywords":["request","http","https","curl","api"],"license":"Apache-2.0","homepage":"https://github.com/request/api","author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"dependencies":{},"devDependencies":{"@request/client":"^0.1.0","coveralls":"^2.11.6","istanbul":"^0.4.2","mocha":"^2.4.5","should":"^8.2.1"},"main":"index.js","files":["LICENSE","README.md","index.js"],"scripts":{"test":"npm run test-ci","test-ci":"mocha","test-cov":"istanbul cover _mocha"},"gitHead":"002b76366861668c3b1e43e4cf59379ab0e5683c","bugs":{"url":"https://github.com/request/api/issues"},"_id":"@request/api@0.2.0","_shasum":"1f0e74bc8228ea8e75ecc99cd7ed28234670af12","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"simov","email":"simeonvelichkov@gmail.com"},"dist":{"shasum":"1f0e74bc8228ea8e75ecc99cd7ed28234670af12","tarball":"https://registry.npmjs.org/@request/api/-/api-0.2.0.tgz","integrity":"sha512-b1Z0jto3cx7l37J/ok873uY8t8gSWNUs7Y6c7I5+SZwBuRkJqu4UOwGFxCRUBRQiHOhIZX0XHPM8aKAm47hDmA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGJO/51eU8i8tUFFrzNF7LrlfJSx26otra/ejvEHLgsYAiEA3UfztIGSxHC2yF4JJ6KH7Yyt4vUistL4AvO6OtYy2h4="}]},"maintainers":[{"name":"request","email":"request@outofindex.com"},{"name":"simov","email":"simeonvelichkov@gmail.com"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/api-0.2.0.tgz_1454933884468_0.4211289403028786"}},"0.3.0":{"name":"@request/api","version":"0.3.0","description":"Sugar API for @request/core consumers","keywords":["request","http","https","curl","api"],"license":"Apache-2.0","homepage":"https://github.com/request/api","author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"dependencies":{},"devDependencies":{"@request/client":"^0.1.0","coveralls":"^2.11.6","istanbul":"^0.4.2","mocha":"^2.4.5"},"main":"index.js","files":["LICENSE","README.md","index.js"],"scripts":{"test":"npm run test-ci","test-ci":"mocha","test-cov":"istanbul cover _mocha"},"gitHead":"070196805ec3a9fe6180795b9079f0d660d6e659","bugs":{"url":"https://github.com/request/api/issues"},"_id":"@request/api@0.3.0","_shasum":"38a6213c111fd609bbd471d6b9c6ad7bac307b07","_from":".","_npmVersion":"3.8.5","_nodeVersion":"5.9.0","_npmUser":{"name":"simov","email":"simeonvelichkov@gmail.com"},"dist":{"shasum":"38a6213c111fd609bbd471d6b9c6ad7bac307b07","tarball":"https://registry.npmjs.org/@request/api/-/api-0.3.0.tgz","integrity":"sha512-DTb6dVJj4N23+Tl1DQjuRlELUmHQjJWdj6lbhl2vyShiSinS7kQfMX7GOeHXOWf9lRyHIG1sSpXCOu9i2xwcUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICmPF8f+UniyDPzKVfGwwNizF81LUoGDfSa3V8IMgZXQAiEAi8FuGT0pE5Ni2VgGX6Vkh/loRdgk8njtgV57wDJ63nU="}]},"maintainers":[{"name":"request","email":"request@outofindex.com"},{"name":"simov","email":"simeonvelichkov@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/api-0.3.0.tgz_1460449309037_0.7781610598322004"}},"0.4.0":{"name":"@request/api","version":"0.4.0","description":"Sugar API for @request/core consumers","keywords":["request","http","https","curl","api"],"license":"Apache-2.0","homepage":"https://github.com/request/api","author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"dependencies":{},"devDependencies":{"@request/client":"^0.1.0","coveralls":"^2.11.6","istanbul":"^0.4.2","mocha":"^2.4.5"},"main":"index.js","files":["LICENSE","README.md","index.js"],"scripts":{"test":"npm run test-ci","test-ci":"mocha","test-cov":"istanbul cover _mocha"},"gitHead":"c3bc724f7bc7bff5d079e0fa33ebe9dc2abc7342","bugs":{"url":"https://github.com/request/api/issues"},"_id":"@request/api@0.4.0","_shasum":"3dafbf9a27e375fd800e05d7f32706a4d4f73fb0","_from":".","_npmVersion":"3.8.5","_nodeVersion":"5.9.0","_npmUser":{"name":"simov","email":"simeonvelichkov@gmail.com"},"dist":{"shasum":"3dafbf9a27e375fd800e05d7f32706a4d4f73fb0","tarball":"https://registry.npmjs.org/@request/api/-/api-0.4.0.tgz","integrity":"sha512-OHq4WyzPbfvQutEl3ZA0p/ray5MkzyZWHX20sOfw0Fk0o0R4cm5uZ4PRN4/33YMM7+S5EYbkVUS1nqzGJ7Zaog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4ZH6uizY29LCtcy4pnwcHx2JEmxBPu8yM95aZmY2tzwIgXfSUWjzAMerxcN/eH+8q3QNtXJ5Vw1cvzYw2gtTX4RA="}]},"maintainers":[{"name":"request","email":"request@outofindex.com"},{"name":"simov","email":"simeonvelichkov@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/api-0.4.0.tgz_1460476579195_0.0820963871665299"}},"0.5.0":{"name":"@request/api","version":"0.5.0","description":"Sugar API for @request/core consumers","keywords":["request","http","https","curl","api"],"license":"Apache-2.0","homepage":"https://github.com/request/api","author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"dependencies":{"deep-copy":"^1.1.2"},"devDependencies":{"@request/client":"^0.1.0","coveralls":"^2.11.6","eslint":"^2.9.0","eslint-config-standard":"^5.3.0","eslint-plugin-promise":"^1.1.0","eslint-plugin-standard":"^1.3.2","istanbul":"^0.4.2","mocha":"^2.4.5"},"main":"index.js","files":["config/","lib/","LICENSE","README.md","index.js"],"scripts":{"test":"npm run lint && npm run test-ci","test-ci":"mocha","test-cov":"istanbul cover _mocha","lint":"eslint lib/ test/ && echo Lint Passed"},"gitHead":"46b2b19b0dc8123f88f52183df95aa9ff8eaee44","bugs":{"url":"https://github.com/request/api/issues"},"_id":"@request/api@0.5.0","_shasum":"d7deab787abf7c7a3748c05ff1fabbf67756d322","_from":".","_npmVersion":"2.15.3","_nodeVersion":"5.9.0","_npmUser":{"name":"simov","email":"simeonvelichkov@gmail.com"},"dist":{"shasum":"d7deab787abf7c7a3748c05ff1fabbf67756d322","tarball":"https://registry.npmjs.org/@request/api/-/api-0.5.0.tgz","integrity":"sha512-nyIf5qTZ/NrthswsF3hncepPhy3WFEhizU0n+KK+QrJuR3+3rRCr3pksI4cajUv4JP28loxlmmd4dwoBCxru7Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7Wn0cUuMNAwP9RXIs95QIxQSiirc0tRWxgT+9IyyT1AIhAPM97HYVGT0Z/JYXkCJW/w1ySoFQx1hwmMqZ5yiNptPG"}]},"maintainers":[{"name":"request","email":"request@outofindex.com"},{"name":"simov","email":"simeonvelichkov@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/api-0.5.0.tgz_1462201798796_0.5339641564060003"}},"0.6.0":{"name":"@request/api","version":"0.6.0","description":"Sugar API for @request/interface consumers","keywords":["http","https","request","api"],"license":"Apache-2.0","homepage":"https://github.com/request/api","author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"dependencies":{"@request/interface":"^0.1.0","deep-copy":"^1.1.2","extend":"^3.0.0"},"devDependencies":{"@request/client":"^0.1.0","coveralls":"^2.11.6","eslint":"^2.9.0","eslint-config-standard":"^5.3.0","eslint-plugin-promise":"^1.1.0","eslint-plugin-standard":"^1.3.2","istanbul":"^0.4.2","mocha":"^2.4.5"},"main":"index.js","files":["config/","lib/","LICENSE","README.md","index.js"],"scripts":{"test":"npm run lint && npm run test-ci","test-ci":"mocha","test-cov":"istanbul cover _mocha","lint":"eslint lib/ test/ && echo Lint Passed"},"gitHead":"fb08ba2c505cc79b2cc4600dc07f04b5886829c5","bugs":{"url":"https://github.com/request/api/issues"},"_id":"@request/api@0.6.0","_shasum":"e46e4c32e21db9ca72639701cba1ebfee06c1666","_from":".","_npmVersion":"2.15.3","_nodeVersion":"5.9.0","_npmUser":{"name":"simov","email":"simeonvelichkov@gmail.com"},"dist":{"shasum":"e46e4c32e21db9ca72639701cba1ebfee06c1666","tarball":"https://registry.npmjs.org/@request/api/-/api-0.6.0.tgz","integrity":"sha512-8V82isKYfLhSerVU1oof5TtYv3vimweF0PBqk313rJVcu7GPzX8B/qH1cTw2fMgjoo3smFbf91p3tS1CiOYczA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICzV6ewj3c4PSkirZPDW0yC6oU9y6cLC8IhWsjjyhUmjAiEA2SM9/14aRyKza0NrYPn2azQgq0IkcoIcLjmkqpP+3og="}]},"maintainers":[{"name":"request","email":"request@outofindex.com"},{"name":"simov","email":"simeonvelichkov@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/api-0.6.0.tgz_1462293387916_0.45963562838733196"}}},"readme":"\n# @request/api\n\n[![npm-version]][npm] [![travis-ci]][travis] [![coveralls-status]][coveralls]\n\n\n## Table of Contents\n\n- [Options](#options)\n- [Basic API](#basic-api)\n- [Chain API](#chain-api)\n- [Chain API Config](#chain-api-config)\n- [Promises](#promises)\n\n\n## Options\n\n```js\nvar api = require('@request/api')\nvar request = api({\n  // required\n  type: 'basic', // or 'chain'\n  // required\n  define: {\n    // HTTP request function\n    // that accepts @request/interface options object\n    request: require('@request/client')\n  },\n  // optional\n  config: {\n    // define your own methods and method aliases\n  }\n})\n```\n\n\n## Basic API\n\n```js\nrequest('url')\nrequest({options})\nrequest('url', function callback (err, res, body) {})\nrequest({options}, function callback (err, res, body) {})\nrequest('url', {options}, function callback (err, res, body) {})\n\nrequest.[HTTP_VERB]('url')\nrequest.[HTTP_VERB]({options})\nrequest.[HTTP_VERB]('url', function callback (err, res, body) {})\nrequest.[HTTP_VERB]({options}, function callback (err, res, body) {})\nrequest.[HTTP_VERB]('url', {options}, function callback (err, res, body) {})\n```\n\n```js\nvar api = require('@request/api')\nvar client = require('@request/client')\n\nvar request = api({\n  type: 'basic',\n  define: {\n    request: client\n  }\n})\n\n// GET http://localhost:6767?a=1\nrequest.get('http://localhost:6767', {qs: {a: 1}}, (err, res, body) => {\n  // request callback\n})\n```\n\n\n## Chain API\n\n```js\nvar api = require('@request/api')\nvar client = require('@request/client')\n\nvar request = api({\n  type: 'chain',\n  define: {\n    request: client\n  }\n})\n\n// GET http://localhost:6767?a=1\nrequest\n  .get('http://localhost:6767')\n  .qs({a: 1})\n  .callback((err, res, body) => {\n    // request callback\n  })\n  .request()\n```\n\n\n## Chain API Config\n\n```js\nvar api = require('@request/api')\nvar client = require('@request/client')\n\nvar request = api({\n  type: 'chain',\n  // API methods configuration\n  config: {\n    // HTTP methods\n    method: {\n      get: ['select'], // list of aliases\n      // ...\n    },\n    // @request/interface option methods\n    option: {\n      qs: ['where'], // list of aliases\n      // ...\n    },\n    // custom methods\n    custom: {\n      request: ['fetch', 'snatch', 'submit'], // list of aliases\n      // ...\n    }\n  },\n  // custom methods implementation\n  define: {\n    // `options` is always prepended as first argument\n    // any other custom arguments follows after that\n    request: (options, callback) => {\n      if (callback) {\n        // `options` contains the generated options object\n        options.callback = callback\n      }\n      // omit the return value if you want to chain further\n      return client(options)\n    }\n  }\n})\n\n// GET http://localhost:6767?a=1\nrequest\n  .select('http://localhost:6767')\n  .where({a: 1})\n  .fetch((err, res, body) => {\n    // request callback\n  })\n```\n\n\n## Promises\n\n```js\nvar api = require('@request/api')\nvar client = require('@request/client')\n\nfunction wrap (options) {\n  var promise = new Promise((resolve, reject) => {\n    options.callback = (err, res, body) => {\n      ;(err) ? reject(err) : resolve([res, body])\n    }\n  })\n  client(options)\n  return promise\n}\n```\n\n```js\nvar request = api({\n  type: 'basic',\n  define: {\n    request: wrap\n  }\n})\n// GET http://localhost:6767?a=1\nrequest.get('http://localhost:6767', {qs: 1})\n  .catch((err) => {})\n  .then((result) => {})\n```\n\n```js\nvar request = api({\n  type: 'chain',\n  define: {\n    request: wrap\n  }\n})\n// GET http://localhost:6767?a=1\nrequest\n  .get('http://localhost:6767')\n  .qs({a: 1})\n  .request()\n  .catch((err) => ())\n  .then((result) => ())\n```\n\n\n  [npm-version]: http://img.shields.io/npm/v/@request/api.svg?style=flat-square (NPM Version)\n  [travis-ci]: https://img.shields.io/travis/request/api/master.svg?style=flat-square (Build Status)\n  [coveralls-status]: https://img.shields.io/coveralls/request/api.svg?style=flat-square (Test Coverage)\n\n  [npm]: https://www.npmjs.org/package/@request/api\n  [travis]: https://travis-ci.org/request/api\n  [coveralls]: https://coveralls.io/r/request/api?branch=master\n","maintainers":[{"name":"request","email":"request@outofindex.com"},{"name":"simov","email":"simeonvelichkov@gmail.com"}],"time":{"modified":"2022-06-12T23:08:38.364Z","created":"2016-02-07T15:33:30.688Z","0.1.0":"2016-02-07T15:33:30.688Z","0.2.0":"2016-02-08T12:18:07.277Z","0.3.0":"2016-04-12T08:21:51.416Z","0.4.0":"2016-04-12T15:56:21.532Z","0.5.0":"2016-05-02T15:10:01.042Z","0.6.0":"2016-05-03T16:36:29.105Z"},"homepage":"https://github.com/request/api","keywords":["http","https","request","api"],"repository":{"type":"git","url":"git+https://github.com/request/api.git"},"author":{"name":"Simeon Velichkov","email":"simeonvelichkov@gmail.com","url":"http://simov.github.io"},"bugs":{"url":"https://github.com/request/api/issues"},"license":"Apache-2.0","readmeFilename":"README.md","users":{"valleyboy":true,"ptrpov":true}}