{"_id":"@bluegill/swagger-client","_rev":"1-e02177929cd4e6a78ae4015e42642cc1","name":"@bluegill/swagger-client","dist-tags":{"latest":"2.0.26"},"versions":{"2.0.26":{"name":"@bluegill/swagger-client","author":{"name":"Zeke Sikelianos","email":"zeke@sikelianos.com"},"contributors":[{"name":"Seth Kester","email":"sekest@bluegilltech.com"}],"description":"swagger.js is a javascript client for use with swaggering APIs.","version":"2.0.26","homepage":"http://swagger.wordnik.com","repository":{"type":"git","url":"git://github.com/sekest/swagger-js.git"},"main":"lib/swagger.js","scripts":{"build":"PATH=$PATH:./node_modules/.bin cake bake","dev":"PATH=$PATH:./node_modules/.bin cake dev","test":"open spec.html"},"engines":{"node":">= 0.6.6"},"dependencies":{"shred":"0.8.10","btoa":"1.1.1"},"devDependencies":{"coffee-script":"~1.5.0"},"license":"MIT","bugs":{"url":"https://github.com/sekest/swagger-js/issues"},"directories":{"lib":"lib"},"gitHead":"139087a7ee7a53c87cce0dfd793ce3b369ea7acb","_id":"@bluegill/swagger-client@2.0.26","_nodeVersion":"14.15.5","_npmVersion":"6.14.11","dist":{"integrity":"sha512-jn/0LsvN6hsdIXSDQAP95KDlT6Xfi0TvE+9SPtGurAsU4o4dNcaWBXuNel8HBcn7neacPoHTS7DnBdBatIdySg==","shasum":"07b7bd80808c4322e985c5888e297bc73092f162","tarball":"https://registry.npmjs.org/@bluegill/swagger-client/-/swagger-client-2.0.26.tgz","fileCount":22,"unpackedSize":314769,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgWueCCRA9TVsSAnZWagAAOusP/2buiLCjh7CdCOXgHoYM\nk8BoPUNRE2gDCMbP6iR3zdshG4+w02Ci0mrHbAgBdFB+E6jqYFfbu3a8xQ1K\nhbUiu/rCNBDxdTvFDyaVlRJ2pWmYT7BnJqFY4TDVu1w7bT6rGrU/Qnxb/KnL\nXGR9N5i9wtGzi5TXmyfvu5yhD9yJT+1f4qK4EA7FMyczpIc+DK66Pz21WRU2\nRVWTHddg/8Umy4uNyr/mVXpKG6EbGKeyu8YvOeJGv06Co9MapSOEIuuoBsLc\nb92eIFkmmSM6LzG3YwFvHcKacpOdy2SYVSg9XAtEkFrZzIl71lHokGwZ2QSH\nwrn9z2ITq3Si+98GN1lxQSnjc+5rNb5uLzSKNasHjuIAZ4/YCa8jWzAkn8U3\nSD8+wJWkEEulBKCweuLv2BpRf9+VvvZeNm3Gs2SSO++LeqplGqmAvuLtsRSN\nOXyKtypmrD/62Ih/FIQCjBJTEzQvUTAMPwLHg8LLRxbBkFXycGh0xRRun+kX\nhvUL8bZOn3aAM0aG07l9lON+6Y/JKtn0ZHIaa2izxnTgqNzvrIeqedXsouqQ\nkrPU1z4dq2ohfhKXyhXGUqfv8aThrfVdnUPMqadZXl3l5C2MBgN0YtEl4Nwh\nz57/bJOY9bVE3l+oKre8CR4KTbykAVT5C2zun+xjaADr+0xOoKo2eZYp7e51\nWqPm\r\n=Ihb9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD650PukgjAELAH883TIaBenNoFwSXDuQnhh0xRPVOY1wIgfaPOLHdDP0/kxDAClQCmTK+s9uvpzR7r21SXcA7yQlE="}]},"_npmUser":{"name":"skester","email":"skester@bluegilltech.com"},"maintainers":[{"name":"skester","email":"skester@bluegilltech.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swagger-client_2.0.26_1616570242078_0.7914366709864675"},"_hasShrinkwrap":false}},"time":{"created":"2021-03-24T07:17:21.809Z","2.0.26":"2021-03-24T07:17:22.255Z","modified":"2022-04-04T19:47:46.048Z"},"maintainers":[{"name":"skester","email":"skester@bluegilltech.com"}],"description":"swagger.js is a javascript client for use with swaggering APIs.","homepage":"http://swagger.wordnik.com","repository":{"type":"git","url":"git://github.com/sekest/swagger-js.git"},"contributors":[{"name":"Seth Kester","email":"sekest@bluegilltech.com"}],"author":{"name":"Zeke Sikelianos","email":"zeke@sikelianos.com"},"bugs":{"url":"https://github.com/sekest/swagger-js/issues"},"license":"MIT","readme":"This is the Wordnik Swagger javascript client for use with [swagger](http://swagger.wordnik.com) enabled APIs.\r\nIt's written in CoffeeScript and tested with Jasmine, and is the fastest way to enable a javascript client to communicate with a swagger-enabled server.\r\n\r\nFind out more about the swagger project at [swagger.wordnik.com](http://swagger.wordnik.com),\r\nand follow us on Twitter at [@swagger_doc](https://twitter.com/#!/swagger_doc).\r\n\r\n## READ MORE about swagger!\r\n\r\nSee the [swagger website](http://swagger.wordnik.com) or the [swagger-core wiki](https://github.com/wordnik/swagger-core/wiki), which contains information about the swagger json spec.\r\n\r\n### Calling an API with swagger + node.js!\r\n\r\nInstall swagger-client:\r\n```\r\nnpm install swagger-client\r\n```\r\n\r\nThen let swagger do the work!\r\n```js\r\nvar client = require(\"swagger-client\")\r\n\r\nvar swagger = new client.SwaggerApi({\r\n  url: 'http://petstore.swagger.wordnik.com/api/api-docs',\r\n  success: function() {\r\n    if(swagger.ready === true) {\r\n      swagger.apis.pet.getPetById({petId:1});\r\n    }\r\n  }\r\n});\r\n\r\n```\r\n\r\nThat's it!  You'll get a JSON response with the default callback handler:\r\n\r\n```json\r\n{\r\n  \"id\": 1,\r\n  \"category\": {\r\n    \"id\": 2,\r\n    \"name\": \"Cats\"\r\n  },\r\n  \"name\": \"Cat 1\",\r\n  \"photoUrls\": [\r\n    \"url1\",\r\n    \"url2\"\r\n  ],\r\n  \"tags\": [\r\n    {\r\n      \"id\": 1,\r\n      \"name\": \"tag1\"\r\n    },\r\n    {\r\n      \"id\": 2,\r\n      \"name\": \"tag2\"\r\n    }\r\n  ],\r\n  \"status\": \"available\"\r\n}\r\n```\r\n\r\nNeed to pass an API key?  Configure one as a querystring:\r\n\r\n```js\r\nclient.authorizations.add(\"apiKey\", new client.ApiKeyAuthorization(\"api_key\",\"special-key\",\"query\"));\r\n```\r\n\r\n...or with a header:\r\n\r\n```js\r\nclient.authorizations.add(\"apiKey\", new client.ApiKeyAuthorization(\"api_key\",\"special-key\",\"header\"));\r\n```\r\n\r\n### Calling an API with swagger + the browser!\r\n\r\nDownload `swagger.js` and `shred.bundle.js` into your lib folder\r\n\r\n```js\r\n<script src='lib/shred.bundle.js' type='text/javascript'></script>\r\n<script src='lib/swagger.js' type='text/javascript'></script>\r\n<script type=\"text/javascript\">\r\n  // initialize swagger, point to a resource listing\r\n  window.swagger = new SwaggerApi({\r\n    url: \"http://petstore.swagger.wordnik.com/api/api-docs.json\",\r\n    success: function() {\r\n      if(swagger.ready === true) {\r\n        // upon connect, fetch a pet and set contents to element \"mydata\"\r\n        swagger.apis.pet.getPetById({petId:1}, function(data) {\r\n          document.getElementById(\"mydata\").innerHTML = data.content.data;\r\n        });\r\n      }\r\n    }\r\n  });\r\n\r\n</script>\r\n```\r\n\r\n### Need to send an object to your API via POST or PUT?\r\n```js\r\nvar body = {\r\n  id: 100,\r\n  name: \"dog\"};\r\n\r\nswagger.apis.pet.addPet({body: JSON.stringify(body)});\r\n```\r\n\r\n### Sending XML in as a payload to your API?\r\n```js\r\nvar body = \"<Pet><id>2</id><name>monster</name></Pet>\";\r\n\r\nswagger.apis.pet.addPet({body: body},{requestContentType:\"application/xml\"});\r\n```\r\n\r\n### Need XML response?\r\n```js\r\nswagger.apis.pet.getPetById({petId:1},{responseContentType:\"application/xml\"});\r\n```\r\n\r\n### How does it work?\r\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:\r\n\r\n```js\r\ns.apis.pet.getPetById.help()\r\n'* petId (required) - ID of pet that needs to be fetched'\r\n```\r\n\r\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.\r\n\r\n\r\nDevelopment\r\n-----------\r\n\r\nPlease [fork the code](https://github.com/wordnik/swagger-js) and help us improve\r\nswagger.js. Send us a pull request and **we'll mail you a wordnik T-shirt!**\r\n\r\nSwagger.js is written in CoffeeScript, so you'll need Node.js and the\r\nCoffeeScript compiler. For more detailed installation instructions, see\r\n[coffeescript.org/#installation](http://coffeescript.org/#installation).\r\n\r\n```bash\r\n# generate the javascript libraries and put them in the `lib` folder\r\n\r\nnpm run-script build\r\n```\r\n\r\n```bash\r\n# The 'dev' task will:\r\n# 1. Open source files in your $EDITOR\r\n# 2. Open and run the Jasmine specs in your browser.\r\n# 3. Watch for changes to CoffeeScript files and auto-compile them to Javascript.\r\n\r\nnpm run-script dev\r\n\r\n# List all cake tasks:\r\ncake\r\n```\r\n\r\nLicense\r\n-------\r\n\r\nCopyright 2011-2014 Wordnik, Inc.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n[apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n","readmeFilename":"README.md"}