Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public DigitalTwinsClient(System.Uri endpoint, Azure.Core.TokenCredential creden
public virtual Azure.Response<T> CreateDigitalTwin<T>(string digitalTwinId, T digitalTwin, Azure.DigitalTwins.Core.CreateDigitalTwinOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response CreateEventRoute(string eventRouteId, Azure.DigitalTwins.Core.EventRoute eventRoute, Azure.DigitalTwins.Core.CreateEventRouteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> CreateEventRouteAsync(string eventRouteId, Azure.DigitalTwins.Core.EventRoute eventRoute, Azure.DigitalTwins.Core.CreateEventRouteOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]> CreateModels(System.Collections.Generic.IEnumerable<string> models, Azure.DigitalTwins.Core.CreateModelsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]>> CreateModelsAsync(System.Collections.Generic.IEnumerable<string> models, Azure.DigitalTwins.Core.CreateModelsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]> CreateModels(System.Collections.Generic.IEnumerable<string> dtdlModels, Azure.DigitalTwins.Core.CreateModelsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]>> CreateModelsAsync(System.Collections.Generic.IEnumerable<string> dtdlModels, Azure.DigitalTwins.Core.CreateModelsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<T>> CreateRelationshipAsync<T>(string digitalTwinId, string relationshipId, T relationship, Azure.DigitalTwins.Core.CreateRelationshipOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<T> CreateRelationship<T>(string digitalTwinId, string relationshipId, T relationship, Azure.DigitalTwins.Core.CreateRelationshipOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DecommissionModel(string modelId, Azure.DigitalTwins.Core.DecomissionModelOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down Expand Up @@ -126,8 +126,8 @@ internal DigitalTwinsModelData() { }
public bool? Decommissioned { get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, string> Description { get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, string> DisplayName { get { throw null; } }
public string DtdlModel { get { throw null; } }
public string Id { get { throw null; } }
public string Model { get { throw null; } }
public System.DateTimeOffset? UploadTime { get { throw null; } }
}
public partial class EventRoute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using Azure.Core;

namespace Azure.DigitalTwins.Core
{
[CodeGenModel("DigitalTwinsModelData")]
public partial class DigitalTwinsModelData
{
// This class declaration makes the generated class of the same name declare Model as a **string** rather than an **object**.
// It also changes the namespace and renames the type from "ModelData" to "DigitalTwinsModelData"
// This class declaration:
// - Changes the namespace and renames the type from "ModelData" to "DigitalTwinsModelData"
// - Makes the generated class of the same name declare Model as a **string** rather than an **object**.
// - Renames Model to DtdlModel.
// Do not remove.

/// <summary>
/// The model definition.
/// The model definition that conforms to the Digital Twins Definition Language (DTDL).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call out that this is DTDL v2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in another PR as this one is merged.

/// </summary>
public string Model { get; }
/// <seealso href="https://docs.microsoft.com/en-us/azure/digital-twins/concepts-models"/>
[CodeGenMember("Model")]
public string DtdlModel { get; }

#region null overrides

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ public virtual Response DecommissionModel(string modelId, DecomissionModelOption
/// <summary>
/// Creates one or many models asynchronously.
/// </summary>
/// <param name="models">The set of models to create. Each string corresponds to exactly one model.</param>
/// <param name="dtdlModels">The set of models conforming to the Digital Twins Definition Language (DTDL) to create. Each string corresponds to exactly one model.</param>
/// <param name="options">The optional parameters for this request. If null, the default option values will be used.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The created models and the http response <see cref="Response{T}"/>.</returns>
Expand All @@ -1301,22 +1301,23 @@ public virtual Response DecommissionModel(string modelId, DecomissionModelOption
/// For more samples, see <see href="https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/digitaltwins/Azure.DigitalTwins.Core/samples">our repo samples</see>.
/// </para>
/// </remarks>
/// <seealso href="https://docs.microsoft.com/en-us/azure/digital-twins/concepts-models" />
Comment thread
drwill-ms marked this conversation as resolved.
/// <example>
/// <code snippet="Snippet:DigitalTwinsSampleCreateModels">
/// await client.CreateModelsAsync(new[] { newComponentModelPayload, newModelPayload });
/// Console.WriteLine($&quot;Created models &apos;{componentModelId}&apos; and &apos;{sampleModelId}&apos;.&quot;);
/// </code>
/// </example>
public virtual async Task<Response<DigitalTwinsModelData[]>> CreateModelsAsync(IEnumerable<string> models, CreateModelsOptions options = null, CancellationToken cancellationToken = default)
public virtual async Task<Response<DigitalTwinsModelData[]>> CreateModelsAsync(IEnumerable<string> dtdlModels, CreateModelsOptions options = null, CancellationToken cancellationToken = default)
{
Response<IReadOnlyList<DigitalTwinsModelData>> response = await _dtModelsRestClient.AddAsync(models, options, cancellationToken).ConfigureAwait(false);
Response<IReadOnlyList<DigitalTwinsModelData>> response = await _dtModelsRestClient.AddAsync(dtdlModels, options, cancellationToken).ConfigureAwait(false);
return Response.FromValue(response.Value.ToArray(), response.GetRawResponse());
}

/// <summary>
/// Creates one or many models synchronously.
/// </summary>
/// <param name="models">The set of models to create. Each string corresponds to exactly one model.</param>
/// <param name="dtdlModels">The set of models conforming to the Digital Twins Definition Language (DTDL) to create. Each string corresponds to exactly one model.</param>
/// <param name="options">The optional parameters for this request. If null, the default option values will be used.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The created models and the http response <see cref="Response{T}"/>.</returns>
Expand All @@ -1331,15 +1332,16 @@ public virtual async Task<Response<DigitalTwinsModelData[]>> CreateModelsAsync(I
/// For more samples, see <see href="https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/digitaltwins/Azure.DigitalTwins.Core/samples">our repo samples</see>.
/// </para>
/// </remarks>
/// <seealso href="https://docs.microsoft.com/en-us/azure/digital-twins/concepts-models" />
/// <exception cref="RequestFailedException">
/// The exception that captures the errors from the service. Check the <see cref="RequestFailedException.ErrorCode"/> and <see cref="RequestFailedException.Status"/> properties for more details.
/// </exception>
/// <seealso cref="CreateModelsAsync(IEnumerable{string}, CreateModelsOptions, CancellationToken)">
/// See the asynchronous version of this method for examples.
/// </seealso>
public virtual Response<DigitalTwinsModelData[]> CreateModels(IEnumerable<string> models, CreateModelsOptions options = null, CancellationToken cancellationToken = default)
public virtual Response<DigitalTwinsModelData[]> CreateModels(IEnumerable<string> dtdlModels, CreateModelsOptions options = null, CancellationToken cancellationToken = default)
{
Response<IReadOnlyList<DigitalTwinsModelData>> response = _dtModelsRestClient.Add(models, options, cancellationToken);
Response<IReadOnlyList<DigitalTwinsModelData>> response = _dtModelsRestClient.Add(dtdlModels, options, cancellationToken);
return Response.FromValue(response.Value.ToArray(), response.GetRawResponse());
}

Expand Down Expand Up @@ -2038,7 +2040,6 @@ internal static async Task<MemoryStream> WriteToStream<T>(T obj, ObjectSerialize

if (async)
{

await objectSerializer.SerializeAsync(memoryStream, obj, typeof(T), cancellationToken).ConfigureAwait(false);
}
else
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task Models_Lifecycle()

// GET one created model
Response<DigitalTwinsModelData> buildingModel = await client.GetModelAsync(buildingModelId).ConfigureAwait(false);
Console.WriteLine($"Got {buildingModelId} as {buildingModel.Value.Model}");
Console.WriteLine($"Got {buildingModelId} as {buildingModel.Value.DtdlModel}");

// LIST all models
AsyncPageable<DigitalTwinsModelData> models = client.GetModelsAsync();
Expand Down