Tony Tam 15a0bf5df5 Refactor nodejs generated code structure (#4909)
* read directly from templates

* refactor nodejs structure

* dont inject into global scope

* move to 2 spaces consistently
2017-03-06 01:10:01 +08:00

187 lines
3.7 KiB
JavaScript

'use strict';
/**
* Add a new pet to the store
*
*
* body Pet Pet object that needs to be added to the store
* no response value expected for this operation
**/
exports.addPet = function(body) {
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'] = [ {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"id" : 123456789,
"name" : "aeiou"
},
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
} ];
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'] = [ {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"id" : 123456789,
"name" : "aeiou"
},
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
} ];
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'] = {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"id" : 123456789,
"name" : "aeiou"
},
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
};
if (Object.keys(examples).length > 0) {
resolve(examples[Object.keys(examples)[0]]);
} else {
resolve();
}
});
}
/**
* Update an existing pet
*
*
* body Pet Pet object that needs to be added to the store
* no response value expected for this operation
**/
exports.updatePet = function(body) {
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'] = {
"message" : "aeiou",
"code" : 123,
"type" : "aeiou"
};
if (Object.keys(examples).length > 0) {
resolve(examples[Object.keys(examples)[0]]);
} else {
resolve();
}
});
}