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
versionIdis a service-assigned integer, not a semantic version.
Methods
CreateThingModelVersionAsync(GroupId, string, IReadOnlyList<Label>, ThingModelVersionAttributes, CreateOptions?, 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, CreateOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
groupIdGroupIdThe Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingModelIdstringThe Thing Model (Resource) identifier.
thingModelLabelsIReadOnlyList<Label>Labels applied to the parent Thing Model.
versionThingModelVersionAttributesThe attributes of the Thing Model Version to create.
optionsCreateOptionsThe CreateOptions that control the behavior of the create operation; when null, the created entity is persisted.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingModelIdstringThe Thing Model (Resource) identifier.
versionIdulongThe identifier of the Thing Model Version to delete.
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingModelIdstringThe Thing Model (Resource) identifier.
versionIdGetThingModelVersionIdThe Version to retrieve. Use ResourceDefault for the Thing Model's default (latest) Version.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<ThingModelVersion>
A task whose result is the requested ThingModelVersion.
ListThingModelVersionsAsync(GroupSelector, string?, 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, string? documentHash = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
groupsGroupSelectorThe Groups to search; see GroupSelector for the available scopes.
thingModelIdstringWhen set, restricts the results to this Thing Model.
documentHashstringWhen set, restricts the results to entities whose document has this hash.
labelLabelWhen set, restricts the results to entities carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<IReadOnlyList<ThingModelVersionXid>>
A task whose result is the XIDs of the matching Thing Model Versions.
ListThingModelsAsync(GroupSelector, Label?, TimeSpan?, CancellationToken)
Lists the XIDs of Thing Models matching the query, optionally filtered by a single label.
Task<IReadOnlyList<ResourceXId>> ListThingModelsAsync(GroupSelector groups, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
groupsGroupSelectorThe Thing Model Groups to search; see GroupSelector for the available scopes.
labelLabelWhen set, restricts the results to Thing Models carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<IReadOnlyList<ResourceXId>>
A task whose result is the XIDs of the matching Thing Models.