Skip to content

Commit

Permalink
Add the account module
Browse files Browse the repository at this point in the history
  • Loading branch information
enricostara committed Aug 16, 2015
1 parent cc029c6 commit c1b1d43
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions lib/api/account.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// telegram.link
// Copyright 2014 Enrico Stara '[email protected]'
// 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;

0 comments on commit c1b1d43

Please sign in to comment.