///
///
import client = require('../client');
import APIError = require('../APIError');
import restify = require('restify');
export enum AccountStatus {
/**
* active user able to log into the system
*/
active = 0,
/**
* Locked out of the system due to password or other issues
*/
lockedOut = 1
}
export class Account {
public id: number;
public name: string;
public createdDate: Date;
public userId: string;
public moduleId: string;
public status: number;
public ipAddress: string;
}
export function create(accessToken: string, moduleId: number, name: string, status: number, callback: (err?: APIError, result?: any) => void) {
try{
var params = {
"accessToken": accessToken,
"moduleId": moduleId,
"name": name,
"status": status
};
client.post('/v1/accounts', params, function(err, req: restify.Request, res: restify.Response, result: any) {
if (err) // first, check for an exception
callback(err);
else if (!result) // then check for a missing result
callback(new APIError());
else
callback(null, result.data); // finally, return the payload
});
} catch(err) {
callback(err);
}
}