Table of Contents

Interface IThingModelClient

Namespace
Azure.Iot.Operations.Services.EdgeRegistry
Assembly
Azure.Iot.Operations.Services.dll

Client for the xRegistry Thing Model extension: create, retrieve, list, and delete Thing Model Versions. Thing Model Versions use integer (ulong) version identifiers assigned by the service. The parent Thing Model (Resource) and Thing Model Group are implicitly created when a Version is created.

public interface IThingModelClient

Remarks

The Thing Model extension is the core xRegistry model specialized for WoT Thing Models; the generic concepts map directly (see ICoreClient):

  • Thing Model Group = xRegistry Group (thingmodelgroups).
  • Thing Model = xRegistry Resource — the named Thing Model that owns its revisions.
  • Thing Model Version = xRegistry Version — one immutable revision of a Thing Model document. ThingModelVersion carries the document bytes plus the revision's metadata; its versionId is a service-assigned integer, not a semantic version.

Methods

CreateThingModelVersionAsync(GroupId, string, IReadOnlyList<Label>, ThingModelVersionAttributes, TimeSpan?, CancellationToken)

Creates a Thing Model Version under the given Thing Model, implicitly creating the parent Thing Model if needed.

Task<ThingModelVersion> CreateThingModelVersionAsync(GroupId groupId, string thingModelId, IReadOnlyList<Label> thingModelLabels, ThingModelVersionAttributes version, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingModelId string

The Thing Model (Resource) identifier.

thingModelLabels IReadOnlyList<Label>

Labels applied to the parent Thing Model.

version ThingModelVersionAttributes

The attributes of the Thing Model Version to create.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ThingModelVersion>

A task whose result is the created ThingModelVersion.

DeleteThingModelVersionAsync(GroupId, string, ulong, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a specific Thing Model Version.

Task DeleteThingModelVersionAsync(GroupId groupId, string thingModelId, ulong versionId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingModelId string

The Thing Model (Resource) identifier.

versionId ulong

The identifier of the Thing Model Version to delete.

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Thing Model Version has been deleted.

GetThingModelVersionAsync(GroupId, string, GetThingModelVersionId, TimeSpan?, CancellationToken)

Retrieves a Thing Model Version.

Task<ThingModelVersion> GetThingModelVersionAsync(GroupId groupId, string thingModelId, GetThingModelVersionId versionId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingModelId string

The Thing Model (Resource) identifier.

versionId GetThingModelVersionId

The Version to retrieve. Use ResourceDefault for the Thing Model's default (latest) Version.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ThingModelVersion>

A task whose result is the requested ThingModelVersion.

ListThingModelVersionsAsync(GroupSelector, string?, Label?, TimeSpan?, CancellationToken)

Lists the XIDs of Thing Model Versions matching the query, optionally filtered by Thing Model id and/or a single label.

Task<IReadOnlyList<ThingModelVersionXid>> ListThingModelVersionsAsync(GroupSelector groups, string? thingModelId = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groups GroupSelector

The Groups to search; see GroupSelector for the available scopes.

thingModelId string

When set, restricts the results to this Thing Model.

label Label

When set, restricts the results to entities carrying this label.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<ThingModelVersionXid>>

A task whose result is the XIDs of the matching Thing Model Versions.