public async Task replyToSbaMessageWithMultipleDocs() { MessageReplyMultipleFiles message = new MessageReplyMultipleFiles { // enter path to files you want to upload documents = new List <string>() { @"<path to file>", @"<path to file>" }, // enter name of documents document_names = new List <string>() { "<document name>", "<document name>" }, // enter document type of each document document_types = new List <int?>() { Int32.Parse("<document type>"), Int32.Parse("<document type>") }, // enter comment for the upload content = "content" }; string slug = "<slug>"; string response = await cSharpClientTest.replyToSbaMessageWithMultipleDocs(message, slug); Assert.IsNotNull(response); }
public async Task <string> replyToSbaMessageWithMultipleDocs(MessageReplyMultipleFiles request, string slug, string loanForgivenessMessageUrl) { try { RestClient restClient = new RestClient($"{baseUri}/{loanForgivenessMessageUrl}/{slug}/"); restClient.Timeout = -1; RestRequest restRequest = new RestRequest(Method.PUT); restRequest.AddHeader("Authorization", apiToken); restRequest.AddHeader(VENDOR_KEY, vendorKey); request.document_names.ForEach(t => restRequest.AddParameter("document_name", t, ParameterType.GetOrPost)); request.document_types.ForEach(t => restRequest.AddParameter("document_type", t, ParameterType.GetOrPost)); request.documents.ForEach(t => restRequest.AddFile("document", t)); restRequest.AddParameter("content", request.content, ParameterType.GetOrPost); IRestResponse response = await restClient.ExecuteAsync(restRequest); if (response.IsSuccessful) { return(response.Content); } throw new Exception($"Did not receive success code. please investigate. \nresponse code: {response.StatusCode}.\n response:{response.Content}"); } catch (Exception exception) { Console.WriteLine($"{Environment.NewLine}{exception.Message}{Environment.NewLine}"); Console.WriteLine("------------------------------------------------------------------------"); return(exception.Message); } }
public Task <string> replyToSbaMessageWithMultipleDocs(MessageReplyMultipleFiles request, string slug, string loanForgivenessMessageUrl) { Console.WriteLine("Processing reply To SbaMessage with multiple documents"); return(sbaLoanForgivenessMessageService.replyToSbaMessageWithMultipleDocs(request, slug, loanForgivenessMessageUrl)); }
public async Task <string> replyToSbaMessageWithMultipleDocs(MessageReplyMultipleFiles message, string slug) { string sbaLoanMessageReply = await sbaLoanForgivenessMessageController.replyToSbaMessageWithMultipleDocs(message, slug, pppLoanForgivenessMessageReply); return(sbaLoanMessageReply); }