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 countrycode = CountryCode; var accountsid = AccountSid.Get(context); var areacode = AreaCode.Get(context); var smsenabled = SmsEnabled.Get(context); var mmsenabled = MmsEnabled.Get(context); var voiceenabled = VoiceEnabled.Get(context); var faxenabled = FaxEnabled.Get(context); var contains = Contains.Get(context); var beta = Beta.Get(context); var nearnumber = NearNumber.Get(context); var nearlatlong = NearLatLong.Get(context); var distance = Distance.Get(context); var inpostalcode = InPostalCode.Get(context); var inregion = InRegion.Get(context); var inratecenter = InRateCenter.Get(context); var inlata = InLata.Get(context); var inlocality = InLocality.Get(context); var excludealladdressrequired = ExcludeAllAddressRequired.Get(context); var excludelocaladdressrequired = ExcludeLocalAddressRequired.Get(context); var excludeforeignaddressrequired = ExcludeForeignAddressRequired.Get(context); var limit = Limit.Get(context); var numbers = await AvailableMobilePhoneNumbersWrappers.GetAvailableMobilePhoneNumberAsync( objectContainer.Get <ITwilioRestClient>(), countrycode, accountsid, areacode, smsenabled, mmsenabled, faxenabled, voiceenabled, beta, contains, inlata, nearlatlong, nearnumber, distance, inlocality, inpostalcode, inratecenter, inregion, excludealladdressrequired, excludeforeignaddressrequired, excludelocaladdressrequired, limit); // Outputs return((ctx) => { PhoneNumbers.Set(ctx, numbers); }); }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (InputObject.Expression != null) { targetCommand.AddParameter("InputObject", InputObject.Get(context)); } if (FilterScript.Expression != null) { targetCommand.AddParameter("FilterScript", FilterScript.Get(context)); } if (Property.Expression != null) { targetCommand.AddParameter("Property", Property.Get(context)); } if (Value.Expression != null) { targetCommand.AddParameter("Value", Value.Get(context)); } if (EQ.Expression != null) { targetCommand.AddParameter("EQ", EQ.Get(context)); } if (CEQ.Expression != null) { targetCommand.AddParameter("CEQ", CEQ.Get(context)); } if (NE.Expression != null) { targetCommand.AddParameter("NE", NE.Get(context)); } if (CNE.Expression != null) { targetCommand.AddParameter("CNE", CNE.Get(context)); } if (GT.Expression != null) { targetCommand.AddParameter("GT", GT.Get(context)); } if (CGT.Expression != null) { targetCommand.AddParameter("CGT", CGT.Get(context)); } if (LT.Expression != null) { targetCommand.AddParameter("LT", LT.Get(context)); } if (CLT.Expression != null) { targetCommand.AddParameter("CLT", CLT.Get(context)); } if (GE.Expression != null) { targetCommand.AddParameter("GE", GE.Get(context)); } if (CGE.Expression != null) { targetCommand.AddParameter("CGE", CGE.Get(context)); } if (LE.Expression != null) { targetCommand.AddParameter("LE", LE.Get(context)); } if (CLE.Expression != null) { targetCommand.AddParameter("CLE", CLE.Get(context)); } if (Like.Expression != null) { targetCommand.AddParameter("Like", Like.Get(context)); } if (CLike.Expression != null) { targetCommand.AddParameter("CLike", CLike.Get(context)); } if (NotLike.Expression != null) { targetCommand.AddParameter("NotLike", NotLike.Get(context)); } if (CNotLike.Expression != null) { targetCommand.AddParameter("CNotLike", CNotLike.Get(context)); } if (Match.Expression != null) { targetCommand.AddParameter("Match", Match.Get(context)); } if (CMatch.Expression != null) { targetCommand.AddParameter("CMatch", CMatch.Get(context)); } if (NotMatch.Expression != null) { targetCommand.AddParameter("NotMatch", NotMatch.Get(context)); } if (CNotMatch.Expression != null) { targetCommand.AddParameter("CNotMatch", CNotMatch.Get(context)); } if (Contains.Expression != null) { targetCommand.AddParameter("Contains", Contains.Get(context)); } if (CContains.Expression != null) { targetCommand.AddParameter("CContains", CContains.Get(context)); } if (NotContains.Expression != null) { targetCommand.AddParameter("NotContains", NotContains.Get(context)); } if (CNotContains.Expression != null) { targetCommand.AddParameter("CNotContains", CNotContains.Get(context)); } if (In.Expression != null) { targetCommand.AddParameter("In", In.Get(context)); } if (CIn.Expression != null) { targetCommand.AddParameter("CIn", CIn.Get(context)); } if (NotIn.Expression != null) { targetCommand.AddParameter("NotIn", NotIn.Get(context)); } if (CNotIn.Expression != null) { targetCommand.AddParameter("CNotIn", CNotIn.Get(context)); } if (Is.Expression != null) { targetCommand.AddParameter("Is", Is.Get(context)); } if (IsNot.Expression != null) { targetCommand.AddParameter("IsNot", IsNot.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }