/// <summary> /// Returns the current user's contact list. /// </summary> /// <returns>Returns the current user's contact list.</returns> public async Task <ICollection <Models.Contact> > GetContactsAsync() { await ConnectAsync(); ContactsContacts result = await _client.GetContacts(); ContactsContactsConstructor userContacts = result.As <ContactsContactsConstructor>(); _contacts = new List <Models.Contact>(); foreach (User userContact in userContacts.users) { _contacts.Add((Models.Contact)userContact); } return(_contacts); }
public ITlResponse Populate(BinaryReader reader) { var contactsContacts = new ContactsContacts(); var combinator = new Combinator(reader.ReadUInt32()); if (combinator.ToType != typeof(Contacts_contactsConstructor)) { Debugger.Break(); } // contacts var contactsCombinator = new Combinator(reader.ReadUInt32()); // vector #1cb5c415 var count = reader.ReadInt32(); contactsContacts.Contacts = new List <Contact>(count); for (var index = 0; index < count; index++) { var contact = Tl.Parse <Contact>(reader); contactsContacts.Contacts.Add(contact); } // users var usersCombinator = new Combinator(reader.ReadUInt32()); // vector #1cb5c415 count = reader.ReadInt32(); contactsContacts.Users = new List <User>(count); for (var index = 0; index < count; index++) { var user = Tl.Parse <User>(reader); contactsContacts.Users.Add(user); } return(contactsContacts); }
public override void OnResponse(BinaryReader reader) { contacts = TLObject.Read <ContactsContacts>(reader); }