From 70d3c927975434889a9199796c48e81fc3351ded Mon Sep 17 00:00:00 2001 From: timtay-microsoft Date: Thu, 13 Apr 2023 11:32:59 -0700 Subject: [PATCH] Miscellaneous cleanup, rename - Move JsonSerializerSettingsInitializer and PageableHelpers to the Utilities folder - Rename ResponseBody to ErrorResponse - Remove unused fields in QueryBuilder --- provisioning/service/src/Http/ContractApiHttp.cs | 2 +- .../service/src/Http/{ResponseBody.cs => ErrorResponse.cs} | 4 ++-- .../src/{ => Utilities}/JsonSerializerSettingsInitializer.cs | 0 provisioning/service/src/{ => Utilities}/PageableHelpers.cs | 0 provisioning/service/src/Utilities/QueryBuilder.cs | 2 -- 5 files changed, 3 insertions(+), 5 deletions(-) rename provisioning/service/src/Http/{ResponseBody.cs => ErrorResponse.cs} (89%) rename provisioning/service/src/{ => Utilities}/JsonSerializerSettingsInitializer.cs (100%) rename provisioning/service/src/{ => Utilities}/PageableHelpers.cs (100%) diff --git a/provisioning/service/src/Http/ContractApiHttp.cs b/provisioning/service/src/Http/ContractApiHttp.cs index 8ce46ca20e..da9c884a79 100644 --- a/provisioning/service/src/Http/ContractApiHttp.cs +++ b/provisioning/service/src/Http/ContractApiHttp.cs @@ -210,7 +210,7 @@ private static async Task ValidateHttpResponse(HttpResponseMessage response) try { string payload = await response.Content.ReadAsStringAsync(); - ResponseBody responseBody = JsonConvert.DeserializeObject(payload); + ErrorResponse responseBody = JsonConvert.DeserializeObject(payload); if (response.StatusCode >= HttpStatusCode.Ambiguous) { diff --git a/provisioning/service/src/Http/ResponseBody.cs b/provisioning/service/src/Http/ErrorResponse.cs similarity index 89% rename from provisioning/service/src/Http/ResponseBody.cs rename to provisioning/service/src/Http/ErrorResponse.cs index ff9c4366ea..0797584794 100644 --- a/provisioning/service/src/Http/ResponseBody.cs +++ b/provisioning/service/src/Http/ErrorResponse.cs @@ -3,9 +3,9 @@ namespace Microsoft.Azure.Devices.Provisioning.Service { /// - /// A class used as a model to deserialize response body object received from DPS. + /// A class used as a model to deserialize response body object received from DPS in error cases. /// - internal sealed class ResponseBody + internal sealed class ErrorResponse { [JsonProperty("errorCode")] internal int ErrorCode { get; set; } diff --git a/provisioning/service/src/JsonSerializerSettingsInitializer.cs b/provisioning/service/src/Utilities/JsonSerializerSettingsInitializer.cs similarity index 100% rename from provisioning/service/src/JsonSerializerSettingsInitializer.cs rename to provisioning/service/src/Utilities/JsonSerializerSettingsInitializer.cs diff --git a/provisioning/service/src/PageableHelpers.cs b/provisioning/service/src/Utilities/PageableHelpers.cs similarity index 100% rename from provisioning/service/src/PageableHelpers.cs rename to provisioning/service/src/Utilities/PageableHelpers.cs diff --git a/provisioning/service/src/Utilities/QueryBuilder.cs b/provisioning/service/src/Utilities/QueryBuilder.cs index 6e54fa381d..8b2926ee3a 100644 --- a/provisioning/service/src/Utilities/QueryBuilder.cs +++ b/provisioning/service/src/Utilities/QueryBuilder.cs @@ -15,9 +15,7 @@ namespace Microsoft.Azure.Devices.Provisioning.Service internal class QueryBuilder { private const string ContinuationTokenHeaderKey = "x-ms-continuation"; - private const string ItemTypeHeaderKey = "x-ms-item-type"; private const string PageSizeHeaderKey = "x-ms-max-item-count"; - private const string QueryUriFormat = "{0}/query"; internal static async Task> BuildAndSendRequestAsync( ContractApiHttp contractApiHttp,