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

137 lines
2.7 KiB
JavaScript

'use strict';
/**
* Create user
* This can only be done by the logged in user.
*
* body User Created user object
* no response value expected for this operation
**/
exports.createUser = function(body) {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* Creates list of users with given input array
*
*
* body List List of user object
* no response value expected for this operation
**/
exports.createUsersWithArrayInput = function(body) {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* Creates list of users with given input array
*
*
* body List List of user object
* no response value expected for this operation
**/
exports.createUsersWithListInput = function(body) {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* Delete user
* This can only be done by the logged in user.
*
* username String The name that needs to be deleted
* no response value expected for this operation
**/
exports.deleteUser = function(username) {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* Get user by user name
*
*
* username String The name that needs to be fetched. Use user1 for testing.
* returns User
**/
exports.getUserByName = function(username) {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = {
"id" : 123456789,
"lastName" : "aeiou",
"phone" : "aeiou",
"username" : "aeiou",
"email" : "aeiou",
"userStatus" : 123,
"firstName" : "aeiou",
"password" : "aeiou"
};
if (Object.keys(examples).length > 0) {
resolve(examples[Object.keys(examples)[0]]);
} else {
resolve();
}
});
}
/**
* Logs user into the system
*
*
* username String The user name for login
* password String The password for login in clear text
* returns String
**/
exports.loginUser = function(username,password) {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = "aeiou";
if (Object.keys(examples).length > 0) {
resolve(examples[Object.keys(examples)[0]]);
} else {
resolve();
}
});
}
/**
* Logs out current logged in user session
*
*
* no response value expected for this operation
**/
exports.logoutUser = function() {
return new Promise(function(resolve, reject) {
resolve();
});
}
/**
* Updated user
* This can only be done by the logged in user.
*
* username String name that need to be deleted
* body User Updated user object
* no response value expected for this operation
**/
exports.updateUser = function(username,body) {
return new Promise(function(resolve, reject) {
resolve();
});
}