swagger_petstore
SwaggerPetstore - JavaScript client for swagger_petstore A sample API that demonstrates Swagger-Express-Middleware features This SDK is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
Installation
Node.js
Fornpm
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
npm adduser Logged in as buger72 on https://registry.npmjs.org/. verify email
(node module name must be unique) npm publish npm unpublish -force swagger_petstore_test_123
cd..
npm install swagger_petstore_test_123 --save
Then install it via:
npm install swagger_petstore --save
git
If the library is hosted at a git repository, e.g. https://github.com/YOUR_USERNAME/swagger_petstore then install it via:
npm install YOUR_USERNAME/swagger_petstore --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
var SwaggerPetstore = require('swagger_petstore');
var api = new SwaggerPetstore.DefaultApi()
var pet = new SwaggerPetstore.Pet(); // {Pet} The pet to add to the store
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.addPet(pet, callback);
Documentation for API Endpoints
All URIs are relative to https://127.0.0.1:8000/v3
Class | Method | HTTP request | Description |
---|---|---|---|
SwaggerPetstore.DefaultApi | addPet | POST /pets | |
SwaggerPetstore.DefaultApi | addPetPhoto | POST /pets/{petName}/photos | |
SwaggerPetstore.DefaultApi | deletePet | DELETE /pets/{petName} | |
SwaggerPetstore.DefaultApi | deletePetPhoto | DELETE /pets/{petName}/photos/{id} | |
SwaggerPetstore.DefaultApi | deletePets | DELETE /pets | |
SwaggerPetstore.DefaultApi | findPetByName | GET /pets/{petName} | |
SwaggerPetstore.DefaultApi | findPets | GET /pets | |
SwaggerPetstore.DefaultApi | getPetPhoto | GET /pets/{petName}/photos/{id} | |
SwaggerPetstore.DefaultApi | petsPetNamePatch | PATCH /pets/{petName} | |
SwaggerPetstore.DefaultApi | petsPetNamePhotosGet | GET /pets/{petName}/photos | |
SwaggerPetstore.DefaultApi | rootGet | GET / |
Documentation for Models
- SwaggerPetstore.Address
- SwaggerPetstore.InlineResponse200
- SwaggerPetstore.Pet
- SwaggerPetstore.Veterinarian
Documentation for Authorization
All endpoints do not require authorization.