コード例 #1
0
        /// <summary>
        /// Gets TokApp user-names of one or more contacts from their phone number or email.
        /// </summary>
        /// <param name="phones">Array with phone numbers to check.</param>
        /// <param name="emails">Array with emails to check.</param>
        /// <returns></returns>
        public GetContactsResponse[] GetContacts(string[] phones, string[] emails)
        {
            var data = new Dictionary <string, object>();

            data.Add("phones", phones);
            data.Add("emails", emails);
            ResponseBase response = this.makePetition("getcontacts", data);

            return(GetContactsResponse.CreateArray(response));
        }
コード例 #2
0
        /// <summary>
        /// Creates an array with data returned from command <c>getcontacts</c>
        /// </summary>
        /// <param name="response">Response object with data returned</param>
        internal static GetContactsResponse[] CreateArray(ResponseBase response)
        {
            List <GetContactsResponse> list = new List <GetContactsResponse>();

            foreach (dynamic elem in response.data)
            {
                var contact = new GetContactsResponse()
                {
                    phone    = elem.phone,
                    email    = elem.email,
                    username = elem.username
                };
                list.Add(contact);
            }

            return(list.ToArray());
        }