From 60f52ff1c1e36dc1f869c03e07dc4c8736ac88ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hartmann?= Date: Tue, 29 Oct 2024 11:31:03 +0100 Subject: [PATCH] Updated dependencies and also moved new changes in regards to OpenAPI evolution. --- Client/Client.csproj | 4 +- Client/Com/Cumulocity/Client/Api/AlarmsApi.cs | 14 +- .../Client/Api/ApplicationBinariesApi.cs | 8 +- .../Client/Api/ApplicationVersionsApi.cs | 10 +- .../Cumulocity/Client/Api/ApplicationsApi.cs | 22 +- .../Cumulocity/Client/Api/AttachmentsApi.cs | 10 +- Client/Com/Cumulocity/Client/Api/AuditsApi.cs | 6 +- .../Com/Cumulocity/Client/Api/BinariesApi.cs | 10 +- .../Cumulocity/Client/Api/BootstrapUserApi.cs | 2 +- .../Client/Api/BulkOperationsApi.cs | 10 +- .../Client/Api/ChildOperationsApi.cs | 45 +-- .../Client/Api/CurrentApplicationApi.cs | 8 +- .../Cumulocity/Client/Api/CurrentUserApi.cs | 16 +- .../Client/Api/DeviceCredentialsApi.cs | 6 +- .../Client/Api/DevicePermissionsApi.cs | 4 +- .../Client/Api/DeviceStatisticsApi.cs | 8 +- Client/Com/Cumulocity/Client/Api/EventsApi.cs | 12 +- .../Cumulocity/Client/Api/ExternalIDsApi.cs | 8 +- .../Client/Api/FeatureTogglesApi.cs | 153 ++++++++++ Client/Com/Cumulocity/Client/Api/GroupsApi.cs | 29 +- .../Com/Cumulocity/Client/Api/IAlarmsApi.cs | 22 +- .../Cumulocity/Client/Api/IApplicationsApi.cs | 14 +- .../Com/Cumulocity/Client/Api/IAuditsApi.cs | 8 +- .../Com/Cumulocity/Client/Api/IBinariesApi.cs | 12 +- .../Client/Api/IBulkOperationsApi.cs | 2 +- .../Client/Api/IChildOperationsApi.cs | 54 ++-- .../Cumulocity/Client/Api/ICurrentUserApi.cs | 7 +- .../Client/Api/IDeviceCredentialsApi.cs | 4 +- .../Client/Api/IDeviceStatisticsApi.cs | 8 +- .../Com/Cumulocity/Client/Api/IEventsApi.cs | 6 +- .../Cumulocity/Client/Api/IExternalIDsApi.cs | 4 + .../Client/Api/IFeatureTogglesApi.cs | 241 ++++++++++++++++ .../Com/Cumulocity/Client/Api/IGroupsApi.cs | 17 +- .../Client/Api/IInventoryRolesApi.cs | 2 +- .../Cumulocity/Client/Api/ILoginOptionsApi.cs | 2 +- .../Client/Api/IManagedObjectsApi.cs | 33 ++- .../Cumulocity/Client/Api/IMeasurementsApi.cs | 16 +- .../Client/Api/INewDeviceRequestsApi.cs | 4 +- .../Cumulocity/Client/Api/IOperationsApi.cs | 11 +- .../Com/Cumulocity/Client/Api/IOptionsApi.cs | 7 +- .../Client/Api/IRealtimeNotificationApi.cs | 2 + .../Client/Api/IRetentionRulesApi.cs | 4 +- Client/Com/Cumulocity/Client/Api/IRolesApi.cs | 4 +- .../Client/Api/ISubscriptionsApi.cs | 6 +- .../Client/Api/ITenantApplicationsApi.cs | 4 +- .../Com/Cumulocity/Client/Api/ITenantsApi.cs | 38 ++- .../Client/Api/ITrustedCertificatesApi.cs | 262 +++++++++++++++++- .../Client/Api/IUsageStatisticsApi.cs | 15 +- Client/Com/Cumulocity/Client/Api/IUsersApi.cs | 46 +-- .../Com/Cumulocity/Client/Api/IdentityApi.cs | 2 +- .../Client/Api/InventoryRolesApi.cs | 20 +- .../Cumulocity/Client/Api/LoginOptionsApi.cs | 14 +- .../Client/Api/ManagedObjectsApi.cs | 29 +- .../Cumulocity/Client/Api/MeasurementsApi.cs | 16 +- .../Client/Api/NewDeviceRequestsApi.cs | 19 +- .../Cumulocity/Client/Api/OperationsApi.cs | 10 +- .../Com/Cumulocity/Client/Api/OptionsApi.cs | 14 +- .../Client/Api/RealtimeNotificationApi.cs | 4 +- .../Client/Api/RetentionRulesApi.cs | 10 +- Client/Com/Cumulocity/Client/Api/RolesApi.cs | 14 +- .../Cumulocity/Client/Api/SubscriptionsApi.cs | 10 +- .../Cumulocity/Client/Api/SystemOptionsApi.cs | 4 +- .../Client/Api/TenantApplicationsApi.cs | 6 +- .../Com/Cumulocity/Client/Api/TenantsApi.cs | 37 ++- Client/Com/Cumulocity/Client/Api/TokensApi.cs | 4 +- .../Client/Api/TrustedCertificatesApi.cs | 122 +++++++- .../Client/Api/UsageStatisticsApi.cs | 14 +- Client/Com/Cumulocity/Client/Api/UsersApi.cs | 43 +-- Client/Com/Cumulocity/Client/Model/Alarm.cs | 2 +- .../Client/Model/ApplicationVersionTag.cs | 8 +- .../Com/Cumulocity/Client/Model/AuthConfig.cs | 194 ++++++++++++- .../Client/Model/C8yLatestMeasurements.cs | 39 +++ .../Com/Cumulocity/Client/Model/CRLEntry.cs | 46 +++ .../Client/Model/DeviceCredentials.cs | 7 + Client/Com/Cumulocity/Client/Model/Event.cs | 2 +- .../Cumulocity/Client/Model/FeatureToggle.cs | 84 ++++++ .../Client/Model/FeatureToggleValue.cs | 30 ++ .../Model/JSONPredicateRepresentation.cs | 2 +- .../Client/Model/LatestMeasurementFragment.cs | 39 +++ .../Client/Model/LatestMeasurementValue.cs | 58 ++++ .../Com/Cumulocity/Client/Model/LoginForm.cs | 6 +- .../Cumulocity/Client/Model/LoginOption.cs | 2 +- .../Cumulocity/Client/Model/ManagedObject.cs | 10 +- .../Cumulocity/Client/Model/Measurement.cs | 2 +- .../Client/Model/NewDeviceRequest.cs | 42 +++ .../Client/Model/NotificationSubscription.cs | 7 +- .../Client/Model/OAuthSessionConfiguration.cs | 2 +- .../Com/Cumulocity/Client/Model/Operation.cs | 2 +- .../Client/Model/TenantFeatureToggleValue.cs | 37 +++ .../Client/Model/TenantTfaStrategy.cs | 54 ++++ .../Client/Model/UpdateCRLEntries.cs | 31 +++ .../Supplementary/CumulocityCoreLibrary.cs | 15 + .../Supplementary/ICumulocityCoreLibrary.cs | 6 + .../Client/Api/FeatureTogglesApiTest.cs | 49 ++++ .../Client/Api/TrustedCertificatesApiTest.cs | 7 + Test/Test.csproj | 12 +- 96 files changed, 1983 insertions(+), 444 deletions(-) create mode 100644 Client/Com/Cumulocity/Client/Api/FeatureTogglesApi.cs create mode 100644 Client/Com/Cumulocity/Client/Api/IFeatureTogglesApi.cs create mode 100644 Client/Com/Cumulocity/Client/Model/C8yLatestMeasurements.cs create mode 100644 Client/Com/Cumulocity/Client/Model/CRLEntry.cs create mode 100644 Client/Com/Cumulocity/Client/Model/FeatureToggle.cs create mode 100644 Client/Com/Cumulocity/Client/Model/FeatureToggleValue.cs create mode 100644 Client/Com/Cumulocity/Client/Model/LatestMeasurementFragment.cs create mode 100644 Client/Com/Cumulocity/Client/Model/LatestMeasurementValue.cs create mode 100644 Client/Com/Cumulocity/Client/Model/TenantFeatureToggleValue.cs create mode 100644 Client/Com/Cumulocity/Client/Model/TenantTfaStrategy.cs create mode 100644 Client/Com/Cumulocity/Client/Model/UpdateCRLEntries.cs create mode 100644 Test/Com/Cumulocity/Client/Api/FeatureTogglesApiTest.cs diff --git a/Client/Client.csproj b/Client/Client.csproj index d17fe02..4d6d3ec 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -18,8 +18,8 @@ - - + + diff --git a/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs b/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs index da386de..b125483 100644 --- a/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/AlarmsApi.cs @@ -38,7 +38,7 @@ public AlarmsApi(HttpClient httpClient) /// public async Task?> GetAlarms(System.DateTime? createdFrom = null, System.DateTime? createdTo = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, System.DateTime? lastUpdatedFrom = null, System.DateTime? lastUpdatedTo = null, int? pageSize = null, bool? resolved = null, List? severity = null, string? source = null, List? status = null, List? type = null, bool? withSourceAssets = null, bool? withSourceDevices = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TAlarm : Alarm { - const string resourcePath = "/alarm/alarms"; + const string resourcePath = $"alarm/alarms"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("createdFrom", createdFrom); @@ -86,7 +86,7 @@ public AlarmsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("text"); jsonNode?.RemoveFromNode("time"); jsonNode?.RemoveFromNode("type"); - const string resourcePath = "/alarm/alarms"; + const string resourcePath = $"alarm/alarms"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("createdFrom", createdFrom); @@ -125,7 +125,7 @@ public AlarmsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("source", "self"); - const string resourcePath = "/alarm/alarms"; + const string resourcePath = $"alarm/alarms"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -145,7 +145,7 @@ public AlarmsApi(HttpClient httpClient) /// public async Task DeleteAlarms(string? xCumulocityProcessingMode = null, System.DateTime? createdFrom = null, System.DateTime? createdTo = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, bool? resolved = null, List? severity = null, string? source = null, List? status = null, List? type = null, bool? withSourceAssets = null, bool? withSourceDevices = null, CancellationToken cToken = default) { - const string resourcePath = "/alarm/alarms"; + const string resourcePath = $"alarm/alarms"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("createdFrom", createdFrom); @@ -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.UrlPathEncode(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.UrlPathEncode(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 { @@ -222,7 +222,7 @@ public AlarmsApi(HttpClient httpClient) /// public async Task GetNumberOfAlarms(System.DateTime? dateFrom = null, System.DateTime? dateTo = null, bool? resolved = null, List? severity = null, string? source = null, List? status = null, List? type = null, bool? withSourceAssets = null, bool? withSourceDevices = null, CancellationToken cToken = default) { - const string resourcePath = "/alarm/alarms/count"; + const string resourcePath = $"alarm/alarms/count"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("dateFrom", dateFrom); diff --git a/Client/Com/Cumulocity/Client/Api/ApplicationBinariesApi.cs b/Client/Com/Cumulocity/Client/Api/ApplicationBinariesApi.cs index c296ef6..b4f85b4 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(id.GetStringValue())}/binaries/{HttpUtility.UrlPathEncode(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.UrlPathEncode(id.GetStringValue())}/binaries/{HttpUtility.UrlPathEncode(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 b87f67c..3d29d4f 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(id.GetStringValue())}/versions/{HttpUtility.UrlPathEncode(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 07fb60c..a925aa5 100644 --- a/Client/Com/Cumulocity/Client/Api/ApplicationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ApplicationsApi.cs @@ -25,7 +25,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// API methods to retrieve, create, update and delete applications.
/// ### Application names
/// For each tenant, Cumulocity IoT manages the subscribed applications and provides a number of applications of various types.In case you want to subscribe a tenant to an application using an API, you must use the application name in the argument (as name).
-/// Refer to the tables in in the User guide for the respective application name to be used.
+/// Refer to the tables in in the Cumulocity IoT user documentation for the respective application name to be used.
/// ⓘ Info: The Accept header should be provided in all POST/PUT requests, otherwise an empty response body will be returned.
/// /// @@ -41,7 +41,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplications(int? currentPage = null, string? name = null, string? owner = null, int? pageSize = null, string? providedFor = null, string? subscriber = null, string? tenant = null, string? type = null, string? user = null, bool? withTotalElements = null, bool? withTotalPages = null, bool? hasVersions = null, CancellationToken cToken = default) { - const string resourcePath = "/application/applications"; + const string resourcePath = $"application/applications"; 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 ApplicationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("resourcesUrl"); - const string resourcePath = "/application/applications"; + const string resourcePath = $"application/applications"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -98,7 +98,7 @@ public ApplicationsApi(HttpClient httpClient) /// public async Task GetApplication(string id, CancellationToken cToken = default) { - string resourcePath = $"/application/applications/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 adfc628..6cbf74b 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 b41f7f8..b7e958d 100644 --- a/Client/Com/Cumulocity/Client/Api/AuditsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/AuditsApi.cs @@ -57,7 +57,7 @@ public AuditsApi(HttpClient httpClient) /// public async Task?> GetAuditRecords(string? application = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, string? source = null, string? type = null, string? user = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TAuditRecord : AuditRecord { - const string resourcePath = "/audit/auditRecords"; + const string resourcePath = $"audit/auditRecords"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("application", application); @@ -95,7 +95,7 @@ public AuditsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("source", "self"); - const string resourcePath = "/audit/auditRecords"; + const string resourcePath = $"audit/auditRecords"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -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.UrlPathEncode(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 9acf0d6..92b7309 100644 --- a/Client/Com/Cumulocity/Client/Api/BinariesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/BinariesApi.cs @@ -38,7 +38,7 @@ public BinariesApi(HttpClient httpClient) /// public async Task GetBinaries(string? childAdditionId = null, string? childAssetId = null, string? childDeviceId = null, int? currentPage = null, List? ids = null, string? owner = null, int? pageSize = null, string? text = null, string? type = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/inventory/binaries"; + const string resourcePath = $"inventory/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("childAdditionId", childAdditionId); @@ -67,7 +67,7 @@ public BinariesApi(HttpClient httpClient) /// public async Task UploadBinary(BinaryInfo pObject, byte[] file, CancellationToken cToken = default) { - const string resourcePath = "/inventory/binaries"; + const string resourcePath = $"inventory/binaries"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var requestContent = new MultipartFormDataContent(); var fileContentObject = new StringContent(JsonSerializerWrapper.Serialize(pObject)); @@ -93,7 +93,7 @@ public BinariesApi(HttpClient httpClient) /// public async Task GetBinary(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/binaries/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 2b64586..8985a4a 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.UrlPathEncode(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 bc79fc1..6a10b2d 100644 --- a/Client/Com/Cumulocity/Client/Api/BulkOperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/BulkOperationsApi.cs @@ -51,7 +51,7 @@ public BulkOperationsApi(HttpClient httpClient) /// public async Task GetBulkOperations(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, CancellationToken cToken = default) { - const string resourcePath = "/devicecontrol/bulkoperations"; + const string resourcePath = $"devicecontrol/bulkoperations"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -79,7 +79,7 @@ public BulkOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("progress"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("status"); - const string resourcePath = "/devicecontrol/bulkoperations"; + const string resourcePath = $"devicecontrol/bulkoperations"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -99,7 +99,7 @@ public BulkOperationsApi(HttpClient httpClient) /// public async Task GetBulkOperation(string id, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/bulkoperations/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 c124573..6e74727 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 { @@ -112,11 +112,12 @@ public ChildOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("childAssets"); jsonNode?.RemoveFromNode("creationTime"); jsonNode?.RemoveFromNode("childAdditions"); + jsonNode?.RemoveFromNode("c8y_LatestMeasurements"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +137,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.UrlPathEncode(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 +156,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildAddition(string id, string childId, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions/{HttpUtility.UrlPathEncode(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 +173,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task UnassignChildAddition(string id, string childId, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAdditions/{HttpUtility.UrlPathEncode(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 +190,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.UrlPathEncode(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 +217,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.UrlPathEncode(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 +237,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.UrlPathEncode(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 { @@ -263,11 +264,12 @@ public ChildOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("childAssets"); jsonNode?.RemoveFromNode("creationTime"); jsonNode?.RemoveFromNode("childAdditions"); + jsonNode?.RemoveFromNode("c8y_LatestMeasurements"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +289,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.UrlPathEncode(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 +308,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildAsset(string id, string childId, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets/{HttpUtility.UrlPathEncode(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 +325,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task UnassignChildAsset(string id, string childId, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childAssets/{HttpUtility.UrlPathEncode(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 +342,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.UrlPathEncode(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 +369,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.UrlPathEncode(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 +389,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.UrlPathEncode(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 { @@ -414,11 +416,12 @@ public ChildOperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("childAssets"); jsonNode?.RemoveFromNode("creationTime"); jsonNode?.RemoveFromNode("childAdditions"); + jsonNode?.RemoveFromNode("c8y_LatestMeasurements"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +441,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.UrlPathEncode(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 +460,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task?> GetChildDevice(string id, string childId, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices/{HttpUtility.UrlPathEncode(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 +477,7 @@ public ChildOperationsApi(HttpClient httpClient) /// public async Task UnassignChildDevice(string id, string childId, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(id.GetStringValue())}/childDevices/{HttpUtility.UrlPathEncode(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/CurrentApplicationApi.cs b/Client/Com/Cumulocity/Client/Api/CurrentApplicationApi.cs index d6e4677..8661ae2 100644 --- a/Client/Com/Cumulocity/Client/Api/CurrentApplicationApi.cs +++ b/Client/Com/Cumulocity/Client/Api/CurrentApplicationApi.cs @@ -37,7 +37,7 @@ public CurrentApplicationApi(HttpClient httpClient) /// public async Task GetCurrentApplication(CancellationToken cToken = default) { - const string resourcePath = "/application/currentApplication"; + const string resourcePath = $"application/currentApplication"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -60,7 +60,7 @@ public CurrentApplicationApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("resourcesUrl"); - const string resourcePath = "/application/currentApplication"; + const string resourcePath = $"application/currentApplication"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -79,7 +79,7 @@ public CurrentApplicationApi(HttpClient httpClient) /// public async Task?> GetCurrentApplicationSettings(CancellationToken cToken = default) { - const string resourcePath = "/application/currentApplication/settings"; + const string resourcePath = $"application/currentApplication/settings"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -96,7 +96,7 @@ public CurrentApplicationApi(HttpClient httpClient) /// public async Task GetSubscribedUsers(CancellationToken cToken = default) { - const string resourcePath = "/application/currentApplication/subscriptions"; + const string resourcePath = $"application/currentApplication/subscriptions"; 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/CurrentUserApi.cs b/Client/Com/Cumulocity/Client/Api/CurrentUserApi.cs index 284bc09..92d3e12 100644 --- a/Client/Com/Cumulocity/Client/Api/CurrentUserApi.cs +++ b/Client/Com/Cumulocity/Client/Api/CurrentUserApi.cs @@ -38,14 +38,14 @@ public CurrentUserApi(HttpClient httpClient) /// public async Task GetCurrentUser(CancellationToken cToken = default) { - const string resourcePath = "/user/currentUser"; + const string resourcePath = $"user/currentUser"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { Method = HttpMethod.Get, RequestUri = new Uri(uriBuilder.ToString()) }; - request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/vnd.com.nsn.cumulocity.currentuser+json"); + request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/vnd.com.nsn.cumulocity.currentuser+json, application/vnd.com.nsn.cumulocity.user+json"); using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); @@ -62,7 +62,7 @@ public CurrentUserApi(HttpClient httpClient) jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("lastPasswordChange"); jsonNode?.RemoveFromNode("twoFactorAuthenticationEnabled"); - const string resourcePath = "/user/currentUser"; + const string resourcePath = $"user/currentUser"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -82,7 +82,7 @@ public CurrentUserApi(HttpClient httpClient) public async Task UpdateCurrentUserPassword(PasswordChange body, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - const string resourcePath = "/user/currentUser/password"; + const string resourcePath = $"user/currentUser/password"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -100,7 +100,7 @@ public CurrentUserApi(HttpClient httpClient) /// public async Task GenerateTfaSecret(CancellationToken cToken = default) { - const string resourcePath = "/user/currentUser/totpSecret"; + const string resourcePath = $"user/currentUser/totpSecret"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -117,7 +117,7 @@ public CurrentUserApi(HttpClient httpClient) /// public async Task GetTfaState(CancellationToken cToken = default) { - const string resourcePath = "/user/currentUser/totpSecret/activity"; + const string resourcePath = $"user/currentUser/totpSecret/activity"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -135,7 +135,7 @@ public CurrentUserApi(HttpClient httpClient) public async Task SetTfaState(CurrentUserTotpSecretActivity body, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - const string resourcePath = "/user/currentUser/totpSecret/activity"; + const string resourcePath = $"user/currentUser/totpSecret/activity"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -154,7 +154,7 @@ public CurrentUserApi(HttpClient httpClient) public async Task VerifyTfaCode(CurrentUserTotpCode body, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - const string resourcePath = "/user/currentUser/totpSecret/verify"; + const string resourcePath = $"user/currentUser/totpSecret/verify"; 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/DeviceCredentialsApi.cs b/Client/Com/Cumulocity/Client/Api/DeviceCredentialsApi.cs index 30b451c..0e746ce 100644 --- a/Client/Com/Cumulocity/Client/Api/DeviceCredentialsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/DeviceCredentialsApi.cs @@ -23,7 +23,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// API methods to create device credentials in Cumulocity IoT.
-/// Device credentials can be enquired by devices that do not have credentials for accessing a tenant yet.Since the device does not have credentials yet, a set of fixed credentials is used for this API.The credentials can be obtained by .
+/// Device credentials can be enquired by devices that do not have credentials for accessing a tenant yet.Since the device does not have credentials yet, a set of fixed credentials is used for this API.The credentials can be obtained by .
/// ⚠️ Important: Do not use your tenant credentials with this API.
/// ⓘ Info: The Accept header should be provided in all POST requests, otherwise an empty response body will be returned.
///
@@ -45,7 +45,7 @@ public DeviceCredentialsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("tenantId"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("username"); - const string resourcePath = "/devicecontrol/deviceCredentials"; + const string resourcePath = $"devicecontrol/deviceCredentials"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -65,7 +65,7 @@ public DeviceCredentialsApi(HttpClient httpClient) /// public async Task CreateBulkDeviceCredentials(byte[] file, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { - const string resourcePath = "/devicecontrol/bulkNewDeviceRequests"; + const string resourcePath = $"devicecontrol/bulkNewDeviceRequests"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var requestContent = new MultipartFormDataContent(); var fileContentFile = new ByteArrayContent(file); diff --git a/Client/Com/Cumulocity/Client/Api/DevicePermissionsApi.cs b/Client/Com/Cumulocity/Client/Api/DevicePermissionsApi.cs index 121190e..8bede04 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.UrlPathEncode(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.UrlPathEncode(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 b3cde2d..359f29c 100644 --- a/Client/Com/Cumulocity/Client/Api/DeviceStatisticsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/DeviceStatisticsApi.cs @@ -62,6 +62,10 @@ namespace Client.Com.Cumulocity.Client.Api; /// Yes, retrieving device logs requires from the device to create an event and attach a binary with logs to it. Those are two separate requests and both are counted.
///
When I have a device with children are the requests counted always to the root device or separately for each child?
/// Separately for each child.
+///
Why do device statistics show significantly smaller request numbers than the total number of created and updated request from usage statistics?
+/// The important aspect here is the moment of recording values for the counters. For inbound data usage statistics we count every request that passed authorization, including invalid requests, as stated in usage statistics description.
+/// For device statistics it is different. We count requests after data is successfully stored in the database (or transient), which means the request was valid and there was no problem with persistence.
+/// In summary, if you observe that your usage statistics counters are significantly larger than your device statistics counters, there is a good chance that some devices or microservices in your tenant are constantly sending invalid requests. In such a situation, the client should check the state of theirs tenant.
/// /// public sealed class DeviceStatisticsApi : IDeviceStatisticsApi @@ -76,7 +80,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.UrlPathEncode(tenantId.GetStringValue())}/monthly/{HttpUtility.UrlPathEncode(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 +103,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.UrlPathEncode(tenantId.GetStringValue())}/daily/{HttpUtility.UrlPathEncode(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 bfe0df0..63f0177 100644 --- a/Client/Com/Cumulocity/Client/Api/EventsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/EventsApi.cs @@ -38,7 +38,7 @@ public EventsApi(HttpClient httpClient) /// public async Task?> GetEvents(System.DateTime? createdFrom = null, System.DateTime? createdTo = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? fragmentType = null, string? fragmentValue = null, System.DateTime? lastUpdatedFrom = null, System.DateTime? lastUpdatedTo = null, int? pageSize = null, bool? revert = null, string? source = null, string? type = null, bool? withSourceAssets = null, bool? withSourceDevices = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TEvent : Event { - const string resourcePath = "/event/events"; + const string resourcePath = $"event/events"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("createdFrom", createdFrom); @@ -80,7 +80,7 @@ public EventsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("source", "self"); - const string resourcePath = "/event/events"; + const string resourcePath = $"event/events"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -100,7 +100,7 @@ public EventsApi(HttpClient httpClient) /// public async Task DeleteEvents(string? xCumulocityProcessingMode = null, System.DateTime? createdFrom = null, System.DateTime? createdTo = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? fragmentType = null, string? source = null, string? type = null, CancellationToken cToken = default) { - const string resourcePath = "/event/events"; + const string resourcePath = $"event/events"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("createdFrom", createdFrom); @@ -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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 d0100f2..591cadf 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(type.GetStringValue())}/{HttpUtility.UrlPathEncode(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.UrlPathEncode(type.GetStringValue())}/{HttpUtility.UrlPathEncode(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/FeatureTogglesApi.cs b/Client/Com/Cumulocity/Client/Api/FeatureTogglesApi.cs new file mode 100644 index 0000000..8bfe2ca --- /dev/null +++ b/Client/Com/Cumulocity/Client/Api/FeatureTogglesApi.cs @@ -0,0 +1,153 @@ +// +// FeatureTogglesApi.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using System.Web; +using Client.Com.Cumulocity.Client.Model; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Api; + +public sealed class FeatureTogglesApi : IFeatureTogglesApi +{ + private readonly HttpClient _httpClient; + + public FeatureTogglesApi(HttpClient httpClient) + { + _httpClient = httpClient; + } + + /// + public async Task?> ListCurrentTenantFeatures(CancellationToken cToken = default) + { + const string resourcePath = $"features"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Get, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + return await JsonSerializerWrapper.DeserializeAsync?>(responseStream, cancellationToken: cToken).ConfigureAwait(false); + } + + /// + public async Task GetCurrentTenantFeature(string featureKey, CancellationToken cToken = default) + { + string resourcePath = $"features/{HttpUtility.UrlPathEncode(featureKey.GetStringValue())}"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Get, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + return await JsonSerializerWrapper.DeserializeAsync(responseStream, cancellationToken: cToken).ConfigureAwait(false); + } + + /// + public async Task?> ListTenantFeatureToggleValues(string featureKey, CancellationToken cToken = default) + { + string resourcePath = $"features/{HttpUtility.UrlPathEncode(featureKey.GetStringValue())}/by-tenant"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Get, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + return await JsonSerializerWrapper.DeserializeAsync?>(responseStream, cancellationToken: cToken).ConfigureAwait(false); + } + + /// + public async Task SetCurrentTenantFeatureToggleValue(FeatureToggleValue body, string featureKey, CancellationToken cToken = default) + { + var jsonNode = body.ToJsonNode(); + string resourcePath = $"features/{HttpUtility.UrlPathEncode(featureKey.GetStringValue())}/by-tenant"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Content = new StringContent(jsonNode?.ToString() ?? string.Empty, Encoding.UTF8, "application/json"), + Method = HttpMethod.Put, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Content-Type", "application/json"); + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } + + /// + public async Task UnsetCurrentTenantFeatureToggleValue(string featureKey, CancellationToken cToken = default) + { + string resourcePath = $"features/{HttpUtility.UrlPathEncode(featureKey.GetStringValue())}/by-tenant"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Delete, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } + + /// + public async Task SetGivenTenantFeatureToggleValue(FeatureToggleValue body, string featureKey, string tenantId, CancellationToken cToken = default) + { + var jsonNode = body.ToJsonNode(); + string resourcePath = $"features/{HttpUtility.UrlPathEncode(featureKey.GetStringValue())}/by-tenant/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Content = new StringContent(jsonNode?.ToString() ?? string.Empty, Encoding.UTF8, "application/json"), + Method = HttpMethod.Put, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Content-Type", "application/json"); + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } + + /// + public async Task UnsetGivenTenantFeatureToggleValue(string featureKey, string tenantId, CancellationToken cToken = default) + { + string resourcePath = $"features/{HttpUtility.UrlPathEncode(featureKey.GetStringValue())}/by-tenant/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Delete, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } +} diff --git a/Client/Com/Cumulocity/Client/Api/GroupsApi.cs b/Client/Com/Cumulocity/Client/Api/GroupsApi.cs index dac8983..f7d89e0 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.UrlPathEncode(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.UrlPathEncode(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 { @@ -86,10 +86,13 @@ public GroupsApi(HttpClient httpClient) } /// - public async Task?> GetUserGroup(string tenantId, int groupId, CancellationToken cToken = default) where TCustomProperties : CustomProperties + public async Task?> GetUserGroup(string tenantId, int groupId, bool? forceLogout = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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)); + var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); + queryString.TryAdd("forceLogout", forceLogout); + uriBuilder.Query = queryString.ToString(); using var request = new HttpRequestMessage { Method = HttpMethod.Get, @@ -103,7 +106,7 @@ public GroupsApi(HttpClient httpClient) } /// - public async Task?> UpdateUserGroup(Group body, string tenantId, int groupId, CancellationToken cToken = default) where TCustomProperties : CustomProperties + public async Task?> UpdateUserGroup(Group body, string tenantId, int groupId, bool? forceLogout = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { var jsonNode = body.ToJsonNode>(); jsonNode?.RemoveFromNode("roles"); @@ -112,8 +115,11 @@ public GroupsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("devicePermissions"); jsonNode?.RemoveFromNode("users"); jsonNode?.RemoveFromNode("applications"); - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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)); + var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); + queryString.TryAdd("forceLogout", forceLogout); + uriBuilder.Query = queryString.ToString(); using var request = new HttpRequestMessage { Content = new StringContent(jsonNode?.ToString() ?? string.Empty, Encoding.UTF8, "application/vnd.com.nsn.cumulocity.group+json"), @@ -129,10 +135,13 @@ public GroupsApi(HttpClient httpClient) } /// - public async Task DeleteUserGroup(string tenantId, int groupId, CancellationToken cToken = default) + public async Task DeleteUserGroup(string tenantId, int groupId, bool? forceLogout = null, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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)); + var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); + queryString.TryAdd("forceLogout", forceLogout); + uriBuilder.Query = queryString.ToString(); using var request = new HttpRequestMessage { Method = HttpMethod.Delete, @@ -147,7 +156,7 @@ public GroupsApi(HttpClient httpClient) /// public async Task?> GetUserGroupByName(string tenantId, string groupName, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groupByName/{HttpUtility.UrlPathEncode(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 +173,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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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/IAlarmsApi.cs b/Client/Com/Cumulocity/Client/Api/IAlarmsApi.cs index 7be6e1e..bd64059 100644 --- a/Client/Com/Cumulocity/Client/Api/IAlarmsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IAlarmsApi.cs @@ -53,15 +53,15 @@ public interface IAlarmsApi /// Start date or date and time of the last update made.
/// End date or date and time of the last update made.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED.
+ /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED. Takes precedence over the status parameter.
/// The severity of the alarm to search for.
ⓘ Info: If you query for multiple alarm severities at once, comma-separate the values.
/// The managed object ID to which the alarm is associated.
- /// The status of the alarm to search for.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
+ /// The status of the alarm to search for. Should not be used when resolved parameter is provided.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
/// The types of alarm to search for.
ⓘ Info: If you query for multiple alarm types at once, comma-separate the values. Space characters in alarm types must be escaped.
/// When set to true also alarms for related source assets will be included in the request. When this parameter is provided a source must be specified.
/// When set to true also alarms for related source devices will be included in the request. When this parameter is provided a source must be specified.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetAlarms(System.DateTime? createdFrom = null, System.DateTime? createdTo = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, System.DateTime? lastUpdatedFrom = null, System.DateTime? lastUpdatedTo = null, int? pageSize = null, bool? resolved = null, List? severity = null, string? source = null, List? status = null, List? type = null, bool? withSourceAssets = null, bool? withSourceDevices = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TAlarm : Alarm; @@ -106,10 +106,10 @@ public interface IAlarmsApi /// End date or date and time of the alarm creation.
/// Start date or date and time of the alarm occurrence.
/// End date or date and time of the alarm occurrence.
- /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED.
+ /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED. Takes precedence over the status parameter.
/// The severity of the alarm to search for.
ⓘ Info: If you query for multiple alarm severities at once, comma-separate the values.
/// The managed object ID to which the alarm is associated.
- /// The status of the alarm to search for.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
+ /// The status of the alarm to search for. Should not be used when resolved parameter is provided.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
/// When set to true also alarms for related source assets will be included in the request. When this parameter is provided a source must be specified.
/// When set to true also alarms for related source devices will be included in the request. When this parameter is provided a source must be specified.
/// @@ -178,7 +178,7 @@ public interface IAlarmsApi /// /// Remove alarm collections
/// Remove alarm collections specified by query parameters.
- /// ⚠️ Important: Note that it is possible to call this endpoint without providing any parameter - it will result in deleting all alarms and it is not recommended.Also note that DELETE requests are not synchronous. The response could be returned before the delete request has been completed.
+ /// ⚠️ Important: DELETE requires at least one of the following parameters: source, dateFrom, dateTo, createdFrom, createdTo.Also note that DELETE requests are not synchronous. The response could be returned before the delete request has been completed.
/// ///
Required roles
/// ROLE_ALARM_ADMIN @@ -206,10 +206,10 @@ public interface IAlarmsApi /// End date or date and time of the alarm creation.
/// Start date or date and time of the alarm occurrence.
/// End date or date and time of the alarm occurrence.
- /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED.
+ /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED. Takes precedence over the status parameter.
/// The severity of the alarm to search for.
ⓘ Info: If you query for multiple alarm severities at once, comma-separate the values.
/// The managed object ID to which the alarm is associated.
- /// The status of the alarm to search for.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
+ /// The status of the alarm to search for. Should not be used when resolved parameter is provided.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
/// The types of alarm to search for.
ⓘ Info: If you query for multiple alarm types at once, comma-separate the values. Space characters in alarm types must be escaped.
/// When set to true also alarms for related source assets will be included in the request. When this parameter is provided a source must be specified.
/// When set to true also alarms for related source devices will be included in the request. When this parameter is provided a source must be specified.
@@ -312,10 +312,10 @@ public interface IAlarmsApi /// Propagates notification that operations should be canceled.
/// Start date or date and time of the alarm occurrence.
/// End date or date and time of the alarm occurrence.
- /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED.
+ /// When set to true only alarms with status CLEARED will be fetched, whereas false will fetch all alarms with status ACTIVE or ACKNOWLEDGED. Takes precedence over the status parameter.
/// The severity of the alarm to search for.
ⓘ Info: If you query for multiple alarm severities at once, comma-separate the values.
/// The managed object ID to which the alarm is associated.
- /// The status of the alarm to search for.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
+ /// The status of the alarm to search for. Should not be used when resolved parameter is provided.
ⓘ Info: If you query for multiple alarm statuses at once, comma-separate the values.
/// The types of alarm to search for.
ⓘ Info: If you query for multiple alarm types at once, comma-separate the values. Space characters in alarm types must be escaped.
/// When set to true also alarms for related source assets will be included in the request. When this parameter is provided a source must be specified.
/// When set to true also alarms for related source devices will be included in the request. When this parameter is provided a source must be specified.
diff --git a/Client/Com/Cumulocity/Client/Api/IApplicationsApi.cs b/Client/Com/Cumulocity/Client/Api/IApplicationsApi.cs index 7b187c0..c975cf2 100644 --- a/Client/Com/Cumulocity/Client/Api/IApplicationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IApplicationsApi.cs @@ -18,7 +18,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// API methods to retrieve, create, update and delete applications.
/// ### Application names
/// For each tenant, Cumulocity IoT manages the subscribed applications and provides a number of applications of various types.In case you want to subscribe a tenant to an application using an API, you must use the application name in the argument (as name).
-/// Refer to the tables in in the User guide for the respective application name to be used.
+/// Refer to the tables in in the Cumulocity IoT user documentation for the respective application name to be used.
/// ⓘ Info: The Accept header should be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -55,8 +55,8 @@ public interface IApplicationsApi /// The ID of a tenant that either owns the application or is subscribed to the applications.
/// The type of the application. It is possible to use multiple values separated by a comma. For example, EXTERNAL,HOSTED will return only applications with type EXTERNAL or HOSTED.
/// The ID of a user that has access to the applications.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// When set to true, the returned result contains applications with an applicationVersions field that is not empty. When set to false, the result will contain applications with an empty applicationVersions field.
/// Task GetApplications(int? currentPage = null, string? name = null, string? owner = null, int? pageSize = null, string? providedFor = null, string? subscriber = null, string? tenant = null, string? type = null, string? user = null, bool? withTotalElements = null, bool? withTotalPages = null, bool? hasVersions = null, CancellationToken cToken = default) ; @@ -302,8 +302,8 @@ public interface IApplicationsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetApplicationsByOwner(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -331,8 +331,8 @@ public interface IApplicationsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetApplicationsByUser(string username, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; } diff --git a/Client/Com/Cumulocity/Client/Api/IAuditsApi.cs b/Client/Com/Cumulocity/Client/Api/IAuditsApi.cs index ccf5973..f6faa3b 100644 --- a/Client/Com/Cumulocity/Client/Api/IAuditsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IAuditsApi.cs @@ -59,14 +59,14 @@ public interface IAuditsApi /// Propagates notification that operations should be canceled.
/// Name of the application from which the audit was carried out.
/// The current page of the paginated results.
- /// Start date or date and time of the audit record.
- /// End date or date and time of the audit record.
+ /// Start date or date and time of the audit record (device time).
+ /// End date or date and time of the audit record (device time).
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
/// The platform component ID to which the audit is associated.
/// The type of audit record to search for.
/// The username to search for.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetAuditRecords(string? application = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, string? source = null, string? type = null, string? user = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TAuditRecord : AuditRecord; diff --git a/Client/Com/Cumulocity/Client/Api/IBinariesApi.cs b/Client/Com/Cumulocity/Client/Api/IBinariesApi.cs index 51c48c8..80bde76 100644 --- a/Client/Com/Cumulocity/Client/Api/IBinariesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IBinariesApi.cs @@ -46,9 +46,9 @@ public interface IBinariesApi /// The managed object IDs to search for.
ⓘ Info: If you query for multiple IDs at once, comma-separate the values.
/// Username of the owner of the managed objects.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// Search for managed objects where any property value is equal to the given one. Only string values are supported.
+ /// Search for managed objects where a property value is equal to the given one.The following properties are examined: id, type, name, owner, externalIds.
/// The type of managed object to search for.
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetBinaries(string? childAdditionId = null, string? childAssetId = null, string? childDeviceId = null, int? currentPage = null, List? ids = null, string? owner = null, int? pageSize = null, string? text = null, string? type = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -68,7 +68,7 @@ public interface IBinariesApi /// After the file has been uploaded, the corresponding managed object will contain the fragment c8y_IsBinary.
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ROLE_INVENTORY_CREATE + /// ROLE_INVENTORY_ADMIN OR ROLE_INVENTORY_CREATE OR ROLE_BINARY_ADMIN OR ROLE_BINARY_CREATE /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -102,7 +102,7 @@ public interface IBinariesApi /// Retrieve a stored file (managed object) by a given ID.Supports chunk download and resuming an interrupted download using the .
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the resource OR MANAGE_OBJECT_READ permission on the resource + /// ROLE_INVENTORY_READ OR ROLE_BINARY_READ OR owner of the resource OR MANAGE_OBJECT_READ permission on the resource /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -128,7 +128,7 @@ public interface IBinariesApi ///
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the resource OR MANAGE_OBJECT_ADMIN permission on the resource + /// ROLE_INVENTORY_ADMIN OR ROLE_BINARY_ADMIN OR owner of the resource OR MANAGE_OBJECT_ADMIN permission on the resource /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -154,7 +154,7 @@ public interface IBinariesApi /// Remove a managed object and its stored file by a given ID.
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the resource OR MANAGE_OBJECT_ADMIN permission on the resource + /// ROLE_INVENTORY_ADMIN OR ROLE_BINARY_ADMIN OR owner of the resource OR MANAGE_OBJECT_ADMIN permission on the resource /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
diff --git a/Client/Com/Cumulocity/Client/Api/IBulkOperationsApi.cs b/Client/Com/Cumulocity/Client/Api/IBulkOperationsApi.cs index ee96f1c..246356c 100644 --- a/Client/Com/Cumulocity/Client/Api/IBulkOperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IBulkOperationsApi.cs @@ -58,7 +58,7 @@ public interface IBulkOperationsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
/// Task GetBulkOperations(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/IChildOperationsApi.cs b/Client/Com/Cumulocity/Client/Api/IChildOperationsApi.cs index 3ee1ca2..ddc949d 100644 --- a/Client/Com/Cumulocity/Client/Api/IChildOperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IChildOperationsApi.cs @@ -27,7 +27,7 @@ public interface IChildOperationsApi /// Retrieve all child additions of a specific managed object by a given ID, or a subset based on queries.
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -57,8 +57,8 @@ public interface IChildOperationsApi /// Use query language to perform operations and/or filter the results. Details about the properties and supported operations can be found in .
/// Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
/// When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices).
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// 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; @@ -81,7 +81,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -126,7 +126,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -171,7 +171,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -202,7 +202,7 @@ public interface IChildOperationsApi /// Remove specific child additions (by given child IDs) from its parent (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -237,7 +237,7 @@ public interface IChildOperationsApi /// Retrieve a specific child addition (by a given child ID) of a specific managed object (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR MANAGE_OBJECT_READ permission on the source (parent) + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR MANAGE_OBJECT_READ permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -271,7 +271,7 @@ public interface IChildOperationsApi /// Remove a specific child addition (by a given child ID) from its parent (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -306,7 +306,7 @@ public interface IChildOperationsApi /// Retrieve all child assets of a specific managed object by a given ID, or a subset based on queries.
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -336,8 +336,8 @@ public interface IChildOperationsApi /// Use query language to perform operations and/or filter the results. Details about the properties and supported operations can be found in .
/// Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
/// When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices).
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// 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; @@ -360,7 +360,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -405,7 +405,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -450,7 +450,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -481,7 +481,7 @@ public interface IChildOperationsApi /// Remove specific child assets (by given child IDs) from its parent (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -516,7 +516,7 @@ public interface IChildOperationsApi /// Retrieve a specific child asset (by a given child ID) of a specific managed object (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR MANAGE_OBJECT_READ permission on the source (parent) + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR MANAGE_OBJECT_READ permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -550,7 +550,7 @@ public interface IChildOperationsApi /// Remove a specific child asset (by a given child ID) from its parent (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -585,7 +585,7 @@ public interface IChildOperationsApi /// Retrieve all child devices of a specific managed object by a given ID, or a subset based on queries.
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -615,8 +615,8 @@ public interface IChildOperationsApi /// Use query language to perform operations and/or filter the results. Details about the properties and supported operations can be found in .
/// Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
/// When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices).
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// 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; @@ -639,7 +639,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -684,7 +684,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -729,7 +729,7 @@ public interface IChildOperationsApi /// /// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR ((owner of the source OR MANAGE_OBJECT_ADMIN permission on the source) AND (owner of the child OR MANAGE_OBJECT_ADMIN permission on the child)) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -760,7 +760,7 @@ public interface IChildOperationsApi /// Remove specific child devices (by given child IDs) from its parent (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -795,7 +795,7 @@ public interface IChildOperationsApi /// Retrieve a specific child device (by a given child ID) of a specific managed object (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR MANAGE_OBJECT_READ permission on the source (parent) + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR MANAGE_OBJECT_READ permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -829,7 +829,7 @@ public interface IChildOperationsApi /// Remove a specific child device (by a given child ID) from its parent (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source (parent) OR owner of the child OR MANAGE_OBJECT_ADMIN permission on the source (parent) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
diff --git a/Client/Com/Cumulocity/Client/Api/ICurrentUserApi.cs b/Client/Com/Cumulocity/Client/Api/ICurrentUserApi.cs index ce973ab..74a58bd 100644 --- a/Client/Com/Cumulocity/Client/Api/ICurrentUserApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ICurrentUserApi.cs @@ -29,6 +29,7 @@ public interface ICurrentUserApi ///
Required roles
/// ROLE_USER_MANAGEMENT_OWN_READ OR ROLE_SYSTEM /// + /// Users with ROLE_SYSTEM are not allowed to query with Accept header application/vnd.com.nsn.cumulocity.user+json
///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
/// @@ -108,7 +109,7 @@ public interface ICurrentUserApi /// /// Generate secret to set up TFA
/// Generate a secret code to create a QR code to set up the two-factor authentication functionality using a TFA app/service.
- /// For more information about the feature, see in the Cumulocity IoT documentation.
+ /// For more information about the feature, see in the Cumulocity IoT user documentation.
/// ///
Required roles
/// ROLE_USER_MANAGEMENT_OWN_READ OR ROLE_SYSTEM @@ -161,7 +162,7 @@ public interface ICurrentUserApi /// /// Activates or deactivates the two-factor authentication feature
/// Activates or deactivates the two-factor authentication feature for the current user.
- /// For more information about the feature, see in the Cumulocity IoT documentation.
+ /// For more information about the feature, see in the Cumulocity IoT user documentation.
/// ///
Required roles
/// ROLE_USER_MANAGEMENT_OWN_READ OR ROLE_SYSTEM @@ -182,7 +183,7 @@ public interface ICurrentUserApi /// /// /// - /// HTTP 404 User not found.

+ /// HTTP 409 TFA TOTP secret does not exist. First generate secret.

///
///
/// diff --git a/Client/Com/Cumulocity/Client/Api/IDeviceCredentialsApi.cs b/Client/Com/Cumulocity/Client/Api/IDeviceCredentialsApi.cs index fa9560d..e940d1c 100644 --- a/Client/Com/Cumulocity/Client/Api/IDeviceCredentialsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IDeviceCredentialsApi.cs @@ -15,7 +15,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// API methods to create device credentials in Cumulocity IoT.
-/// Device credentials can be enquired by devices that do not have credentials for accessing a tenant yet.Since the device does not have credentials yet, a set of fixed credentials is used for this API.The credentials can be obtained by .
+/// Device credentials can be enquired by devices that do not have credentials for accessing a tenant yet.Since the device does not have credentials yet, a set of fixed credentials is used for this API.The credentials can be obtained by .
/// ⚠️ Important: Do not use your tenant credentials with this API.
/// ⓘ Info: The Accept header should be provided in all POST requests, otherwise an empty response body will be returned.
///
@@ -58,7 +58,7 @@ public interface IDeviceCredentialsApi /// Section two is the rest of the CSV file. Section two contains the device information. The order and quantity of the values must be the same as of the headers.
/// A separator is automatically obtained from the CSV file. Valid separator values are: \t (tabulation mark), ; (semicolon) and , (comma).
/// ⚠️ Important: The CSV file needs the "com_cumulocity_model_Agent.active" header with a value of "true" to be added to the request.
- /// ⓘ Info: A bulk registration creates an elementary representation of the device. Then, the device needs to update it to a full representation with its own status. The device is ready to use only after it is updated to the full representation. Also see and .
+ /// ⓘ Info: A bulk registration creates an elementary representation of the device. Then, the device needs to update it to a full representation with its own status. The device is ready to use only after it is updated to the full representation. Also see and .
/// A CSV file can appear in many forms (with regard to the optional tenant column and the occurrence of device information):
/// /// diff --git a/Client/Com/Cumulocity/Client/Api/IDeviceStatisticsApi.cs b/Client/Com/Cumulocity/Client/Api/IDeviceStatisticsApi.cs index 92d3ff2..c8a30de 100644 --- a/Client/Com/Cumulocity/Client/Api/IDeviceStatisticsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IDeviceStatisticsApi.cs @@ -54,6 +54,10 @@ namespace Client.Com.Cumulocity.Client.Api; /// Yes, retrieving device logs requires from the device to create an event and attach a binary with logs to it. Those are two separate requests and both are counted.
///
When I have a device with children are the requests counted always to the root device or separately for each child?
/// Separately for each child.
+///
Why do device statistics show significantly smaller request numbers than the total number of created and updated request from usage statistics?
+/// The important aspect here is the moment of recording values for the counters. For inbound data usage statistics we count every request that passed authorization, including invalid requests, as stated in usage statistics description.
+/// For device statistics it is different. We count requests after data is successfully stored in the database (or transient), which means the request was valid and there was no problem with persistence.
+/// In summary, if you observe that your usage statistics counters are significantly larger than your device statistics counters, there is a good chance that some devices or microservices in your tenant are constantly sending invalid requests. In such a situation, the client should check the state of theirs tenant.
///
/// public interface IDeviceStatisticsApi @@ -89,7 +93,7 @@ public interface IDeviceStatisticsApi /// The current page of the paginated results.
/// The ID of the device to search for.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetMonthlyDeviceStatistics(string tenantId, System.DateTime date, int? currentPage = null, string? deviceId = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -123,7 +127,7 @@ public interface IDeviceStatisticsApi /// The current page of the paginated results.
/// The ID of the device to search for.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetDailyDeviceStatistics(string tenantId, System.DateTime date, int? currentPage = null, string? deviceId = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) ; } diff --git a/Client/Com/Cumulocity/Client/Api/IEventsApi.cs b/Client/Com/Cumulocity/Client/Api/IEventsApi.cs index 2c49510..be65147 100644 --- a/Client/Com/Cumulocity/Client/Api/IEventsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IEventsApi.cs @@ -59,8 +59,8 @@ public interface IEventsApi /// The type of event to search for.
/// When set to true also events for related source assets will be included in the request. When this parameter is provided a source must be specified.
/// When set to true also events for related source devices will be included in the request. When this parameter is provided a source must be specified.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetEvents(System.DateTime? createdFrom = null, System.DateTime? createdTo = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? fragmentType = null, string? fragmentValue = null, System.DateTime? lastUpdatedFrom = null, System.DateTime? lastUpdatedTo = null, int? pageSize = null, bool? revert = null, string? source = null, string? type = null, bool? withSourceAssets = null, bool? withSourceDevices = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TEvent : Event; @@ -121,7 +121,7 @@ public interface IEventsApi /// Remove event collections
/// Remove event collections specified by query parameters.
/// DELETE requests are not synchronous. The response could be returned before the delete request has been completed. This may happen especially when the deleted event has a lot of associated data. After sending the request, the platform starts deleting the associated data in an asynchronous way. Finally, the requested event is deleted after all associated data has been deleted.
- /// ⚠️ Important: Note that it is possible to call this endpoint without providing any parameter - it will result in deleting all events and it is not recommended.
+ /// ⚠️ Important: DELETE requires at least one of the following parameters: source, dateFrom, dateTo, createdFrom, createdTo.
/// ///
Required roles
/// ROLE_EVENT_ADMIN diff --git a/Client/Com/Cumulocity/Client/Api/IExternalIDsApi.cs b/Client/Com/Cumulocity/Client/Api/IExternalIDsApi.cs index 3734136..29b1f07 100644 --- a/Client/Com/Cumulocity/Client/Api/IExternalIDsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IExternalIDsApi.cs @@ -66,6 +66,10 @@ public interface IExternalIDsApi /// /// /// + /// HTTP 404 Global ID not found.

+ ///
+ ///
+ /// /// HTTP 409 Duplicate – Identity already bound to a different Global ID.

///
///
diff --git a/Client/Com/Cumulocity/Client/Api/IFeatureTogglesApi.cs b/Client/Com/Cumulocity/Client/Api/IFeatureTogglesApi.cs new file mode 100644 index 0000000..01377bd --- /dev/null +++ b/Client/Com/Cumulocity/Client/Api/IFeatureTogglesApi.cs @@ -0,0 +1,241 @@ +// +// IFeatureTogglesApi.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Collections.Generic; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Client.Com.Cumulocity.Client.Model; + +namespace Client.Com.Cumulocity.Client.Api; + +public interface IFeatureTogglesApi +{ + + /// + /// Retrieve list of feature toggles with values for current tenant.
+ /// Retrieve a list of all defined feature toggles with values calculated for a tenant of authenticated user.
+ /// + ///
Required roles
+ /// none, any authenticated user can call this endpoint + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggles are sent in the response.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ ///
+ ///
+ /// Propagates notification that operations should be canceled.
+ /// + Task?> ListCurrentTenantFeatures(CancellationToken cToken = default) ; + + /// + /// Retrieve a specific feature toggle with value for current tenant.
+ /// Retrieve a specific feature toggles defined under given key, with value calculated for a tenant of authenticated user.
+ /// + ///
Required roles
+ /// none, any authenticated user can call this endpoint + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggle is sent in the response.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 404 Managed object not found.

+ ///
+ ///
+ ///
+ ///
+ /// A unique key of the feature toggle.
+ /// Propagates notification that operations should be canceled.
+ /// + Task GetCurrentTenantFeature(string featureKey, CancellationToken cToken = default) ; + + /// + /// Retrieve list of feature toggles values overrides of all tenants.
+ /// Retrieve a list of all existing feature toggle value overrides for all tenants.
+ /// + ///
Required roles
+ /// ROLE_TENANT_MANAGEMENT_ADMIN AND current tenant is management + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggles are sent in the response.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not authorized to perform this operation.

+ ///
+ ///
+ /// + /// HTTP 404 Managed object not found.

+ ///
+ ///
+ ///
+ ///
+ /// A unique key of the feature toggle.
+ /// Propagates notification that operations should be canceled.
+ /// + Task?> ListTenantFeatureToggleValues(string featureKey, CancellationToken cToken = default) ; + + /// + /// Sets the value of feature toggle override for the current tenant.
+ /// Sets the value of feature toggle override for a tenant of authenticated user.
+ /// + ///
Required roles
+ /// ROLE_TENANT_MANAGEMENT_ADMIN AND (current tenant is management OR the feature toggle phase is PUBLIC_PREVIEW or GENERALLY_AVAILABLE) + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggle value override was set.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not authorized to perform this operation.

+ ///
+ ///
+ /// + /// HTTP 404 Managed object not found.

+ ///
+ ///
+ ///
+ ///
+ /// + /// A unique key of the feature toggle.
+ /// Propagates notification that operations should be canceled.
+ /// + Task SetCurrentTenantFeatureToggleValue(FeatureToggleValue body, string featureKey, CancellationToken cToken = default) ; + + /// + /// Removes the feature toggle override for the current tenant.
+ /// Removes the feature toggle override for a tenant of authenticated user.
+ /// + ///
Required roles
+ /// ROLE_TENANT_MANAGEMENT_ADMIN AND (current tenant is management OR the feature toggle phase is PUBLIC_PREVIEW or GENERALLY_AVAILABLE) + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggle value override was removed.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not authorized to perform this operation.

+ ///
+ ///
+ /// + /// HTTP 404 Managed object not found.

+ ///
+ ///
+ ///
+ ///
+ /// A unique key of the feature toggle.
+ /// Propagates notification that operations should be canceled.
+ /// + Task UnsetCurrentTenantFeatureToggleValue(string featureKey, CancellationToken cToken = default) ; + + /// + /// Sets the value of feature toggle override for a given tenant.
+ /// Sets the value of feature toggle override for a given tenant.
+ /// + ///
Required roles
+ /// ROLE_TENANT_MANAGEMENT_ADMIN AND current tenant is management. + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggle value override was set.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not authorized to perform this operation.

+ ///
+ ///
+ /// + /// HTTP 404 Managed object not found.

+ ///
+ ///
+ ///
+ ///
+ /// + /// A unique key of the feature toggle.
+ /// Unique identifier of a Cumulocity IoT tenant.
+ /// Propagates notification that operations should be canceled.
+ /// + Task SetGivenTenantFeatureToggleValue(FeatureToggleValue body, string featureKey, string tenantId, CancellationToken cToken = default) ; + + /// + /// Removes the feature toggle override for a given tenant.
+ /// Removes the feature toggle override for a given tenant.
+ /// + ///
Required roles
+ /// ROLE_TENANT_MANAGEMENT_ADMIN AND current tenant is management. + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The request has succeeded and the feature toggle value override was removed.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not authorized to perform this operation.

+ ///
+ ///
+ /// + /// HTTP 404 Managed object not found.

+ ///
+ ///
+ ///
+ ///
+ /// A unique key of the feature toggle.
+ /// Unique identifier of a Cumulocity IoT tenant.
+ /// Propagates notification that operations should be canceled.
+ /// + Task UnsetGivenTenantFeatureToggleValue(string featureKey, string tenantId, CancellationToken cToken = default) ; +} diff --git a/Client/Com/Cumulocity/Client/Api/IGroupsApi.cs b/Client/Com/Cumulocity/Client/Api/IGroupsApi.cs index 784390b..a6ac3b4 100644 --- a/Client/Com/Cumulocity/Client/Api/IGroupsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IGroupsApi.cs @@ -51,8 +51,8 @@ public interface IGroupsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetTenantUserGroups(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties; @@ -125,8 +125,9 @@ public interface IGroupsApi /// Unique identifier of a Cumulocity IoT tenant.
/// Unique identifier of the user group.
/// Propagates notification that operations should be canceled.
+ /// If set to true, users with this global role will be force logged out.
/// - Task?> GetUserGroup(string tenantId, int groupId, CancellationToken cToken = default) where TCustomProperties : CustomProperties; + Task?> GetUserGroup(string tenantId, int groupId, bool? forceLogout = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties; /// /// Update a specific user group for a specific tenant
@@ -164,8 +165,9 @@ public interface IGroupsApi /// Unique identifier of a Cumulocity IoT tenant.
/// Unique identifier of the user group.
/// Propagates notification that operations should be canceled.
+ /// If set to true, users with this global role will be force logged out.
/// - Task?> UpdateUserGroup(Group body, string tenantId, int groupId, CancellationToken cToken = default) where TCustomProperties : CustomProperties; + Task?> UpdateUserGroup(Group body, string tenantId, int groupId, bool? forceLogout = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties; /// /// Delete a specific user group for a specific tenant
@@ -198,8 +200,9 @@ public interface IGroupsApi /// Unique identifier of a Cumulocity IoT tenant.
/// Unique identifier of the user group.
/// Propagates notification that operations should be canceled.
+ /// If set to true, users with this global role will be force logged out.
/// - Task DeleteUserGroup(string tenantId, int groupId, CancellationToken cToken = default) ; + Task DeleteUserGroup(string tenantId, int groupId, bool? forceLogout = null, CancellationToken cToken = default) ; /// /// Retrieve a user group by group name for a specific tenant
@@ -268,8 +271,8 @@ public interface IGroupsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetUserGroups(string tenantId, string userId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties; } diff --git a/Client/Com/Cumulocity/Client/Api/IInventoryRolesApi.cs b/Client/Com/Cumulocity/Client/Api/IInventoryRolesApi.cs index a0fadac..b3dcfba 100644 --- a/Client/Com/Cumulocity/Client/Api/IInventoryRolesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IInventoryRolesApi.cs @@ -45,7 +45,7 @@ public interface IInventoryRolesApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
/// Task GetInventoryRoles(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/ILoginOptionsApi.cs b/Client/Com/Cumulocity/Client/Api/ILoginOptionsApi.cs index e1cee6f..b63f5cd 100644 --- a/Client/Com/Cumulocity/Client/Api/ILoginOptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ILoginOptionsApi.cs @@ -16,7 +16,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// API methods to retrieve the login options configured in the tenant.
-/// More detailed information about the parameters and their meaning can be found in in the Users guide.
+/// More detailed information about the parameters and their meaning can be found in in the Cumulocity IoT user documentation.
/// ⓘ Info: If OAuth external is the only login option shown in the response, the user will be automatically redirected to the SSO login screen.
///
/// diff --git a/Client/Com/Cumulocity/Client/Api/IManagedObjectsApi.cs b/Client/Com/Cumulocity/Client/Api/IManagedObjectsApi.cs index 9e4bbc4..d4536bc 100644 --- a/Client/Com/Cumulocity/Client/Api/IManagedObjectsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IManagedObjectsApi.cs @@ -16,6 +16,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// The inventory stores devices and other assets relevant to your IoT solution. We refer to them as managed objects and such can be “smart objects”, for example, smart electricity meters, home automation gateways or GPS devices.
+/// For further information, refer to in the Cumulocity IoT user documentation.
/// ⓘ Info: The Accept header should be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -55,16 +56,17 @@ public interface IManagedObjectsApi /// Similar to the parameter query, but it assumes that this is a device query request and it adds automatically the search criteria fragmentType=c8y_IsDevice.
/// Use query language to perform operations and/or filter the results. Details about the properties and supported operations can be found in .
/// When set to true, the returned references of child devices won't contain their names.
- /// Search for managed objects where any property value is equal to the given one. Only string values are supported.
+ /// Search for managed objects where a property value is equal to the given one.The following properties are examined: id, type, name, owner, externalIds.
/// The type of managed object to search for.
/// Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
/// When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices).
/// When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.
/// When set to true, the returned references of child parents will return the device's parents (if any). Otherwise, it will be an empty array.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
+ /// If set to true the platform returns managed objects with the fragment `c8y_LatestMeasurements, which contains the latest measurement values reported by the device to the platform.
⚠️ Feature Preview: The parameter is a part of the Latest Measurement feature which is still under public preview.
/// - Task?> GetManagedObjects(string? childAdditionId = null, string? childAssetId = null, string? childDeviceId = null, int? currentPage = null, string? fragmentType = null, List? ids = null, bool? onlyRoots = null, string? owner = null, int? pageSize = null, string? q = null, string? query = null, bool? skipChildrenNames = null, string? text = null, string? type = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withGroups = null, bool? withParents = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TManagedObject : ManagedObject; + Task?> GetManagedObjects(string? childAdditionId = null, string? childAssetId = null, string? childDeviceId = null, int? currentPage = null, string? fragmentType = null, List? ids = null, bool? onlyRoots = null, string? owner = null, int? pageSize = null, string? q = null, string? query = null, bool? skipChildrenNames = null, string? text = null, string? type = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withGroups = null, bool? withParents = null, bool? withTotalElements = null, bool? withTotalPages = null, bool? withLatestValues = null, CancellationToken cToken = default) where TManagedObject : ManagedObject; /// /// Create a managed object
@@ -97,10 +99,10 @@ public interface IManagedObjectsApi /// /// /// Imagine, for example, that you want to describe electric meters from different vendors. Depending on the make of the meter, one may have a relay and one may be capable to measure a single phase or three phases (for example, a three-phase electricity sensor). A fragment c8y_ThreePhaseElectricitySensor would identify such an electric meter. Devices' characteristics are identified by storing fragments for each of them.
- /// ⓘ Info: For more details about fragments with specific meanings, review the sections and .
+ /// ⓘ Info: For more details about fragments with specific meanings, refer to in the Cumulocity IoT user documentation.
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR ROLE_INVENTORY_CREATE + /// ROLE_INVENTORY_ADMIN OR ROLE_INVENTORY_CREATE OR ROLE_MANAGED_OBJECT_ADMIN OR ROLE_MANAGED_OBJECT_CREATE /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -130,7 +132,7 @@ public interface IManagedObjectsApi /// Retrieve a specific managed object (for example, device, group, template) by a given ID.
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -155,8 +157,9 @@ public interface IManagedObjectsApi /// Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
/// When set to true, the returned result will contain the total number of children in the respective objects (childAdditions, childAssets and childDevices).
/// When set to true, the returned references of child parents will return the device's parents (if any). Otherwise, it will be an empty array.
+ /// If set to true the platform returns managed objects with the fragment `c8y_LatestMeasurements, which contains the latest measurement values reported by the device to the platform.
⚠️ Feature Preview: The parameter is a part of the Latest Measurement feature which is still under public preview.
/// - Task GetManagedObject(string id, bool? skipChildrenNames = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withParents = null, CancellationToken cToken = default) where TManagedObject : ManagedObject; + Task GetManagedObject(string id, bool? skipChildrenNames = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withParents = null, bool? withLatestValues = null, CancellationToken cToken = default) where TManagedObject : ManagedObject; /// /// Update a specific managed object
@@ -165,7 +168,7 @@ public interface IManagedObjectsApi /// The endpoint can also be used as a device availability heartbeat.If you only specifiy the id, it updates the date when the last message was received and no other property.The response then only contains the id instead of the full managed object.
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source OR MANAGE_OBJECT_ADMIN permission on the source + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source OR MANAGE_OBJECT_ADMIN permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -198,7 +201,7 @@ public interface IManagedObjectsApi /// ⓘ Info: By default, the delete operation is always propagated to the subgroups, but only if the deleted object is a group.
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source OR MANAGE_OBJECT_ADMIN permission on the source + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source OR MANAGE_OBJECT_ADMIN permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -235,7 +238,7 @@ public interface IManagedObjectsApi /// Retrieve the date when a specific managed object (by a given ID) sent the last message to Cumulocity IoT.
/// ///
Required roles
- /// ROLE_INVENTORY_READ + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -264,7 +267,7 @@ public interface IManagedObjectsApi /// Retrieve all measurement types of a specific managed object by a given ID.
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -293,7 +296,7 @@ public interface IManagedObjectsApi /// Retrieve all supported measurement fragments and series of a specific managed object by a given ID.
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -322,7 +325,7 @@ public interface IManagedObjectsApi /// Retrieve the device owner's username and state (enabled or disabled) of a specific managed object (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source + /// ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ OR owner of the source OR MANAGE_OBJECT_READ permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -351,7 +354,7 @@ public interface IManagedObjectsApi /// Update the device owner's state (enabled or disabled) of a specific managed object (by a given ID).
/// ///
Required roles
- /// ROLE_INVENTORY_ADMIN OR owner of the source OR MANAGE_OBJECT_ADMIN permission on the source + /// ROLE_INVENTORY_ADMIN OR ROLE_MANAGED_OBJECT_ADMIN OR owner of the source OR MANAGE_OBJECT_ADMIN permission on the source /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
diff --git a/Client/Com/Cumulocity/Client/Api/IMeasurementsApi.cs b/Client/Com/Cumulocity/Client/Api/IMeasurementsApi.cs index c0ace4b..d4253e0 100644 --- a/Client/Com/Cumulocity/Client/Api/IMeasurementsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IMeasurementsApi.cs @@ -55,8 +55,8 @@ public interface IMeasurementsApi /// The type of measurement to search for.
/// The specific series to search for.
/// A characteristic which identifies the measurement.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetMeasurements(int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, bool? revert = null, string? source = null, string? type = null, string? valueFragmentSeries = null, string? valueFragmentType = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TMeasurement : Measurement; @@ -74,12 +74,12 @@ public interface IMeasurementsApi /// /// /// - /// Review the section for details about the conversions of units. Also review the in the Concepts guide.
+ /// Review the section for details about the conversions of units. Also review in the Cumulocity IoT user documentation.
/// The example below uses c8y_Steam in the request body to illustrate a fragment for recording temperature measurements.
/// ⚠️ Important: Property names used for fragment and series must not contain whitespaces nor the special characters . , * [ ] ( ) @ $. This is required to ensure a correct processing and visualization of measurement series on UI graphs.
///
Create multiple measurements
/// It is also possible to create multiple measurements at once by sending a measurements array containing all the measurements to be created. The content type must be application/vnd.com.nsn.cumulocity.measurementcollection+json.
- /// ⓘ Info: For more details about fragments with specific meanings, review the sections and .
+ /// ⓘ Info: For more details about fragments with specific meanings, refer to in the Cumulocity IoT user documentation.
/// ///
Required roles
/// ROLE_MEASUREMENT_ADMIN OR owner of the source OR MEASUREMENT_ADMIN permission on the source @@ -125,12 +125,12 @@ public interface IMeasurementsApi /// /// /// - /// Review the section for details about the conversions of units. Also review the in the Concepts guide.
+ /// Review the section for details about the conversions of units. Also review in the Cumulocity IoT user documentation.
/// The example below uses c8y_Steam in the request body to illustrate a fragment for recording temperature measurements.
/// ⚠️ Important: Property names used for fragment and series must not contain whitespaces nor the special characters . , * [ ] ( ) @ $. This is required to ensure a correct processing and visualization of measurement series on UI graphs.
///
Create multiple measurements
/// It is also possible to create multiple measurements at once by sending a measurements array containing all the measurements to be created. The content type must be application/vnd.com.nsn.cumulocity.measurementcollection+json.
- /// ⓘ Info: For more details about fragments with specific meanings, review the sections and .
+ /// ⓘ Info: For more details about fragments with specific meanings, refer to in the Cumulocity IoT user documentation.
/// ///
Required roles
/// ROLE_MEASUREMENT_ADMIN OR owner of the source OR MEASUREMENT_ADMIN permission on the source @@ -166,7 +166,7 @@ public interface IMeasurementsApi /// Remove measurement collections
/// Remove measurement collections specified by query parameters.
/// DELETE requests are not synchronous. The response could be returned before the delete request has been completed. This may happen especially when there are a lot of measurements to be deleted.
- /// ⚠️ Important: Note that it is possible to call this endpoint without providing any parameter - it may result in deleting all measurements and it is not recommended.
+ /// ⚠️ Important: DELETE requires at least one of the following parameters: source, dateFrom, dateTo.
/// In case of enhanced time series measurements, both dateFrom and dateTo parameters must be truncated to full hours (for example, 2022-08-19T14:00:00.000Z), otherwise an error will be returned.The fragmentType parameter allows to delete measurements only by a measurement fragment when enhanced time series measurements are used.It's not possible to delete by a custom (non-measurement) fragment.
/// Example for a valid measurement value fragment:
/// Start date or date and time of the measurement.
/// End date or date and time of the measurement.
/// If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request), then setting revert=true will sort the results by the newest measurements first.By default, the results are sorted by the oldest measurements first.
- /// The specific series to search for.
ⓘ Info: If you query for multiple series at once, comma-separate the values.
+ /// The specific series to search for.
ⓘ Info: If you want to query multiple series at once, you must specify the parameter multiple times.
/// The managed object ID to which the measurement is associated.
/// Task GetMeasurementSeries(string? aggregationType = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, bool? revert = null, List? series = null, string? source = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/INewDeviceRequestsApi.cs b/Client/Com/Cumulocity/Client/Api/INewDeviceRequestsApi.cs index a8c3b52..85a3866 100644 --- a/Client/Com/Cumulocity/Client/Api/INewDeviceRequestsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/INewDeviceRequestsApi.cs @@ -45,8 +45,8 @@ public interface INewDeviceRequestsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetNewDeviceRequests(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/IOperationsApi.cs b/Client/Com/Cumulocity/Client/Api/IOperationsApi.cs index 090e3bc..4b1b19b 100644 --- a/Client/Com/Cumulocity/Client/Api/IOperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IOperationsApi.cs @@ -68,8 +68,8 @@ public interface IOperationsApi /// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
/// If you are using a range query (that is, at least one of the dateFrom or dateTo parameters is included in the request), then setting revert=true will sort the results by the newest operations first.By default, the results are sorted by the oldest operations first.
/// Status of the operation.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task?> GetOperations(string? agentId = null, string? bulkOperationId = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? deviceId = null, string? fragmentType = null, int? pageSize = null, bool? revert = null, string? status = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TOperation : Operation; @@ -77,6 +77,13 @@ public interface IOperationsApi /// Create an operation
/// Create an operation.
/// It is possible to add custom fragments to operations, for example com_cumulocity_model_WebCamDevice is a custom object of the webcam operation.
+ /// There are some custom fragments which are used by web applications (like Device management) to provide additional context to operations, for example:
+ /// + /// + /// description - this fragment can be used to provide a brief user-friendly description of the operation which is later displayed in the operations list views within web applications.
+ ///
+ ///
+ ///
/// ///
Required roles
/// ROLE_DEVICE_CONTROL_ADMIN OR owner of the device OR ADMIN permissions on the device diff --git a/Client/Com/Cumulocity/Client/Api/IOptionsApi.cs b/Client/Com/Cumulocity/Client/Api/IOptionsApi.cs index 55fe046..7ca5aef 100644 --- a/Client/Com/Cumulocity/Client/Api/IOptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IOptionsApi.cs @@ -25,6 +25,7 @@ public interface IOptionsApi /// /// Retrieve all options
/// Retrieve all the options available on the tenant.
+ /// ⚠️ Important: Note that Enterprise Tenants are also allowed to read inherited tenant options from the management tenant.
/// ///
Required roles
/// ROLE_OPTION_MANAGEMENT_READ @@ -45,7 +46,7 @@ public interface IOptionsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetOptions(int? currentPage = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -56,7 +57,7 @@ public interface IOptionsApi /// Any option of any tenant can be defined as "non-editable" by the "management" tenant; once done, any PUT or DELETE requests made on that option by the tenant owner will result in a 403 error (Unauthorized).
///
Default option categories
/// access.control
- /// | Key | Default value | Predefined | Description ||--|--|--|--|| allow.origin | * | Yes | Comma separated list of domains allowed for execution of CORS. Wildcards are allowed (for example, *.cumuclocity.com) |
+ /// | Key | Default value | Predefined | Description ||--|--|--|--|| allow.origin | * | Yes | Comma separated list of domains allowed for execution of CORS. Wildcards are allowed (for example, *.cumulocity.com) |
/// alarm.type.mapping
/// | Key | Predefined | Description ||--|--|--|| | No | Overrides the severity and alarm text for the alarm with type . The severity and text are specified as \|. If either part is empty, the value will not be overridden. If the severity is NONE, the alarm will be suppressed. Example: "CRITICAL\|temperature too high"|
///
Encrypted credentials
@@ -98,6 +99,7 @@ public interface IOptionsApi /// /// Retrieve all options by category
/// Retrieve all the options (by a specified category) on your tenant.
+ /// ⚠️ Important: Note that Enterprise Tenants are also allowed to read inherited tenant options from the management tenant.
/// ///
Required roles
/// ROLE_OPTION_MANAGEMENT_READ @@ -153,6 +155,7 @@ public interface IOptionsApi /// /// Retrieve a specific option
/// Retrieve a specific option (by a given category and key) on your tenant.
+ /// ⚠️ Important: Note that Enterprise Tenants are also allowed to read inherited tenant options from the management tenant.
/// ///
Required roles
/// ROLE_OPTION_MANAGEMENT_READ diff --git a/Client/Com/Cumulocity/Client/Api/IRealtimeNotificationApi.cs b/Client/Com/Cumulocity/Client/Api/IRealtimeNotificationApi.cs index d08ad4b..0e3211d 100644 --- a/Client/Com/Cumulocity/Client/Api/IRealtimeNotificationApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IRealtimeNotificationApi.cs @@ -176,6 +176,8 @@ namespace Client.Com.Cumulocity.Client.Api; /// } /// ] /// ]]> +///
Long-running connections
+/// To keep a long-running connection alive when there are no new notifications to deliver, the server will periodically send an empty /meta/connect response to the client.The client should send a new /meta/connect request immediately after receiving such a response, to ensure that the connection remains active and future notifications are delivered.
///
/// public interface IRealtimeNotificationApi diff --git a/Client/Com/Cumulocity/Client/Api/IRetentionRulesApi.cs b/Client/Com/Cumulocity/Client/Api/IRetentionRulesApi.cs index 01ab9ba..0efe401 100644 --- a/Client/Com/Cumulocity/Client/Api/IRetentionRulesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IRetentionRulesApi.cs @@ -49,8 +49,8 @@ public interface IRetentionRulesApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetRetentionRules(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/IRolesApi.cs b/Client/Com/Cumulocity/Client/Api/IRolesApi.cs index 5f0f3e3..befb459 100644 --- a/Client/Com/Cumulocity/Client/Api/IRolesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IRolesApi.cs @@ -45,8 +45,8 @@ public interface IRolesApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetUserRoles(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/ISubscriptionsApi.cs b/Client/Com/Cumulocity/Client/Api/ISubscriptionsApi.cs index cc4b877..1a1fcff 100644 --- a/Client/Com/Cumulocity/Client/Api/ISubscriptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ISubscriptionsApi.cs @@ -52,8 +52,8 @@ public interface ISubscriptionsApi /// The managed object ID to which the subscription is associated.
/// The subscription name by which filtering will be done.
/// The type used to filter subscriptions. This will check the subscription's subscriptionFilter.typeFilter field.
ⓘ Info: Filtering by typeFilter may affect paging. Additional post filtering may be performed if OData-like expressions are used in the subscriptions.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetSubscriptions(string? context = null, int? currentPage = null, int? pageSize = null, string? source = null, string? subscription = null, string? typeFilter = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -157,7 +157,7 @@ public interface ISubscriptionsApi ///
/// Used to explicitly control the processing mode of the request. See for more details.
/// Propagates notification that operations should be canceled.
- /// The context to which the subscription is associated.
ⓘ Info: If the value is mo, then source must also be provided in the query.
+ /// The context to which the subscription is associated.
ⓘ Info: If the value is mo (managed object), then source must also be provided in the query.
/// The managed object ID to which the subscription is associated.
/// Task DeleteSubscriptions(string? xCumulocityProcessingMode = null, string? context = null, string? source = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/ITenantApplicationsApi.cs b/Client/Com/Cumulocity/Client/Api/ITenantApplicationsApi.cs index b760bc4..84f456d 100644 --- a/Client/Com/Cumulocity/Client/Api/ITenantApplicationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ITenantApplicationsApi.cs @@ -54,8 +54,8 @@ public interface ITenantApplicationsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetSubscribedApplications(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; diff --git a/Client/Com/Cumulocity/Client/Api/ITenantsApi.cs b/Client/Com/Cumulocity/Client/Api/ITenantsApi.cs index 69b6360..06bb882 100644 --- a/Client/Com/Cumulocity/Client/Api/ITenantsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ITenantsApi.cs @@ -22,12 +22,12 @@ namespace Client.Com.Cumulocity.Client.Api; /// In general, the tenant domain should be used for communication if it is known.
/// ⚠️ Important: For support user access, the tenant ID must be used and not the tenant domain.
/// See for information on how to retrieve the tenant ID and domain of the current tenant via the API.
-/// In the UI, the tenant ID is displayed in the user dropdown menu, see in the User guide.
+/// In the UI, the tenant ID is displayed in the user dropdown menu, see in the Cumulocity IoT user documentation.
///
Access rights and permissions
/// There are two types of roles in Cumulocity IoT – global and inventory. Global roles are applied at the tenant level. In a Role Based Access Control (RBAC) approach you must use the inventory roles in order to have the correct level of separation. Apart from some global permissions (like "own user management") customer users will not be assigned any roles. Inventory roles must be created, or the default roles used, and then assigned to the user in combination with the assets the roles apply to. This needs to be done at least once for each customer.
/// In a multi-tenancy approach, as the tenant is completely separated from all other customers you do not necessarily need to be involved in setting up the access rights of the customer. If customers are given administration rights for their tenants, they can set up permissions on their own. It is not possible for customers to have any sight or knowledge of other customers.
/// In the RBAC approach, managing access is the most complicated part because a misconfiguration can potentially give customers access to data that they must not see, like other customers' data. The inventory roles allow you to granularly define access for only certain parts of data, but they don't protect you from accidental misconfigurations. A limitation here is that customers won't be able to create their own roles.
-/// For more details, see .
+/// For more details, see .
/// ⓘ Info: The Accept header should be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -57,8 +57,8 @@ public interface ITenantsApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Company name associated with the Cumulocity IoT tenant.
/// Domain name of the Cumulocity IoT tenant.
/// Identifier of the Cumulocity IoT tenant's parent.
@@ -262,4 +262,34 @@ public interface ITenantsApi /// Propagates notification that operations should be canceled.
/// Task GetTenantTfaSettings(string tenantId, CancellationToken cToken = default) ; + + /// + /// Sets TFA settings for a specific tenant
+ /// Sets the two-factor authentication settings of a specific tenant for a specific tenant ID.
+ /// + ///
Required roles
+ /// ((ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_MANAGEMENT_UPDATE) AND (the current tenant is its parent OR the current user belongs to the tenant))) + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 204 The tenant's TFA configuration was updated.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 404 Tenant not found.

+ ///
+ ///
+ ///
+ ///
+ /// + /// Unique identifier of a Cumulocity IoT tenant.
+ /// Propagates notification that operations should be canceled.
+ /// + Task UpdateTenantTfaSettings(TenantTfaStrategy body, string tenantId, CancellationToken cToken = default) ; } diff --git a/Client/Com/Cumulocity/Client/Api/ITrustedCertificatesApi.cs b/Client/Com/Cumulocity/Client/Api/ITrustedCertificatesApi.cs index a16af61..7088ef6 100644 --- a/Client/Com/Cumulocity/Client/Api/ITrustedCertificatesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ITrustedCertificatesApi.cs @@ -16,7 +16,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// API methods for managing trusted certificates used to establish device connections via MQTT.
-/// More detailed information about trusted certificates and their role can be found in in the User guide.
+/// More detailed information about trusted certificates and their role can be found in in the Cumulocity IoT user documentation.
/// ⓘ Info: The Accept header must be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -28,7 +28,7 @@ public interface ITrustedCertificatesApi /// Retrieve all the trusted certificates of a specific tenant (by a given ID).
/// ///
Required roles
- /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN) AND (is the current tenant) + /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN OR ROLE_TENANT_MANAGEMENT_READ) AND (is the current tenant) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -55,8 +55,8 @@ public interface ITrustedCertificatesApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetTrustedCertificates(string tenantId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -144,7 +144,7 @@ public interface ITrustedCertificatesApi /// Retrieve the data of a stored trusted certificate (by a given fingerprint) of a specific tenant (by a given ID).
/// ///
Required roles
- /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN) AND (is the current tenant OR is the management tenant) + /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN OR ROLE_TENANT_MANAGEMENT_READ) AND (is the current tenant OR is the management tenant) /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -332,4 +332,256 @@ public interface ITrustedCertificatesApi /// Propagates notification that operations should be canceled.
/// Task GenerateVerificationCode(string tenantId, string fingerprint, CancellationToken cToken = default) ; + + /// + /// Verify a certificate chain
+ /// Verify a device certificate chain against a specific tenant using file upload or by HTTP headers.The tenant ID is optional and this api will try to resolve the tenant from the chain if not found in the request header.For file upload, the max chain length support is 10 and for a header it is 5.
+ /// If CRL (certificate revocation list) check is enabled on the tenant and the certificate chain is identified to be revoked during validation the further validation of the chain stops and returns unauthorized.
+ /// ⓘ Info: File upload takes precedence over HTTP headers if both are passed.
+ /// + ///
Required roles
+ /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_MANAGEMENT_READ) AND (is the current tenant OR is current management tenant) OR (is authenticated AND is current user service user) + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The certificate chain is valid and not revoked.

+ ///
+ ///
+ /// + /// HTTP 400 Unable to parse certificate chain.

+ ///
+ ///
+ /// + /// HTTP 401 One or more certificates in the chain are revoked or the certificate chain is not valid. Revoked certificates are checked first, then the validity of the certificate chain.

+ ///
+ ///
+ /// + /// HTTP 403 Not enough permissions/roles to perform this operation.

+ ///
+ ///
+ /// + /// HTTP 404 The tenant ID does not exist.

+ ///
+ ///
+ ///
+ ///
+ /// + /// File to be uploaded.
+ /// Used to send a certificate chain in the header. Separate the chain with , and also each 64 bit block with (a space character).
+ /// Propagates notification that operations should be canceled.
+ /// + Task ValidateChain(string tenantId, byte[] file, string? xCumulocityClientCertChain = null, CancellationToken cToken = default) ; + + /// + /// Get revoked certificates
+ /// This endpoint downloads current CRL file containing list of revoked certificate ina binary file format with content-type as application/pkix-crl.
+ /// + ///
Required roles
+ /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN OR ROLE_TENANT_MANAGEMENT_READ) + /// + ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 The CRL file of the current tenant.

+ ///
+ ///
+ ///
+ ///
+ /// Propagates notification that operations should be canceled.
+ /// + Task DownloadCrl(CancellationToken cToken = default) ; + + /// + /// Add revoked certificates
+ /// ⓘ Info: A certificate revocation list (CRL) is a list of digital certificatesthat have been revoked by the issuing certificate authority (CA) before expiration date.In Cumulocity IoT, a CRL check can be in online or offline mode or both.
+ /// An endpoint to add revoked certificate serial numbers for offline CRL check via payload or file.
+ /// For payload, a JSON object required with list of CRL entries, for example:
+ /// + /// Each entry is composed of:
+ /// + /// + /// serialNumberInHex: Needs to be in Hexadecimal Value. e.g As (1000)^16 == (4096)^10, So we have to enter 1000.If duplicate serial number exists in payload, the existing entry stays

+ ///
+ ///
+ /// + /// revocationDate - accepted Date format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example: 2023-01-11T16:12:36.288Z.This is an optional parameter and defaults to the current server UTC date time if not specified in the payload.If specified and the date is in future then those entries will be also defaulted to current date.
+ ///
+ ///
+ ///
+ /// For file upload, each file can hold at maximum 5000 revocation entries.Multiple upload is allowed.In case of duplicates, the latest (last uploaded) entry is considered.
+ /// See below for a sample CSV file:
+ /// | SERIAL NO. | REVOCATION DATE ||--|--|| 1000 | 2023-01-11T16:12:36.288Z |
+ /// Each entry is composed of :
+ /// + /// + /// serialNumberInHex: Needs to be in Hexadecimal Value. e.g (1000)^16 == (4096)^10, So we have to enter 1000.If duplicate serial number exists in payload, the latest entry will be taken.

+ ///
+ ///
+ /// + /// revocationDate: Accepted Date format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z' e.g: 2023-01-11T16:12:36.288Z.This is an optional and will be default to current server UTC date time if not specified in payload.If specified and the date is in future then those entries will be skipped.
+ ///
+ ///
+ ///
+ /// The CRL setting for offline and online check can be enabled/disabled using /tenant/options.Keys are crl.online.check.enabled and crl.offline.check.enabled under the category configuration.
+ /// + ///
Required roles
+ /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN) AND is the current tenant + /// + /// ⚠️ Important: According to CRL policy, added serial numbers cannot be reversed.
+ ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 204 CRLs updated successfully.

+ ///
+ ///
+ /// + /// HTTP 400 Unsupported date time format.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not enough permissions/roles to perform this operation.

+ ///
+ ///
+ ///
+ ///
+ /// + /// Propagates notification that operations should be canceled.
+ /// + Task UpdateCRL(UpdateCRLEntries body, CancellationToken cToken = default) ; + + /// + /// Add revoked certificates
+ /// ⓘ Info: A certificate revocation list (CRL) is a list of digital certificatesthat have been revoked by the issuing certificate authority (CA) before expiration date.In Cumulocity IoT, a CRL check can be in online or offline mode or both.
+ /// An endpoint to add revoked certificate serial numbers for offline CRL check via payload or file.
+ /// For payload, a JSON object required with list of CRL entries, for example:
+ /// + /// Each entry is composed of:
+ /// + /// + /// serialNumberInHex: Needs to be in Hexadecimal Value. e.g As (1000)^16 == (4096)^10, So we have to enter 1000.If duplicate serial number exists in payload, the existing entry stays

+ ///
+ ///
+ /// + /// revocationDate - accepted Date format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example: 2023-01-11T16:12:36.288Z.This is an optional parameter and defaults to the current server UTC date time if not specified in the payload.If specified and the date is in future then those entries will be also defaulted to current date.
+ ///
+ ///
+ ///
+ /// For file upload, each file can hold at maximum 5000 revocation entries.Multiple upload is allowed.In case of duplicates, the latest (last uploaded) entry is considered.
+ /// See below for a sample CSV file:
+ /// | SERIAL NO. | REVOCATION DATE ||--|--|| 1000 | 2023-01-11T16:12:36.288Z |
+ /// Each entry is composed of :
+ /// + /// + /// serialNumberInHex: Needs to be in Hexadecimal Value. e.g (1000)^16 == (4096)^10, So we have to enter 1000.If duplicate serial number exists in payload, the latest entry will be taken.

+ ///
+ ///
+ /// + /// revocationDate: Accepted Date format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z' e.g: 2023-01-11T16:12:36.288Z.This is an optional and will be default to current server UTC date time if not specified in payload.If specified and the date is in future then those entries will be skipped.
+ ///
+ ///
+ ///
+ /// The CRL setting for offline and online check can be enabled/disabled using /tenant/options.Keys are crl.online.check.enabled and crl.offline.check.enabled under the category configuration.
+ /// + ///
Required roles
+ /// (ROLE_TENANT_MANAGEMENT_ADMIN OR ROLE_TENANT_ADMIN) AND is the current tenant + /// + /// ⚠️ Important: According to CRL policy, added serial numbers cannot be reversed.
+ ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 204 CRLs updated successfully.

+ ///
+ ///
+ /// + /// HTTP 400 Unsupported date time format.

+ ///
+ ///
+ /// + /// HTTP 401 Authentication information is missing or invalid.

+ ///
+ ///
+ /// + /// HTTP 403 Not enough permissions/roles to perform this operation.

+ ///
+ ///
+ ///
+ ///
+ /// File to be uploaded.
+ /// Propagates notification that operations should be canceled.
+ /// + Task UpdateCRL(byte[] file, CancellationToken cToken = default) ; + + /// + /// Obtain device access token
+ /// Only those devices which are registered to use cert auth can authenticate via mTLS protocol and retrieve JWT token. Device access token API works only on port 8443 via mutual TLS (mTLS) connection.Immediate issuer of client certificate must present in Platform's truststore, if not then whole certificate chain needs to send in header and root or any intermediate certificate must be present in the Platform's truststore.We must have the following:
+ /// + /// + /// private_key
+ ///
+ ///
+ /// + /// client certificate
+ ///
+ ///
+ /// + /// whole certificate chain (Optional - This API requires the client to send a custom header X-SSL-CERT-CHAIN only if the immediate issuer of the client's certificate is not uploaded as a trusted certificate on the platform. If the immediate issuer is already uploaded and trusted, the header can be omitted)
+ ///
+ ///
+ ///
+ ///
Response Codes
+ /// The following table gives an overview of the possible response codes and their meanings:
+ /// + /// + /// HTTP 200 Successfully retrieved device access token from device certificate.

+ ///
+ ///
+ /// + /// HTTP 400 Unable to parse certificate chain.

+ ///
+ ///
+ /// + /// HTTP 401 One or more certificates in the chain are revoked or the certificate chain is not valid. Revoked certificates are checked first, then the validity of the certificate chain.

+ ///
+ ///
+ /// + /// HTTP 404 Device access token feature is disabled.

+ ///
+ ///
+ /// + /// HTTP 422 The verification was not successful.

+ ///
+ ///
+ ///
+ ///
+ /// Used to send a certificate chain in the header. Separate the chain with (a space character) and also each 64 bit block with (a space character).
+ /// Propagates notification that operations should be canceled.
+ /// + Task ObtainAccessToken(string? xSslCertChain = null, CancellationToken cToken = default) ; } diff --git a/Client/Com/Cumulocity/Client/Api/IUsageStatisticsApi.cs b/Client/Com/Cumulocity/Client/Api/IUsageStatisticsApi.cs index 941706e..517ca70 100644 --- a/Client/Com/Cumulocity/Client/Api/IUsageStatisticsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IUsageStatisticsApi.cs @@ -196,8 +196,8 @@ public interface IUsageStatisticsApi /// Start date or date and time of the statistics.
/// End date or date and time of the statistics.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetTenantUsageStatisticsCollectionResource(int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -206,8 +206,7 @@ public interface IUsageStatisticsApi /// Retrieve a usage statistics summary of a tenant.
/// ///
Required roles
- /// ROLE_TENANT_STATISTICS_READ OR ROLE_INVENTORY_READ
- /// If the `tenant` request parameter is specified, then the current tenant must be the management tenant OR the parent of the requested `tenant`. + /// ROLE_TENANT_STATISTICS_READ OR ROLE_INVENTORY_READ OR ROLE_MANAGED_OBJECT_READ If the `tenant` request parameter is specified, then the current tenant must be the management tenant OR the parent of the requested `tenant`. /// ///
Response Codes
/// The following table gives an overview of the possible response codes and their meanings:
@@ -267,6 +266,7 @@ public interface IUsageStatisticsApi /// Retrieve usage statistics files metadata
/// Retrieve usage statistics summary files report metadata.
/// ⓘ Info: This is only accessible by the Management tenant.
+ /// Date range defines the search criteria for files which have any data inside this range. For example, query containing dateFrom=2023-03-01&dateTo=2023-03-31will return files with statistics from ranges 2023-02-25---2023-03-03, 2023-03-04---2023-03-05, 2023-03-15---2023-04-15, but not the files wherethe whole range of data is outside of queried range, like 2023-02-01---2023-02-27.
/// ///
Required roles
/// ROLE_TENANT_MANAGEMENT_ADMIN @@ -286,10 +286,10 @@ public interface IUsageStatisticsApi ///
/// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
- /// Start date or date and time of the statistics file generation.
- /// End date or date and time of the statistics file generation.
+ /// Start date or date and time of the range included in statistics file.
+ /// End date or date and time of the range included in statistics file.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// Task GetMetadata(int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) ; @@ -307,6 +307,7 @@ public interface IUsageStatisticsApi /// /// /// + /// dateFrom and dateTo are using daily granularity and each day is stored with respect to local Time Zone of the server.
/// ⓘ Info: This is only accessible by the Management tenant.
/// ///
Required roles
diff --git a/Client/Com/Cumulocity/Client/Api/IUsersApi.cs b/Client/Com/Cumulocity/Client/Api/IUsersApi.cs index d905659..a2b91d8 100644 --- a/Client/Com/Cumulocity/Client/Api/IUsersApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IUsersApi.cs @@ -55,8 +55,8 @@ public interface IUsersApi /// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
/// Prefix or full username
/// If set to true, then each of returned user will contain an additional field “subusersCount”.It is the number of direct subusers (users with corresponding “owner”).
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
- /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
+ /// When set to true, the returned result will contain in the statistics object the total number of pages. Only applicable on .
ⓘ Info: To improve performance, the totalPages statistics are cached for 10 seconds.
/// 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; @@ -138,6 +138,7 @@ public interface IUsersApi /// Update a specific user (by a given user ID) for a specific tenant (by a given tenant ID).
/// Any change in user's roles, device permissions and groups creates corresponding audit records with type "User" and activity "User updated" with information which properties have been changed.
/// When the user is updated with changed permissions or groups, a corresponding audit record is created with type "User" and activity "User updated".
+ /// Note that you cannot update the password or email of another user, they can only be updated for the current user.
/// ///
Required roles
/// ROLE_USER_MANAGEMENT_ADMIN to update root users in a user hierarchy OR users that are not in any hierarchy
@@ -210,45 +211,6 @@ public interface IUsersApi /// Task DeleteUser(string tenantId, string userId, CancellationToken cToken = default) ; - /// - /// Update a specific user's password of a specific tenant
- /// Update a specific user's password (by a given user ID) of a specific tenant (by a given tenant ID).
- /// Changing the user's password creates a corresponding audit record of type "User" and activity "User updated", and specifying that the password has been changed.
- /// ⚠️ Important: If the tenant uses OAI-Secure authentication, the target user will be logged out.
- /// - ///
Required roles
- /// ROLE_USER_MANAGEMENT_ADMIN to update root users in a user hierarchy OR users that are not in any hierarchy
- /// ROLE_USER_MANAGEMENT_ADMIN to update non-root users in a user hierarchy AND whose parents have access to assigned roles, groups, device permissions and applications
- /// ROLE_USER_MANAGEMENT_CREATE to update descendants of the current user in a user hierarchy AND whose parents have access to assigned roles, groups, device permissions and applications - /// - ///
Response Codes
- /// The following table gives an overview of the possible response codes and their meanings:
- /// - /// - /// HTTP 200 A user was updated.

- ///
- ///
- /// - /// HTTP 401 Authentication information is missing or invalid.

- ///
- ///
- /// - /// HTTP 403 Not enough permissions/roles to perform this operation.

- ///
- ///
- /// - /// HTTP 422 Unprocessable Entity – invalid payload.

- ///
- ///
- ///
- ///
- /// - /// Unique identifier of a Cumulocity IoT tenant.
- /// Unique identifier of the a user.
- /// Propagates notification that operations should be canceled.
- /// - Task UpdateUserPassword(PasswordChange body, string tenantId, string userId, CancellationToken cToken = default) ; - /// /// Retrieve the TFA settings of a specific user
/// Retrieve the two-factor authentication settings for the specified user.
@@ -350,7 +312,7 @@ public interface IUsersApi /// Propagates notification that operations should be canceled.
/// The current page of the paginated results.
/// Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects.
- /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
+ /// When set to true, the returned result will contain in the statistics object the total number of elements. Only applicable on .
ⓘ Info: To improve performance, the totalElements statistics are cached for 10 seconds.
/// Task?> GetUsersFromUserGroup(string tenantId, int groupId, int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties; diff --git a/Client/Com/Cumulocity/Client/Api/IdentityApi.cs b/Client/Com/Cumulocity/Client/Api/IdentityApi.cs index 412324a..c3b4d43 100644 --- a/Client/Com/Cumulocity/Client/Api/IdentityApi.cs +++ b/Client/Com/Cumulocity/Client/Api/IdentityApi.cs @@ -38,7 +38,7 @@ public IdentityApi(HttpClient httpClient) /// public async Task GetIdentityApiResource(CancellationToken cToken = default) { - const string resourcePath = "/identity"; + const string resourcePath = $"identity"; 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/InventoryRolesApi.cs b/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs index ce2e248..8541575 100644 --- a/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/InventoryRolesApi.cs @@ -38,7 +38,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task GetInventoryRoles(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, CancellationToken cToken = default) { - const string resourcePath = "/user/inventoryroles"; + const string resourcePath = $"user/inventoryroles"; 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 InventoryRolesApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - const string resourcePath = "/user/inventoryroles"; + const string resourcePath = $"user/inventoryroles"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -82,7 +82,7 @@ public InventoryRolesApi(HttpClient httpClient) /// public async Task GetInventoryRole(int id, CancellationToken cToken = default) { - string resourcePath = $"/user/inventoryroles/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/inventory/{HttpUtility.UrlPathEncode(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 0f71dba..1c2f251 100644 --- a/Client/Com/Cumulocity/Client/Api/LoginOptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/LoginOptionsApi.cs @@ -23,7 +23,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// API methods to retrieve the login options configured in the tenant.
-/// More detailed information about the parameters and their meaning can be found in in the Users guide.
+/// More detailed information about the parameters and their meaning can be found in in the Cumulocity IoT user documentation.
/// ⓘ Info: If OAuth external is the only login option shown in the response, the user will be automatically redirected to the SSO login screen.
///
/// @@ -39,7 +39,7 @@ public LoginOptionsApi(HttpClient httpClient) /// public async Task GetLoginOptions(bool? management = null, string? tenantId = null, CancellationToken cToken = default) { - const string resourcePath = "/tenant/loginOptions"; + const string resourcePath = $"tenant/loginOptions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("management", management); @@ -63,7 +63,7 @@ public LoginOptionsApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - const string resourcePath = "/tenant/loginOptions"; + const string resourcePath = $"tenant/loginOptions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -82,7 +82,7 @@ public LoginOptionsApi(HttpClient httpClient) /// public async Task GetLoginOption(string typeOrId, CancellationToken cToken = default) { - string resourcePath = $"/tenant/loginOptions/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 2f6b360..4c62549 100644 --- a/Client/Com/Cumulocity/Client/Api/ManagedObjectsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/ManagedObjectsApi.cs @@ -23,6 +23,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// The inventory stores devices and other assets relevant to your IoT solution. We refer to them as managed objects and such can be “smart objects”, for example, smart electricity meters, home automation gateways or GPS devices.
+/// For further information, refer to in the Cumulocity IoT user documentation.
/// ⓘ Info: The Accept header should be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -36,9 +37,9 @@ public ManagedObjectsApi(HttpClient httpClient) } /// - public async Task?> GetManagedObjects(string? childAdditionId = null, string? childAssetId = null, string? childDeviceId = null, int? currentPage = null, string? fragmentType = null, List? ids = null, bool? onlyRoots = null, string? owner = null, int? pageSize = null, string? q = null, string? query = null, bool? skipChildrenNames = null, string? text = null, string? type = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withGroups = null, bool? withParents = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TManagedObject : ManagedObject + public async Task?> GetManagedObjects(string? childAdditionId = null, string? childAssetId = null, string? childDeviceId = null, int? currentPage = null, string? fragmentType = null, List? ids = null, bool? onlyRoots = null, string? owner = null, int? pageSize = null, string? q = null, string? query = null, bool? skipChildrenNames = null, string? text = null, string? type = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withGroups = null, bool? withParents = null, bool? withTotalElements = null, bool? withTotalPages = null, bool? withLatestValues = null, CancellationToken cToken = default) where TManagedObject : ManagedObject { - const string resourcePath = "/inventory/managedObjects"; + const string resourcePath = $"inventory/managedObjects"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("childAdditionId", childAdditionId); @@ -61,6 +62,7 @@ public ManagedObjectsApi(HttpClient httpClient) queryString.TryAdd("withParents", withParents); queryString.TryAdd("withTotalElements", withTotalElements); queryString.TryAdd("withTotalPages", withTotalPages); + queryString.TryAdd("withLatestValues", withLatestValues); uriBuilder.Query = queryString.ToString(); using var request = new HttpRequestMessage { @@ -85,11 +87,12 @@ public ManagedObjectsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("childAssets"); jsonNode?.RemoveFromNode("creationTime"); jsonNode?.RemoveFromNode("childAdditions"); + jsonNode?.RemoveFromNode("c8y_LatestMeasurements"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - const string resourcePath = "/inventory/managedObjects"; + const string resourcePath = $"inventory/managedObjects"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -107,15 +110,16 @@ 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 + public async Task GetManagedObject(string id, bool? skipChildrenNames = null, bool? withChildren = null, bool? withChildrenCount = null, bool? withParents = null, bool? withLatestValues = null, CancellationToken cToken = default) where TManagedObject : ManagedObject { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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); queryString.TryAdd("withChildren", withChildren); queryString.TryAdd("withChildrenCount", withChildrenCount); queryString.TryAdd("withParents", withParents); + queryString.TryAdd("withLatestValues", withLatestValues); uriBuilder.Query = queryString.ToString(); using var request = new HttpRequestMessage { @@ -140,11 +144,12 @@ public ManagedObjectsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("childAssets"); jsonNode?.RemoveFromNode("creationTime"); jsonNode?.RemoveFromNode("childAdditions"); + jsonNode?.RemoveFromNode("c8y_LatestMeasurements"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("assetParents"); jsonNode?.RemoveFromNode("deviceParents"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +169,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.UrlPathEncode(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 +191,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetLatestAvailability(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +208,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetSupportedMeasurements(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +225,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetSupportedSeries(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +242,7 @@ public ManagedObjectsApi(HttpClient httpClient) /// public async Task GetManagedObjectUser(string id, CancellationToken cToken = default) { - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 +262,7 @@ public ManagedObjectsApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("userName"); - string resourcePath = $"/inventory/managedObjects/{HttpUtility.UrlPathEncode(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 0e68cf2..a6ada57 100644 --- a/Client/Com/Cumulocity/Client/Api/MeasurementsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/MeasurementsApi.cs @@ -38,7 +38,7 @@ public MeasurementsApi(HttpClient httpClient) /// public async Task?> GetMeasurements(int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, bool? revert = null, string? source = null, string? type = null, string? valueFragmentSeries = null, string? valueFragmentType = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TMeasurement : Measurement { - const string resourcePath = "/measurement/measurements"; + const string resourcePath = $"measurement/measurements"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -72,7 +72,7 @@ public MeasurementsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("source", "self"); - const string resourcePath = "/measurement/measurements"; + const string resourcePath = $"measurement/measurements"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -97,7 +97,7 @@ public MeasurementsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("prev"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("statistics"); - const string resourcePath = "/measurement/measurements"; + const string resourcePath = $"measurement/measurements"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -117,7 +117,7 @@ public MeasurementsApi(HttpClient httpClient) /// public async Task DeleteMeasurements(string? xCumulocityProcessingMode = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? fragmentType = null, string? source = null, string? type = null, CancellationToken cToken = default) { - const string resourcePath = "/measurement/measurements"; + const string resourcePath = $"measurement/measurements"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("dateFrom", dateFrom); @@ -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.UrlPathEncode(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.UrlPathEncode(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 { @@ -175,14 +175,14 @@ public MeasurementsApi(HttpClient httpClient) /// public async Task GetMeasurementSeries(string? aggregationType = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, bool? revert = null, List? series = null, string? source = null, CancellationToken cToken = default) { - const string resourcePath = "/measurement/measurements/series"; + const string resourcePath = $"measurement/measurements/series"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("aggregationType", aggregationType); queryString.TryAdd("dateFrom", dateFrom); queryString.TryAdd("dateTo", dateTo); queryString.TryAdd("revert", revert); - queryString.TryAdd("series", series, false); + queryString.TryAdd("series", series, true); queryString.TryAdd("source", source); uriBuilder.Query = queryString.ToString(); using var request = new HttpRequestMessage diff --git a/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs b/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs index 2dbdba4..974f843 100644 --- a/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/NewDeviceRequestsApi.cs @@ -38,7 +38,7 @@ public NewDeviceRequestsApi(HttpClient httpClient) /// public async Task GetNewDeviceRequests(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/devicecontrol/newDeviceRequests"; + const string resourcePath = $"devicecontrol/newDeviceRequests"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -62,9 +62,13 @@ public NewDeviceRequestsApi(HttpClient httpClient) public async Task CreateNewDeviceRequest(NewDeviceRequest body, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); + jsonNode?.RemoveFromNode("owner"); + jsonNode?.RemoveFromNode("securityToken"); + jsonNode?.RemoveFromNode("creationTime"); + jsonNode?.RemoveFromNode("tenantId"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("status"); - const string resourcePath = "/devicecontrol/newDeviceRequests"; + const string resourcePath = $"devicecontrol/newDeviceRequests"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -84,7 +88,7 @@ public NewDeviceRequestsApi(HttpClient httpClient) /// public async Task GetNewDeviceRequest(string requestId, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlPathEncode(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 { @@ -102,9 +106,14 @@ public NewDeviceRequestsApi(HttpClient httpClient) public async Task UpdateNewDeviceRequest(NewDeviceRequest body, string requestId, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); + jsonNode?.RemoveFromNode("owner"); + jsonNode?.RemoveFromNode("creationTime"); + jsonNode?.RemoveFromNode("groupId"); + jsonNode?.RemoveFromNode("tenantId"); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlPathEncode(requestId.GetStringValue())}"; + jsonNode?.RemoveFromNode("type"); + 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 +132,7 @@ public NewDeviceRequestsApi(HttpClient httpClient) /// public async Task DeleteNewDeviceRequest(string requestId, CancellationToken cToken = default) { - string resourcePath = $"/devicecontrol/newDeviceRequests/{HttpUtility.UrlPathEncode(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 b196816..4fd1e65 100644 --- a/Client/Com/Cumulocity/Client/Api/OperationsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/OperationsApi.cs @@ -38,7 +38,7 @@ public OperationsApi(HttpClient httpClient) /// public async Task?> GetOperations(string? agentId = null, string? bulkOperationId = null, int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? deviceId = null, string? fragmentType = null, int? pageSize = null, bool? revert = null, string? status = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) where TOperation : Operation { - const string resourcePath = "/devicecontrol/operations"; + const string resourcePath = $"devicecontrol/operations"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("agentId", agentId); @@ -77,7 +77,7 @@ public OperationsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("status"); - const string resourcePath = "/devicecontrol/operations"; + const string resourcePath = $"devicecontrol/operations"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -97,7 +97,7 @@ public OperationsApi(HttpClient httpClient) /// public async Task DeleteOperations(string? xCumulocityProcessingMode = null, string? agentId = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? deviceId = null, string? status = null, CancellationToken cToken = default) { - const string resourcePath = "/devicecontrol/operations"; + const string resourcePath = $"devicecontrol/operations"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("agentId", agentId); @@ -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.UrlPathEncode(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.UrlPathEncode(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 e81b835..40d266e 100644 --- a/Client/Com/Cumulocity/Client/Api/OptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/OptionsApi.cs @@ -38,7 +38,7 @@ public OptionsApi(HttpClient httpClient) /// public async Task GetOptions(int? currentPage = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/tenant/options"; + const string resourcePath = $"tenant/options"; 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 OptionsApi(HttpClient httpClient) { var jsonNode = body.ToJsonNode
/// public sealed class RealtimeNotificationApi : IRealtimeNotificationApi @@ -203,7 +205,7 @@ public RealtimeNotificationApi(HttpClient httpClient) jsonNode?.RemoveFromNode("data"); jsonNode?.RemoveFromNode("error"); jsonNode?.RemoveFromNode("successful"); - const string resourcePath = "/notification/realtime"; + const string resourcePath = $"notification/realtime"; 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 1937da2..6e4919d 100644 --- a/Client/Com/Cumulocity/Client/Api/RetentionRulesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/RetentionRulesApi.cs @@ -38,7 +38,7 @@ public RetentionRulesApi(HttpClient httpClient) /// public async Task GetRetentionRules(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/retention/retentions"; + const string resourcePath = $"retention/retentions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -64,7 +64,7 @@ public RetentionRulesApi(HttpClient httpClient) var jsonNode = body.ToJsonNode(); jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); - const string resourcePath = "/retention/retentions"; + const string resourcePath = $"retention/retentions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -83,7 +83,7 @@ public RetentionRulesApi(HttpClient httpClient) /// public async Task GetRetentionRule(string id, CancellationToken cToken = default) { - string resourcePath = $"/retention/retentions/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 4c90a3d..5950759 100644 --- a/Client/Com/Cumulocity/Client/Api/RolesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/RolesApi.cs @@ -38,7 +38,7 @@ public RolesApi(HttpClient httpClient) /// public async Task GetUserRoles(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/user/roles"; + const string resourcePath = $"user/roles"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -61,7 +61,7 @@ public RolesApi(HttpClient httpClient) /// public async Task GetUserRole(string name, CancellationToken cToken = default) { - string resourcePath = $"/user/roles/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/roles/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(userId.GetStringValue())}/roles/{HttpUtility.UrlPathEncode(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 7b376b5..76d3663 100644 --- a/Client/Com/Cumulocity/Client/Api/SubscriptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/SubscriptionsApi.cs @@ -37,7 +37,7 @@ public SubscriptionsApi(HttpClient httpClient) /// public async Task GetSubscriptions(string? context = null, int? currentPage = null, int? pageSize = null, string? source = null, string? subscription = null, string? typeFilter = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/notification2/subscriptions"; + const string resourcePath = $"notification2/subscriptions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("context", context); @@ -68,7 +68,7 @@ public SubscriptionsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("self"); jsonNode?.RemoveFromNode("id"); jsonNode?.RemoveFromNode("source", "self"); - const string resourcePath = "/notification2/subscriptions"; + const string resourcePath = $"notification2/subscriptions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -88,7 +88,7 @@ public SubscriptionsApi(HttpClient httpClient) /// public async Task DeleteSubscriptions(string? xCumulocityProcessingMode = null, string? context = null, string? source = null, CancellationToken cToken = default) { - const string resourcePath = "/notification2/subscriptions"; + const string resourcePath = $"notification2/subscriptions"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("context", context); @@ -109,7 +109,7 @@ public SubscriptionsApi(HttpClient httpClient) /// public async Task GetSubscription(string id, CancellationToken cToken = default) { - string resourcePath = $"/notification2/subscriptions/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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 a21fe92..79a1f61 100644 --- a/Client/Com/Cumulocity/Client/Api/SystemOptionsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/SystemOptionsApi.cs @@ -40,7 +40,7 @@ public SystemOptionsApi(HttpClient httpClient) /// public async Task GetSystemOptions(CancellationToken cToken = default) { - const string resourcePath = "/tenant/system/options"; + const string resourcePath = $"tenant/system/options"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -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.UrlPathEncode(category.GetStringValue())}/{HttpUtility.UrlPathEncode(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 30d6a30..19f1691 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/applications/{HttpUtility.UrlPathEncode(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 e040d7b..71de93f 100644 --- a/Client/Com/Cumulocity/Client/Api/TenantsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/TenantsApi.cs @@ -29,12 +29,12 @@ namespace Client.Com.Cumulocity.Client.Api; /// In general, the tenant domain should be used for communication if it is known.
/// ⚠️ Important: For support user access, the tenant ID must be used and not the tenant domain.
/// See for information on how to retrieve the tenant ID and domain of the current tenant via the API.
-/// In the UI, the tenant ID is displayed in the user dropdown menu, see in the User guide.
+/// In the UI, the tenant ID is displayed in the user dropdown menu, see in the Cumulocity IoT user documentation.
///
Access rights and permissions
/// There are two types of roles in Cumulocity IoT – global and inventory. Global roles are applied at the tenant level. In a Role Based Access Control (RBAC) approach you must use the inventory roles in order to have the correct level of separation. Apart from some global permissions (like "own user management") customer users will not be assigned any roles. Inventory roles must be created, or the default roles used, and then assigned to the user in combination with the assets the roles apply to. This needs to be done at least once for each customer.
/// In a multi-tenancy approach, as the tenant is completely separated from all other customers you do not necessarily need to be involved in setting up the access rights of the customer. If customers are given administration rights for their tenants, they can set up permissions on their own. It is not possible for customers to have any sight or knowledge of other customers.
/// In the RBAC approach, managing access is the most complicated part because a misconfiguration can potentially give customers access to data that they must not see, like other customers' data. The inventory roles allow you to granularly define access for only certain parts of data, but they don't protect you from accidental misconfigurations. A limitation here is that customers won't be able to create their own roles.
-/// For more details, see .
+/// For more details, see .
/// ⓘ Info: The Accept header should be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -50,7 +50,7 @@ public TenantsApi(HttpClient httpClient) /// public async Task?> GetTenants(int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, string? company = null, string? domain = null, string? parent = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - const string resourcePath = "/tenant/tenants"; + const string resourcePath = $"tenant/tenants"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -85,7 +85,7 @@ public TenantsApi(HttpClient httpClient) jsonNode?.RemoveFromNode("ownedApplications"); jsonNode?.RemoveFromNode("applications"); jsonNode?.RemoveFromNode("status"); - const string resourcePath = "/tenant/tenants"; + const string resourcePath = $"tenant/tenants"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -104,7 +104,7 @@ public TenantsApi(HttpClient httpClient) /// public async Task?> GetCurrentTenant(bool? withParent = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - const string resourcePath = "/tenant/currentTenant"; + const string resourcePath = $"tenant/currentTenant"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("withParent", withParent); @@ -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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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 { @@ -199,4 +199,23 @@ public TenantsApi(HttpClient httpClient) await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); return await JsonSerializerWrapper.DeserializeAsync(responseStream, cancellationToken: cToken).ConfigureAwait(false); } + + /// + public async Task UpdateTenantTfaSettings(TenantTfaStrategy body, string tenantId, CancellationToken cToken = default) + { + var jsonNode = body.ToJsonNode(); + 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 + { + Content = new StringContent(jsonNode?.ToString() ?? string.Empty, Encoding.UTF8, "application/json"), + Method = HttpMethod.Put, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Content-Type", "application/json"); + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } } diff --git a/Client/Com/Cumulocity/Client/Api/TokensApi.cs b/Client/Com/Cumulocity/Client/Api/TokensApi.cs index 3008ef2..5862909 100644 --- a/Client/Com/Cumulocity/Client/Api/TokensApi.cs +++ b/Client/Com/Cumulocity/Client/Api/TokensApi.cs @@ -38,7 +38,7 @@ public TokensApi(HttpClient httpClient) public async Task CreateToken(NotificationTokenClaims body, string? xCumulocityProcessingMode = null, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - const string resourcePath = "/notification2/token"; + const string resourcePath = $"notification2/token"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -58,7 +58,7 @@ public TokensApi(HttpClient httpClient) /// public async Task UnsubscribeSubscriber(string? xCumulocityProcessingMode = null, string? token = null, CancellationToken cToken = default) { - const string resourcePath = "/notification2/unsubscribe"; + const string resourcePath = $"notification2/unsubscribe"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("token", token); diff --git a/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs b/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs index a918472..418d379 100644 --- a/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs +++ b/Client/Com/Cumulocity/Client/Api/TrustedCertificatesApi.cs @@ -23,7 +23,7 @@ namespace Client.Com.Cumulocity.Client.Api; /// /// API methods for managing trusted certificates used to establish device connections via MQTT.
-/// More detailed information about trusted certificates and their role can be found in in the User guide.
+/// More detailed information about trusted certificates and their role can be found in in the Cumulocity IoT user documentation.
/// ⓘ Info: The Accept header must be provided in all POST/PUT requests, otherwise an empty response body will be returned.
///
/// @@ -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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/trusted-certificates-pop/{HttpUtility.UrlPathEncode(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 { @@ -229,4 +229,106 @@ public TrustedCertificatesApi(HttpClient httpClient) await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); return await JsonSerializerWrapper.DeserializeAsync(responseStream, cancellationToken: cToken).ConfigureAwait(false); } + + /// + public async Task ValidateChain(string tenantId, byte[] file, string? xCumulocityClientCertChain = null, CancellationToken cToken = default) + { + const string resourcePath = $"tenant/trusted-certificates/verify-cert-chain"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + var requestContent = new MultipartFormDataContent(); + var fileContentTenantId = new StringContent(JsonSerializerWrapper.Serialize(tenantId)); + fileContentTenantId.Headers.ContentType = MediaTypeHeaderValue.Parse("text/plain"); + requestContent.Add(fileContentTenantId, "tenantId"); + var fileContentFile = new ByteArrayContent(file); + fileContentFile.Headers.ContentType = MediaTypeHeaderValue.Parse("text/plain"); + requestContent.Add(fileContentFile, "file"); + using var request = new HttpRequestMessage + { + Content = requestContent, + Method = HttpMethod.Post, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("X-Cumulocity-Client-Cert-Chain", xCumulocityClientCertChain); + request.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data"); + request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + return await JsonSerializerWrapper.DeserializeAsync(responseStream, cancellationToken: cToken).ConfigureAwait(false); + } + + /// + public async Task DownloadCrl(CancellationToken cToken = default) + { + const string resourcePath = $"tenant/trusted-certificates/settings/crl"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Get, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Accept", "application/pkix-crl"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + /// + public async Task UpdateCRL(UpdateCRLEntries body, CancellationToken cToken = default) + { + var jsonNode = body.ToJsonNode(); + const string resourcePath = $"tenant/trusted-certificates/settings/crl"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Content = new StringContent(jsonNode?.ToString() ?? string.Empty, Encoding.UTF8, "application/json"), + Method = HttpMethod.Put, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Content-Type", "application/json"); + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } + + /// + public async Task UpdateCRL(byte[] file, CancellationToken cToken = default) + { + const string resourcePath = $"tenant/trusted-certificates/settings/crl"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + var requestContent = new MultipartFormDataContent(); + var fileContentFile = new ByteArrayContent(file); + fileContentFile.Headers.ContentType = MediaTypeHeaderValue.Parse("text/plain"); + requestContent.Add(fileContentFile, "file"); + using var request = new HttpRequestMessage + { + Content = requestContent, + Method = HttpMethod.Put, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data"); + request.Headers.TryAddWithoutValidation("Accept", "application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + } + + /// + public async Task ObtainAccessToken(string? xSslCertChain = null, CancellationToken cToken = default) + { + const string resourcePath = $"devicecontrol/deviceAccessToken"; + var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); + using var request = new HttpRequestMessage + { + Method = HttpMethod.Post, + RequestUri = new Uri(uriBuilder.ToString()) + }; + request.Headers.TryAddWithoutValidation("X-Ssl-Cert-Chain", xSslCertChain); + request.Headers.TryAddWithoutValidation("Accept", "application/vnd.com.nsn.cumulocity.error+json, application/json"); + using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); + await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); + await using var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + return await JsonSerializerWrapper.DeserializeAsync(responseStream, cancellationToken: cToken).ConfigureAwait(false); + } } diff --git a/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs b/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs index 72977f1..ec34520 100644 --- a/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs +++ b/Client/Com/Cumulocity/Client/Api/UsageStatisticsApi.cs @@ -187,7 +187,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task GetTenantUsageStatisticsCollectionResource(int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/tenant/statistics"; + const string resourcePath = $"tenant/statistics"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -212,7 +212,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task GetTenantUsageStatistics(System.DateTime? dateFrom = null, System.DateTime? dateTo = null, string? tenant = null, CancellationToken cToken = default) { - const string resourcePath = "/tenant/statistics/summary"; + const string resourcePath = $"tenant/statistics/summary"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("dateFrom", dateFrom); @@ -234,7 +234,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task>?> GetTenantsUsageStatistics(System.DateTime? dateFrom = null, System.DateTime? dateTo = null, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - const string resourcePath = "/tenant/statistics/allTenantsSummary"; + const string resourcePath = $"tenant/statistics/allTenantsSummary"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("dateFrom", dateFrom); @@ -255,7 +255,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task GetMetadata(int? currentPage = null, System.DateTime? dateFrom = null, System.DateTime? dateTo = null, int? pageSize = null, bool? withTotalPages = null, CancellationToken cToken = default) { - const string resourcePath = "/tenant/statistics/files"; + const string resourcePath = $"tenant/statistics/files"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); var queryString = HttpUtility.ParseQueryString(uriBuilder.Query); queryString.TryAdd("currentPage", currentPage); @@ -280,7 +280,7 @@ public UsageStatisticsApi(HttpClient httpClient) public async Task GenerateStatisticsFile(RangeStatisticsFile body, CancellationToken cToken = default) { var jsonNode = body.ToJsonNode(); - const string resourcePath = "/tenant/statistics/files"; + const string resourcePath = $"tenant/statistics/files"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -299,7 +299,7 @@ public UsageStatisticsApi(HttpClient httpClient) /// public async Task GetStatisticsFile(string id, CancellationToken cToken = default) { - string resourcePath = $"/tenant/statistics/files/{HttpUtility.UrlPathEncode(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.UrlPathEncode(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 1e87e28..4c102ee 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.UrlPathEncode(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.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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 { @@ -159,29 +159,10 @@ public UsersApi(HttpClient httpClient) return await response.Content.ReadAsStringAsync().ConfigureAwait(false); } - /// - public async Task UpdateUserPassword(PasswordChange body, string tenantId, string userId, CancellationToken cToken = default) - { - var jsonNode = body.ToJsonNode(); - 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 - { - Content = new StringContent(jsonNode?.ToString() ?? string.Empty, Encoding.UTF8, "application/json"), - Method = HttpMethod.Put, - RequestUri = new Uri(uriBuilder.ToString()) - }; - request.Headers.TryAddWithoutValidation("Content-Type", "application/json"); - request.Headers.TryAddWithoutValidation("Accept", "application/json"); - using var response = await _httpClient.SendAsync(request: request, cancellationToken: cToken).ConfigureAwait(false); - await response.EnsureSuccessStatusCodeWithContentInfo().ConfigureAwait(false); - return await response.Content.ReadAsStringAsync().ConfigureAwait(false); - } - /// public async Task GetUserTfaSettings(string tenantId, string userId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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 +179,7 @@ public UsersApi(HttpClient httpClient) /// public async Task?> GetUserByUsername(string tenantId, string username, CancellationToken cToken = default) where TCustomProperties : CustomProperties { - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/userByName/{HttpUtility.UrlPathEncode(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 +196,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.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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 +219,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.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(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 +238,7 @@ public UsersApi(HttpClient httpClient) /// public async Task RemoveUserFromUserGroup(string tenantId, int groupId, string userId, CancellationToken cToken = default) { - string resourcePath = $"/user/{HttpUtility.UrlPathEncode(tenantId.GetStringValue())}/groups/{HttpUtility.UrlPathEncode(groupId.GetStringValue())}/users/{HttpUtility.UrlPathEncode(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 { @@ -273,7 +254,7 @@ public UsersApi(HttpClient httpClient) /// public async Task Logout(string? cookie = null, string? xXSRFTOKEN = null, CancellationToken cToken = default) { - const string resourcePath = "/user/logout"; + const string resourcePath = $"user/logout"; var uriBuilder = new UriBuilder(new Uri(_httpClient.BaseAddress ?? new Uri(resourcePath), resourcePath)); using var request = new HttpRequestMessage { @@ -291,7 +272,7 @@ public UsersApi(HttpClient httpClient) /// public async Task LogoutAllUsers(string tenantId, CancellationToken cToken = default) { - string resourcePath = $"/user/logout/{HttpUtility.UrlPathEncode(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 { diff --git a/Client/Com/Cumulocity/Client/Model/Alarm.cs b/Client/Com/Cumulocity/Client/Model/Alarm.cs index 6f430c5..3b7bd03 100644 --- a/Client/Com/Cumulocity/Client/Model/Alarm.cs +++ b/Client/Com/Cumulocity/Client/Model/Alarm.cs @@ -105,7 +105,7 @@ public class Alarm /// /// It is possible to add an arbitrary number of additional properties as a list of key-value pairs, for example, "property1": {}, "property2": "value". These properties are known as custom fragments and can be of any type, for example, object or string. Each custom fragment is identified by a unique name.
- /// Review the as there are characters that can not be used when naming custom fragments.
+ /// Review in the Cumulocity IoT user documentation as there are characters that can not be used when naming custom fragments.
///
/// [JsonPropertyName("customFragments")] diff --git a/Client/Com/Cumulocity/Client/Model/ApplicationVersionTag.cs b/Client/Com/Cumulocity/Client/Model/ApplicationVersionTag.cs index 99bddfe..424393f 100644 --- a/Client/Com/Cumulocity/Client/Model/ApplicationVersionTag.cs +++ b/Client/Com/Cumulocity/Client/Model/ApplicationVersionTag.cs @@ -21,16 +21,16 @@ public sealed class ApplicationVersionTag /// Tag assigned to the version. Version tags must be unique across all versions and version fields of application versions.
///
/// - [JsonPropertyName("tag")] - public List Tag { get; set; } = new List(); + [JsonPropertyName("tags")] + public List Tags { get; set; } = new List(); public ApplicationVersionTag() { } - public ApplicationVersionTag(List tag) + public ApplicationVersionTag(List tags) { - this.Tag = tag; + this.Tags = tags; } public override string ToString() diff --git a/Client/Com/Cumulocity/Client/Model/AuthConfig.cs b/Client/Com/Cumulocity/Client/Model/AuthConfig.cs index c366cde..ddd3109 100644 --- a/Client/Com/Cumulocity/Client/Model/AuthConfig.cs +++ b/Client/Com/Cumulocity/Client/Model/AuthConfig.cs @@ -106,7 +106,7 @@ public sealed class AuthConfig public string? ProviderName { get; set; } /// - /// SSO specific. URL used for redirecting to the Cumulocity IoT platform.
+ /// SSO specific. URL used for redirecting to the Cumulocity IoT platform. Do not set or leave it empty to allow SSO flow to be controlled by client (UI) applications.
///
/// [JsonPropertyName("redirectToPlatform")] @@ -123,7 +123,7 @@ public sealed class AuthConfig public string? Self { get; set; } /// - /// The session configuration properties are only available for OAuth internal. See for more details.
+ /// The session configuration properties are only available for OAI-Secure. See in the Cumulocity IoT user documentation.
///
/// [JsonPropertyName("sessionConfiguration")] @@ -153,6 +153,13 @@ public sealed class AuthConfig [JsonPropertyName("type")] public Type? PType { get; set; } + /// + /// If set to true, user data and the userId are retrieved using the claims from the id_token; otherwise, they are based on the access_token.
+ ///
+ /// + [JsonPropertyName("useIdToken")] + public bool? UseIdToken { get; set; } + /// /// SSO specific. Points to the field in the obtained JWT access token that should be used as the username in the Cumulocity IoT platform.
///
@@ -174,6 +181,13 @@ public sealed class AuthConfig [JsonPropertyName("visibleOnLoginPage")] public bool? VisibleOnLoginPage { get; set; } + /// + /// A configuration for authentication with an access token from the authorization server.
+ ///
+ /// + [JsonPropertyName("externalTokenConfig")] + public ExternalTokenConfig? PExternalTokenConfig { get; set; } + public AuthConfig() { } @@ -302,6 +316,13 @@ public sealed class DynamicMapping [JsonPropertyName("mappings")] public List PMappings { get; set; } = new List(); + /// + /// Represents rules used to assign inventory roles.
+ ///
+ /// + [JsonPropertyName("inventoryMappings")] + public List PInventoryMappings { get; set; } = new List(); + /// /// Configuration of the mapping.
///
@@ -316,6 +337,20 @@ public sealed class Configuration [JsonPropertyName("mapRolesOnlyForNewUser")] public bool? MapRolesOnlyForNewUser { get; set; } + /// + /// If set to true, dynamic access mapping is only managed for global roles, applications and inventory roles which are listed in the configuration. Others remain unchanged.
+ ///
+ /// + [JsonPropertyName("manageRolesOnlyFromAccessMapping")] + public bool? ManageRolesOnlyFromAccessMapping { get; set; } + + /// + /// If set to true, dynamic access mapping is performed using the claims from the id_token; otherwise, it is based on the access_token.
+ ///
+ /// + [JsonPropertyName("mapFromIdToken")] + public bool? MapFromIdToken { get; set; } + public override string ToString() { return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); @@ -330,7 +365,7 @@ public sealed class Mappings { /// - /// Represents a predicate for verification. It acts as a condition which is necessary to assign a user to the given groups and permit access to the specified applications.
+ /// Represents a predicate for verification. It acts as a condition which is necessary to assign a user to the given groups, permit access to the specified applications or to assign specific inventory roles to device groups.
///
/// [JsonPropertyName("when")] @@ -356,6 +391,60 @@ public override string ToString() } } + /// + /// Represents information of mapping access to inventory roles.
+ ///
+ /// + public sealed class InventoryMappings + { + + /// + /// Represents a predicate for verification. It acts as a condition which is necessary to assign a user to the given groups, permit access to the specified applications or to assign specific inventory roles to device groups.
+ ///
+ /// + [JsonPropertyName("when")] + public JSONPredicateRepresentation? When { get; set; } + + /// + /// List of the OAuth inventory assignments.
+ ///
+ /// + [JsonPropertyName("thenInventoryRoles")] + public List PThenInventoryRoles { get; set; } = new List(); + + /// + /// Represents inventory roles for a specific device group.
+ ///
+ /// + public sealed class ThenInventoryRoles + { + + /// + /// A unique identifier for the managed object for which the roles are assigned.
+ ///
+ /// + [JsonPropertyName("managedObject")] + public string? ManagedObject { get; set; } + + /// + /// List of the inventory roles' identifiers.
+ ///
+ /// + [JsonPropertyName("roleIds")] + public List RoleIds { get; set; } = new List(); + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } + } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } + } + public override string ToString() { return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); @@ -594,6 +683,105 @@ public override string ToString() } + /// + /// A configuration for authentication with an access token from the authorization server.
+ ///
+ /// + public sealed class ExternalTokenConfig + { + + /// + /// Indicates whether authentication is enabled or disabled.
+ ///
+ /// + [JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + + /// + /// Points to the claim of the access token from the authorization server that must be used as the username in the Cumulocity IoT platform.
+ ///
+ /// + [JsonPropertyName("userOrAppIdConfig")] + public UserOrAppIdConfig? PUserOrAppIdConfig { get; set; } + + /// + /// If set to true, the access token is validated against the authorization server by way of introspection or user info request.
+ ///
+ /// + [JsonPropertyName("validationRequired")] + public bool? ValidationRequired { get; set; } + + /// + /// The method of validation of the access token.
+ ///
+ /// + [JsonPropertyName("validationMethod")] + public ValidationMethod? PValidationMethod { get; set; } + + [JsonPropertyName("tokenValidationRequest")] + public RequestRepresentation? TokenValidationRequest { get; set; } + + /// + /// The frequency (in Minutes) in which Cumulocity sends a validation request to authorization server. The recommended frequency is 1 minute.
+ ///
+ /// + [JsonPropertyName("accessTokenValidityCheckIntervalInMinutes")] + public int? AccessTokenValidityCheckIntervalInMinutes { get; set; } + + /// + /// The method of validation of the access token.
+ ///
+ /// + [JsonConverter(typeof(EnumConverterFactory))] + public enum ValidationMethod + { + [EnumMember(Value = "INTROSPECTION")] + INTROSPECTION, + [EnumMember(Value = "USERINFO")] + USERINFO + } + + /// + /// Points to the claim of the access token from the authorization server that must be used as the username in the Cumulocity IoT platform.
+ ///
+ /// + public sealed class UserOrAppIdConfig + { + + /// + /// Used only if useConstantValue is set to true.
+ ///
+ /// + [JsonPropertyName("constantValue")] + public string? ConstantValue { get; set; } + + /// + /// The name of the field containing the JWT.
+ ///
+ /// + [JsonPropertyName("jwtField")] + public string? JwtField { get; set; } + + /// + /// Not recommended. If set to true, all users share a single account in the Cumulocity IoT platform.
+ ///
+ /// + [JsonPropertyName("useConstantValue")] + public bool? UseConstantValue { get; set; } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } + } + + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } + } + public override string ToString() { return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); diff --git a/Client/Com/Cumulocity/Client/Model/C8yLatestMeasurements.cs b/Client/Com/Cumulocity/Client/Model/C8yLatestMeasurements.cs new file mode 100644 index 0000000..9d23152 --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/C8yLatestMeasurements.cs @@ -0,0 +1,39 @@ +// +// C8yLatestMeasurements.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +/// +/// The read only fragment which contains the latest measurements reported by the device.The returned optionally only if the query parameter withLatestValues=true is used.
+/// ⚠️ Feature Preview: The feature is part of the Latest Measurement feature which is still under public feature preview.
+///
+/// +public sealed class C8yLatestMeasurements +{ + + [JsonPropertyName("additionalProperties")] + public IDictionary AdditionalProperties { get; set; } = new Dictionary(); + + [JsonIgnore] + public LatestMeasurementFragment? this[string key] + { + get => AdditionalProperties[key]; + set => AdditionalProperties[key] = value; + } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/CRLEntry.cs b/Client/Com/Cumulocity/Client/Model/CRLEntry.cs new file mode 100644 index 0000000..19698cc --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/CRLEntry.cs @@ -0,0 +1,46 @@ +// +// CRLEntry.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +public sealed class CRLEntry +{ + + /// + /// Revoked certificate serial number in hexadecimal.
+ ///
+ /// + [JsonPropertyName("serialNumberInHex")] + public string? SerialNumberInHex { get; set; } + + /// + /// Date and time when the certificate is revoked.
+ ///
+ /// + [JsonPropertyName("revocationDate")] + public System.DateTime? RevocationDate { get; set; } + + public CRLEntry() + { + } + + public CRLEntry(string serialNumberInHex) + { + this.SerialNumberInHex = serialNumberInHex; + } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/DeviceCredentials.cs b/Client/Com/Cumulocity/Client/Model/DeviceCredentials.cs index 46fa66e..4b1ecd5 100644 --- a/Client/Com/Cumulocity/Client/Model/DeviceCredentials.cs +++ b/Client/Com/Cumulocity/Client/Model/DeviceCredentials.cs @@ -51,6 +51,13 @@ public sealed class DeviceCredentials [JsonPropertyName("username")] public string? Username { get; set; } + /// + /// Security token which is required and verified against during device request acceptance.See for more details on configuration.See for details on submitting token upon device acceptance.
+ ///
+ /// + [JsonPropertyName("securityToken")] + public string? SecurityToken { get; set; } + public override string ToString() { return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); diff --git a/Client/Com/Cumulocity/Client/Model/Event.cs b/Client/Com/Cumulocity/Client/Model/Event.cs index 09ad876..7bdbd17 100644 --- a/Client/Com/Cumulocity/Client/Model/Event.cs +++ b/Client/Com/Cumulocity/Client/Model/Event.cs @@ -77,7 +77,7 @@ public class Event /// /// It is possible to add an arbitrary number of additional properties as a list of key-value pairs, for example, "property1": {}, "property2": "value". These properties are known as custom fragments and can be of any type, for example, object or string. Each custom fragment is identified by a unique name.
- /// Review the as there are characters that can not be used when naming custom fragments.
+ /// Review in the Cumulocity IoT user documentation as there are characters that can not be used when naming custom fragments.
///
/// [JsonPropertyName("customFragments")] diff --git a/Client/Com/Cumulocity/Client/Model/FeatureToggle.cs b/Client/Com/Cumulocity/Client/Model/FeatureToggle.cs new file mode 100644 index 0000000..6d32eef --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/FeatureToggle.cs @@ -0,0 +1,84 @@ +// +// FeatureToggle.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Converter; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +public sealed class FeatureToggle +{ + + /// + /// A unique key of the feature toggle.
+ ///
+ /// + [JsonPropertyName("key")] + public string? Key { get; set; } + + /// + /// Current phase of feature toggle rollout.
+ ///
+ /// + [JsonPropertyName("phase")] + public Phase? PPhase { get; set; } + + /// + /// Current value of the feature toggle marking whether the feature is active or not.
+ ///
+ /// + [JsonPropertyName("active")] + public bool? Active { get; set; } + + /// + /// The source of the feature toggle value - either it's feature toggle definition provided default, or per tenant provided override.
+ ///
+ /// + [JsonPropertyName("strategy")] + public Strategy? PStrategy { get; set; } + + /// + /// Current phase of feature toggle rollout.
+ ///
+ /// + [JsonConverter(typeof(EnumConverterFactory))] + public enum Phase + { + [EnumMember(Value = "IN_DEVELOPMENT")] + INDEVELOPMENT, + [EnumMember(Value = "PRIVATE_PREVIEW")] + PRIVATEPREVIEW, + [EnumMember(Value = "PUBLIC_PREVIEW")] + PUBLICPREVIEW, + [EnumMember(Value = "GENERALLY_AVAILABLE")] + GENERALLYAVAILABLE + } + + /// + /// The source of the feature toggle value - either it's feature toggle definition provided default, or per tenant provided override.
+ ///
+ /// + [JsonConverter(typeof(EnumConverterFactory))] + public enum Strategy + { + [EnumMember(Value = "DEFAULT")] + DEFAULT, + [EnumMember(Value = "TENANT")] + TENANT + } + + + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/FeatureToggleValue.cs b/Client/Com/Cumulocity/Client/Model/FeatureToggleValue.cs new file mode 100644 index 0000000..ac6a313 --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/FeatureToggleValue.cs @@ -0,0 +1,30 @@ +// +// FeatureToggleValue.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +public sealed class FeatureToggleValue +{ + + /// + /// Current value of the feature toggle marking whether the feature is active or not.
+ ///
+ /// + [JsonPropertyName("active")] + public bool? Active { get; set; } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/JSONPredicateRepresentation.cs b/Client/Com/Cumulocity/Client/Model/JSONPredicateRepresentation.cs index 0e97b70..5e9a857 100644 --- a/Client/Com/Cumulocity/Client/Model/JSONPredicateRepresentation.cs +++ b/Client/Com/Cumulocity/Client/Model/JSONPredicateRepresentation.cs @@ -16,7 +16,7 @@ namespace Client.Com.Cumulocity.Client.Model; /// -/// Represents a predicate for verification. It acts as a condition which is necessary to assign a user to the given groups and permit access to the specified applications.
+/// Represents a predicate for verification. It acts as a condition which is necessary to assign a user to the given groups, permit access to the specified applications or to assign specific inventory roles to device groups.
///
/// public sealed class JSONPredicateRepresentation diff --git a/Client/Com/Cumulocity/Client/Model/LatestMeasurementFragment.cs b/Client/Com/Cumulocity/Client/Model/LatestMeasurementFragment.cs new file mode 100644 index 0000000..49d3edd --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/LatestMeasurementFragment.cs @@ -0,0 +1,39 @@ +// +// LatestMeasurementFragment.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +/// +/// The read only fragment which contains the latest measurements series reported by the device.
+/// ⚠️ Feature Preview: The feature is part of the Latest Measurement feature which is still under public feature preview.
+///
+/// +public sealed class LatestMeasurementFragment +{ + + [JsonPropertyName("additionalProperties")] + public IDictionary AdditionalProperties { get; set; } = new Dictionary(); + + [JsonIgnore] + public LatestMeasurementValue? this[string key] + { + get => AdditionalProperties[key]; + set => AdditionalProperties[key] = value; + } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/LatestMeasurementValue.cs b/Client/Com/Cumulocity/Client/Model/LatestMeasurementValue.cs new file mode 100644 index 0000000..af5b18c --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/LatestMeasurementValue.cs @@ -0,0 +1,58 @@ +// +// LatestMeasurementValue.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +/// +/// The read only fragment which contains the latest measurements series values reported by the device.
+/// ⚠️ Feature Preview: The feature is part of the Latest Measurement feature which is still under public feature preview.
+///
+/// +public sealed class LatestMeasurementValue +{ + + /// + /// The unit of the measurement series.
+ ///
+ /// + [JsonPropertyName("unit")] + public string? Unit { get; set; } + + /// + /// The time of the measurement series.
+ ///
+ /// + [JsonPropertyName("time")] + public System.DateTime? Time { get; set; } + + /// + /// The value of the individual measurement.
+ ///
+ /// + [JsonPropertyName("value")] + public decimal? Value { get; set; } + + public LatestMeasurementValue() + { + } + + public LatestMeasurementValue(decimal value) + { + this.Value = value; + } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/LoginForm.cs b/Client/Com/Cumulocity/Client/Model/LoginForm.cs index 0f66867..722aa7b 100644 --- a/Client/Com/Cumulocity/Client/Model/LoginForm.cs +++ b/Client/Com/Cumulocity/Client/Model/LoginForm.cs @@ -32,21 +32,21 @@ public sealed class LoginForm public GrantType? PGrantType { get; set; } /// - /// Used in cases of basic or OAI-Secure authentication.
+ /// Used in case of OAI-Secure authentication.
///
/// [JsonPropertyName("password")] public string? Password { get; set; } /// - /// Current TFA code, sent by the user, if a TFA code is required to log in.
+ /// Current TFA code, sent by the user, if a TFA code is required to log in. Used in case of OAI-Secure authentication.
///
/// [JsonPropertyName("tfa_code")] public string? TfaCode { get; set; } /// - /// Used in cases of basic or OAI-Secure authentication.
+ /// Used in case of OAI-Secure authentication.
///
/// [JsonPropertyName("username")] diff --git a/Client/Com/Cumulocity/Client/Model/LoginOption.cs b/Client/Com/Cumulocity/Client/Model/LoginOption.cs index 13bd34a..ddda210 100644 --- a/Client/Com/Cumulocity/Client/Model/LoginOption.cs +++ b/Client/Com/Cumulocity/Client/Model/LoginOption.cs @@ -78,7 +78,7 @@ public sealed class LoginOption public string? Self { get; set; } /// - /// The session configuration properties are only available for OAuth internal. See for more details.
+ /// The session configuration properties are only available for OAI-Secure. See in the Cumulocity IoT user documentation.
///
/// [JsonPropertyName("sessionConfiguration")] diff --git a/Client/Com/Cumulocity/Client/Model/ManagedObject.cs b/Client/Com/Cumulocity/Client/Model/ManagedObject.cs index 2fac15f..9f785c0 100644 --- a/Client/Com/Cumulocity/Client/Model/ManagedObject.cs +++ b/Client/Com/Cumulocity/Client/Model/ManagedObject.cs @@ -117,6 +117,14 @@ public class ManagedObject [JsonPropertyName("c8y_IsDevice")] public C8yIsDevice? PC8yIsDevice { get; set; } + /// + /// The read only fragment which contains the latest measurements reported by the device.The returned optionally only if the query parameter withLatestValues=true is used.
+ /// ⚠️ Feature Preview: The feature is part of the Latest Measurement feature which is still under public feature preview.
+ ///
+ /// + [JsonPropertyName("c8y_LatestMeasurements")] + public C8yLatestMeasurements? PC8yLatestMeasurements { get; set; } + /// /// A fragment which identifies this managed object as a device group.
///
@@ -140,7 +148,7 @@ public class ManagedObject /// /// It is possible to add an arbitrary number of additional properties as a list of key-value pairs, for example, "property1": {}, "property2": "value". These properties are known as custom fragments and can be of any type, for example, object or string. Each custom fragment is identified by a unique name.
- /// Review the as there are characters that can not be used when naming custom fragments.
+ /// Review in the Cumulocity IoT user documentation as there are characters that can not be used when naming custom fragments.
///
/// [JsonPropertyName("customFragments")] diff --git a/Client/Com/Cumulocity/Client/Model/Measurement.cs b/Client/Com/Cumulocity/Client/Model/Measurement.cs index d4bfdbc..0955ca5 100644 --- a/Client/Com/Cumulocity/Client/Model/Measurement.cs +++ b/Client/Com/Cumulocity/Client/Model/Measurement.cs @@ -63,7 +63,7 @@ public class Measurement /// /// It is possible to add an arbitrary number of additional properties as a list of key-value pairs, for example, "property1": {}, "property2": "value". These properties are known as custom fragments and can be of any type, for example, object or string. Each custom fragment is identified by a unique name.
- /// Review the as there are characters that can not be used when naming custom fragments.
+ /// Review in the Cumulocity IoT user documentation as there are characters that can not be used when naming custom fragments.
///
/// [JsonPropertyName("customFragments")] diff --git a/Client/Com/Cumulocity/Client/Model/NewDeviceRequest.cs b/Client/Com/Cumulocity/Client/Model/NewDeviceRequest.cs index c3a3fd4..e0af4fd 100644 --- a/Client/Com/Cumulocity/Client/Model/NewDeviceRequest.cs +++ b/Client/Com/Cumulocity/Client/Model/NewDeviceRequest.cs @@ -24,6 +24,27 @@ public sealed class NewDeviceRequest [JsonPropertyName("id")] public string? Id { get; set; } + /// + /// ID of the group to which the device will be assigned.
+ ///
+ /// + [JsonPropertyName("groupId")] + public string? GroupId { get; set; } + + /// + /// Type of the device.
+ ///
+ /// + [JsonPropertyName("type")] + public string? Type { get; set; } + + /// + /// Tenant who owns the device.
+ ///
+ /// + [JsonPropertyName("tenantId")] + public string? TenantId { get; set; } + /// /// A URL linking to this resource.
///
@@ -38,6 +59,27 @@ public sealed class NewDeviceRequest [JsonPropertyName("status")] public Status? PStatus { get; set; } + /// + /// Owner of the device.
+ ///
+ /// + [JsonPropertyName("owner")] + public string? Owner { get; set; } + + /// + /// Date and time when the device was created in the database.
+ ///
+ /// + [JsonPropertyName("creationTime")] + public System.DateTime? CreationTime { get; set; } + + /// + /// When accepting a device request, the security token is verified against the token submitted by the device when requesting credentials.See for details on configuration.See for details on creating token for device registration.securityToken parameter can be added only when submitting ACCEPTED status.
+ ///
+ /// + [JsonPropertyName("securityToken")] + public string? SecurityToken { get; set; } + /// /// Status of this new device request.
///
diff --git a/Client/Com/Cumulocity/Client/Model/NotificationSubscription.cs b/Client/Com/Cumulocity/Client/Model/NotificationSubscription.cs index 4a01be8..66714a9 100644 --- a/Client/Com/Cumulocity/Client/Model/NotificationSubscription.cs +++ b/Client/Com/Cumulocity/Client/Model/NotificationSubscription.cs @@ -20,7 +20,7 @@ public sealed class NotificationSubscription /// /// The context within which the subscription is to be processed.
- /// ⓘ Info: If the value is mo, then source must also be provided in the request body.
+ /// ⓘ Info: If the value is mo (managed object), then source must also be provided in the request body.
///
/// [JsonPropertyName("context")] @@ -87,7 +87,7 @@ public NotificationSubscription(Context context, string subscription) /// /// The context within which the subscription is to be processed.
- /// ⓘ Info: If the value is mo, then source must also be provided in the request body.
+ /// ⓘ Info: If the value is mo (managed object), then source must also be provided in the request body.
///
/// [JsonConverter(typeof(EnumConverterFactory))] @@ -142,8 +142,7 @@ public sealed class SubscriptionFilter { /// - /// For the mo (Managed object) context, notifications from the alarms, alarmsWithChildren, events, eventsWithChildren, managedobjects (Inventory), measurements and operations (Device control) APIs can be subscribed to.
- /// The alarmsWithChildren and eventsWithChildren APIs subscribe to alarms and events respectively from the managed object identified by the source.id field, and all of its descendant managed objects.
+ /// For the mo (managed object) context, notifications from the alarms, alarmsWithChildren, events, eventsWithChildren, managedobjects (Inventory), measurements and operations (Device control) APIs can be subscribed to.The alarmsWithChildren and eventsWithChildren APIs subscribe to alarms and events respectively from the managed object identified by the source.id field, and all of its descendant managed objects.
/// For the tenant context, notifications from the alarms, events and managedobjects (Inventory) APIs can be subscribed to.
/// For all contexts, the * (wildcard) value can be used to subscribe to notifications from all of the available APIs in that context.
/// ⓘ Info: The wildcard * cannot be used in conjunction with other values.
diff --git a/Client/Com/Cumulocity/Client/Model/OAuthSessionConfiguration.cs b/Client/Com/Cumulocity/Client/Model/OAuthSessionConfiguration.cs index f501b40..8c07fe4 100644 --- a/Client/Com/Cumulocity/Client/Model/OAuthSessionConfiguration.cs +++ b/Client/Com/Cumulocity/Client/Model/OAuthSessionConfiguration.cs @@ -14,7 +14,7 @@ namespace Client.Com.Cumulocity.Client.Model; /// -/// The session configuration properties are only available for OAuth internal. See for more details.
+/// The session configuration properties are only available for OAI-Secure. See in the Cumulocity IoT user documentation.
///
/// public sealed class OAuthSessionConfiguration diff --git a/Client/Com/Cumulocity/Client/Model/Operation.cs b/Client/Com/Cumulocity/Client/Model/Operation.cs index 8bec5d9..4c637bd 100644 --- a/Client/Com/Cumulocity/Client/Model/Operation.cs +++ b/Client/Com/Cumulocity/Client/Model/Operation.cs @@ -73,7 +73,7 @@ public class Operation /// /// It is possible to add an arbitrary number of additional properties as a list of key-value pairs, for example, "property1": {}, "property2": "value". These properties are known as custom fragments and can be of any type, for example, object or string. Each custom fragment is identified by a unique name.
- /// Review the as there are characters that can not be used when naming custom fragments.
+ /// Review in the Cumulocity IoT user documentation as there are characters that can not be used when naming custom fragments.
///
/// [JsonPropertyName("customFragments")] diff --git a/Client/Com/Cumulocity/Client/Model/TenantFeatureToggleValue.cs b/Client/Com/Cumulocity/Client/Model/TenantFeatureToggleValue.cs new file mode 100644 index 0000000..a1cceb3 --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/TenantFeatureToggleValue.cs @@ -0,0 +1,37 @@ +// +// TenantFeatureToggleValue.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +public sealed class TenantFeatureToggleValue +{ + + /// + /// Identifier of a tenant this feature toggle value is for.
+ ///
+ /// + [JsonPropertyName("tenantId")] + public string? TenantId { get; set; } + + /// + /// Current value of the feature toggle marking whether the feature is active or not.
+ ///
+ /// + [JsonPropertyName("active")] + public bool? Active { get; set; } + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/TenantTfaStrategy.cs b/Client/Com/Cumulocity/Client/Model/TenantTfaStrategy.cs new file mode 100644 index 0000000..5ddd9d4 --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/TenantTfaStrategy.cs @@ -0,0 +1,54 @@ +// +// TenantTfaStrategy.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Converter; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +public sealed class TenantTfaStrategy +{ + + /// + /// Two-factor authentication strategy.
+ ///
+ /// + [JsonPropertyName("strategy")] + public Strategy? PStrategy { get; set; } + + public TenantTfaStrategy() + { + } + + public TenantTfaStrategy(Strategy strategy) + { + this.PStrategy = strategy; + } + + /// + /// Two-factor authentication strategy.
+ ///
+ /// + [JsonConverter(typeof(EnumConverterFactory))] + public enum Strategy + { + [EnumMember(Value = "SMS")] + SMS, + [EnumMember(Value = "TOTP")] + TOTP + } + + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Model/UpdateCRLEntries.cs b/Client/Com/Cumulocity/Client/Model/UpdateCRLEntries.cs new file mode 100644 index 0000000..31ed629 --- /dev/null +++ b/Client/Com/Cumulocity/Client/Model/UpdateCRLEntries.cs @@ -0,0 +1,31 @@ +// +// UpdateCRLEntries.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Client.Com.Cumulocity.Client.Supplementary; + +namespace Client.Com.Cumulocity.Client.Model; + +/// +/// A list of serial numbers.
+///
+/// +public sealed class UpdateCRLEntries +{ + + [JsonPropertyName("crls")] + public List Crls { get; set; } = new List(); + + public override string ToString() + { + return JsonSerializerWrapper.Serialize(this, JsonSerializerWrapper.ToStringJsonSerializerOptions); + } +} diff --git a/Client/Com/Cumulocity/Client/Supplementary/CumulocityCoreLibrary.cs b/Client/Com/Cumulocity/Client/Supplementary/CumulocityCoreLibrary.cs index 4e53063..7a7e985 100644 --- a/Client/Com/Cumulocity/Client/Supplementary/CumulocityCoreLibrary.cs +++ b/Client/Com/Cumulocity/Client/Supplementary/CumulocityCoreLibrary.cs @@ -18,6 +18,7 @@ public sealed class CumulocityCoreLibrary: ICumulocityCoreLibrary private readonly Lazy _lazyApplications; private readonly Lazy _lazyMeasurements; private readonly Lazy _lazyAlarms; + private readonly Lazy _lazyFeatureToggles; private readonly Lazy _lazyTenants; private readonly Lazy _lazyUsers; private readonly Lazy _lazyAudits; @@ -34,6 +35,7 @@ public CumulocityCoreLibrary(HttpClient client) _lazyApplications = new Lazy(() => new ApplicationsFactory(client)); _lazyMeasurements = new Lazy(() => new MeasurementsFactory(client)); _lazyAlarms = new Lazy(() => new AlarmsFactory(client)); + _lazyFeatureToggles = new Lazy(() => new FeatureTogglesFactory(client)); _lazyTenants = new Lazy(() => new TenantsFactory(client)); _lazyUsers = new Lazy(() => new UsersFactory(client)); _lazyAudits = new Lazy(() => new AuditsFactory(client)); @@ -57,6 +59,7 @@ public CumulocityCoreLibrary(IHttpClientFactory clientFactory, string clientName public IApplicationsFactory Applications => _lazyApplications.Value; public IMeasurementsFactory Measurements => _lazyMeasurements.Value; public IAlarmsFactory Alarms => _lazyAlarms.Value; + public IFeatureTogglesFactory FeatureToggles => _lazyFeatureToggles.Value; public ITenantsFactory Tenants => _lazyTenants.Value; public IUsersFactory Users => _lazyUsers.Value; public IAuditsFactory Audits => _lazyAudits.Value; @@ -116,6 +119,18 @@ internal AlarmsFactory(HttpClient client) public IAlarmsApi AlarmsApi => _lazyAlarmsApi.Value; } + public class FeatureTogglesFactory: IFeatureTogglesFactory + { + private readonly Lazy _lazyFeatureTogglesApi; + + internal FeatureTogglesFactory(HttpClient client) + { + _lazyFeatureTogglesApi = new Lazy(() => new FeatureTogglesApi(client)); + } + + public IFeatureTogglesApi FeatureTogglesApi => _lazyFeatureTogglesApi.Value; + } + public class TenantsFactory: ITenantsFactory { private readonly Lazy _lazyTenantsApi; diff --git a/Client/Com/Cumulocity/Client/Supplementary/ICumulocityCoreLibrary.cs b/Client/Com/Cumulocity/Client/Supplementary/ICumulocityCoreLibrary.cs index b309f41..8e7f657 100644 --- a/Client/Com/Cumulocity/Client/Supplementary/ICumulocityCoreLibrary.cs +++ b/Client/Com/Cumulocity/Client/Supplementary/ICumulocityCoreLibrary.cs @@ -17,6 +17,7 @@ public interface ICumulocityCoreLibrary IApplicationsFactory Applications { get; } IMeasurementsFactory Measurements { get; } IAlarmsFactory Alarms { get; } + IFeatureTogglesFactory FeatureToggles { get; } ITenantsFactory Tenants { get; } IUsersFactory Users { get; } IAuditsFactory Audits { get; } @@ -47,6 +48,11 @@ public interface IAlarmsFactory IAlarmsApi AlarmsApi { get; } } + public interface IFeatureTogglesFactory + { + IFeatureTogglesApi FeatureTogglesApi { get; } + } + public interface ITenantsFactory { ITenantsApi TenantsApi { get; } diff --git a/Test/Com/Cumulocity/Client/Api/FeatureTogglesApiTest.cs b/Test/Com/Cumulocity/Client/Api/FeatureTogglesApiTest.cs new file mode 100644 index 0000000..3ca3c00 --- /dev/null +++ b/Test/Com/Cumulocity/Client/Api/FeatureTogglesApiTest.cs @@ -0,0 +1,49 @@ +// +// FeatureTogglesApiTest.cs +// CumulocityCoreLibrary +// +// Copyright (c) 2014-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. +// Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. +// + +using System; +using System.Diagnostics; +using System.Net; +using System.Net.Http; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Client.Com.Cumulocity.Client.Api; +using Client.Com.Cumulocity.Client.Model; +using Test.Com.Cumulocity.Client.Supplementary; + +namespace Test.Com.Cumulocity.Client.Api; + +[TestClass] +public sealed class FeatureTogglesApiTest +{ + + private static HttpClient? HttpClient { get; set; } + + [ClassInitialize] + public static void SetupHttpClient(TestContext context) + { + var configuration = new TestConfiguration(); + configuration.Load(); + + var httpClientHandler = new HttpClientHandler() + { + Credentials = new NetworkCredential(configuration.Username, configuration.Password) + }; + FeatureTogglesApiTest.HttpClient = new HttpClient(httpClientHandler) + { + BaseAddress = new Uri(configuration.Hostname) + }; + } + + [TestMethod] + public async void TestListCurrentTenantFeatures() + { + var api = new FeatureTogglesApi(HttpClient!); + var response = await api.ListCurrentTenantFeatures(); + Debug.Assert(response != null); + } +} diff --git a/Test/Com/Cumulocity/Client/Api/TrustedCertificatesApiTest.cs b/Test/Com/Cumulocity/Client/Api/TrustedCertificatesApiTest.cs index c90261b..1b5c588 100644 --- a/Test/Com/Cumulocity/Client/Api/TrustedCertificatesApiTest.cs +++ b/Test/Com/Cumulocity/Client/Api/TrustedCertificatesApiTest.cs @@ -39,4 +39,11 @@ public static void SetupHttpClient(TestContext context) }; } + [TestMethod] + public async void TestDownloadCrl() + { + var api = new TrustedCertificatesApi(HttpClient!); + var response = await api.DownloadCrl(); + Debug.Assert(response != null); + } } diff --git a/Test/Test.csproj b/Test/Test.csproj index e14199d..79f8018 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -16,15 +16,15 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + +