update js sample

This commit is contained in:
wing328
2016-03-24 19:54:25 +08:00
parent ec38afde0a
commit eb5c689fac
14 changed files with 114 additions and 113 deletions

View File

@@ -1,4 +1,3 @@
# SwaggerPetstore.StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
@@ -25,11 +24,11 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted
api.deleteOrder(orderId).then(function() {
apiInstance.deleteOrder(orderId).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@@ -81,12 +80,12 @@ test_api_client_secret.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var opts = {
'status': "placed" // {String} Status value that needs to be considered for query
};
api.findOrdersByStatus(opts).then(function(data) {
apiInstance.findOrdersByStatus(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@@ -132,8 +131,8 @@ api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['api_key'] = "Token"
var api = new SwaggerPetstore.StoreApi()
api.getInventory().then(function(data) {
var apiInstance = new SwaggerPetstore.StoreApi()
apiInstance.getInventory().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@@ -176,8 +175,8 @@ api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['api_key'] = "Token"
var api = new SwaggerPetstore.StoreApi()
api.getInventoryInObject().then(function(data) {
var apiInstance = new SwaggerPetstore.StoreApi()
apiInstance.getInventoryInObject().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@@ -226,11 +225,11 @@ test_api_key_query.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
api.getOrderById(orderId).then(function(data) {
apiInstance.getOrderById(orderId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@@ -282,12 +281,12 @@ test_api_client_secret.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var opts = {
'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet
};
api.placeOrder(opts).then(function(data) {
apiInstance.placeOrder(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);