Skip to content

Commit

Permalink
Re-add using without brackets
Browse files Browse the repository at this point in the history
For best practices
  • Loading branch information
datalogics-tsmith committed Dec 13, 2023
1 parent 29a52ea commit e37fa2c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions DotNET/Complex Flow Examples/merge-different-file-types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand All @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions DotNET/Complex Flow Examples/preserve-word-document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions DotNET/Complex Flow Examples/protected-watermark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down

0 comments on commit e37fa2c

Please sign in to comment.