From 3f0fea5cac3e1bece2038ef94353d5242f72ad0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Hartmann?= Date: Thu, 28 Mar 2024 14:56:18 +0100 Subject: [PATCH] Use HttpUtility#UrlPathEncode instead of HttpUtility#UrlEncode to properly encode spaces. --- Client/Com/Cumulocity/Client/Api/AlarmsApi.cs | 4 +- .../Client/Api/ApplicationBinariesApi.cs | 8 ++-- .../Client/Api/ApplicationVersionsApi.cs | 10 ++--- .../Cumulocity/Client/Api/ApplicationsApi.cs | 16 +++---- .../Cumulocity/Client/Api/AttachmentsApi.cs | 10 ++--- Client/Com/Cumulocity/Client/Api/AuditsApi.cs | 2 +- .../Com/Cumulocity/Client/Api/BinariesApi.cs | 6 +-- .../Cumulocity/Client/Api/BootstrapUserApi.cs | 2 +- .../Client/Api/BulkOperationsApi.cs | 6 +-- .../Client/Api/ChildOperationsApi.cs | 42 +++++++++---------- .../Client/Api/DevicePermissionsApi.cs | 4 +- .../Client/Api/DeviceStatisticsApi.cs | 4 +- Client/Com/Cumulocity/Client/Api/EventsApi.cs | 6 +-- .../Cumulocity/Client/Api/ExternalIDsApi.cs | 8 ++-- Client/Com/Cumulocity/Client/Api/GroupsApi.cs | 14 +++---- .../Client/Api/InventoryRolesApi.cs | 16 +++---- .../Cumulocity/Client/Api/LoginOptionsApi.cs | 8 ++-- .../Client/Api/ManagedObjectsApi.cs | 16 +++---- .../Cumulocity/Client/Api/MeasurementsApi.cs | 4 +- .../Client/Api/NewDeviceRequestsApi.cs | 6 +-- .../Cumulocity/Client/Api/OperationsApi.cs | 4 +- .../Com/Cumulocity/Client/Api/OptionsApi.cs | 10 ++--- .../Client/Api/RetentionRulesApi.cs | 6 +-- Client/Com/Cumulocity/Client/Api/RolesApi.cs | 12 +++--- .../Cumulocity/Client/Api/SubscriptionsApi.cs | 4 +- .../Cumulocity/Client/Api/SystemOptionsApi.cs | 2 +- .../Client/Api/TenantApplicationsApi.cs | 6 +-- .../Com/Cumulocity/Client/Api/TenantsApi.cs | 8 ++-- .../Client/Api/TrustedCertificatesApi.cs | 18 ++++---- .../Client/Api/UsageStatisticsApi.cs | 4 +- Client/Com/Cumulocity/Client/Api/UsersApi.cs | 24 +++++------ 31 files changed, 145 insertions(+), 145 deletions(-) diff --git a/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs b/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs index 17b8f9a..da386de 100644 --- a/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs @@ -175,7 +175,7 @@ public AlarmsApi(HttpClient httpClient) /// public async Task GetAlarm(string id, CancellationToken cToken = default) where TAlarm : Alarm { - string resourcePath = $"/alarm/alarms/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/alarm/alarms/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -202,7 +202,7 @@ public AlarmsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("source"); jsonNode?.RemoveFromNode("time"); jsonNode?.RemoveFromNode("type"); - string resourcePath = $"/alarm/alarms/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/alarm/alarms/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/ApplicationBinariesApi.cs b/Client/Com/Cumulocity/Client/Api/ApplicationBinariesApi.cs index 3b4e355..c296ef6 100644 --- a/Client/Com/Cumulocity/Client/Api/ApplicationBinariesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ApplicationBinariesApi.cs @@ -37,7 +37,7 @@ public ApplicationBinariesApi(HttpClient httpClient) /// public async Task GetApplicationAttachments(string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -54,7 +54,7 @@ public ApplicationBinariesApi(HttpClient httpClient) /// public async Task UploadApplicationAttachment(byte[] file, string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var requestContent = new MultipartFormDataContent(); var fileContentFile = new ByteArrayContent(file); @@ -77,7 +77,7 @@ public ApplicationBinariesApi(HttpClient httpClient) /// public async Task GetApplicationAttachment(string id, string binaryId, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries/{HttpUtility.UrlEncode(binaryId.GetStringValue())}"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries/{HttpUtility.UrlPathEncode(binaryId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -93,7 +93,7 @@ public ApplicationBinariesApi(HttpClient httpClient) /// public async Task DeleteApplicationAttachment(string id, string binaryId, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries/{HttpUtility.UrlEncode(binaryId.GetStringValue())}"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries/{HttpUtility.UrlPathEncode(binaryId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/ApplicationVersionsApi.cs b/Client/Com/Cumulocity/Client/Api/ApplicationVersionsApi.cs index 84fba6e..b87f67c 100644 --- a/Client/Com/Cumulocity/Client/Api/ApplicationVersionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ApplicationVersionsApi.cs @@ -37,7 +37,7 @@ public ApplicationVersionsApi(HttpClient httpClient) /// public async Task GetApplicationVersion(string id, string? version = null, string? tag = null, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/versions?version=1.0"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/versions?version=1.0"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("version", version); @@ -58,7 +58,7 @@ public ApplicationVersionsApi(HttpClient httpClient) /// public async Task GetApplicationVersions(string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/versions"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/versions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -75,7 +75,7 @@ public ApplicationVersionsApi(HttpClient httpClient) /// public async Task CreateApplicationVersion(byte[] applicationBinary, string applicationVersion, string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/versions"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/versions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var requestContent = new MultipartFormDataContent(); var fileContentApplicationBinary = new ByteArrayContent(applicationBinary); @@ -101,7 +101,7 @@ public ApplicationVersionsApi(HttpClient httpClient) /// public async Task DeleteApplicationVersion(string id, string? version = null, string? tag = null, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/versions"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/versions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("version", version); @@ -122,7 +122,7 @@ public ApplicationVersionsApi(HttpClient httpClient) public async Task UpdateApplicationVersion(ApplicationVersionTag body, string id, string version, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/versions/{HttpUtility.UrlEncode(version.GetStringValue())}"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/versions/{HttpUtility.UrlPathEncode(version.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/ApplicationsApi.cs b/Client/Com/Cumulocity/Client/Api/ApplicationsApi.cs index 3732ca6..07fb60c 100644 --- a/Client/Com/Cumulocity/Client/Api/ApplicationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ApplicationsApi.cs @@ -98,7 +98,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplication(string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -122,7 +122,7 @@ public ApplicationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("type"); jsonNode?.RemoveFromNode("resourcesUrl"); - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -142,7 +142,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task DeleteApplication(string id, bool? force = null, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("force", force); @@ -162,7 +162,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task CopyApplication(string id, string? version = null, string? tag = null, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/clone"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/clone"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("version", version); @@ -184,7 +184,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplicationsByName(string name, CancellationToken cToken = default) { - string resourcePath = $"/application/applicationsByName/{HttpUtility.UrlEncode(name.GetStringValue())}"; + string resourcePath = $"/application/applicationsByName/{HttpUtility.UrlPathEncode(name.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -201,7 +201,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplicationsByTenant(string tenantId, CancellationToken cToken = default) { - string resourcePath = $"/application/applicationsByTenant/{HttpUtility.UrlEncode(tenantId.GetStringValue())}"; + string resourcePath = $"/application/applicationsByTenant/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -218,7 +218,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplicationsByOwner(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - string resourcePath = $"/application/applicationsByOwner/{HttpUtility.UrlEncode(tenantId.GetStringValue())}"; + string resourcePath = $"/application/applicationsByOwner/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -241,7 +241,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplicationsByUser(string username, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - string resourcePath = $"/application/applicationsByUser/{HttpUtility.UrlEncode(username.GetStringValue())}"; + string resourcePath = $"/application/applicationsByUser/{HttpUtility.UrlPathEncode(username.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); diff --git a/Client/Com/Cumulocity/Client/Api/AttachmentsApi.cs b/Client/Com/Cumulocity/Client/Api/AttachmentsApi.cs index 037d423..adfc628 100644 --- a/Client/Com/Cumulocity/Client/Api/AttachmentsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/AttachmentsApi.cs @@ -37,7 +37,7 @@ public AttachmentsApi(HttpClient httpClient) /// public async Task GetEventAttachment(string id, CancellationToken cToken = default) { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -53,7 +53,7 @@ public AttachmentsApi(HttpClient httpClient) /// public async Task ReplaceEventAttachment(byte[] body, string id, CancellationToken cToken = default) { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -72,7 +72,7 @@ public AttachmentsApi(HttpClient httpClient) /// public async Task UploadEventAttachment(byte[] body, string id, CancellationToken cToken = default) { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -91,7 +91,7 @@ public AttachmentsApi(HttpClient httpClient) /// public async Task UploadEventAttachment(BinaryInfo pObject, byte[] file, string id, CancellationToken cToken = default) { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var requestContent = new MultipartFormDataContent(); var fileContentObject = new StringContent(JsonSerializerWrapper.Serialize(pObject)); @@ -117,7 +117,7 @@ public AttachmentsApi(HttpClient httpClient) /// public async Task DeleteEventAttachment(string id, CancellationToken cToken = default) { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}/binaries"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/AuditsApi.cs b/Client/Com/Cumulocity/Client/Api/AuditsApi.cs index ec1aeb5..b41f7f8 100644 --- a/Client/Com/Cumulocity/Client/Api/AuditsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/AuditsApi.cs @@ -114,7 +114,7 @@ public AuditsApi(HttpClient httpClient) /// public async Task GetAuditRecord(string id, CancellationToken cToken = default) where TAuditRecord : AuditRecord { - string resourcePath = $"/audit/auditRecords/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/audit/auditRecords/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/BinariesApi.cs b/Client/Com/Cumulocity/Client/Api/BinariesApi.cs index 326f386..9acf0d6 100644 --- a/Client/Com/Cumulocity/Client/Api/BinariesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/BinariesApi.cs @@ -93,7 +93,7 @@ public BinariesApi(HttpClient httpClient) /// public async Task GetBinary(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/binaries/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/inventory/binaries/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -109,7 +109,7 @@ public BinariesApi(HttpClient httpClient) /// public async Task ReplaceBinary(byte[] body, string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/binaries/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/inventory/binaries/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -128,7 +128,7 @@ public BinariesApi(HttpClient httpClient) /// public async Task RemoveBinary(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/binaries/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/inventory/binaries/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/BootstrapUserApi.cs b/Client/Com/Cumulocity/Client/Api/BootstrapUserApi.cs index 5a595cd..2b64586 100644 --- a/Client/Com/Cumulocity/Client/Api/BootstrapUserApi.cs +++ b/Client/Com/Cumulocity/Client/Api/BootstrapUserApi.cs @@ -37,7 +37,7 @@ public BootstrapUserApi(HttpClient httpClient) /// public async Task GetBootstrapUser(string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlEncode(id.GetStringValue())}/bootstrapUser"; + string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(id.GetStringValue())}/bootstrapUser"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/BulkOperationsApi.cs b/Client/Com/Cumulocity/Client/Api/BulkOperationsApi.cs index 71c12ae..bc79fc1 100644 --- a/Client/Com/Cumulocity/Client/Api/BulkOperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/BulkOperationsApi.cs @@ -99,7 +99,7 @@ public BulkOperationsApi(HttpClient httpClient) /// public async Task GetBulkOperation(string id, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -122,7 +122,7 @@ public BulkOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("progress"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("status"); - string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -142,7 +142,7 @@ public BulkOperationsApi(HttpClient httpClient) /// public async Task DeleteBulkOperation(string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/ChildOperationsApi.cs b/Client/Com/Cumulocity/Client/Api/ChildOperationsApi.cs index 0c7d11a..c124573 100644 --- a/Client/Com/Cumulocity/Client/Api/ChildOperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ChildOperationsApi.cs @@ -38,7 +38,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildAdditions(string id, int? currentPage = null, int? pageSize = null, string? query = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -65,7 +65,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task AssignAsChildAddition(ChildOperationsAddOne body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -85,7 +85,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task AssignAsChildAddition(ChildOperationsAddMultiple body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -116,7 +116,7 @@ public ChildOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -136,7 +136,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task UnassignChildAdditions(ChildOperationsAddMultiple body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -155,7 +155,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildAddition(string id, string childId, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions/{HttpUtility.UrlEncode(childId.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions/{HttpUtility.UrlPathEncode(childId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -172,7 +172,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task UnassignChildAddition(string id, string childId, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAdditions/{HttpUtility.UrlEncode(childId.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions/{HttpUtility.UrlPathEncode(childId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -189,7 +189,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildAssets(string id, int? currentPage = null, int? pageSize = null, string? query = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -216,7 +216,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task AssignAsChildAsset(ChildOperationsAddOne body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -236,7 +236,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task AssignAsChildAsset(ChildOperationsAddMultiple body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -267,7 +267,7 @@ public ChildOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -287,7 +287,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task UnassignChildAssets(ChildOperationsAddMultiple body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -306,7 +306,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildAsset(string id, string childId, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets/{HttpUtility.UrlEncode(childId.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets/{HttpUtility.UrlPathEncode(childId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -323,7 +323,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task UnassignChildAsset(string id, string childId, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childAssets/{HttpUtility.UrlEncode(childId.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets/{HttpUtility.UrlPathEncode(childId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -340,7 +340,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildDevices(string id, int? currentPage = null, int? pageSize = null, string? query = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -367,7 +367,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task AssignAsChildDevice(ChildOperationsAddOne body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -387,7 +387,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task AssignAsChildDevice(ChildOperationsAddMultiple body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -418,7 +418,7 @@ public ChildOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -438,7 +438,7 @@ public ChildOperationsApi(HttpClient httpClient) public async Task UnassignChildDevices(ChildOperationsAddMultiple body, string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -457,7 +457,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildDevice(string id, string childId, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices/{HttpUtility.UrlEncode(childId.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices/{HttpUtility.UrlPathEncode(childId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -474,7 +474,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task UnassignChildDevice(string id, string childId, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/childDevices/{HttpUtility.UrlEncode(childId.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices/{HttpUtility.UrlPathEncode(childId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/DevicePermissionsApi.cs b/Client/Com/Cumulocity/Client/Api/DevicePermissionsApi.cs index 05834a2..121190e 100644 --- a/Client/Com/Cumulocity/Client/Api/DevicePermissionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/DevicePermissionsApi.cs @@ -66,7 +66,7 @@ public DevicePermissionsApi(HttpClient httpClient) /// public async Task?> GetDevicePermissionAssignments(string id, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/devicePermissions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/devicePermissions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -84,7 +84,7 @@ public DevicePermissionsApi(HttpClient httpClient) public async Task UpdateDevicePermissionAssignments(UpdatedDevicePermissions body, string id, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/user/devicePermissions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/devicePermissions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/DeviceStatisticsApi.cs b/Client/Com/Cumulocity/Client/Api/DeviceStatisticsApi.cs index 45b3fbc..b3cde2d 100644 --- a/Client/Com/Cumulocity/Client/Api/DeviceStatisticsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/DeviceStatisticsApi.cs @@ -76,7 +76,7 @@ public DeviceStatisticsApi(HttpClient httpClient) /// public async Task GetMonthlyDeviceStatistics(string tenantId, System.DateTime date, int? currentPage = null, string? deviceId = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) { - string resourcePath = $"/tenant/statistics/device/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/monthly/{HttpUtility.UrlEncode(date.GetStringValue())}"; + string resourcePath = $"/tenant/statistics/device/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/monthly/{HttpUtility.UrlPathEncode(date.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -99,7 +99,7 @@ public DeviceStatisticsApi(HttpClient httpClient) /// public async Task GetDailyDeviceStatistics(string tenantId, System.DateTime date, int? currentPage = null, string? deviceId = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) { - string resourcePath = $"/tenant/statistics/device/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/daily/{HttpUtility.UrlEncode(date.GetStringValue())}"; + string resourcePath = $"/tenant/statistics/device/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/daily/{HttpUtility.UrlPathEncode(date.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); diff --git a/Client/Com/Cumulocity/Client/Api/EventsApi.cs b/Client/Com/Cumulocity/Client/Api/EventsApi.cs index a01a184..bfe0df0 100644 --- a/Client/Com/Cumulocity/Client/Api/EventsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/EventsApi.cs @@ -126,7 +126,7 @@ public EventsApi(HttpClient httpClient) /// public async Task GetEvent(string id, CancellationToken cToken = default) where TEvent : Event { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -151,7 +151,7 @@ public EventsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("source"); jsonNode?.RemoveFromNode("time"); jsonNode?.RemoveFromNode("type"); - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -171,7 +171,7 @@ public EventsApi(HttpClient httpClient) /// public async Task DeleteEvent(string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/event/events/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/event/events/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/ExternalIDsApi.cs b/Client/Com/Cumulocity/Client/Api/ExternalIDsApi.cs index b83102b..d0100f2 100644 --- a/Client/Com/Cumulocity/Client/Api/ExternalIDsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ExternalIDsApi.cs @@ -38,7 +38,7 @@ public ExternalIDsApi(HttpClient httpClient) /// public async Task GetExternalIds(string id, CancellationToken cToken = default) { - string resourcePath = $"/identity/globalIds/{HttpUtility.UrlEncode(id.GetStringValue())}/externalIds"; + string resourcePath = $"/identity/globalIds/{HttpUtility.UrlPathEncode(id.GetStringValue())}/externalIds"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -58,7 +58,7 @@ public ExternalIDsApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("managedObject"); jsonNode?.RemoveFromNode("self"); - string resourcePath = $"/identity/globalIds/{HttpUtility.UrlEncode(id.GetStringValue())}/externalIds"; + string resourcePath = $"/identity/globalIds/{HttpUtility.UrlPathEncode(id.GetStringValue())}/externalIds"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -77,7 +77,7 @@ public ExternalIDsApi(HttpClient httpClient) /// public async Task GetExternalId(string type, string externalId, CancellationToken cToken = default) { - string resourcePath = $"/identity/externalIds/{HttpUtility.UrlEncode(type.GetStringValue())}/{HttpUtility.UrlEncode(externalId.GetStringValue())}"; + string resourcePath = $"/identity/externalIds/{HttpUtility.UrlPathEncode(type.GetStringValue())}/{HttpUtility.UrlPathEncode(externalId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -94,7 +94,7 @@ public ExternalIDsApi(HttpClient httpClient) /// public async Task DeleteExternalId(string type, string externalId, CancellationToken cToken = default) { - string resourcePath = $"/identity/externalIds/{HttpUtility.UrlEncode(type.GetStringValue())}/{HttpUtility.UrlEncode(externalId.GetStringValue())}"; + string resourcePath = $"/identity/externalIds/{HttpUtility.UrlPathEncode(type.GetStringValue())}/{HttpUtility.UrlPathEncode(externalId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/GroupsApi.cs b/Client/Com/Cumulocity/Client/Api/GroupsApi.cs index af0351f..dac8983 100644 --- a/Client/Com/Cumulocity/Client/Api/GroupsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/GroupsApi.cs @@ -39,7 +39,7 @@ public GroupsApi(HttpClient httpClient) /// public async Task?> GetTenantUserGroups(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -69,7 +69,7 @@ public GroupsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("devicePermissions"); jsonNode?.RemoveFromNode("users"); jsonNode?.RemoveFromNode("applications"); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -88,7 +88,7 @@ public GroupsApi(HttpClient httpClient) /// public async Task?> GetUserGroup(string tenantId, int groupId, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -112,7 +112,7 @@ public GroupsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("devicePermissions"); jsonNode?.RemoveFromNode("users"); jsonNode?.RemoveFromNode("applications"); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -131,7 +131,7 @@ public GroupsApi(HttpClient httpClient) /// public async Task DeleteUserGroup(string tenantId, int groupId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -147,7 +147,7 @@ public GroupsApi(HttpClient httpClient) /// public async Task?> GetUserGroupByName(string tenantId, string groupName, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groupByName/{HttpUtility.UrlEncode(groupName.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groupByName/{HttpUtility.UrlPathEncode(groupName.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -164,7 +164,7 @@ public GroupsApi(HttpClient httpClient) /// public async Task?> GetUserGroups(string tenantId, string userId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/groups"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/groups"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); diff --git a/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs b/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs index d6fa1a7..ce2e248 100644 --- a/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs @@ -82,7 +82,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task GetInventoryRole(int id, CancellationToken cToken = default) { - string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -102,7 +102,7 @@ public InventoryRolesApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -121,7 +121,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task DeleteInventoryRole(int id, CancellationToken cToken = default) { - string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -137,7 +137,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task GetUserInventoryRoles(string tenantId, string userId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles/inventory"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -157,7 +157,7 @@ public InventoryRolesApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles/inventory"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -176,7 +176,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task GetUserInventoryRole(string tenantId, string userId, int id, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -194,7 +194,7 @@ public InventoryRolesApi(HttpClient httpClient) public async Task UpdateUserInventoryRole(InventoryAssignmentReference body, string tenantId, string userId, int id, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -213,7 +213,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task UnassignUserInventoryRole(string tenantId, string userId, int id, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/LoginOptionsApi.cs b/Client/Com/Cumulocity/Client/Api/LoginOptionsApi.cs index 1dc30f6..0f71dba 100644 --- a/Client/Com/Cumulocity/Client/Api/LoginOptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/LoginOptionsApi.cs @@ -82,7 +82,7 @@ public LoginOptionsApi(HttpClient httpClient) /// public async Task GetLoginOption(string typeOrId, CancellationToken cToken = default) { - string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlEncode(typeOrId.GetStringValue())}"; + string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlPathEncode(typeOrId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -101,7 +101,7 @@ public LoginOptionsApi(HttpClient httpClient) { var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); - string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlEncode(typeOrId.GetStringValue())}"; + string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlPathEncode(typeOrId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -121,7 +121,7 @@ public LoginOptionsApi(HttpClient httpClient) /// public async Task DeleteLoginOption(string typeOrId, CancellationToken cToken = default) { - string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlEncode(typeOrId.GetStringValue())}"; + string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlPathEncode(typeOrId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -138,7 +138,7 @@ public LoginOptionsApi(HttpClient httpClient) public async Task UpdateLoginOptionAccess(AuthConfigAccess body, string typeOrId, string? targetTenant = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlEncode(typeOrId.GetStringValue())}/restrict"; + string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlPathEncode(typeOrId.GetStringValue())}/restrict"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("targetTenant", targetTenant); diff --git a/Client/Com/Cumulocity/Client/Api/ManagedObjectsApi.cs b/Client/Com/Cumulocity/Client/Api/ManagedObjectsApi.cs index 41bdfc7..2f6b360 100644 --- a/Client/Com/Cumulocity/Client/Api/ManagedObjectsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ManagedObjectsApi.cs @@ -109,7 +109,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetManagedObject(string id, bool? skipChildrenNames = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withParents = null, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("skipChildrenNames", skipChildrenNames); @@ -144,7 +144,7 @@ public ManagedObjectsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -164,7 +164,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task DeleteManagedObject(string id, string? xCumulocityProcessingMode = null, bool? cascade = null, bool? forceCascade = null, bool? withDeviceUser = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("cascade", cascade); @@ -186,7 +186,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetLatestAvailability(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/availability"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/availability"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -203,7 +203,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetSupportedMeasurements(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/supportedMeasurements"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/supportedMeasurements"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -220,7 +220,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetSupportedSeries(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/supportedSeries"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/supportedSeries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -237,7 +237,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetManagedObjectUser(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/user"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/user"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -257,7 +257,7 @@ public ManagedObjectsApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("userName"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlEncode(id.GetStringValue())}/user"; + string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/user"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/MeasurementsApi.cs b/Client/Com/Cumulocity/Client/Api/MeasurementsApi.cs index b0a1b50..0e68cf2 100644 --- a/Client/Com/Cumulocity/Client/Api/MeasurementsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/MeasurementsApi.cs @@ -141,7 +141,7 @@ public MeasurementsApi(HttpClient httpClient) /// public async Task GetMeasurement(string id, CancellationToken cToken = default) where TMeasurement : Measurement { - string resourcePath = $"/measurement/measurements/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/measurement/measurements/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -158,7 +158,7 @@ public MeasurementsApi(HttpClient httpClient) /// public async Task DeleteMeasurement(string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/measurement/measurements/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/measurement/measurements/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs b/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs index df06888..2dbdba4 100644 --- a/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs @@ -84,7 +84,7 @@ public NewDeviceRequestsApi(HttpClient httpClient) /// public async Task GetNewDeviceRequest(string requestId, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlEncode(requestId.GetStringValue())}"; + string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlPathEncode(requestId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -104,7 +104,7 @@ public NewDeviceRequestsApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlEncode(requestId.GetStringValue())}"; + string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlPathEncode(requestId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -123,7 +123,7 @@ public NewDeviceRequestsApi(HttpClient httpClient) /// public async Task DeleteNewDeviceRequest(string requestId, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlEncode(requestId.GetStringValue())}"; + string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlPathEncode(requestId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/OperationsApi.cs b/Client/Com/Cumulocity/Client/Api/OperationsApi.cs index 61213aa..b196816 100644 --- a/Client/Com/Cumulocity/Client/Api/OperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/OperationsApi.cs @@ -121,7 +121,7 @@ public OperationsApi(HttpClient httpClient) /// public async Task GetOperation(string id, CancellationToken cToken = default) where TOperation : Operation { - string resourcePath = $"/devicecontrol/operations/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/devicecontrol/operations/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -145,7 +145,7 @@ public OperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("deviceId"); - string resourcePath = $"/devicecontrol/operations/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/devicecontrol/operations/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/OptionsApi.cs b/Client/Com/Cumulocity/Client/Api/OptionsApi.cs index 6e6ce3a..e81b835 100644 --- a/Client/Com/Cumulocity/Client/Api/OptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/OptionsApi.cs @@ -81,7 +81,7 @@ public OptionsApi(HttpClient httpClient) /// public async Task GetOptionsByCategory(string category, CancellationToken cToken = default) where TCategoryOptions : CategoryOptions { - string resourcePath = $"/tenant/options/{HttpUtility.UrlEncode(category.GetStringValue())}"; + string resourcePath = $"/tenant/options/{HttpUtility.UrlPathEncode(category.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -99,7 +99,7 @@ public OptionsApi(HttpClient httpClient) public async Task UpdateOptionsByCategory(TCategoryOptions body, string category, CancellationToken cToken = default) where TCategoryOptions : CategoryOptions { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/tenant/options/{HttpUtility.UrlEncode(category.GetStringValue())}"; + string resourcePath = $"/tenant/options/{HttpUtility.UrlPathEncode(category.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -118,7 +118,7 @@ public OptionsApi(HttpClient httpClient) /// public async Task GetOption(string category, string key, CancellationToken cToken = default) { - string resourcePath = $"/tenant/options/{HttpUtility.UrlEncode(category.GetStringValue())}/{HttpUtility.UrlEncode(key.GetStringValue())}"; + string resourcePath = $"/tenant/options/{HttpUtility.UrlPathEncode(category.GetStringValue())}/{HttpUtility.UrlPathEncode(key.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -136,7 +136,7 @@ public OptionsApi(HttpClient httpClient) public async Task UpdateOption(CategoryKeyOption body, string category, string key, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/tenant/options/{HttpUtility.UrlEncode(category.GetStringValue())}/{HttpUtility.UrlEncode(key.GetStringValue())}"; + string resourcePath = $"/tenant/options/{HttpUtility.UrlPathEncode(category.GetStringValue())}/{HttpUtility.UrlPathEncode(key.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -155,7 +155,7 @@ public OptionsApi(HttpClient httpClient) /// public async Task DeleteOption(string category, string key, CancellationToken cToken = default) { - string resourcePath = $"/tenant/options/{HttpUtility.UrlEncode(category.GetStringValue())}/{HttpUtility.UrlEncode(key.GetStringValue())}"; + string resourcePath = $"/tenant/options/{HttpUtility.UrlPathEncode(category.GetStringValue())}/{HttpUtility.UrlPathEncode(key.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/RetentionRulesApi.cs b/Client/Com/Cumulocity/Client/Api/RetentionRulesApi.cs index 797daeb..1937da2 100644 --- a/Client/Com/Cumulocity/Client/Api/RetentionRulesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/RetentionRulesApi.cs @@ -83,7 +83,7 @@ public RetentionRulesApi(HttpClient httpClient) /// public async Task GetRetentionRule(string id, CancellationToken cToken = default) { - string resourcePath = $"/retention/retentions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/retention/retentions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -103,7 +103,7 @@ public RetentionRulesApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/retention/retentions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/retention/retentions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -122,7 +122,7 @@ public RetentionRulesApi(HttpClient httpClient) /// public async Task DeleteRetentionRule(string id, CancellationToken cToken = default) { - string resourcePath = $"/retention/retentions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/retention/retentions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/RolesApi.cs b/Client/Com/Cumulocity/Client/Api/RolesApi.cs index 16c8355..4c90a3d 100644 --- a/Client/Com/Cumulocity/Client/Api/RolesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/RolesApi.cs @@ -61,7 +61,7 @@ public RolesApi(HttpClient httpClient) /// public async Task GetUserRole(string name, CancellationToken cToken = default) { - string resourcePath = $"/user/roles/{HttpUtility.UrlEncode(name.GetStringValue())}"; + string resourcePath = $"/user/roles/{HttpUtility.UrlPathEncode(name.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -78,7 +78,7 @@ public RolesApi(HttpClient httpClient) /// public async Task GetGroupRoles(string tenantId, int groupId, int? currentPage = null, int? pageSize = null, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}/roles"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/roles"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -100,7 +100,7 @@ public RolesApi(HttpClient httpClient) public async Task AssignGroupRole(SubscribedRole body, string tenantId, int groupId, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}/roles"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/roles"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -119,7 +119,7 @@ public RolesApi(HttpClient httpClient) /// public async Task UnassignGroupRole(string tenantId, int groupId, string roleId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}/roles/{HttpUtility.UrlEncode(roleId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/roles/{HttpUtility.UrlPathEncode(roleId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -136,7 +136,7 @@ public RolesApi(HttpClient httpClient) public async Task AssignUserRole(SubscribedRole body, string tenantId, string userId, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -155,7 +155,7 @@ public RolesApi(HttpClient httpClient) /// public async Task UnassignUserRole(string tenantId, string userId, string roleId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/roles/{HttpUtility.UrlEncode(roleId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/{HttpUtility.UrlPathEncode(roleId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/SubscriptionsApi.cs b/Client/Com/Cumulocity/Client/Api/SubscriptionsApi.cs index 3062a33..7b376b5 100644 --- a/Client/Com/Cumulocity/Client/Api/SubscriptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/SubscriptionsApi.cs @@ -109,7 +109,7 @@ public SubscriptionsApi(HttpClient httpClient) /// public async Task GetSubscription(string id, CancellationToken cToken = default) { - string resourcePath = $"/notification2/subscriptions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/notification2/subscriptions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -126,7 +126,7 @@ public SubscriptionsApi(HttpClient httpClient) /// public async Task DeleteSubscription(string id, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/notification2/subscriptions/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/notification2/subscriptions/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/SystemOptionsApi.cs b/Client/Com/Cumulocity/Client/Api/SystemOptionsApi.cs index ca0b849..a21fe92 100644 --- a/Client/Com/Cumulocity/Client/Api/SystemOptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/SystemOptionsApi.cs @@ -57,7 +57,7 @@ public SystemOptionsApi(HttpClient httpClient) /// public async Task GetSystemOption(string category, string key, CancellationToken cToken = default) { - string resourcePath = $"/tenant/system/options/{HttpUtility.UrlEncode(category.GetStringValue())}/{HttpUtility.UrlEncode(key.GetStringValue())}"; + string resourcePath = $"/tenant/system/options/{HttpUtility.UrlPathEncode(category.GetStringValue())}/{HttpUtility.UrlPathEncode(key.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/TenantApplicationsApi.cs b/Client/Com/Cumulocity/Client/Api/TenantApplicationsApi.cs index 2c63592..30d6a30 100644 --- a/Client/Com/Cumulocity/Client/Api/TenantApplicationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/TenantApplicationsApi.cs @@ -38,7 +38,7 @@ public TenantApplicationsApi(HttpClient httpClient) /// public async Task GetSubscribedApplications(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/applications"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/applications"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -62,7 +62,7 @@ public TenantApplicationsApi(HttpClient httpClient) public async Task SubscribeApplication(SubscribedApplicationReference body, string tenantId, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/applications"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/applications"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -81,7 +81,7 @@ public TenantApplicationsApi(HttpClient httpClient) /// public async Task UnsubscribeApplication(string tenantId, string applicationId, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/applications/{HttpUtility.UrlEncode(applicationId.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/applications/{HttpUtility.UrlPathEncode(applicationId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/TenantsApi.cs b/Client/Com/Cumulocity/Client/Api/TenantsApi.cs index 06170b4..e040d7b 100644 --- a/Client/Com/Cumulocity/Client/Api/TenantsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/TenantsApi.cs @@ -124,7 +124,7 @@ public TenantsApi(HttpClient httpClient) /// public async Task?> GetTenant(string tenantId, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -151,7 +151,7 @@ public TenantsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("ownedApplications"); jsonNode?.RemoveFromNode("applications"); jsonNode?.RemoveFromNode("status"); - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -170,7 +170,7 @@ public TenantsApi(HttpClient httpClient) /// public async Task DeleteTenant(string tenantId, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -186,7 +186,7 @@ public TenantsApi(HttpClient httpClient) /// public async Task GetTenantTfaSettings(string tenantId, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/tfa"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/tfa"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs b/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs index 566d654..a918472 100644 --- a/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs @@ -39,7 +39,7 @@ public TrustedCertificatesApi(HttpClient httpClient) /// public async Task GetTrustedCertificates(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -63,7 +63,7 @@ public TrustedCertificatesApi(HttpClient httpClient) public async Task AddTrustedCertificate(UploadedTrustedCertificate body, string tenantId, string? xCumulocityProcessingMode = null, bool? addToTrustStore = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("addToTrustStore", addToTrustStore); @@ -91,7 +91,7 @@ public TrustedCertificatesApi(HttpClient httpClient) jsonNode?.RemoveFromNode("prev"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("statistics"); - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates/bulk"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/bulk"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("addToTrustStore", addToTrustStore); @@ -113,7 +113,7 @@ public TrustedCertificatesApi(HttpClient httpClient) /// public async Task GetTrustedCertificate(string tenantId, string fingerprint, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlEncode(fingerprint.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlPathEncode(fingerprint.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -144,7 +144,7 @@ public TrustedCertificatesApi(HttpClient httpClient) jsonNode?.RemoveFromNode("fingerprint"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("certInPemFormat"); - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlEncode(fingerprint.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlPathEncode(fingerprint.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -163,7 +163,7 @@ public TrustedCertificatesApi(HttpClient httpClient) /// public async Task RemoveTrustedCertificate(string tenantId, string fingerprint, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlEncode(fingerprint.GetStringValue())}"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlPathEncode(fingerprint.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -180,7 +180,7 @@ public TrustedCertificatesApi(HttpClient httpClient) public async Task ProveCertificatePossession(UploadedTrustedCertSignedVerificationCode body, string tenantId, string fingerprint, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlEncode(fingerprint.GetStringValue())}/pop"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlPathEncode(fingerprint.GetStringValue())}/pop"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -199,7 +199,7 @@ public TrustedCertificatesApi(HttpClient httpClient) /// public async Task ConfirmCertificate(string tenantId, string fingerprint, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlEncode(fingerprint.GetStringValue())}/confirmed"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlPathEncode(fingerprint.GetStringValue())}/confirmed"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -216,7 +216,7 @@ public TrustedCertificatesApi(HttpClient httpClient) /// public async Task GenerateVerificationCode(string tenantId, string fingerprint, CancellationToken cToken = default) { - string resourcePath = $"/tenant/tenants/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlEncode(fingerprint.GetStringValue())}/verification-code"; + string resourcePath = $"/tenant/tenants/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlPathEncode(fingerprint.GetStringValue())}/verification-code"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs b/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs index c4f96e5..72977f1 100644 --- a/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs @@ -299,7 +299,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task GetStatisticsFile(string id, CancellationToken cToken = default) { - string resourcePath = $"/tenant/statistics/files/{HttpUtility.UrlEncode(id.GetStringValue())}"; + string resourcePath = $"/tenant/statistics/files/{HttpUtility.UrlPathEncode(id.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -315,7 +315,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task GetLatestStatisticsFile(System.DateTime month, CancellationToken cToken = default) { - string resourcePath = $"/tenant/statistics/files/latest/{HttpUtility.UrlEncode(month.GetStringValue())}"; + string resourcePath = $"/tenant/statistics/files/latest/{HttpUtility.UrlPathEncode(month.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { diff --git a/Client/Com/Cumulocity/Client/Api/UsersApi.cs b/Client/Com/Cumulocity/Client/Api/UsersApi.cs index e7b1ec1..1e87e28 100644 --- a/Client/Com/Cumulocity/Client/Api/UsersApi.cs +++ b/Client/Com/Cumulocity/Client/Api/UsersApi.cs @@ -38,7 +38,7 @@ public UsersApi(HttpClient httpClient) /// public async Task?> GetUsers(string tenantId, int? currentPage = null, List? groups = null, bool? onlyDevices = null, string? owner = null, int? pageSize = null, string? username = null, bool? withSubusersCount = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -78,7 +78,7 @@ public UsersApi(HttpClient httpClient) jsonNode?.RemoveFromNode("twoFactorAuthenticationEnabled"); jsonNode?.RemoveFromNode("devicePermissions"); jsonNode?.RemoveFromNode("applications"); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -97,7 +97,7 @@ public UsersApi(HttpClient httpClient) /// public async Task?> GetUser(string tenantId, string userId, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -127,7 +127,7 @@ public UsersApi(HttpClient httpClient) jsonNode?.RemoveFromNode("twoFactorAuthenticationEnabled"); jsonNode?.RemoveFromNode("devicePermissions"); jsonNode?.RemoveFromNode("applications"); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -146,7 +146,7 @@ public UsersApi(HttpClient httpClient) /// public async Task DeleteUser(string tenantId, string userId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -163,7 +163,7 @@ public UsersApi(HttpClient httpClient) public async Task UpdateUserPassword(PasswordChange body, string tenantId, string userId, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/password"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/password"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -181,7 +181,7 @@ public UsersApi(HttpClient httpClient) /// public async Task GetUserTfaSettings(string tenantId, string userId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}/tfa"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/tfa"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -198,7 +198,7 @@ public UsersApi(HttpClient httpClient) /// public async Task?> GetUserByUsername(string tenantId, string username, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/userByName/{HttpUtility.UrlEncode(username.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/userByName/{HttpUtility.UrlPathEncode(username.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -215,7 +215,7 @@ public UsersApi(HttpClient httpClient) /// public async Task?> GetUsersFromUserGroup(string tenantId, int groupId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}/users"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/users"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -238,7 +238,7 @@ public UsersApi(HttpClient httpClient) public async Task?> AssignUserToUserGroup(SubscribedUser body, string tenantId, int groupId, CancellationToken cToken = default) where TCustomProperties : CustomProperties { var jsonNode = body.ToJsonNode(); - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}/users"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/users"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -257,7 +257,7 @@ public UsersApi(HttpClient httpClient) /// public async Task RemoveUserFromUserGroup(string tenantId, int groupId, string userId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlEncode(groupId.GetStringValue())}/users/{HttpUtility.UrlEncode(userId.GetStringValue())}"; + string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -291,7 +291,7 @@ public UsersApi(HttpClient httpClient) /// public async Task LogoutAllUsers(string tenantId, CancellationToken cToken = default) { - string resourcePath = $"/user/logout/{HttpUtility.UrlEncode(tenantId.GetStringValue())}/allUsers"; + string resourcePath = $"/user/logout/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/allUsers"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage {