diff --git a/lib/api/account.js b/lib/api/account.js new file mode 100644 index 0000000..f8134fc --- /dev/null +++ b/lib/api/account.js @@ -0,0 +1,51 @@ +// telegram.link +// Copyright 2014 Enrico Stara 'enrico.stara@gmail.com' +// Released under the MIT License +// http://telegram.link + + +// Dependencies: +var api = require('../api'); +var utility = require('../utility'); + + +// *** + +// This module wraps API methods required to manage notifications and settings + +// See [Api Methods](https://core.telegram.org/methods#working-with-notifications-settings) + +// Access only via Client object and `account` instance property + +function Account(client) { + this.client = client; +} + + +// *** + +// **Event: **`'method name'` + +// Each of the following methods emits an event with the same name when done, an `error` event otherwise. + + +// *** +// account.**updateStatus(offline, [callback])** + +// Returns a Promise for update the online user status.. + +// [Click here for more details](https://core.telegram.org/method/account.updateStatus) + +// The code: +Account.prototype.updateStatus = function (offline, callback) { + + offline = offline === false ? new api.type.BoolFalse() : + ( offline === true ? new api.type.BoolTrue() : offline); + + return utility.callService(api.service.account.updateStatus, this.client, this.client._channel, callback, arguments); +}; + + + +// Exports the class +module.exports = exports = Account; \ No newline at end of file