Пример #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 (DateCreated != null)
            {
                p.Add(new KeyValuePair <string, string>("DateCreated", Serializers.DateTimeIso8601(DateCreated)));
            }

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

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

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

            return(p);
        }
Пример #2
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope
            var objectContainer = context.GetFromContext <IObjectContainer>(TwilioApiScope.ParentContainerPropertyTag);

            // Inputs
            var to                  = To.Get(context);
            var from                = From.Get(context);
            var body                = Body.Get(context);
            var mediaurls           = MediaUrls.Get(context);
            var accountsid          = AccountSid.Get(context);
            var messagingservicesid = MessagingServiceSid.Get(context);
            var applicationsid      = ApplicationSid.Get(context);
            var statuscallback      = StatusCallback.Get(context);
            var providefeedback     = ProvideFeedback.Get(context);
            var maxprice            = MaxPrice.Get(context);
            var validityperiod      = ValidityPeriod.Get(context);
            var smartencoded        = SmartEncoded.Get(context);

            var message = await MessageWrappers.SendMessageAsync(objectContainer.Get <ITwilioRestClient>(), from, to, body, mediaurls, maxprice, validityperiod, smartencoded, accountsid, applicationsid, messagingservicesid, providefeedback, statuscallback);

            // Outputs
            return((ctx) => {
                Message.Set(ctx, message);
            });
        }
Пример #3
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

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

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

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

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

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

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

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

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

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

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

            return(p);
        }
Пример #4
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 (ApnCredentialSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ApnCredentialSid", ApnCredentialSid.ToString()));
            }

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

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

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

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

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

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

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

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

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

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

            return(p);
        }
Пример #5
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            return(p);
        }
Пример #6
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

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

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

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

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

            if (MediaUrl != null)
            {
                p.AddRange(MediaUrl.Select(prop => new KeyValuePair <string, string>("MediaUrl", prop.AbsoluteUri.TrimEnd('/'))));
            }

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

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

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

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

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

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

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

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

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

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

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

            return(p);
        }