diff --git a/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs b/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs index aaca601..fcb6b56 100644 --- a/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs +++ b/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs @@ -15,7 +15,7 @@ using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { // Begin decryption - var decryptRequest = new HttpRequestMessage(HttpMethod.Post, "decrypted-pdf"); + using var decryptRequest = new HttpRequestMessage(HttpMethod.Post, "decrypted-pdf"); decryptRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); decryptRequest.Headers.Accept.Add(new("application/json")); @@ -42,7 +42,7 @@ string decryptID = decryptJson.outputId; // Begin add image - var addImageRequest = new HttpRequestMessage(HttpMethod.Post, "pdf-with-added-image"); + using var addImageRequest = new HttpRequestMessage(HttpMethod.Post, "pdf-with-added-image"); addImageRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); addImageRequest.Headers.Accept.Add(new("application/json")); @@ -67,7 +67,7 @@ addImageRequest.Content = addImageMultipartContent; var addImageResponse = await httpClient.SendAsync(addImageRequest); - var addImageResult = await addImageResponse.Content.ReadAsStringAsync(); + using var addImageResult = await addImageResponse.Content.ReadAsStringAsync(); Console.WriteLine("Add image response received."); Console.WriteLine(addImageResult); diff --git a/DotNET/Complex Flow Examples/merge-different-file-types.cs b/DotNET/Complex Flow Examples/merge-different-file-types.cs index 3b101cd..1abec57 100644 --- a/DotNET/Complex Flow Examples/merge-different-file-types.cs +++ b/DotNET/Complex Flow Examples/merge-different-file-types.cs @@ -18,7 +18,7 @@ using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { // Begin first PDF conversion - var imageRequest = new HttpRequestMessage(HttpMethod.Post, "pdf"); + using var imageRequest = new HttpRequestMessage(HttpMethod.Post, "pdf"); imageRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); imageRequest.Headers.Accept.Add(new("application/json")); @@ -40,7 +40,7 @@ string imageID = imageResponseData.outputId; // Begin second PDF conversion - var powerpointRequest = new HttpRequestMessage(HttpMethod.Post, "pdf"); + using var powerpointRequest = new HttpRequestMessage(HttpMethod.Post, "pdf"); powerpointRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); powerpointRequest.Headers.Accept.Add(new("application/json")); @@ -62,7 +62,7 @@ string powerpointID = powerpointResponseData.outputId; // Begin file merge - var request = new HttpRequestMessage(HttpMethod.Post, "merged-pdf"); + using var request = new HttpRequestMessage(HttpMethod.Post, "merged-pdf"); request.Headers.TryAddWithoutValidation("Api-Key", apiKey); request.Headers.Accept.Add(new("application/json")); diff --git a/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs b/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs index 88e25b9..644bb61 100644 --- a/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs +++ b/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs @@ -16,7 +16,7 @@ using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { // Begin file attachment - var attachRequest = new HttpRequestMessage(HttpMethod.Post, "pdf-with-added-attachment"); + using var attachRequest = new HttpRequestMessage(HttpMethod.Post, "pdf-with-added-attachment"); attachRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); attachRequest.Headers.Accept.Add(new("application/json")); @@ -43,7 +43,7 @@ string attachementID = responseData.outputId; // Begin PDF/A conversion - var pdfaRequest = new HttpRequestMessage(HttpMethod.Post, "pdfa"); + using var pdfaRequest = new HttpRequestMessage(HttpMethod.Post, "pdfa"); pdfaRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); pdfaRequest.Headers.Accept.Add(new("application/json")); diff --git a/DotNET/Complex Flow Examples/preserve-word-document.cs b/DotNET/Complex Flow Examples/preserve-word-document.cs index ef97823..e4f1de4 100644 --- a/DotNET/Complex Flow Examples/preserve-word-document.cs +++ b/DotNET/Complex Flow Examples/preserve-word-document.cs @@ -14,7 +14,7 @@ { // Begin PDF conversion - var pdfRequest = new HttpRequestMessage(HttpMethod.Post, "pdf"); + using var pdfRequest = new HttpRequestMessage(HttpMethod.Post, "pdf"); pdfRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); pdfRequest.Headers.Accept.Add(new("application/json")); @@ -36,7 +36,7 @@ string pdfID = responseData.outputId; // Begin PDF/A conversion - var pdfaRequest = new HttpRequestMessage(HttpMethod.Post, "pdfa"); + using var pdfaRequest = new HttpRequestMessage(HttpMethod.Post, "pdfa"); pdfaRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); pdfaRequest.Headers.Accept.Add(new("application/json")); diff --git a/DotNET/Complex Flow Examples/protected-watermark.cs b/DotNET/Complex Flow Examples/protected-watermark.cs index d6ea3af..52fc1fd 100644 --- a/DotNET/Complex Flow Examples/protected-watermark.cs +++ b/DotNET/Complex Flow Examples/protected-watermark.cs @@ -14,7 +14,7 @@ using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { // Begin watermarking - var watermarkRequest = new HttpRequestMessage(HttpMethod.Post, "watermarked-pdf"); + using var watermarkRequest = new HttpRequestMessage(HttpMethod.Post, "watermarked-pdf"); watermarkRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); watermarkRequest.Headers.Accept.Add(new("application/json")); @@ -39,7 +39,7 @@ string watermarkID = watermarkResponseData.outputId; // Begin restricting - var restrictRequest = new HttpRequestMessage(HttpMethod.Post, "restricted-pdf"); + using var restrictRequest = new HttpRequestMessage(HttpMethod.Post, "restricted-pdf"); restrictRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); restrictRequest.Headers.Accept.Add(new("application/json"));