From fcce5ce344e4f7edd9d511639d1bafe4ed160c48 Mon Sep 17 00:00:00 2001
From: amurchick
Date: Sun, 13 Mar 2016 17:28:27 +0700
Subject: [PATCH 1/5] Add auth.logOut() method
---
lib/api/auth.js | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/api/auth.js b/lib/api/auth.js
index 37a92d1..a09036e 100644
--- a/lib/api/auth.js
+++ b/lib/api/auth.js
@@ -114,6 +114,17 @@ Auth.prototype.checkPhone = function (phone_number, callback) {
return utility.callService(api.service.auth.checkPhone, this.client, this.client._channel, callback, arguments);
};
+// ***
+// auth.**logOut([callback])**
+
+// Return a Promise for logout the user.
+
+// [Click here for more details](https://core.telegram.org/method/auth.logOut)
+
+// The code:
+Auth.prototype.logOut = function (callback) {
+ return utility.callService(api.service.auth.logOut, this.client, this.client._channel, callback, arguments);
+};
// Export the class.
module.exports = exports = Auth;
From 6586d60ceb673d0137474852474800d119b15e65 Mon Sep 17 00:00:00 2001
From: amurchick
Date: Sun, 13 Mar 2016 17:55:27 +0700
Subject: [PATCH 2/5] Add messages.receivedMessages() method
---
lib/api/messages.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/api/messages.js b/lib/api/messages.js
index 89c73a2..27bd4db 100644
--- a/lib/api/messages.js
+++ b/lib/api/messages.js
@@ -122,5 +122,15 @@ Messages.prototype.sendMessage = function (peer, message, random_id, callback) {
return utility.callService(api.service.messages.sendMessage, this.client, this.client._channel, callback, arguments);
};
+// ***
+// messages.**receivedMessages(max_id, [callback])**
+
+// Return a Promise to Confirms receipt of messages by a client, cancels PUSH-notification sending.
+
+// [Click here for more details](https://core.telegram.org/method/messages.receivedMessages)
+Messages.prototype.receivedMessages = function (max_id, callback) {
+ return utility.callService(api.service.messages.receivedMessages, this.client, this.client._channel, callback, arguments);
+};
+
// Export the class.
module.exports = exports = Messages;
From 26ac014a573ce53535caeb33312588fe7c0a4f10 Mon Sep 17 00:00:00 2001
From: amurchick
Date: Sun, 13 Mar 2016 18:09:16 +0700
Subject: [PATCH 3/5] Switch to my telegram-mt-node
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 42a1c06..d6561b7 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"get-log": "latest",
"requirish": "latest",
"telegram-tl-node": "latest",
- "telegram-mt-node": "latest",
+ "telegram-mt-node": "https://github.com/amurchick/telegram-mt-node",
"colors": "1.1.2",
"es6-promise": "2.3.0"
},
From bc0929f6783af6bfb1b0c388f4263165064102c5 Mon Sep 17 00:00:00 2001
From: amurchick
Date: Thu, 17 Mar 2016 12:26:00 +0700
Subject: [PATCH 4/5] Add method contacts.importContacts(contacts, replace,
[callback])
---
lib/api/contacts.js | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/lib/api/contacts.js b/lib/api/contacts.js
index 60fa2fb..77b4807 100644
--- a/lib/api/contacts.js
+++ b/lib/api/contacts.js
@@ -7,6 +7,7 @@
// Dependencies:
var api = require('../api');
var utility = require('../utility');
+var tl = require('telegram-tl-node');
// ***
@@ -41,5 +42,30 @@ Contacts.prototype.getContacts = function (hash, callback) {
return utility.callService(api.service.contacts.getContacts, this.client, this.client._channel, callback, arguments);
};
+// ***
+// contacts.**importContacts(contacts, replace, [callback])**
+
+// Return a Promise. Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.
+
+// [Click here for more details](https://core.telegram.org/method/contacts.importContacts)
+
+// The code:
+Contacts.prototype.importContacts = function (contacts, replace, callback) {
+
+ contacts = new tl.TypeVector({
+ type: 'InputContact',
+ list: contacts.map(function (item) {
+
+ return new api.type.InputPhoneContact({props: item});
+ })
+ });
+
+ replace = !!replace === false
+ ? new api.type.BoolFalse()
+ : new api.type.BoolTrue();
+
+ return utility.callService(api.service.contacts.importContacts, this.client, this.client._channel, callback, arguments);
+};
+
// Export the class
module.exports = exports = Contacts;
From 49256546ea47a592b1aa7581388b6cad1ba03ae7 Mon Sep 17 00:00:00 2001
From: amurchick
Date: Fri, 18 Mar 2016 15:14:41 +0700
Subject: [PATCH 5/5] Add methods Contacts.getStatuses(),
Contacts.deleteContact()
---
lib/api/contacts.js | 28 ++++++++++++++++++++++++++++
package.json | 2 +-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/lib/api/contacts.js b/lib/api/contacts.js
index 77b4807..ebc6637 100644
--- a/lib/api/contacts.js
+++ b/lib/api/contacts.js
@@ -67,5 +67,33 @@ Contacts.prototype.importContacts = function (contacts, replace, callback) {
return utility.callService(api.service.contacts.importContacts, this.client, this.client._channel, callback, arguments);
};
+// ***
+// contacts.**getStatuses([callback])**
+
+// Return a Promise. Returns the list of contact statuses.
+
+// [Click here for more details](https://core.telegram.org/method/contacts.getStatuses)
+
+// The code:
+Contacts.prototype.getStatuses = function (callback) {
+
+ return utility.callService(api.service.contacts.getStatuses, this.client, this.client._channel, callback, arguments);
+};
+
+// ***
+// contacts.**deleteContact(user_id, [callback])**
+
+// Return a Promise. Deletes a contact from the list.
+
+// [Click here for more details](https://core.telegram.org/method/contacts.deleteContact)
+
+// The code:
+Contacts.prototype.deleteContact = function (user_id, callback) {
+
+ user_id = new tl.type.InputUserContact({props: {user_id: user_id}});
+
+ return utility.callService(api.service.contacts.importContacts, this.client, this.client._channel, callback, arguments);
+};
+
// Export the class
module.exports = exports = Contacts;
diff --git a/package.json b/package.json
index d6561b7..9368365 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"get-flow": "latest",
"get-log": "latest",
"requirish": "latest",
- "telegram-tl-node": "latest",
+ "telegram-tl-node": "https://github.com/amurchick/telegram-tl-node",
"telegram-mt-node": "https://github.com/amurchick/telegram-mt-node",
"colors": "1.1.2",
"es6-promise": "2.3.0"