{"_id":"strong-swagger-client","_rev":"234-2596f21581e4fe842d088f24bb46f17a","name":"strong-swagger-client","dist-tags":{"20.x":"20.1.1","latest":"21.1.0"},"versions":{"20.0.0":{"name":"strong-swagger-client","version":"20.0.0","author":{"name":"Zeke Sikelianos","email":"zeke@sikelianos.com"},"license":"Apache-2.0","_id":"strong-swagger-client@20.0.0","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"}],"contributors":[{"name":"Tony Tam","email":"fehguy@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"d895d5bd87310dcf5616490b2cbd587c8a8867f3","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-20.0.0.tgz","integrity":"sha512-hOr4l55tdTBGX3z2QPIA093hmd6NdmXx4HYh/6MZwflGN1DfvammzWFm1Opa4364fYi87X3ZxGjhqaR1GEaywg==","signatures":[{"sig":"MEUCIQDkSrpwG0in7BqVKR6qgMw0w4FMb9u3dBHr0R8zb1TlNgIgRnWxSMqQl6+BrEecRqkHsA2dlVqOc7gnXVBvnepE6x8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/swagger.js","_from":".","_shasum":"d895d5bd87310dcf5616490b2cbd587c8a8867f3","engines":{"node":">= 0.6.6"},"gitHead":"52f379f9980642d1b708682b3ed73086aa64ace3","scripts":{"test":"mocha","build":"uglifyjs lib/swagger.js -o lib/swagger.min.js"},"_npmUser":{"name":"strongloop","email":"callback@strongloop.com"},"repository":{"url":"git://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.11.3","description":"swagger.js is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"2.3.3","dependencies":{"btoa":"1.1.1","shred":"0.8.10"},"devDependencies":{"mocha":"^1.21.3","should":"4.4.2","unit.js":"1.1.2","uglify-js":"1.3.x"}},"20.1.0":{"name":"strong-swagger-client","version":"20.1.0","author":{"name":"Zeke Sikelianos","email":"zeke@sikelianos.com"},"license":"Apache-2.0","_id":"strong-swagger-client@20.1.0","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"},{"name":"bajtos","email":"miro.bajtos@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"}],"contributors":[{"name":"Tony Tam","email":"fehguy@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"fdf242e9c01ee630062bce90d9b2d3235900664f","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-20.1.0.tgz","integrity":"sha512-Dkz9ZZw7r4BiBQq2Hgr7lkaZn78Qc/WNkRQyZd7Gme2p+fqJ4m7sdSIgw5RpEsZvltEOLfDToXv4JLFZzmIz6w==","signatures":[{"sig":"MEQCIBQTIOMRWvRzDn2p3pKpv8fV8iEFIFE9U6hFKrV6VKSOAiB+quCu2IkXFhwfTn43Gzo7ZTZanZXE210xuM8oNB/sqg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/swagger.js","_from":".","_shasum":"fdf242e9c01ee630062bce90d9b2d3235900664f","engines":{"node":">= 0.6.6"},"gitHead":"7d2f15c2ae8618d0975c73fe93c0914a675d7fca","scripts":{"test":"mocha","build":"uglifyjs lib/swagger.js -o lib/swagger.min.js"},"_npmUser":{"name":"bajtos","email":"miro.bajtos@gmail.com"},"repository":{"url":"git://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.13.2","description":"swagger.js is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"2.5.0","dependencies":{"btoa":"1.1.1","shred":"0.8.10"},"devDependencies":{"mocha":"^1.21.3","should":"4.4.2","unit.js":"1.1.2","uglify-js":"1.3.x"}},"21.0.0-dev.1":{"name":"strong-swagger-client","version":"21.0.0-dev.1","author":{"name":"Tony Tam","email":"fehguy@gmail.com"},"license":"Apache-2.0","_id":"strong-swagger-client@21.0.0-dev.1","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"},{"name":"bajtos","email":"miro.bajtos@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"}],"contributors":[{"name":"Jeremy Whitlock","email":"jcscoobyrs@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"53ec1a20213584b54e8cb2510aaf4b7790725d91","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-21.0.0-dev.1.tgz","integrity":"sha512-o1tcL9wBfsph+qKBGAfbIGtAqFbZIs3m9TC+UYdIeQGGHyh+0vLX+KnVlD0GVuwHiTw/HAYfv8oO8mf5pXg5CQ==","signatures":[{"sig":"MEYCIQDoCVf5Qt0XqM8x688rQ5Fw/IDMZ8aWpuu1rQM7hWRvwAIhAMRzCVJPtwEyLQN9kpVX+p78PJFLSKIUGCuEukrcRnaT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","files":["LICENSE","lib","browser","index.js"],"_shasum":"53ec1a20213584b54e8cb2510aaf4b7790725d91","engines":{"node":">= 0.6.6"},"gitHead":"093af1377bfd3d3a5668460b2d1590c4fa262601","scripts":{"dev":"gulp watch","test":"gulp test","build":"gulp build","prepublish":"gulp build","browsertest":"gulp browsertest"},"_npmUser":{"name":"bajtos","email":"miro.bajtos@gmail.com"},"repository":{"url":"git+https://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.13.2","description":"strong-swagger-client is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"2.5.0","dependencies":{"btoa":"^1.1.2","jquery":"^2.1.3","js-yaml":"^3.3.0","cookiejar":"^2.0.1","superagent":"^1.2","lodash-compat":"^3.5.0"},"devDependencies":{"del":"^1.1.1","brfs":"^1.4.0","chai":"^2.3.0","gulp":"^3.8.10","async":"^0.9.0","karma":"^0.12.35","mocha":"^1.21.3","expect":"1.4.0","unit.js":"^2.0.0","faux-jax":"^4.0.0","uglifyify":"^3.0.1","browserify":"^9.0.3","gulp-mocha":"^2.0.0","gulp-buffer":"0.0.2","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","http-server":"git://github.com/nodeapps/http-server.git","karma-mocha":"^0.1.10","connect-cors":"^0.5.6","gulp-connect":"^2.2.0","gulp-istanbul":"^0.5.0","object.assign":"^3.0.0","jshint-stylish":"^1.0.1","karma-browserify":"^4.2.1","selenium-webdriver":"^2.45.1","vinyl-source-stream":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-source-map-support":"^1.0.0"}},"21.0.0-dev.2":{"name":"strong-swagger-client","version":"21.0.0-dev.2","author":{"name":"Tony Tam","email":"fehguy@gmail.com"},"license":"Apache-2.0","_id":"strong-swagger-client@21.0.0-dev.2","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"},{"name":"bajtos","email":"miro.bajtos@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"}],"contributors":[{"name":"Jeremy Whitlock","email":"jcscoobyrs@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"21efccb5cd2b9d49f3412085005730a185abe9d3","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-21.0.0-dev.2.tgz","integrity":"sha512-PUDTsMe3CUBGf0S1pwe04LHx4drsDuLGFs/ka5fJBBALKqOezVdxYfhJEmzMtx3rwgcdIGYnBKdnPLxUCOStrA==","signatures":[{"sig":"MEYCIQCFu5PFH+qY+a1i7vmv1biIW3C1tivP3uwYFCQNd3j+agIhAIXwN2IDQg2zuccFqqMZTIYcgyFm+IasEfigbIPEHRlY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","files":["LICENSE","lib","browser","index.js"],"_shasum":"21efccb5cd2b9d49f3412085005730a185abe9d3","engines":{"node":">= 0.6.6"},"gitHead":"fb5f5a4778cee89bf0c240009e7bd03d6c030f36","scripts":{"dev":"gulp watch","test":"gulp test && gulp browsertest","build":"gulp build","prepublish":"gulp build"},"_npmUser":{"name":"bajtos","email":"miro.bajtos@gmail.com"},"repository":{"url":"git+https://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.13.2","description":"strong-swagger-client is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"2.5.0","dependencies":{"btoa":"^1.1.2","jquery":"^2.1.3","js-yaml":"^3.3.0","cookiejar":"^2.0.1","superagent":"^1.2","lodash-compat":"^3.5.0"},"devDependencies":{"del":"^1.1.1","brfs":"^1.4.0","chai":"^2.3.0","gulp":"^3.8.10","async":"^0.9.0","karma":"^0.12.35","mocha":"^1.21.3","expect":"1.4.0","unit.js":"^2.0.0","faux-jax":"^4.0.0","uglifyify":"^3.0.1","browserify":"^9.0.3","gulp-mocha":"^2.0.0","gulp-buffer":"0.0.2","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","http-server":"git://github.com/nodeapps/http-server.git","karma-mocha":"^0.1.10","connect-cors":"^0.5.6","gulp-connect":"^2.2.0","gulp-istanbul":"^0.5.0","object.assign":"^3.0.0","jshint-stylish":"^1.0.1","karma-browserify":"^4.2.1","selenium-webdriver":"^2.45.1","vinyl-source-stream":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-source-map-support":"^1.0.0"}},"20.1.1":{"name":"strong-swagger-client","version":"20.1.1","author":{"name":"Zeke Sikelianos","email":"zeke@sikelianos.com"},"license":"Apache-2.0","_id":"strong-swagger-client@20.1.1","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"},{"name":"bajtos","email":"miro.bajtos@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"}],"contributors":[{"name":"Tony Tam","email":"fehguy@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"f178e9d07e4b1d0dd39c140d75991c7c27a3067b","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-20.1.1.tgz","integrity":"sha512-a8GcYFJmgsKdvSqu3oOebg7qudXCLb6OMgsEXVsQnxMSaYZUDBBWJ4nGV87/4aWVNqQSvyTT0094j8vCIK5ZCQ==","signatures":[{"sig":"MEYCIQDagISiEG3Z6im/3pXgMGfP7q8hAGUYybp1BHjtZE3jDAIhAMvrjzEqc131koDcHyW7gEA2E86Uy0lqoseCzZt73DHg","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/swagger.js","_from":".","_shasum":"f178e9d07e4b1d0dd39c140d75991c7c27a3067b","engines":{"node":">= 0.6.6"},"gitHead":"c229c345eb50868e491dbe7fbdbf423c9dacada4","scripts":{"test":"mocha","build":"uglifyjs lib/swagger.js -o lib/swagger.min.js"},"_npmUser":{"name":"bajtos","email":"miro.bajtos@gmail.com"},"repository":{"url":"git://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.13.2","description":"swagger.js is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"2.5.0","dependencies":{"btoa":"1.1.1","shred":"0.8.10"},"publishConfig":{"tag":"20.x"},"devDependencies":{"mocha":"^1.21.3","should":"4.4.2","unit.js":"1.1.2","uglify-js":"1.3.x"}},"21.0.0":{"name":"strong-swagger-client","version":"21.0.0","author":{"name":"Tony Tam","email":"fehguy@gmail.com"},"license":"Apache-2.0","_id":"strong-swagger-client@21.0.0","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"},{"name":"bajtos","email":"miro.bajtos@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"}],"contributors":[{"name":"Jeremy Whitlock","email":"jcscoobyrs@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"5a142c925c35121c0f9a36d91bafbb95fd2fe736","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-21.0.0.tgz","integrity":"sha512-T2ybVj3rKgSq8e5mhnrf1Ay3K8IlM2R9T5f7bt9syfDL1SnH7kRYqK6+DFKGl3QGSD+feBR8mdH0voYG1Tb7PA==","signatures":[{"sig":"MEQCIBauJol7wnzW2nlKtFFtpF2gC0F0R+JeubG4ot07woB2AiB8ynty9TyHT+wmB835EWBMXAyiQlZWEk5xhVen4ZtMxg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","files":["LICENSE","lib","browser","index.js"],"_shasum":"5a142c925c35121c0f9a36d91bafbb95fd2fe736","engines":{"node":">= 0.6.6"},"gitHead":"1dcead514a7d5ae491fe8b8749b1b1d9fd93a89c","scripts":{"dev":"gulp watch","test":"gulp test && gulp browsertest","build":"gulp build","prepublish":"gulp build"},"_npmUser":{"name":"bajtos","email":"miro.bajtos@gmail.com"},"repository":{"url":"git+https://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.13.2","description":"strong-swagger-client is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"2.5.0","dependencies":{"btoa":"^1.1.2","jquery":"^2.1.3","js-yaml":"^3.3.0","cookiejar":"^2.0.1","superagent":"^1.2","lodash-compat":"^3.5.0"},"devDependencies":{"del":"^1.1.1","brfs":"^1.4.0","chai":"^2.3.0","gulp":"^3.8.10","async":"^0.9.0","karma":"^0.12.35","mocha":"^1.21.3","expect":"1.4.0","unit.js":"^2.0.0","faux-jax":"^4.0.0","uglifyify":"^3.0.1","browserify":"^9.0.3","gulp-mocha":"^2.0.0","gulp-buffer":"0.0.2","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","http-server":"git://github.com/nodeapps/http-server.git","karma-mocha":"^0.1.10","connect-cors":"^0.5.6","gulp-connect":"^2.2.0","gulp-istanbul":"^0.5.0","object.assign":"^3.0.0","jshint-stylish":"^1.0.1","karma-browserify":"^4.2.1","selenium-webdriver":"^2.45.1","vinyl-source-stream":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-source-map-support":"^1.0.0"}},"21.1.0":{"name":"strong-swagger-client","version":"21.1.0","author":{"name":"Tony Tam","email":"fehguy@gmail.com"},"license":"Apache-2.0","_id":"strong-swagger-client@21.1.0","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"},{"name":"bajtos","email":"miro.bajtos@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"}],"contributors":[{"name":"Jeremy Whitlock","email":"jcscoobyrs@gmail.com"}],"homepage":"http://swagger.io","bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"dist":{"shasum":"66212de3873bad34c47bd2a85647e317c80d35f4","tarball":"https://registry.npmjs.org/strong-swagger-client/-/strong-swagger-client-21.1.0.tgz","integrity":"sha512-7uYYZK2ghZL0+ga3LBj7y2zXqotv7DQbRobv3+z44xxnneZPhHmphVhzdVs/tXHznvvzHC9xm7YxYJiX5UTW1Q==","signatures":[{"sig":"MEYCIQDD+zyrzNVySdNuLn7BPdaV/868+1zPtqz6hsPLdcjxDwIhAPyAVhrTgMoEYo9gV1uM65bjyCeHDuyZDx1722Gc2VAA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","files":["LICENSE","lib","browser","index.js"],"_shasum":"66212de3873bad34c47bd2a85647e317c80d35f4","engines":{"node":">= 0.6.6"},"gitHead":"216902de2758d7d9dd1b469b948bb18067e0da23","scripts":{"dev":"gulp watch","test":"gulp test && gulp browsertest","build":"gulp build","prepublish":"gulp build"},"_npmUser":{"name":"bajtos","email":"miro.bajtos@gmail.com"},"repository":{"url":"git+https://github.com/strongloop/strong-swagger-js.git","type":"git"},"_npmVersion":"2.14.3","description":"strong-swagger-client is a javascript client for use with swaggering APIs.","directories":{},"_nodeVersion":"4.1.0","dependencies":{"btoa":"^1.1.2","jquery":"^2.1.3","js-yaml":"^3.3.0","cookiejar":"^2.0.1","superagent":"^1.2","lodash-compat":"^3.5.0"},"devDependencies":{"del":"^1.1.1","brfs":"^1.4.0","chai":"^2.3.0","gulp":"^3.8.10","async":"^0.9.0","karma":"^0.12.35","mocha":"^1.21.3","expect":"1.4.0","unit.js":"^2.0.0","faux-jax":"^4.0.0","uglifyify":"^3.0.1","browserify":"^9.0.3","gulp-mocha":"^2.0.0","gulp-buffer":"0.0.2","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","http-server":"^0.8.4","karma-mocha":"^0.1.10","connect-cors":"^0.5.6","gulp-connect":"^2.2.0","gulp-istanbul":"^0.5.0","object.assign":"^3.0.0","jshint-stylish":"^1.0.1","karma-browserify":"^4.2.1","selenium-webdriver":"^2.45.1","vinyl-source-stream":"^1.1.0","karma-firefox-launcher":"^0.1.6","karma-source-map-support":"^1.0.0"}}},"time":{"created":"2015-07-07T17:27:05.084Z","modified":"2026-04-14T15:16:23.695Z","20.0.0":"2015-07-07T17:27:05.084Z","20.1.0":"2015-08-06T08:37:28.484Z","21.0.0-dev.1":"2015-08-06T14:29:11.110Z","21.0.0-dev.2":"2015-08-11T14:10:27.564Z","20.1.1":"2015-08-24T14:27:54.686Z","21.0.0":"2015-09-01T15:09:06.113Z","21.1.0":"2015-09-29T16:43:44.602Z"},"bugs":{"url":"https://github.com/strongloop/strong-swagger-js/issues"},"author":{"name":"Tony Tam","email":"fehguy@gmail.com"},"license":"Apache-2.0","homepage":"http://swagger.io","repository":{"url":"git+https://github.com/strongloop/strong-swagger-js.git","type":"git"},"description":"strong-swagger-client is a javascript client for use with swaggering APIs.","contributors":[{"name":"Jeremy Whitlock","email":"jcscoobyrs@gmail.com"}],"maintainers":[],"readme":"# Swagger JS library\n\n[![Build Status](https://api.travis-ci.org/strongloop/strong-swagger-js.png?branch=master)](https://travis-ci.org/strongloop/strong-swagger-js)\n\nThis repository contains a friendly fork\nof [swagger-js](https://github.com/swagger-api/swagger-js) v2.0.x with\nadditional enhancements. Our goal is to eventually contribute these\nimprovements to the upstream repository.\n!!FIXME!!\nThis is the Swagger javascript client for use with [swagger](http://swagger.io) enabled APIs.\nIt's written in javascript and tested with mocha, and is the fastest way to enable a javascript client to communicate with a swagger-enabled server.\n\nThe client is compatible with Swagger Spec versions 1.1 and 1.2, the Swagger\nSpec version 2.0 is *not* supported by this module.\n\n\n### Calling an API with swagger + node.js!\n\nInstall swagger-client:\n```\nnpm install swagger-client\n```\n\nThen let swagger do the work!\n```js\nvar client = require('strong-swagger-client');\n\nvar swagger = new client({\n  url: 'http://petstore.swagger.io/v2/swagger.json',\n  success: function() {\n    swagger.pet.getPetById({petId:7},{responseContentType: 'application/json'},function(pet){\n      console.log('pet', pet);\n    });\n  }\n});\n```\n\nNOTE: we're explicitly setting the responseContentType, because we don't want you getting stuck when there is more than one content type available.\n\nThat's it!  You'll get a JSON response with the default callback handler:\n\n```json\n{\n  \"id\": 1,\n  \"category\": {\n    \"id\": 2,\n    \"name\": \"Cats\"\n  },\n  \"name\": \"Cat 1\",\n  \"photoUrls\": [\n    \"url1\",\n    \"url2\"\n  ],\n  \"tags\": [\n    {\n      \"id\": 1,\n      \"name\": \"tag1\"\n    },\n    {\n      \"id\": 2,\n      \"name\": \"tag2\"\n    }\n  ],\n  \"status\": \"available\"\n}\n```\n\nNeed to pass an API key?  Configure one as a querystring:\n\n```js\nclient.clientAuthorizations.add(\"apiKey\", new client.ApiKeyAuthorization(\"api_key\",\"special-key\",\"query\"));\n```\n\n...or with a header:\n\n```js\nclient.clientAuthorizations.add(\"apiKey\", new client.ApiKeyAuthorization(\"api_key\",\"special-key\",\"header\"));\n```\n\n...or with the swagger-client constructor:\n\n```js\nvar swagger = new client({\n  url: 'http://example.com/spec.json',\n  success: function() {},\n  authorizations : {\n    easyapi_basic: new client.PasswordAuthorization('<name>', '<username>', '<password>'),\n    someHeaderAuth: new client.ApiKeyAuthorization('<nameOfHeader>', '<value>', 'header'),\n    someQueryAuth: new client.ApiKeyAuthorization('<nameOfQueryKey>', '<value>', 'query'),\n    someCookieAuth: new client.CookieAuthorization('<cookie>'),\n  }\n});\n```\n\n### Calling an API with swagger + the browser!\n\nDownload `browser/swagger-client.js` into your webapp:\n\n```js\n<script src='browser/swagger-client.js' type='text/javascript'></script>\n<script type=\"text/javascript\">\n  // initialize swagger, point to a resource listing\n  window.swagger = new SwaggerClient({\n    url: \"http://petstore.swagger.io/api/api-docs\",\n    success: function() {\n      // upon connect, fetch a pet and set contents to element \"mydata\"\n      swagger.apis.pet.getPetById({petId:1},{responseContentType: 'application/json'}, function(data) {\n        document.getElementById(\"mydata\").innerHTML = JSON.stringify(data.obj);\n      });\n    }\n  });\n</script>\n\n<body>\n  <div id=\"mydata\"></div>\n</body>\n```\n\n### Need to send an object to your API via POST or PUT?\n```js\nvar pet = {\n  id: 100,\n  name: \"dog\"};\n\nswagger.pet.addPet({body: pet});\n```\n\n### Sending XML in as a payload to your API?\n```js\nvar pet = \"<Pet><id>2</id><name>monster</name></Pet>\";\n\nswagger.pet.addPet({body: pet}, {requestContentType:\"application/xml\"});\n```\n\n### Need XML response?\n```js\nswagger.pet.getPetById({petId:1}, {responseContentType:\"application/xml\"});\n```\n\n### Custom request signing\nYou can easily write your own request signing code for Swagger.  For example:\n\n```js\nvar CustomRequestSigner = function(name) {\n  this.name = name;\n};\n\nCustomRequestSigner.prototype.apply = function(obj, authorizations) {\n  var hashFunction = this._btoa;\n  var hash = hashFunction(obj.url);\n\n  obj.headers[\"signature\"] = hash;\n  return true;\n};\n```\n\nIn the above simple example, we're creating a new request signer that simply\nbase 64 encodes the URL.  Of course you'd do something more sophisticated, but\nafter encoding it, a header called `signature` is set before sending the request.\n\n### How does it work?\nThe swagger javascript client reads the swagger api definition directly from the server.  As it does, it constructs a client based on the api definition, which means it is completely dynamic.  It even reads the api text descriptions (which are intended for humans!) and provides help if you need it:\n\n```js\ns.apis.pet.getPetById.help()\n'* petId (required) - ID of pet that needs to be fetched'\n```\n\nThe HTTP requests themselves are handled by the excellent [shred](https://github.com/automatthew/shred) library, which has a ton of features itself.  But it runs on both node and the browser.\n\n\nDevelopment\n-----------\n\nPlease [fork the code](https://github.com/strongloop/strong-swagger-js) and help us improve\nswagger-client.js. Send us a pull request to the `master` branch!  Tests make merges get accepted more quickly.\n\nswagger-js use gulp for Node.js.\n\n```bash\n# Install the gulp client on the path\nnpm install -g gulp\n\n# Install all project dependencies\nnpm install\n```\n\n```bash\n# List all tasks.\ngulp -T\n\n# Run lint (will not fail if there are errors/warnings), tests (without coverage) and builds the browser binaries\ngulp\n\n# Run the test suite (without coverage)\ngulp test\n\n# Build the browser binaries (One for development with source maps and one that is minified and without source maps) in the browser directory\ngulp build\n\n# Continuously run the test suite:\ngulp watch\n\n# Run jshint report\ngulp lint\n\n# Run a coverage report based on running the unit tests\ngulp coverage\n```\n\nLicense\n-------\n\nCopyright 2011-2015 SmartBear Software\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n[apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","readmeFilename":"README.md"}