epitech-intranet
Version:
epitech intranet wrapper
191 lines (160 loc) • 5.73 kB
JavaScript
// Generated by CoffeeScript 1.5.0
(function() {
var Model,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Model = require('../Model').Model;
module.exports.User = (function(_super) {
__extends(User, _super);
function User() {
this.router = __bind(this.router, this);
this.filter_user = __bind(this.filter_user, this);
this.filter_prefered = __bind(this.filter_prefered, this);
this.filter_filtered = __bind(this.filter_filtered, this);
this.filter_year = __bind(this.filter_year, this);
this.filter_promo = __bind(this.filter_promo, this);
this.filter_course = __bind(this.filter_course, this);
this.complete = __bind(this.complete, this);
this.index = __bind(this.index, this);
this.setupRoutes = __bind(this.setupRoutes, this);
User.__super__.constructor.apply(this, arguments);
}
User.prototype.setupRoutes = function() {
this.globalRoutes['user'] = this.router;
this.router.index = this.index;
this.router.complete = this.complete;
return this.router.filter = {
course: this.filter_course,
promo: this.filter_promo,
year: this.filter_year,
filtered: this.filter_filtered,
prefered: this.filter_prefered,
user: this.filter_user
};
};
User.prototype.index = function(fn) {
return this.request("user/", fn);
};
User.prototype.complete = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/complete/";
return this.request(args, fn);
};
User.prototype.filter_course = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/filter/course/";
return this.request(args, fn);
};
User.prototype.filter_promo = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/filter/promo/";
return this.request(args, fn);
};
User.prototype.filter_year = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/filter/year/";
return this.request(args, fn);
};
User.prototype.filter_filtered = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/filter/filtered/";
return this.request(args, fn);
};
User.prototype.filter_prefered = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/filter/prefered/";
return this.request(args, fn);
};
User.prototype.filter_user = function(args, fn) {
if (args == null) {
args = {};
}
args.path = "user/filter/user/";
return this.request(args, function(err, result) {
if (err) {
return fn(err, result);
}
return fn(err, result.items, result);
});
};
User.prototype.router = function(fn) {
var ue;
if (fn == null) {
fn = null;
}
switch (typeof fn) {
case 'function':
return this.index(fn);
case 'string':
ue = this.client.initModel(module.exports.UserEntity);
ue.login = fn;
return ue;
}
};
return User;
})(Model);
module.exports.UserEntity = (function(_super) {
__extends(UserEntity, _super);
function UserEntity() {
this.binome = __bind(this.binome, this);
this.alive = __bind(this.alive, this);
this.index = __bind(this.index, this);
this.notification_alert = __bind(this.notification_alert, this);
this.notification_message = __bind(this.notification_message, this);
this.notification_coming = __bind(this.notification_coming, this);
this.netsoul_getlog = __bind(this.netsoul_getlog, this);
this.setupRoutes = __bind(this.setupRoutes, this);
UserEntity.__super__.constructor.apply(this, arguments);
}
UserEntity.prototype.setupRoutes = function() {
this.netsoul = {
getlog: this.netsoul_getlog
};
return this.notification = {
coming: this.notification_coming,
message: this.notification_message,
alert: this.notification_alert
};
};
UserEntity.prototype.netsoul_getlog = function(fn) {
return this.request("user/" + this.login + "/netsoul/getlog/", fn);
};
UserEntity.prototype.notification_coming = function(fn) {
return this.request("user/" + this.login + "/notification/coming/", fn);
};
UserEntity.prototype.notification_message = function(fn) {
return this.request("user/" + this.login + "/notification/message/", fn);
};
UserEntity.prototype.notification_alert = function(fn) {
return this.request("user/" + this.login + "/notification/alert/", fn);
};
UserEntity.prototype.index = function(fn) {
return this.request("user/" + this.login + "/", fn);
};
UserEntity.prototype.alive = function(fn) {
return this.request("user/" + this.login + "/alive/", fn);
};
UserEntity.prototype.binome = function(fn) {
return this.request("user/" + this.login + "/binome", function(err, result) {
if (err) {
return fn(err, result);
}
return fn(err, result.binomes, result);
});
};
return UserEntity;
})(Model);
}).call(this);