forked from loafle/openapi-generator-original
* update nodejs server oas2 * update nodejs server petstore with oas3 * update nodejs google cloud with oas2 petstore * update nodejs server google function with oas3
91 lines
1.9 KiB
JavaScript
91 lines
1.9 KiB
JavaScript
'use strict';
|
|
|
|
|
|
/**
|
|
* Delete purchase order by ID
|
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
*
|
|
* orderId String ID of the order that needs to be deleted
|
|
* no response value expected for this operation
|
|
**/
|
|
exports.deleteOrder = function(orderId) {
|
|
return new Promise(function(resolve, reject) {
|
|
resolve();
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns pet inventories by status
|
|
* Returns a map of status codes to quantities
|
|
*
|
|
* returns Map
|
|
**/
|
|
exports.getInventory = function() {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"key" : 0
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Find purchase order by ID
|
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
*
|
|
* orderId Long ID of pet that needs to be fetched
|
|
* returns Order
|
|
**/
|
|
exports.getOrderById = function(orderId) {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"petId" : 6,
|
|
"quantity" : 1,
|
|
"id" : 0,
|
|
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
|
"complete" : false,
|
|
"status" : "placed"
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Place an order for a pet
|
|
*
|
|
* order Order order placed for purchasing the pet
|
|
* returns Order
|
|
**/
|
|
exports.placeOrder = function(order) {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"petId" : 6,
|
|
"quantity" : 1,
|
|
"id" : 0,
|
|
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
|
"complete" : false,
|
|
"status" : "placed"
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|