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
191 lines
3.8 KiB
JavaScript
191 lines
3.8 KiB
JavaScript
'use strict';
|
|
|
|
|
|
/**
|
|
* Add a new pet to the store
|
|
*
|
|
* pet Pet Pet object that needs to be added to the store
|
|
* no response value expected for this operation
|
|
**/
|
|
exports.addPet = function(pet) {
|
|
return new Promise(function(resolve, reject) {
|
|
resolve();
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Deletes a pet
|
|
*
|
|
* petId Long Pet id to delete
|
|
* api_key String (optional)
|
|
* no response value expected for this operation
|
|
**/
|
|
exports.deletePet = function(petId,api_key) {
|
|
return new Promise(function(resolve, reject) {
|
|
resolve();
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Finds Pets by status
|
|
* Multiple status values can be provided with comma separated strings
|
|
*
|
|
* status List Status values that need to be considered for filter
|
|
* returns List
|
|
**/
|
|
exports.findPetsByStatus = function(status) {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
|
"name" : "doggie",
|
|
"id" : 0,
|
|
"category" : {
|
|
"name" : "name",
|
|
"id" : 6
|
|
},
|
|
"tags" : [ {
|
|
"name" : "name",
|
|
"id" : 1
|
|
}, {
|
|
"name" : "name",
|
|
"id" : 1
|
|
} ],
|
|
"status" : "available"
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Finds Pets by tags
|
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
*
|
|
* tags List Tags to filter by
|
|
* returns List
|
|
**/
|
|
exports.findPetsByTags = function(tags) {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
|
"name" : "doggie",
|
|
"id" : 0,
|
|
"category" : {
|
|
"name" : "name",
|
|
"id" : 6
|
|
},
|
|
"tags" : [ {
|
|
"name" : "name",
|
|
"id" : 1
|
|
}, {
|
|
"name" : "name",
|
|
"id" : 1
|
|
} ],
|
|
"status" : "available"
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Find pet by ID
|
|
* Returns a single pet
|
|
*
|
|
* petId Long ID of pet to return
|
|
* returns Pet
|
|
**/
|
|
exports.getPetById = function(petId) {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
|
"name" : "doggie",
|
|
"id" : 0,
|
|
"category" : {
|
|
"name" : "name",
|
|
"id" : 6
|
|
},
|
|
"tags" : [ {
|
|
"name" : "name",
|
|
"id" : 1
|
|
}, {
|
|
"name" : "name",
|
|
"id" : 1
|
|
} ],
|
|
"status" : "available"
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Update an existing pet
|
|
*
|
|
* pet Pet Pet object that needs to be added to the store
|
|
* no response value expected for this operation
|
|
**/
|
|
exports.updatePet = function(pet) {
|
|
return new Promise(function(resolve, reject) {
|
|
resolve();
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Updates a pet in the store with form data
|
|
*
|
|
* petId Long ID of pet that needs to be updated
|
|
* name String Updated name of the pet (optional)
|
|
* status String Updated status of the pet (optional)
|
|
* no response value expected for this operation
|
|
**/
|
|
exports.updatePetWithForm = function(petId,name,status) {
|
|
return new Promise(function(resolve, reject) {
|
|
resolve();
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* uploads an image
|
|
*
|
|
* petId Long ID of pet to update
|
|
* additionalMetadata String Additional data to pass to server (optional)
|
|
* file File file to upload (optional)
|
|
* returns ApiResponse
|
|
**/
|
|
exports.uploadFile = function(petId,additionalMetadata,file) {
|
|
return new Promise(function(resolve, reject) {
|
|
var examples = {};
|
|
examples['application/json'] = {
|
|
"code" : 0,
|
|
"type" : "type",
|
|
"message" : "message"
|
|
};
|
|
if (Object.keys(examples).length > 0) {
|
|
resolve(examples[Object.keys(examples)[0]]);
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
|