Exemplo n.º 1
0
        public async Task<int?> ImportContactByPhoneNumber(string phoneNumber)
        {
            if (!validateNumber(phoneNumber))
                throw new InvalidOperationException("Invalid phone number. It should be only digit string, from 5 to 20 digits.");

            var request = new ImportContactRequest(new InputPhoneContactConstructor(0, phoneNumber, "My Test Name", String.Empty));
            await _sender.Send(request);
            await _sender.Recieve(request);

            var importedUser = (ImportedContactConstructor)request.imported.FirstOrDefault();

            return importedUser?.user_id;
        }
Exemplo n.º 2
0
		public async Task<int?> ImportContact(string phoneNumber)
		{
			var request = new ImportContactRequest(new InputPhoneContactConstructor(0, phoneNumber, "My Test Name", string.Empty));
			await _sender.Send(request);
			await _sender.Recieve(request);

			var importedUser = request.users.FirstOrDefault();

			return importedUser == null ? (int?) null : ((UserContactConstructor) importedUser).id;
		}