예제 #1
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            if (UniqueName != null)
            {
                p.Add(new KeyValuePair <string, string>("UniqueName", UniqueName));
            }

            if (Email != null)
            {
                p.Add(new KeyValuePair <string, string>("Email", Email));
            }

            if (CcEmails != null)
            {
                p.AddRange(CcEmails.Select(prop => new KeyValuePair <string, string>("CcEmails", prop)));
            }

            if (Status != null)
            {
                p.Add(new KeyValuePair <string, string>("Status", Status.ToString()));
            }

            if (VerificationCode != null)
            {
                p.Add(new KeyValuePair <string, string>("VerificationCode", VerificationCode));
            }

            if (VerificationType != null)
            {
                p.Add(new KeyValuePair <string, string>("VerificationType", VerificationType.ToString()));
            }

            if (VerificationDocumentSid != null)
            {
                p.Add(new KeyValuePair <string, string>("VerificationDocumentSid", VerificationDocumentSid.ToString()));
            }

            if (Extension != null)
            {
                p.Add(new KeyValuePair <string, string>("Extension", Extension));
            }

            if (CallDelay != null)
            {
                p.Add(new KeyValuePair <string, string>("CallDelay", CallDelay.ToString()));
            }

            return(p);
        }
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (PhoneNumber != null)
            {
                p.Add(new KeyValuePair <string, string>("PhoneNumber", PhoneNumber.ToString()));
            }

            if (SmsCapability != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsCapability", SmsCapability.Value.ToString().ToLower()));
            }

            if (AccountSid != null)
            {
                p.Add(new KeyValuePair <string, string>("AccountSid", AccountSid.ToString()));
            }

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            if (UniqueName != null)
            {
                p.Add(new KeyValuePair <string, string>("UniqueName", UniqueName));
            }

            if (CcEmails != null)
            {
                p.AddRange(CcEmails.Select(prop => new KeyValuePair <string, string>("CcEmails", prop)));
            }

            if (SmsUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsUrl", SmsUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (SmsMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsMethod", SmsMethod.ToString()));
            }

            if (SmsFallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsFallbackUrl", SmsFallbackUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (SmsFallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsFallbackMethod", SmsFallbackMethod.ToString()));
            }

            if (StatusCallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackUrl", StatusCallbackUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (SmsApplicationSid != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsApplicationSid", SmsApplicationSid.ToString()));
            }

            if (AddressSid != null)
            {
                p.Add(new KeyValuePair <string, string>("AddressSid", AddressSid.ToString()));
            }

            if (Email != null)
            {
                p.Add(new KeyValuePair <string, string>("Email", Email));
            }

            if (VerificationType != null)
            {
                p.Add(new KeyValuePair <string, string>("VerificationType", VerificationType.ToString()));
            }

            if (VerificationDocumentSid != null)
            {
                p.Add(new KeyValuePair <string, string>("VerificationDocumentSid", VerificationDocumentSid.ToString()));
            }

            return(p);
        }
예제 #3
0
        public async Task <VerificationRequest> GetVerificationRequest(VerificationType type, string userId)
        {
            var table = await this.GetTableAsync();

            var tableResult = await table.ExecuteAsync(TableOperation.Retrieve <VerificationRequestEntity>(userId, type.ToString()));

            if (tableResult.HttpStatusCode != 200)
            {
                return(null);
            }

            var result = (VerificationRequestEntity)tableResult.Result;

            return(new VerificationRequest(
                       result.UserId,
                       Enum.Parse <VerificationType>(result.VerificationType),
                       (VerificationRequestStatus)result.Status,
                       result.ExpirationDate,
                       new VerificationCode(result.Code),
                       result.Attempts));
        }