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>(BitbucketAPIScope.ParentContainerPropertyTag); var client = objectContainer.Get <FluentClient>(); // Inputs var repositoryLocation = RepositoryLocation.Get(context); var fileToUpload = FileToUpload.Get(context); var commitMessage = CommitMessage.Get(context); var repositoryUUIDOrSlug = RepositoryUUIDOrSlug.Get(context); var workspaceUUIDOrSlug = WorkspaceUUIDOrSlug.Get(context); var branchName = BranchName.Get(context); // Validate whether Workspace UUID or Name provided (assume name will never be a GUID format) if (Validation.IsUUID(workspaceUUIDOrSlug)) { HttpUtility.UrlEncode(workspaceUUIDOrSlug); } // Validate whether Repository UUID or Slug provided (assume slug will never be a GUID format) if (Validation.IsUUID(repositoryUUIDOrSlug)) { HttpUtility.UrlEncode(repositoryUUIDOrSlug); } // Create standard request URI var uri = "repositories/" + workspaceUUIDOrSlug + "/" + repositoryUUIDOrSlug + "/src"; // Initialise and populate multipart content var multipartContent = new MultipartFormDataContent(); multipartContent.Add(new ByteArrayContent(File.ReadAllBytes(fileToUpload)), repositoryLocation, Path.GetFileName(fileToUpload)); multipartContent.Add(new StringContent(commitMessage), "message"); // Check if optional branch name parameter provided. Add to request if not null. if (branchName != null) { multipartContent.Add(new StringContent(branchName), "branch"); } // Execution Logic var response = new JObject(); var exceptionHandler = new ApiExceptionHandler(); try { response = await AsyncRequests.PostRequest_WithBody(client, uri, cancellationToken, multipartContent); } catch (ApiException ex) // Catches any API exception and returns the message { await exceptionHandler.ParseExceptionAsync(ex); } // Outputs - API response as JObject return((ctx) => { JsonResult.Set(ctx, response); }); }
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>(TextApplicationScope.ParentContainerPropertyTag); // Inputs string inputText = objectContainer.Get <string>(); // Inputs var searchWordsCol = SearchWords.Get(context); var displayLog = DisplayLog; //Convert Collection to Array string[] searchWords = Utils.ConvertCollectionToArray(searchWordsCol); /////////////////////////// // Add execution logic HERE //Find Words in String double PercResults = Utils.FindWordsInString(inputText, searchWords, displayLog); /////////////////////////// // Outputs return((ctx) => { Percentage.Set(ctx, PercResults); }); }
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>(SFTPScope.ParentContainerPropertyTag); // Inputs var remoteDirectoryPath = RemoteDirectoryPath.Get(context); /////////////////////////// // Add execution logic HERE /////////////////////////// /// SftpClient sftp_session = objectContainer.Get <SftpClient>(); //sftp_session.Connect(); //List<System.Collections.IList> ashley = new List<System.Collections.IList>(); List <String> ashley = new List <String>(); foreach (var entry in sftp_session.ListDirectory(@remoteDirectoryPath)) { if (entry.IsDirectory) { continue; } else { ashley.Add(entry.Name); } } // Outputs return((ctx) => { IList.Set(ctx, ashley); }); }
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>(TextApplicationScope.ParentContainerPropertyTag); // Inputs string inputText = objectContainer.Get <string>(); // Inputs var wordsCol = Words.Get(context); var occurrencesText = Occurrences.Get(context); var occurrenceNumber = OccurrenceNumber.Get(context); var displayLog = DisplayLog; //Convert Collection to Array string[] words = Utils.ConvertCollectionToArray(wordsCol); /////////////////////////// // Add execution logic HERE string OuputString = Utils.RemoveWordsFromText(inputText, words, occurrencesText, occurrenceNumber, displayLog); /////////////////////////// // Outputs return((ctx) => { AdjustText.Set(ctx, OuputString); }); }
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); }); }
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>(TextApplicationScope.ParentContainerPropertyTag); // Inputs string inputText = objectContainer.Get <string>(); // Inputs var searchWordsCol = SearchWord.Get(context); var replacedWord = ReplacedWord.Get(context); var textOccurrance = TextOccurrance.Get(context); var indexOccurence = IndexOccurence.Get(context); var displayLog = DisplayLog; //Convert Collection to Array string[] searchWords = Utils.ConvertCollectionToArray(searchWordsCol); /////////////////////////// // Add execution logic HERE //Replace word from text string OutputString = Utils.ReplaceWordsFromText(inputText, searchWords, replacedWord, textOccurrance, indexOccurence, displayLog); /////////////////////////// // Outputs return((ctx) => { AdjustedText.Set(ctx, OutputString); }); }
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 mediaurl = MediaUrl.Get(context); var from = From.Get(context); var quality = Quality.Get(context); var storemedia = StoreMedia.Get(context); var minutestosend = MinutesToSend.Get(context); var sipauthusername = SipAuthUsername.Get(context); var sipauthpassword = SipAuthPassword.Get(context); var statuscallback = StatusCallback.Get(context); var twilioQuality = quality == FaxQuality.Fine ? FaxResource.QualityEnum.Fine : quality == FaxQuality.SuperFine ? FaxResource.QualityEnum.Superfine : FaxResource.QualityEnum.Standard; var statusCallbackUri = statuscallback != null ? new Uri(statuscallback) : null; var sent = await FaxWrappers.SendFaxAsync(objectContainer.Get <ITwilioRestClient>(), from, to, new Uri(mediaurl), twilioQuality, sipauthusername, sipauthpassword, statusCallbackUri, storemedia, minutestosend); // Outputs return((ctx) => { Fax.Set(ctx, sent); }); }
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>(SFTPScope.ParentContainerPropertyTag); // Inputs var uploadPath = UploadPath.Get(context); var remoteDirectoryPath = RemoteDirectoryPath.Get(context); /////////////////////////// // Add execution logic HERE /////////////////////////// /// SftpClient sftp_session = objectContainer.Get <SftpClient>(); //sftp_session.Connect(); using (var file = File.OpenRead(@uploadPath)) { sftp_session.UploadFile(file, Path.Combine(@remoteDirectoryPath, Path.GetFileName(uploadPath))); } //sftp_session.Disconnect(); // Outputs return((ctx) => { }); }
private async Task <List <Dataset> > ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default) { var objectContainer = context.GetFromContext <IObjectContainer>(IndicoScope.ParentContainerPropertyTag); var application = objectContainer.Get <Application>(); var datasets = application.ListDatasets(); return(datasets); }
protected override void Init(AsyncCodeActivityContext context) { base.Init(context); var objectContainer = context.GetFromContext <IObjectContainer>(IndicoScope.ParentContainerPropertyTag); Application = objectContainer.Get <Application>(); }
private async Task <Entity.ModelGroup> ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default) { var modelGroupID = ModelGroupID.Get(context); var objectContainer = context.GetFromContext <IObjectContainer>(IndicoScope.ParentContainerPropertyTag); var application = objectContainer.Get <Application>(); return(application.GetModelGroup(modelGroupID)); }
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>(TextApplicationScope.ParentContainerPropertyTag); // Inputs string inputText = objectContainer.Get <string>(); // Inputs var anchorTextCol = AnchorText.Get(context); var displayLog = DisplayLog; var displayRegex = DisplayRegex; var anchorTextParamText = AnchorTextParam.Get(context); //Convert Collection to Array string[] anchorText = Utils.ConvertCollectionToArray(anchorTextCol); //Output Data Row bool bUpdateDataRow = BUpdateDataRow; var myDataRow = MyDataRow.Get(context); var myDataRowColumn = MyDataRowColumn.Get(context); var myIndex = MyIndex.Get(context); string OutputString = null; /////////////////////////// // Add execution logic HERE string[] OutputResults = CallExtractions.CallExtractAllLinesBelowAnchorText(inputText, anchorText, anchorTextParamText, displayLog, displayRegex); #region Update Data Row (optional) //Check if functionality is Activated if (bUpdateDataRow == true) { //Check it there is an item to the Output Variable if (OutputResults.Length > 0) { if (myIndex == -1) { //Upper Bound OutputString = OutputResults[OutputResults.Length - 1]; } else { OutputString = OutputResults[myIndex]; } //Update Data Row Utils.CallUpdateDataRow2(myDataRow, myDataRowColumn, OutputString); } } #endregion /////////////////////////// // Outputs return((ctx) => { Results.Set(ctx, OutputResults); }); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs IOcrClient ocrClient = GetOcrClient(context); var objectContainer = context.GetFromContext <IObjectContainer>(OcrScope.ParentContainerPropertyTag); objectContainer.Add(ocrClient); /////////////////////////// // Add execution logic HERE /////////////////////////// // Outputs return((ctx) => { }); }
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 accountsid = AccountSid.Get(context); var account = await AccountWrappers.GetAccountAsync(objectContainer.Get <ITwilioRestClient>(), accountsid); // Outputs return((ctx) => { Account.Set(ctx, account); }); }
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 limit = Limit.Get(context); var pricings = await VoicePricingWrappers.GetVoicePricingAsync(objectContainer.Get <ITwilioRestClient>(), limit); // Outputs return((ctx) => { CountryResources.Set(ctx, pricings); }); }
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 faxsid = FaxSid.Get(context); var cancelledFax = FaxWrappers.CancelFaxAsync(objectContainer.Get <ITwilioRestClient>(), faxsid); // Outputs return((ctx) => { Fax.Set(ctx, cancelledFax); }); }
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>(BitbucketAPIScope.ParentContainerPropertyTag); var client = objectContainer.Get <FluentClient>(); // Inputs var workspaceUUIDOrSlug = WorkspaceUUIDOrSlug.Get(context); // Validate whether Workspace UUID or Slug provided (assume name will never be a GUID format) if (Validation.IsUUID(workspaceUUIDOrSlug)) { HttpUtility.UrlEncode(workspaceUUIDOrSlug); } // Create request URI var uri = "repositories/" + workspaceUUIDOrSlug; // Initialsie var response = new JObject(); var repositorySlugList = new List <string>(); var repositoryUUIDList = new List <string>(); var exceptionHandler = new ApiExceptionHandler(); try { // Perform request response = await AsyncRequests.GetRequest(client, uri, cancellationToken); // Create slug list repositorySlugList = JObjectParser.JObjectToSlugList(response); // Create UUID list repositoryUUIDList = JObjectParser.JObjectToUUIDList(response); } catch (ApiException ex) // Catches any API exception and returns the message { await exceptionHandler.ParseExceptionAsync(ex); } // Outputs return((ctx) => { RepositoriesJObject.Set(ctx, response); RepositoriesSlugList.Set(ctx, repositorySlugList); RepositoriesUUIDList.Set(ctx, repositoryUUIDList); }); }
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 servicesid = ServiceSid.Get(context); var alphasendersid = AlphaSenderSid.Get(context); var alphaSender = AlphaSenderWrappers.GetAlphaSenderAsync(objectContainer.Get <ITwilioRestClient>(), servicesid, alphasendersid); // Outputs return((ctx) => { AlphaSender.Set(ctx, alphaSender); }); }
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 fax = Fax.Get(context); var path = Path.Get(context); var media = await FaxWrappers.DownloadFaxMediaAsync(objectContainer.Get <ITwilioRestClient>(), fax, path); // Outputs return((ctx) => { FaxMediaPDF.Set(ctx, media); }); }
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 messagesid = MessageSid.Get(context); var messagemediasid = MessageMediaSid.Get(context); var messageMedia = await MessageMediaWrappers.GetSMSMediaAsync(objectContainer.Get <ITwilioRestClient>(), messagesid, messagemediasid); // Outputs return((ctx) => { MessageMedia.Set(ctx, messageMedia); }); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { var objectContainer = context.GetFromContext <IObjectContainer>(SynapScope.ParentContainerPropertyTag); var synap = objectContainer.Get <SynapContext>(); // Inputs var filepath = FilePath.Get(context); var language = Language.Get(context); var client = new UiPathHttpClient(synap.Endpoint); /////////////////////////// // Add execution logic HERE /////////////////////////// if (string.IsNullOrEmpty(filepath) || !System.IO.File.Exists(filepath)) { return((ctx) => { ctx.SetValue(StatusCode, HttpStatusCode.NotFound); ctx.SetValue(JsonOutput, string.Empty); }); } client.AddFile(filepath); client.AddField("api_key", synap.ApiKey); client.AddField("langs", "all"); client.AddField("type", "upload"); client.AddField("skew", "true"); client.AddField("boxes_type", "all"); //client.AddField("textout", "true"); var json = await client.Upload(); SynapOCRResponse resp = JsonConvert.DeserializeObject <SynapOCRResponse>(json.body, new SynapOCRResponseConverter()); // Outputs return((ctx) => { ctx.SetValue(StatusCode, json.status); if (json.status == HttpStatusCode.OK) { ctx.SetValue(Result, resp.result); } else { ctx.SetValue(Result, null); } ctx.SetValue(JsonOutput, json.body); }); }
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 messagesid = MessageSid.Get(context); var accountsid = AccountSid.Get(context); var body = Body.Get(context); var updated = await MessageWrappers.UpdateMessageAsync(objectContainer.Get <ITwilioRestClient>(), messagesid, body, accountsid); // Outputs return((ctx) => { Message.Set(ctx, updated); }); }
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 faxsid = FaxSid.Get(context); var faxmediasid = FaxMediaSid.Get(context); var deleted = await FaxMediaWrappers.DeleteFaxMediaAsync(objectContainer.Get <ITwilioRestClient>(), faxsid, faxmediasid); // Outputs return((ctx) => { Success.Set(ctx, deleted); }); }
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>(TextApplicationScope.ParentContainerPropertyTag); // Inputs string inputText = objectContainer.Get <string>(); /////////////////////////// // Add execution logic HERE string[] OutLinesArray = Utils.SplitTextNewLine(inputText); /////////////////////////// // Outputs return((ctx) => { TextLines.Set(ctx, OutLinesArray); }); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var imagepath = ImagePath.Get(context); var objectContainer = context.GetFromContext <IObjectContainer>(OcrScope.ParentContainerPropertyTag); var ocrClient = objectContainer.Get <IOcrClient>(); /////////////////////////// // Add execution logic HERE /////////////////////////// var recognizerName = GetRecognizerName(); var recognizerOptions = GetRecognizerOptions(context); var result = await ocrClient.RecognizeAsync(recognizerName, imagepath, recognizerOptions); // Outputs return((ctx) => { Result.Set(ctx, result); }); }
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 from = From.Get(context); var to = To.Get(context); var datecreatedonorbefore = DateCreatedOnOrBefore.Get(context); var datecreatedafter = DateCreatedAfter.Get(context); var limit = Limit.Get(context); var faxes = await FaxWrappers.GetFaxesAsync(objectContainer.Get <ITwilioRestClient>(), from, to, datecreatedafter, datecreatedonorbefore, limit); // Outputs return((ctx) => { Faxes.Set(ctx, faxes); }); }
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 from = From.Get(context); var to = To.Get(context); var datesent = DateSent.Get(context); var datesentbefore = DateSentBefore.Get(context); var datesentafter = DateSentAfter.Get(context); var accountsid = AccountSid.Get(context); var limit = Limit.Get(context); var messages = await MessageWrappers.GetMessagesAsync(objectContainer.Get <ITwilioRestClient>(), from, to, accountsid, datesent, datesentafter, datesentbefore, limit); // Outputs return((ctx) => { Messages.Set(ctx, messages); }); }
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 number = Number.Get(context); var countrycode = CountryCode; var includeCallerName = IncludeCallerName.Get(context); var includeCarrier = IncludeCarrier.Get(context); var addOns = AddOns.Get(context); var addOnsData = AddOnsData.Get(context); var lookup = await LookupWrappers.LookupPhoneNumber(objectContainer.Get <ITwilioRestClient>(), number, countrycode, includeCallerName, includeCarrier, addOns, addOnsData); // Outputs return((ctx) => { PhoneNumber.Set(ctx, lookup); }); }
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>(BitbucketAPIScope.ParentContainerPropertyTag); var client = objectContainer.Get <FluentClient>(); // Create request URI var uri = "workspaces"; // Initialsie var response = new JObject(); var workspaceSlugList = new List <string>(); var workspaceUUIDList = new List <string>(); var exceptionHandler = new ApiExceptionHandler(); try { // Perform request response = await AsyncRequests.GetRequest(client, uri, cancellationToken); // Create slug list workspaceSlugList = JObjectParser.JObjectToSlugList(response); // Create UUID list workspaceUUIDList = JObjectParser.JObjectToUUIDList(response); } catch (ApiException ex) // Catches any API exception and returns the message { await exceptionHandler.ParseExceptionAsync(ex); } // Outputs return((ctx) => { WorkspacesJObject.Set(ctx, response); WorkspacesSlugList.Set(ctx, workspaceSlugList); WorkspacesUUIDList.Set(ctx, workspaceUUIDList); }); }
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 accountsid = AccountSid.Get(context); var friendlyname = FriendlyName.Get(context); var status = Status.Get(context); var twilioStatus = status == AccountStatus.Active ? AccountResource.StatusEnum.Active : status == AccountStatus.Closed ? AccountResource.StatusEnum.Closed : status == AccountStatus.Suspended ? AccountResource.StatusEnum.Suspended : null; var account = await AccountWrappers.UpdateAccountAsync(objectContainer.Get <ITwilioRestClient>(), accountsid, friendlyname, twilioStatus); // Outputs return((ctx) => { Account.Set(ctx, account); }); }