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); }); }
/// <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); }
/// <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); }
/// <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 (Url != null) { p.Add(new KeyValuePair <string, string>("Url", Serializers.Url(Url))); } if (Twiml != null) { p.Add(new KeyValuePair <string, string>("Twiml", Twiml.ToString())); } if (ApplicationSid != null) { p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString())); } if (Method != null) { p.Add(new KeyValuePair <string, string>("Method", Method.ToString())); } if (FallbackUrl != null) { p.Add(new KeyValuePair <string, string>("FallbackUrl", Serializers.Url(FallbackUrl))); } if (FallbackMethod != null) { p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString())); } if (StatusCallback != null) { p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback))); } if (StatusCallbackEvent != null) { p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop))); } if (StatusCallbackMethod != null) { p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString())); } if (SendDigits != null) { p.Add(new KeyValuePair <string, string>("SendDigits", SendDigits)); } if (Timeout != null) { p.Add(new KeyValuePair <string, string>("Timeout", Timeout.ToString())); } if (Record != null) { p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString().ToLower())); } if (RecordingChannels != null) { p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels)); } if (RecordingStatusCallback != null) { p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback)); } if (RecordingStatusCallbackMethod != null) { p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString())); } if (SipAuthUsername != null) { p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername)); } if (SipAuthPassword != null) { p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword)); } if (MachineDetection != null) { p.Add(new KeyValuePair <string, string>("MachineDetection", MachineDetection)); } if (MachineDetectionTimeout != null) { p.Add(new KeyValuePair <string, string>("MachineDetectionTimeout", MachineDetectionTimeout.ToString())); } if (RecordingStatusCallbackEvent != null) { p.AddRange(RecordingStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("RecordingStatusCallbackEvent", prop))); } if (Trim != null) { p.Add(new KeyValuePair <string, string>("Trim", Trim)); } if (CallerId != null) { p.Add(new KeyValuePair <string, string>("CallerId", CallerId)); } if (MachineDetectionSpeechThreshold != null) { p.Add(new KeyValuePair <string, string>("MachineDetectionSpeechThreshold", MachineDetectionSpeechThreshold.ToString())); } if (MachineDetectionSpeechEndThreshold != null) { p.Add(new KeyValuePair <string, string>("MachineDetectionSpeechEndThreshold", MachineDetectionSpeechEndThreshold.ToString())); } if (MachineDetectionSilenceTimeout != null) { p.Add(new KeyValuePair <string, string>("MachineDetectionSilenceTimeout", MachineDetectionSilenceTimeout.ToString())); } if (AsyncAmd != null) { p.Add(new KeyValuePair <string, string>("AsyncAmd", AsyncAmd)); } if (AsyncAmdStatusCallback != null) { p.Add(new KeyValuePair <string, string>("AsyncAmdStatusCallback", Serializers.Url(AsyncAmdStatusCallback))); } if (AsyncAmdStatusCallbackMethod != null) { p.Add(new KeyValuePair <string, string>("AsyncAmdStatusCallbackMethod", AsyncAmdStatusCallbackMethod.ToString())); } if (Byoc != null) { p.Add(new KeyValuePair <string, string>("Byoc", Byoc.ToString())); } if (CallReason != null) { p.Add(new KeyValuePair <string, string>("CallReason", CallReason)); } return(p); }
/// <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); }
/// <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 (Url != null) { p.Add(new KeyValuePair <string, string>("Url", Url.AbsoluteUri.TrimEnd('/'))); } if (ApplicationSid != null) { p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString())); } if (Method != null) { p.Add(new KeyValuePair <string, string>("Method", Method.ToString())); } if (FallbackUrl != null) { p.Add(new KeyValuePair <string, string>("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/'))); } if (FallbackMethod != null) { p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString())); } if (StatusCallback != null) { p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/'))); } if (StatusCallbackEvent != null) { p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop))); } if (StatusCallbackMethod != null) { p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString())); } if (SendDigits != null) { p.Add(new KeyValuePair <string, string>("SendDigits", SendDigits)); } if (IfMachine != null) { p.Add(new KeyValuePair <string, string>("IfMachine", IfMachine)); } if (Timeout != null) { p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString())); } if (Record != null) { p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString().ToLower())); } if (RecordingChannels != null) { p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels)); } if (RecordingStatusCallback != null) { p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback)); } if (RecordingStatusCallbackMethod != null) { p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString())); } if (SipAuthUsername != null) { p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername)); } if (SipAuthPassword != null) { p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword)); } if (MachineDetection != null) { p.Add(new KeyValuePair <string, string>("MachineDetection", MachineDetection)); } if (MachineDetectionTimeout != null) { p.Add(new KeyValuePair <string, string>("MachineDetectionTimeout", MachineDetectionTimeout.Value.ToString())); } if (RecordingStatusCallbackEvent != null) { p.AddRange(RecordingStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("RecordingStatusCallbackEvent", prop))); } return(p); }