From 11dc733da741b4e52e92568e949f589c48711a12 Mon Sep 17 00:00:00 2001 From: David Burg <12040431+daviburg@users.noreply.github.com> Date: Wed, 29 Jul 2026 14:04:45 -0700 Subject: [PATCH] Regenerate AzureIoTCentral from the type-identity generator fix The generator stripped version affixes from definition names without knowing which definitions a connector retains, so DeviceV1 and DeviceV2 both wanted to be Device and only one was emitted. The shipped Device carried DeviceV1 seven properties, and the organizations property that DeviceV2 declares was unreachable from the SDK. The connector now exposes DeviceV1 and DeviceV2 as distinct models, so callers of the v2 routes can read every field the service returns. This is the demonstrating client for the paired generator change; the fix affects five SDK clients in total and the remaining four are left to the full regeneration that is already owed. --- .../Generated/AzureIoTCentralExtensions.cs | 1488 +++++++++++------ 1 file changed, 939 insertions(+), 549 deletions(-) diff --git a/src/Azure.Connectors.Sdk/Generated/AzureIoTCentralExtensions.cs b/src/Azure.Connectors.Sdk/Generated/AzureIoTCentralExtensions.cs index 4ed03b6..043bc0b 100644 --- a/src/Azure.Connectors.Sdk/Generated/AzureIoTCentralExtensions.cs +++ b/src/Azure.Connectors.Sdk/Generated/AzureIoTCentralExtensions.cs @@ -30,44 +30,7 @@ namespace Azure.Connectors.Sdk.AzureIoTCentral.Models #region Types /// - /// Response for Get the list of applications accessible to the signed-in user - /// - public class ApplicationCollection : IPageable - { - /// The collection of applications. - [JsonPropertyName("value")] - public List Value { get; set; } - - /// URL to get the next page of applications. - [JsonPropertyName("nextLink")] - public string NextLink { get; set; } - } - - /// - /// Item in The collection of applications. - /// - public class Application - { - /// Unique ID of the application. - [JsonPropertyName("id")] - [JsonInclude] - public string ApplicationId { get; init; } - - /// Display name of the application. - [JsonPropertyName("displayName")] - public string ApplicationName { get; set; } - - /// The URL subdomain of the application. - [JsonPropertyName("subdomain")] - public string Subdomain { get; set; } - - /// The URL host of the application. - [JsonPropertyName("host")] - public string Host { get; set; } - } - - /// - /// Response for List device groups + /// The paged results of device groups. /// public class DeviceGroupCollection : IPageable { @@ -81,7 +44,7 @@ public class DeviceGroupCollection : IPageable } /// - /// Item in The collection of device groups. + /// The device group definition. /// public class DeviceGroup { @@ -113,13 +76,13 @@ public class DeviceGroup } /// - /// Response for Get devices by device group ID + /// The paged results of devices belonging to the device group. /// - public class DeviceGroupDeviceCollection : IPageable + public class DeviceGroupDeviceCollection : IPageable { /// The collection of devices belonging to the device group. [JsonPropertyName("value")] - public List Value { get; set; } + public List Value { get; set; } /// URL to get the next page of devices in the group. [JsonPropertyName("nextLink")] @@ -129,7 +92,7 @@ public class DeviceGroupDeviceCollection : IPageable /// /// Item in The collection of devices belonging to the device group. /// - public class Device + public class DeviceV1 { /// Unique ID of the device. [JsonPropertyName("id")] @@ -163,7 +126,7 @@ public class Device } /// - /// Response for Get device cloud properties (deprecated) + /// Cloud property values associated with the device. /// [DynamicSchema("Schema_DeviceCloudProperties")] public class DeviceCloudProperties @@ -251,7 +214,7 @@ public class DeviceRelationshipStatic } /// - /// Response for List jobs + /// The paged results of jobs. /// public class JobCollection : IPageable { @@ -265,7 +228,7 @@ public class JobCollection : IPageable } /// - /// Item in The collection of jobs. + /// The job definition. /// public class JobStatic { @@ -308,7 +271,7 @@ public class JobStatic } /// - /// The batching configuration for the job. + /// The job batch definition. /// public class JobBatch { @@ -322,7 +285,7 @@ public class JobBatch } /// - /// The cancellation threshold for the job. + /// The job cancellation threshold definition. /// public class JobCancellationThreshold { @@ -340,7 +303,7 @@ public class JobCancellationThreshold } /// - /// Response for Create a job + /// The job definition. /// [DynamicSchema("Schema_Job")] public class Job @@ -388,7 +351,7 @@ public class Job } /// - /// Response for Get device statuses + /// The paged results of job device statuses. /// public class JobDeviceStatusCollection : IPageable { @@ -402,7 +365,7 @@ public class JobDeviceStatusCollection : IPageable } /// - /// Item in The collection of job device statuses. + /// The job device status definition. /// public class JobDeviceStatus { @@ -451,7 +414,7 @@ public class Organization } /// - /// Response for List scheduled jobs + /// The paged results of scheduled job definitions. /// public class ScheduledJobCollection : IPageable { @@ -465,7 +428,7 @@ public class ScheduledJobCollection : IPageable } /// - /// Item in The collection of scheduled jobs. + /// The scheduled job definition. /// [DynamicSchema("Schema_ScheduledJob")] public class ScheduledJob @@ -526,7 +489,7 @@ public class ScheduledJob } /// - /// Response for Update a scheduled job + /// The scheduled job definition. /// public class ScheduledJobStatic { @@ -583,7 +546,7 @@ public class ScheduledJobStatic } /// - /// Response for Get jobs by scheduled job ID + /// The paged results of job definitions belonging to a scheduled job. /// public class ScheduledJobJobCollection : IPageable { @@ -597,58 +560,63 @@ public class ScheduledJobJobCollection : IPageable } /// - /// Response for Schema_DeviceCloudProperties + /// Response for When a rule is fired /// - public class SchemaDeviceCloudPropertiesResponse + public class WorkflowTrigger { - /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - } + /// Unique ID of the workflow trigger. + [JsonPropertyName("id")] + [JsonInclude] + public string WorkflowTriggerId { get; init; } - /// - /// Response for Schema_Job - /// - public class SchemaJobResponse - { - /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); + /// Unique ID of the rule that is tied to the workflow trigger. + [JsonPropertyName("rule")] + public string Rule { get; set; } + + /// Callback URL of the workflow Trigger. + [JsonPropertyName("url")] + public string WorkflowTriggerURL { get; set; } } /// - /// Response for Schema_ScheduledJob + /// Response for Get device command response /// - public class SchemaScheduledJobResponse + [DynamicSchema("Schema_DeviceCommand_V1")] + public class DeviceCommandV1 { /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. /// [JsonExtensionData] public Dictionary AdditionalProperties { get; set; } = new(); - } - /// - /// Response for When a rule is fired - /// - public class WorkflowTrigger - { - /// Unique ID of the workflow trigger. + /// The request ID of the device command execution. [JsonPropertyName("id")] [JsonInclude] - public string WorkflowTriggerId { get; init; } + public string DeviceCommandRequestId { get; init; } - /// Unique ID of the rule that is tied to the workflow trigger. - [JsonPropertyName("rule")] - public string Rule { get; set; } + /// The payload for the device command. + [JsonPropertyName("request")] + public JsonElement? DeviceCommandRequestPayload { get; set; } - /// Callback URL of the workflow Trigger. - [JsonPropertyName("url")] - public string WorkflowTriggerURL { get; set; } + /// The payload of the device command response. + [JsonPropertyName("response")] + [JsonInclude] + public JsonElement? DeviceCommandResponsePayload { get; init; } + + /// Connection timeout in seconds to wait for a disconnected device to come online. Defaults to 0 seconds. + [JsonPropertyName("connectionTimeout")] + public int? DeviceCommandConnectionTimeout { get; set; } + + /// Response timeout in seconds to wait for a command completion on a device. Defaults to 30 seconds. + [JsonPropertyName("responseTimeout")] + public int? DeviceCommandResponseTimeout { get; set; } + + /// The status code of the device command response. + [JsonPropertyName("responseCode")] + [JsonInclude] + public int? DeviceCommandResponseStatus { get; init; } } /// @@ -821,7 +789,7 @@ public class DeviceModuleComponentTelemetry } /// - /// Response for Get module properties + /// Property values associated with the module. /// [DynamicSchema("Schema_DeviceProperties_V1")] public class ModuleProperties @@ -858,7 +826,7 @@ public class DeviceModuleTelemetry } /// - /// Response for Get device properties + /// Property values associated with the device. /// [DynamicSchema("Schema_DeviceProperties_V1")] public class DeviceProperties @@ -897,21 +865,61 @@ public class DeviceTelemetry /// /// Response for List devices /// - public class DeviceCollection : IPageable + public class DeviceCollection : IPageable { /// The collection of devices. [JsonPropertyName("value")] - public List Value { get; set; } + public List Value { get; set; } /// URL to get the next page of devices. [JsonPropertyName("nextLink")] public string NextLink { get; set; } } + /// + /// Response for Create or update a device + /// + public class DeviceV2 + { + /// Unique ID of the device. + [JsonPropertyName("id")] + [JsonInclude] + public string DeviceId { get; init; } + + /// ETag used to prevent conflict in device updates. + [JsonPropertyName("etag")] + public string DeviceETag { get; set; } + + /// Display name of the device. + [JsonPropertyName("displayName")] + public string DeviceName { get; set; } + + /// The device template definition for the device. + [JsonPropertyName("template")] + public string DeviceTemplate { get; set; } + + /// Whether the device is simulated. + [JsonPropertyName("simulated")] + public bool? Simulated { get; set; } + + /// Whether the device connection to IoT Central has been enabled. + [JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + + /// List of organizations of the device, only one organization is supported today, multiple organizations will be supported soon. + [JsonPropertyName("organizations")] + public List Organizations { get; set; } + + /// Whether resources have been allocated for the device. + [JsonPropertyName("provisioned")] + [JsonInclude] + public bool? Provisioned { get; init; } + } + /// /// Response for Get a device template by ID /// - public class DeviceTemplate + public class DeviceTemplateV1 { /// Unique ID of the device template. [JsonPropertyName("@id")] @@ -942,11 +950,11 @@ public class DeviceTemplate /// /// Response for List device templates /// - public class DeviceTemplateCollection : IPageable + public class DeviceTemplateCollectionV1 : IPageable { /// The collection of device templates. [JsonPropertyName("value")] - public List Value { get; set; } + public List Value { get; set; } /// URL to get the next page of device templates. [JsonPropertyName("nextLink")] @@ -978,54 +986,6 @@ public class RoleCollection public List Value { get; set; } } - /// - /// Response for Schema_DeviceCommand_V1 - /// - public class SchemaDeviceCommandResponse - { - /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - } - - /// - /// Response for Schema_DeviceProperties_V1 - /// - public class SchemaDevicePropertiesResponse - { - /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - } - - /// - /// Response for Schema_DeviceTelemetry_V1 - /// - public class SchemaDeviceTelemetryResponse - { - /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - } - - /// - /// Response for Schema_User_V1 - /// - public class SchemaUserResponse - { - /// - /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - } - /// /// Response for Create user /// @@ -1095,62 +1055,224 @@ public class UserPatch } /// - /// DeviceRelationship + /// Response for Get the list of applications accessible to the signed-in user /// - public class DeviceRelationship + public class ApplicationCollection : IPageable { - /// Unique ID of the device relationship. - [JsonPropertyName("id")] - [JsonInclude] - public string DeviceRelationshipId { get; init; } + /// The collection of applications. + [JsonPropertyName("value")] + public List Value { get; set; } - /// The device ID of the source (child) device. - [JsonPropertyName("target")] - public string DeviceRelationshipTargetId { get; set; } + /// URL to get the next page of applications. + [JsonPropertyName("nextLink")] + public string NextLink { get; set; } } /// - /// ScheduledJobPatch + /// Item in The collection of applications. /// - [DynamicSchema("Schema_ScheduledJob")] - public class ScheduledJobPatch + public class Application { - /// - /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. - /// Populate this dictionary with the properties returned by the schema API. - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; set; } = new(); - - /// ETag used to prevent conflict in scheduled job updates. - [JsonPropertyName("etag")] - [JsonInclude] - public string ETag { get; init; } - - /// Unique ID of the scheduled job. + /// Unique ID of the application. [JsonPropertyName("id")] [JsonInclude] - public string ScheduledJobId { get; init; } + public string ApplicationId { get; init; } - /// The schedule at which to execute the job. - [JsonPropertyName("schedule")] - public JsonElement? Schedule { get; set; } + /// Display name of the application. + [JsonPropertyName("displayName")] + public string ApplicationName { get; set; } - /// Whether the scheduled job is enabled. - [JsonPropertyName("enabled")] - public bool? Enabled { get; set; } + /// The URL subdomain of the application. + [JsonPropertyName("subdomain")] + public string Subdomain { get; set; } - /// Whether the scheduled job has completed. - [JsonPropertyName("completed")] - [JsonInclude] - public bool? Completed { get; init; } + /// The URL host of the application. + [JsonPropertyName("host")] + public string Host { get; set; } } /// - /// Extensible enum for known AzureiotcentralType values. + /// Response for List device templates /// - [JsonConverter(typeof(AzureiotcentralType.AzureiotcentralTypeJsonConverter))] - public readonly struct AzureiotcentralType : IEquatable + public class DeviceTemplateCollection : IPageable + { + /// The collection of device templates. + [JsonPropertyName("value")] + public List Value { get; set; } + + /// URL to get the next page of device templates. + [JsonPropertyName("nextLink")] + public string NextLink { get; set; } + } + + /// + /// Item in The collection of device templates. + /// + public class DeviceTemplate + { + /// Unique ID of the device template. + [JsonPropertyName("id")] + [JsonInclude] + public string DeviceTemplateId { get; init; } + + /// ETag used to prevent conflict in device template updates. + [JsonPropertyName("etag")] + public string DeviceTemplateETag { get; set; } + + /// The types of device to which this template applies. + [JsonPropertyName("types")] + public List DeviceTemplateTypes { get; set; } + + /// Display name of the device template. + [JsonPropertyName("displayName")] + public string DeviceTemplateName { get; set; } + + /// Detailed description of the device template. + [JsonPropertyName("description")] + public string DeviceTemplateDescription { get; set; } + } + + /// + /// Response for Schema_DeviceCloudProperties + /// + public class SchemaDeviceCloudPropertiesResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Schema_DeviceCommand + /// + public class SchemaDeviceCommandResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Schema_DeviceProperties + /// + public class SchemaDevicePropertiesResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Schema_DeviceTelemetry + /// + public class SchemaDeviceTelemetryResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Schema_Job + /// + public class SchemaJobResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Schema_ScheduledJob + /// + public class SchemaScheduledJobResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// Response for Schema_User_V1 + /// + public class SchemaUserResponse + { + /// + /// Arbitrary properties. This type has no static schema; any JSON properties will be captured here. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + } + + /// + /// DeviceRelationship + /// + public class DeviceRelationship + { + /// Unique ID of the device relationship. + [JsonPropertyName("id")] + [JsonInclude] + public string DeviceRelationshipId { get; init; } + + /// The device ID of the source (child) device. + [JsonPropertyName("target")] + public string DeviceRelationshipTargetId { get; set; } + } + + /// + /// The scheduled job definition. + /// + [DynamicSchema("Schema_ScheduledJob")] + public class ScheduledJobPatch + { + /// + /// Dynamic properties determined at runtime by the connector's schema discovery endpoint. + /// Populate this dictionary with the properties returned by the schema API. + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new(); + + /// ETag used to prevent conflict in scheduled job updates. + [JsonPropertyName("etag")] + [JsonInclude] + public string ETag { get; init; } + + /// Unique ID of the scheduled job. + [JsonPropertyName("id")] + [JsonInclude] + public string ScheduledJobId { get; init; } + + /// The schedule at which to execute the job. + [JsonPropertyName("schedule")] + public JsonElement? Schedule { get; set; } + + /// Whether the scheduled job is enabled. + [JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + + /// Whether the scheduled job has completed. + [JsonPropertyName("completed")] + [JsonInclude] + public bool? Completed { get; init; } + } + + /// + /// Extensible enum for known AzureiotcentralType values. + /// + [JsonConverter(typeof(AzureiotcentralType.AzureiotcentralTypeJsonConverter))] + public readonly struct AzureiotcentralType : IEquatable { private readonly string _value; @@ -1209,38 +1331,6 @@ public AzureiotcentralTypeJsonConverter() { } /// public static class AzureIoTCentralModelFactory { - /// - /// Creates a new instance of . - /// - public static ApplicationCollection ApplicationCollection( - List value = default, - string nextLink = default) - { - return new ApplicationCollection - { - Value = value, - NextLink = nextLink, - }; - } - - /// - /// Creates a new instance of . - /// - public static Application Application( - string applicationId = default, - string applicationName = default, - string subdomain = default, - string host = default) - { - return new Application - { - ApplicationId = applicationId, - ApplicationName = applicationName, - Subdomain = subdomain, - Host = host, - }; - } - /// /// Creates a new instance of . /// @@ -1281,7 +1371,7 @@ public static DeviceGroup DeviceGroup( /// Creates a new instance of . /// public static DeviceGroupDeviceCollection DeviceGroupDeviceCollection( - List value = default, + List value = default, string nextLink = default) { return new DeviceGroupDeviceCollection @@ -1292,9 +1382,9 @@ public static DeviceGroupDeviceCollection DeviceGroupDeviceCollection( } /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public static Device Device( + public static DeviceV1 DeviceV1( string deviceId = default, string deviceETag = default, string deviceName = default, @@ -1303,7 +1393,7 @@ public static Device Device( bool? enabled = default, bool? provisioned = default) { - return new Device + return new DeviceV1 { DeviceId = deviceId, DeviceETag = deviceETag, @@ -1633,6 +1723,28 @@ public static WorkflowTrigger WorkflowTrigger( }; } + /// + /// Creates a new instance of . + /// + public static DeviceCommandV1 DeviceCommandV1( + string deviceCommandRequestId = default, + JsonElement? deviceCommandRequestPayload = default, + JsonElement? deviceCommandResponsePayload = default, + int? deviceCommandConnectionTimeout = default, + int? deviceCommandResponseTimeout = default, + int? deviceCommandResponseStatus = default) + { + return new DeviceCommandV1 + { + DeviceCommandRequestId = deviceCommandRequestId, + DeviceCommandRequestPayload = deviceCommandRequestPayload, + DeviceCommandResponsePayload = deviceCommandResponsePayload, + DeviceCommandConnectionTimeout = deviceCommandConnectionTimeout, + DeviceCommandResponseTimeout = deviceCommandResponseTimeout, + DeviceCommandResponseStatus = deviceCommandResponseStatus, + }; + } + /// /// Creates a new instance of . /// @@ -1759,7 +1871,7 @@ public static DeviceTelemetry DeviceTelemetry( /// Creates a new instance of . /// public static DeviceCollection DeviceCollection( - List value = default, + List value = default, string nextLink = default) { return new DeviceCollection @@ -1770,9 +1882,35 @@ public static DeviceCollection DeviceCollection( } /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public static DeviceTemplate DeviceTemplate( + public static DeviceV2 DeviceV2( + string deviceId = default, + string deviceETag = default, + string deviceName = default, + string deviceTemplate = default, + bool? simulated = default, + bool? enabled = default, + List organizations = default, + bool? provisioned = default) + { + return new DeviceV2 + { + DeviceId = deviceId, + DeviceETag = deviceETag, + DeviceName = deviceName, + DeviceTemplate = deviceTemplate, + Simulated = simulated, + Enabled = enabled, + Organizations = organizations, + Provisioned = provisioned, + }; + } + + /// + /// Creates a new instance of . + /// + public static DeviceTemplateV1 DeviceTemplateV1( string deviceTemplateId = default, string deviceTemplateETag = default, List deviceTemplateTypes = default, @@ -1780,7 +1918,7 @@ public static DeviceTemplate DeviceTemplate( string deviceTemplateDescription = default, JsonElement? deviceTemplateCapabilityModel = default) { - return new DeviceTemplate + return new DeviceTemplateV1 { DeviceTemplateId = deviceTemplateId, DeviceTemplateETag = deviceTemplateETag, @@ -1792,13 +1930,13 @@ public static DeviceTemplate DeviceTemplate( } /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public static DeviceTemplateCollection DeviceTemplateCollection( - List value = default, + public static DeviceTemplateCollectionV1 DeviceTemplateCollectionV1( + List value = default, string nextLink = default) { - return new DeviceTemplateCollection + return new DeviceTemplateCollectionV1 { Value = value, NextLink = nextLink, @@ -1872,10 +2010,76 @@ public static UserCollection UserCollection( } /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public static DeviceRelationship DeviceRelationship( - string deviceRelationshipId = default, + public static ApplicationCollection ApplicationCollection( + List value = default, + string nextLink = default) + { + return new ApplicationCollection + { + Value = value, + NextLink = nextLink, + }; + } + + /// + /// Creates a new instance of . + /// + public static Application Application( + string applicationId = default, + string applicationName = default, + string subdomain = default, + string host = default) + { + return new Application + { + ApplicationId = applicationId, + ApplicationName = applicationName, + Subdomain = subdomain, + Host = host, + }; + } + + /// + /// Creates a new instance of . + /// + public static DeviceTemplateCollection DeviceTemplateCollection( + List value = default, + string nextLink = default) + { + return new DeviceTemplateCollection + { + Value = value, + NextLink = nextLink, + }; + } + + /// + /// Creates a new instance of . + /// + public static DeviceTemplate DeviceTemplate( + string deviceTemplateId = default, + string deviceTemplateETag = default, + List deviceTemplateTypes = default, + string deviceTemplateName = default, + string deviceTemplateDescription = default) + { + return new DeviceTemplate + { + DeviceTemplateId = deviceTemplateId, + DeviceTemplateETag = deviceTemplateETag, + DeviceTemplateTypes = deviceTemplateTypes, + DeviceTemplateName = deviceTemplateName, + DeviceTemplateDescription = deviceTemplateDescription, + }; + } + + /// + /// Creates a new instance of . + /// + public static DeviceRelationship DeviceRelationship( + string deviceRelationshipId = default, string deviceRelationshipTargetId = default) { return new DeviceRelationship @@ -2023,21 +2227,6 @@ protected AzureIoTCentralClient() : base() { } [EditorBrowsable(EditorBrowsableState.Never)] public override string ToString() => base.ToString(); - /// - /// Get the list of applications accessible to the signed-in user - /// - /// Discovery method used to populate dynamic parameter values at design time. - /// Cancellation token. - /// An async enumerable of items across all pages. - public virtual AsyncPageable ApplicationsListAsync(CancellationToken cancellationToken = default) - { - var path = $"/api/preview/applications"; - return this.CreatePageable( - ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), - (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), - cancellationToken); - } - /// /// List device groups /// @@ -2161,8 +2350,8 @@ await this /// Device Group ID /// Application /// Cancellation token. - /// An async enumerable of items across all pages. - public virtual AsyncPageable DeviceGroupsGetDevicesAsync(string deviceGroupId, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + /// An async enumerable of items across all pages. + public virtual AsyncPageable DeviceGroupsGetDevicesAsync(string deviceGroupId, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { if (deviceGroupId is null) throw new ArgumentNullException(nameof(deviceGroupId)); @@ -2171,7 +2360,7 @@ public virtual AsyncPageable DeviceGroupsGetDevicesAsync(string deviceGr throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); var path = $"/api/ga_2022_07_31/deviceGroups/{Uri.EscapeDataString(deviceGroupId.ToString())}/devices" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return this.CreatePageable( + return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), cancellationToken); @@ -2959,139 +3148,6 @@ public virtual AsyncPageable ScheduledJobsListJobsAsync(string schedu cancellationToken); } - /// - /// Schema_DeviceCloudProperties - /// - /// Discovery method used to populate dynamic parameter values at design time. - /// Application - /// Device Template ID - /// Cancellation token. - /// The Schema_DeviceCloudProperties response. - public virtual async Task SchemaDeviceCloudPropertiesAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplateId = default, CancellationToken cancellationToken = default) - { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceCloudPropertiesAsync"); - try - { - var queryParams = new List(); - if (application is null) - throw new ArgumentNullException(nameof(application)); - queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (deviceTemplateId != default) - queryParams.Add($"instanceOf={Uri.EscapeDataString(deviceTemplateId.ToString())}"); - var path = $"/api/preview/_internal/workflow/schema/DeviceCloudProperties" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) - .ConfigureAwait(continueOnCapturedContext: false); - - } - catch (Exception ex) when (!ex.IsFatal()) - { - activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); - throw; - } - } - - /// - /// Schema_WebhookActionBody - /// - /// Discovery method used to populate dynamic parameter values at design time. - /// Application - /// rule - /// Cancellation token. - public virtual async Task SchemaWebhookActionBodyAsync([DynamicValues("Applications_List")] string application, string rule = default, CancellationToken cancellationToken = default) - { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaWebhookActionBodyAsync"); - try - { - var queryParams = new List(); - if (application is null) - throw new ArgumentNullException(nameof(application)); - queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (rule != default) - queryParams.Add($"rule={Uri.EscapeDataString(rule.ToString())}"); - var path = $"/api/preview/_internal/workflow/schema/WebhookActionBody" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) - .ConfigureAwait(continueOnCapturedContext: false); - - } - catch (Exception ex) when (!ex.IsFatal()) - { - activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); - throw; - } - } - - /// - /// Schema_Job - /// - /// Discovery method used to populate dynamic parameter values at design time. - /// Application - /// job_type - /// Cancellation token. - /// The Schema_Job response. - public virtual async Task SchemaJobAsync([DynamicValues("Applications_List")] string application, string jobType = default, CancellationToken cancellationToken = default) - { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaJobAsync"); - try - { - var queryParams = new List(); - if (application is null) - throw new ArgumentNullException(nameof(application)); - queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (jobType != default) - queryParams.Add($"job_type={Uri.EscapeDataString(jobType.ToString())}"); - var path = $"/api/ga_2022_07_31/_internal/workflow/schema/Job" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) - .ConfigureAwait(continueOnCapturedContext: false); - - } - catch (Exception ex) when (!ex.IsFatal()) - { - activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); - throw; - } - } - - /// - /// Schema_ScheduledJob - /// - /// Discovery method used to populate dynamic parameter values at design time. - /// Application - /// scheduled_job_end_type - /// job_type - /// patch - /// Cancellation token. - /// The Schema_ScheduledJob response. - public virtual async Task SchemaScheduledJobAsync([DynamicValues("Applications_List")] string application, string scheduledJobEndType = default, string jobType = default, bool? patch = default, CancellationToken cancellationToken = default) - { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaScheduledJobAsync"); - try - { - var queryParams = new List(); - if (application is null) - throw new ArgumentNullException(nameof(application)); - queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (scheduledJobEndType != default) - queryParams.Add($"scheduled_job_end_type={Uri.EscapeDataString(scheduledJobEndType.ToString())}"); - if (jobType != default) - queryParams.Add($"job_type={Uri.EscapeDataString(jobType.ToString())}"); - if (patch.HasValue) - queryParams.Add($"patch={Uri.EscapeDataString(patch.Value.ToString())}"); - var path = $"/api/ga_2022_07_31/_internal/workflow/schema/ScheduledJob" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) - .ConfigureAwait(continueOnCapturedContext: false); - - } - catch (Exception ex) when (!ex.IsFatal()) - { - activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); - throw; - } - } - /// /// Get a device by ID /// @@ -3100,7 +3156,7 @@ public virtual async Task SchemaScheduledJobAsync([D /// Application /// Cancellation token. /// The Get a device by ID response. - public virtual async Task DevicesGetAsync(string deviceId, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + public virtual async Task DevicesGetAsync(string deviceId, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.DevicesGetAsync"); try @@ -3113,7 +3169,7 @@ public virtual async Task DevicesGetAsync(string deviceId, [DynamicValue queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); var path = $"/api/v1/devices/{Uri.EscapeDataString(deviceId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -3134,7 +3190,7 @@ public virtual async Task DevicesGetAsync(string deviceId, [DynamicValue /// Device Template /// Cancellation token. /// The Get device command response response. - public virtual async Task DevicesGetCommandResponseAsync(string deviceId, [DynamicValues("Workflow_GetCapabilities_V1")] string deviceCommand, [DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, CancellationToken cancellationToken = default) + public virtual async Task DevicesGetCommandResponseAsync(string deviceId, [DynamicValues("Workflow_GetCapabilities_V1")] string deviceCommand, [DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, CancellationToken cancellationToken = default) { using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.DevicesGetCommandResponseAsync"); try @@ -3151,7 +3207,7 @@ public virtual async Task DevicesGetCommandResponseAsync(string d queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); var path = $"/api/v1/devices/{Uri.EscapeDataString(deviceId.ToString())}/commands/{Uri.EscapeDataString(deviceCommand.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -3531,15 +3587,15 @@ public virtual async Task DevicesGetTelemetryValueAsync(string /// Get the list of devices in an application. /// Application /// Cancellation token. - /// An async enumerable of items across all pages. - public virtual AsyncPageable DevicesListAsync([DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + /// An async enumerable of items across all pages. + public virtual AsyncPageable DevicesListAsync([DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); var path = $"/api/v1/devices" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return this.CreatePageable( + return this.CreatePageable( ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), cancellationToken); @@ -3587,7 +3643,7 @@ await this /// Device Template /// Cancellation token. /// The Run a device command response. - public virtual async Task DevicesRunCommandAsync(string deviceId, [DynamicValues("Workflow_GetCapabilities_V1")] string deviceCommand, DeviceCommand input, [DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, CancellationToken cancellationToken = default) + public virtual async Task DevicesRunCommandAsync(string deviceId, [DynamicValues("Workflow_GetCapabilities_V1")] string deviceCommand, DeviceCommandV1 input, [DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, CancellationToken cancellationToken = default) { using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.DevicesRunCommandAsync"); try @@ -3604,7 +3660,7 @@ public virtual async Task DevicesRunCommandAsync(string deviceId, queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); var path = $"/api/v1/devices/{Uri.EscapeDataString(deviceId.ToString())}/commands/{Uri.EscapeDataString(deviceCommand.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) + .CallConnectorAsync(HttpMethod.Post, path, input, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -3753,7 +3809,7 @@ public virtual async Task DevicesRunModuleComponen /// Application /// Cancellation token. /// The Create or update a device response. - public virtual async Task DevicesSetAsync(string deviceId, Device input, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + public virtual async Task DevicesSetAsync(string deviceId, DeviceV2 input, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.DevicesSetAsync"); try @@ -3766,7 +3822,7 @@ public virtual async Task DevicesSetAsync(string deviceId, Device input, queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); var path = $"/api/ga_2022_07_31/devices/{Uri.EscapeDataString(deviceId.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -3860,7 +3916,7 @@ public virtual async Task DevicesUpdatePropertiesAsync(string /// Application /// Cancellation token. /// The Get a device template by ID response. - public virtual async Task DeviceTemplatesGetAsync([DynamicValues("DeviceTemplates_List_V1")] string template, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + public virtual async Task DeviceTemplatesGetAsync([DynamicValues("DeviceTemplates_List_V1")] string template, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.DeviceTemplatesGetAsync"); try @@ -3873,7 +3929,7 @@ public virtual async Task DeviceTemplatesGetAsync([DynamicValues queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); var path = $"/api/v1/deviceTemplates/{Uri.EscapeDataString(template.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -3890,17 +3946,17 @@ public virtual async Task DeviceTemplatesGetAsync([DynamicValues /// Get the list of device templates in an application. /// Application /// Cancellation token. - /// An async enumerable of items across all pages. - public virtual AsyncPageable DeviceTemplatesListAsync([DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + /// An async enumerable of items across all pages. + public virtual AsyncPageable DeviceTemplatesListAsync([DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); var path = $"/api/v1/deviceTemplates" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return this.CreatePageable( - ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), - (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), + return this.CreatePageable( + ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), + (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), cancellationToken); } @@ -3997,36 +4053,31 @@ public virtual async Task RolesListAsync([DynamicValues("Applica } /// - /// Schema_DeviceCommand_V1 + /// Create user /// - /// Discovery method used to populate dynamic parameter values at design time. + /// Create a user in the application + /// User + /// The request body. /// Application - /// Device Template - /// module - /// component - /// capability + /// User type /// Cancellation token. - /// The Schema_DeviceCommand_V1 response. - public virtual async Task SchemaDeviceCommandAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, string module = default, string component = default, string capability = default, CancellationToken cancellationToken = default) + /// The Create user response. + public virtual async Task UsersCreateAsync(string user, User input, [DynamicValues("Applications_List")] string application, string userType = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceCommandAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersCreateAsync"); try { + if (user is null) + throw new ArgumentNullException(nameof(user)); var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (deviceTemplate != default) - queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); - if (module != default) - queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); - if (component != default) - queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); - if (capability != default) - queryParams.Add($"capability={Uri.EscapeDataString(capability.ToString())}"); - var path = $"/api/v1/_internal/workflow/schema/DeviceCommand" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + if (userType != default) + queryParams.Add($"user_type={Uri.EscapeDataString(userType.ToString())}"); + var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4038,30 +4089,27 @@ public virtual async Task SchemaDeviceCommandAsync( } /// - /// Schema_DeviceProperties_V1 + /// Get user /// - /// Discovery method used to populate dynamic parameter values at design time. + /// Get a user by ID + /// User /// Application - /// Device Template - /// module /// Cancellation token. - /// The Schema_DeviceProperties_V1 response. - public virtual async Task SchemaDevicePropertiesAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, [DynamicValues("Workflow_GetModules_V1")] string module = default, CancellationToken cancellationToken = default) + /// The Get user response. + public virtual async Task UsersGetAsync(string user, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDevicePropertiesAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersGetAsync"); try { + if (user is null) + throw new ArgumentNullException(nameof(user)); var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (deviceTemplate != default) - queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); - if (module != default) - queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); - var path = $"/api/v1/_internal/workflow/schema/DeviceProperties" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4073,36 +4121,24 @@ public virtual async Task SchemaDeviceProperties } /// - /// Schema_DeviceTelemetry_V1 + /// List users /// - /// Discovery method used to populate dynamic parameter values at design time. + /// Get the list of users in an application /// Application - /// Device Template - /// module - /// component - /// capability /// Cancellation token. - /// The Schema_DeviceTelemetry_V1 response. - public virtual async Task SchemaDeviceTelemetryAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, string module = default, string component = default, string capability = default, CancellationToken cancellationToken = default) + /// The List users response. + public virtual async Task UsersListAsync([DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceTelemetryAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersListAsync"); try { var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (deviceTemplate != default) - queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); - if (module != default) - queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); - if (component != default) - queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); - if (capability != default) - queryParams.Add($"capability={Uri.EscapeDataString(capability.ToString())}"); - var path = $"/api/v1/_internal/workflow/schema/DeviceTelemetry" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + var path = $"/api/v1/users" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4114,30 +4150,26 @@ public virtual async Task SchemaDeviceTelemetryAs } /// - /// Schema_User_V1 + /// Delete user /// - /// Discovery method used to populate dynamic parameter values at design time. + /// Delete a user + /// User /// Application - /// user_type - /// patch /// Cancellation token. - /// The Schema_User_V1 response. - public virtual async Task SchemaUserAsync([DynamicValues("Applications_List")] string application, string userType = default, bool? patch = default, CancellationToken cancellationToken = default) + public virtual async Task UsersRemoveAsync(string user, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaUserAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersRemoveAsync"); try { + if (user is null) + throw new ArgumentNullException(nameof(user)); var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (userType != default) - queryParams.Add($"user_type={Uri.EscapeDataString(userType.ToString())}"); - if (patch.HasValue) - queryParams.Add($"patch={Uri.EscapeDataString(patch.Value.ToString())}"); - var path = $"/api/v1/_internal/workflow/schema/User" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + await this + .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4149,18 +4181,18 @@ public virtual async Task SchemaUserAsync([DynamicValues("Ap } /// - /// Create user + /// Update user /// - /// Create a user in the application + /// Update a user in the application via patch /// User /// The request body. /// Application /// User type /// Cancellation token. - /// The Create user response. - public virtual async Task UsersCreateAsync(string user, User input, [DynamicValues("Applications_List")] string application, string userType = default, CancellationToken cancellationToken = default) + /// The Update user response. + public virtual async Task UsersUpdateAsync(string user, UserPatch input, [DynamicValues("Applications_List")] string application, string userType = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersCreateAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersUpdateAsync"); try { if (user is null) @@ -4173,7 +4205,7 @@ public virtual async Task UsersCreateAsync(string user, User input, [Dynam queryParams.Add($"user_type={Uri.EscapeDataString(userType.ToString())}"); var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Put, path, input, cancellationToken) + .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4185,27 +4217,46 @@ public virtual async Task UsersCreateAsync(string user, User input, [Dynam } /// - /// Get user + /// Get the list of applications accessible to the signed-in user /// - /// Get a user by ID - /// User + /// Discovery method used to populate dynamic parameter values at design time. + /// Cancellation token. + /// An async enumerable of items across all pages. + public virtual AsyncPageable ApplicationsListAsync(CancellationToken cancellationToken = default) + { + var path = $"/api/preview/applications"; + return this.CreatePageable( + ct => this.CallConnectorAsync(HttpMethod.Get, path, cancellationToken: ct), + (nextLink, ct) => this.CallConnectorAsync(HttpMethod.Get, nextLink, cancellationToken: ct), + cancellationToken); + } + + /// + /// Workflow_GetComponents + /// + /// Discovery method used to populate dynamic parameter values at design time. /// Application + /// template + /// module /// Cancellation token. - /// The Get user response. - public virtual async Task UsersGetAsync(string user, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + /// The Workflow_GetComponents response. + public virtual async Task> WorkflowGetComponentsAsync([DynamicValues("Applications_List")] string application, string template, string module = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersGetAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetComponentsAsync"); try { - if (user is null) - throw new ArgumentNullException(nameof(user)); var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + if (template is null) + throw new ArgumentNullException(nameof(template)); + queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + var path = $"/api/preview/_internal/workflow/components" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4217,24 +4268,37 @@ public virtual async Task UsersGetAsync(string user, [DynamicValues( } /// - /// List users + /// Workflow_GetCapabilities /// - /// Get the list of users in an application + /// Discovery method used to populate dynamic parameter values at design time. /// Application + /// template + /// component + /// module + /// type /// Cancellation token. - /// The List users response. - public virtual async Task UsersListAsync([DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + /// The Workflow_GetCapabilities response. + public virtual async Task> WorkflowGetCapabilitiesAsync([DynamicValues("Applications_List")] string application, string template, string component = default, string module = default, string type = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersListAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetCapabilitiesAsync"); try { var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - var path = $"/api/v1/users" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + if (template is null) + throw new ArgumentNullException(nameof(template)); + queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); + if (component != default) + queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + if (type != default) + queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); + var path = $"/api/preview/_internal/workflow/capabilities" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4246,26 +4310,37 @@ public virtual async Task UsersListAsync([DynamicValues("Applica } /// - /// Delete user + /// Workflow_GetCapabilities_V1 /// - /// Delete a user - /// User + /// Discovery method used to populate dynamic parameter values at design time. /// Application + /// template + /// component + /// module + /// type /// Cancellation token. - public virtual async Task UsersRemoveAsync(string user, [DynamicValues("Applications_List")] string application, CancellationToken cancellationToken = default) + /// The Workflow_GetCapabilities_V1 response. + public virtual async Task> WorkflowGetCapabilitiesV1Async([DynamicValues("Applications_List")] string application, string template, string component = default, string module = default, string type = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersRemoveAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetCapabilitiesV1Async"); try { - if (user is null) - throw new ArgumentNullException(nameof(user)); var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); - await this - .CallConnectorAsync(HttpMethod.Delete, path, cancellationToken: cancellationToken) + if (template is null) + throw new ArgumentNullException(nameof(template)); + queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); + if (component != default) + queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + if (type != default) + queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); + var path = $"/api/v1/_internal/workflow/capabilities" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4277,31 +4352,31 @@ await this } /// - /// Update user + /// Workflow_GetComponents_V1 /// - /// Update a user in the application via patch - /// User - /// The request body. + /// Discovery method used to populate dynamic parameter values at design time. /// Application - /// User type + /// template + /// module /// Cancellation token. - /// The Update user response. - public virtual async Task UsersUpdateAsync(string user, UserPatch input, [DynamicValues("Applications_List")] string application, string userType = default, CancellationToken cancellationToken = default) + /// The Workflow_GetComponents_V1 response. + public virtual async Task> WorkflowGetComponentsV1Async([DynamicValues("Applications_List")] string application, string template, string module = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.UsersUpdateAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetComponentsV1Async"); try { - if (user is null) - throw new ArgumentNullException(nameof(user)); var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (userType != default) - queryParams.Add($"user_type={Uri.EscapeDataString(userType.ToString())}"); - var path = $"/api/v1/users/{Uri.EscapeDataString(user.ToString())}" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + if (template is null) + throw new ArgumentNullException(nameof(template)); + queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + var path = $"/api/v1/_internal/workflow/components" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync(HttpMethod.Patch, path, input, cancellationToken) + .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4313,19 +4388,16 @@ public virtual async Task UsersUpdateAsync(string user, UserPatch inp } /// - /// Workflow_GetCapabilities_V1 + /// Workflow_GetModules_V1 /// /// Discovery method used to populate dynamic parameter values at design time. /// Application /// template - /// component - /// module - /// type /// Cancellation token. - /// The Workflow_GetCapabilities_V1 response. - public virtual async Task> WorkflowGetCapabilitiesAsync([DynamicValues("Applications_List")] string application, string template, string component = default, string module = default, string type = default, CancellationToken cancellationToken = default) + /// The Workflow_GetModules_V1 response. + public virtual async Task> WorkflowGetModulesAsync([DynamicValues("Applications_List")] string application, string template, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetCapabilitiesAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetModulesAsync"); try { var queryParams = new List(); @@ -4335,13 +4407,7 @@ public virtual async Task UsersUpdateAsync(string user, UserPatch inp if (template is null) throw new ArgumentNullException(nameof(template)); queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); - if (component != default) - queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); - if (module != default) - queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); - if (type != default) - queryParams.Add($"type={Uri.EscapeDataString(type.ToString())}"); - var path = $"/api/v1/_internal/workflow/capabilities" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + var path = $"/api/v1/_internal/workflow/modules" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); @@ -4355,31 +4421,27 @@ public virtual async Task UsersUpdateAsync(string user, UserPatch inp } /// - /// Workflow_GetComponents_V1 + /// Schema_DeviceCloudProperties /// /// Discovery method used to populate dynamic parameter values at design time. /// Application - /// template - /// module + /// Device Template ID /// Cancellation token. - /// The Workflow_GetComponents_V1 response. - public virtual async Task> WorkflowGetComponentsAsync([DynamicValues("Applications_List")] string application, string template, string module = default, CancellationToken cancellationToken = default) + /// The Schema_DeviceCloudProperties response. + public virtual async Task SchemaDeviceCloudPropertiesAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplateId = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetComponentsAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceCloudPropertiesAsync"); try { var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (template is null) - throw new ArgumentNullException(nameof(template)); - queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); - if (module != default) - queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); - var path = $"/api/v1/_internal/workflow/components" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + if (deviceTemplateId != default) + queryParams.Add($"instanceOf={Uri.EscapeDataString(deviceTemplateId.ToString())}"); + var path = $"/api/preview/_internal/workflow/schema/DeviceCloudProperties" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); } @@ -4391,28 +4453,356 @@ public virtual async Task UsersUpdateAsync(string user, UserPatch inp } /// - /// Workflow_GetModules_V1 + /// Schema_DeviceCommand /// /// Discovery method used to populate dynamic parameter values at design time. /// Application - /// template + /// Device Template ID + /// component + /// capability /// Cancellation token. - /// The Workflow_GetModules_V1 response. - public virtual async Task> WorkflowGetModulesAsync([DynamicValues("Applications_List")] string application, string template, CancellationToken cancellationToken = default) + /// The Schema_DeviceCommand response. + public virtual async Task SchemaDeviceCommandAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplateId = default, string component = default, string capability = default, CancellationToken cancellationToken = default) { - using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.WorkflowGetModulesAsync"); + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceCommandAsync"); try { var queryParams = new List(); if (application is null) throw new ArgumentNullException(nameof(application)); queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); - if (template is null) - throw new ArgumentNullException(nameof(template)); - queryParams.Add($"template={Uri.EscapeDataString(template.ToString())}"); - var path = $"/api/v1/_internal/workflow/modules" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + if (deviceTemplateId != default) + queryParams.Add($"instanceOf={Uri.EscapeDataString(deviceTemplateId.ToString())}"); + if (component != default) + queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); + if (capability != default) + queryParams.Add($"capability={Uri.EscapeDataString(capability.ToString())}"); + var path = $"/api/preview/_internal/workflow/schema/DeviceCommand" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); return await this - .CallConnectorAsync>(HttpMethod.Get, path, cancellationToken: cancellationToken) + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_DeviceCommand_V1 + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// Device Template + /// module + /// component + /// capability + /// Cancellation token. + /// The Schema_DeviceCommand_V1 response. + public virtual async Task SchemaDeviceCommandV1Async([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, string module = default, string component = default, string capability = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceCommandV1Async"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (deviceTemplate != default) + queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + if (component != default) + queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); + if (capability != default) + queryParams.Add($"capability={Uri.EscapeDataString(capability.ToString())}"); + var path = $"/api/v1/_internal/workflow/schema/DeviceCommand" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_DeviceProperties + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// Device Template ID + /// Cancellation token. + /// The Schema_DeviceProperties response. + public virtual async Task SchemaDevicePropertiesAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplateId = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDevicePropertiesAsync"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (deviceTemplateId != default) + queryParams.Add($"instanceOf={Uri.EscapeDataString(deviceTemplateId.ToString())}"); + var path = $"/api/preview/_internal/workflow/schema/DeviceProperties" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_DeviceProperties_V1 + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// Device Template + /// module + /// Cancellation token. + /// The Schema_DeviceProperties_V1 response. + public virtual async Task SchemaDevicePropertiesV1Async([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, [DynamicValues("Workflow_GetModules_V1")] string module = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDevicePropertiesV1Async"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (deviceTemplate != default) + queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + var path = $"/api/v1/_internal/workflow/schema/DeviceProperties" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_DeviceTelemetry + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// Device Template ID + /// component + /// capability + /// Cancellation token. + /// The Schema_DeviceTelemetry response. + public virtual async Task SchemaDeviceTelemetryAsync([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplateId = default, string component = default, string capability = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceTelemetryAsync"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (deviceTemplateId != default) + queryParams.Add($"instanceOf={Uri.EscapeDataString(deviceTemplateId.ToString())}"); + if (component != default) + queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); + if (capability != default) + queryParams.Add($"capability={Uri.EscapeDataString(capability.ToString())}"); + var path = $"/api/preview/_internal/workflow/schema/DeviceTelemetry" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_DeviceTelemetry_V1 + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// Device Template + /// module + /// component + /// capability + /// Cancellation token. + /// The Schema_DeviceTelemetry_V1 response. + public virtual async Task SchemaDeviceTelemetryV1Async([DynamicValues("Applications_List")] string application, [DynamicValues("DeviceTemplates_List")] string deviceTemplate = default, string module = default, string component = default, string capability = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaDeviceTelemetryV1Async"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (deviceTemplate != default) + queryParams.Add($"template={Uri.EscapeDataString(deviceTemplate.ToString())}"); + if (module != default) + queryParams.Add($"module={Uri.EscapeDataString(module.ToString())}"); + if (component != default) + queryParams.Add($"component={Uri.EscapeDataString(component.ToString())}"); + if (capability != default) + queryParams.Add($"capability={Uri.EscapeDataString(capability.ToString())}"); + var path = $"/api/v1/_internal/workflow/schema/DeviceTelemetry" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_Job + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// job_type + /// Cancellation token. + /// The Schema_Job response. + public virtual async Task SchemaJobAsync([DynamicValues("Applications_List")] string application, string jobType = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaJobAsync"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (jobType != default) + queryParams.Add($"job_type={Uri.EscapeDataString(jobType.ToString())}"); + var path = $"/api/ga_2022_07_31/_internal/workflow/schema/Job" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_ScheduledJob + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// scheduled_job_end_type + /// job_type + /// patch + /// Cancellation token. + /// The Schema_ScheduledJob response. + public virtual async Task SchemaScheduledJobAsync([DynamicValues("Applications_List")] string application, string scheduledJobEndType = default, string jobType = default, bool? patch = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaScheduledJobAsync"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (scheduledJobEndType != default) + queryParams.Add($"scheduled_job_end_type={Uri.EscapeDataString(scheduledJobEndType.ToString())}"); + if (jobType != default) + queryParams.Add($"job_type={Uri.EscapeDataString(jobType.ToString())}"); + if (patch.HasValue) + queryParams.Add($"patch={Uri.EscapeDataString(patch.Value.ToString())}"); + var path = $"/api/ga_2022_07_31/_internal/workflow/schema/ScheduledJob" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_User_V1 + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// user_type + /// patch + /// Cancellation token. + /// The Schema_User_V1 response. + public virtual async Task SchemaUserAsync([DynamicValues("Applications_List")] string application, string userType = default, bool? patch = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaUserAsync"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (userType != default) + queryParams.Add($"user_type={Uri.EscapeDataString(userType.ToString())}"); + if (patch.HasValue) + queryParams.Add($"patch={Uri.EscapeDataString(patch.Value.ToString())}"); + var path = $"/api/v1/_internal/workflow/schema/User" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + return await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) + .ConfigureAwait(continueOnCapturedContext: false); + + } + catch (Exception ex) when (!ex.IsFatal()) + { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, ex.Message); + throw; + } + } + + /// + /// Schema_WebhookActionBody + /// + /// Discovery method used to populate dynamic parameter values at design time. + /// Application + /// rule + /// Cancellation token. + public virtual async Task SchemaWebhookActionBodyAsync([DynamicValues("Applications_List")] string application, string rule = default, CancellationToken cancellationToken = default) + { + using var activity = AzureIoTCentralClient.ConnectorActivitySource.StartActivity("AzureIoTCentralClient.SchemaWebhookActionBodyAsync"); + try + { + var queryParams = new List(); + if (application is null) + throw new ArgumentNullException(nameof(application)); + queryParams.Add($"application={Uri.EscapeDataString(application.ToString())}"); + if (rule != default) + queryParams.Add($"rule={Uri.EscapeDataString(rule.ToString())}"); + var path = $"/api/preview/_internal/workflow/schema/WebhookActionBody" + (queryParams.Count > 0 ? "?" + string.Join("&", queryParams) : ""); + await this + .CallConnectorAsync(HttpMethod.Get, path, cancellationToken: cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); }