diff --git a/sdk/iot/Azure.Iot.Hub.Service/src/API Design.md b/sdk/iot/Azure.Iot.Hub.Service/src/API Design.md index 59981f493fa4..dd0db8f441dd 100644 --- a/sdk/iot/Azure.Iot.Hub.Service/src/API Design.md +++ b/sdk/iot/Azure.Iot.Hub.Service/src/API Design.md @@ -51,6 +51,93 @@ APIs for managing module identities, module twins, and querying modules ```csharp +public class Modules +{ + /// + /// Create a device module identity. + /// + /// The module to create. + /// The cancellation token. + /// The newly created device module identity + public virtual async Task> CreateIdentityAsync(ModuleIdentity moduleIdentity, CancellationToken cancellationToken = default); + + /// + /// Get a single device module identity. + /// + /// The unique identifier of the device that contains the module. + /// The unique identifier of the module to get. + /// The cancellation token. + /// The retrieved device module identity. + public virtual async Task> GetIdentityAsync(string deviceId, string moduleId, CancellationToken cancellationToken = default); + + /// + /// List a set of device's module identities. + /// + /// The unique identifier of the device. + /// The cancellation token. + /// A pageable set of device module identities. + public virtual async Task>> GetIdentitiesAsync(string deviceId, CancellationToken cancellationToken = default); + + /// + /// Update a device module identity. + /// + /// The module to update. + /// A string representing a weak ETag for this module, as per RFC7232. The update operation is performed + /// only if this ETag matches the value maintained by the server, indicating that the module has not been modified since it was last retrieved. + /// The current ETag can be retrieved from the module identity last retrieved from the service. To force an unconditional update, set If-Match to the wildcard character (*). + /// The cancellation token. + /// The updated device module identity. + public virtual async Task> UpdateIdentityAsync(ModuleIdentity moduleIdentity, string ifMatch = null, CancellationToken cancellationToken = default); + + /// + /// Delete a single device module identity. + /// + /// The unique identifier of the device that contains the module. + /// The unique identifier of the module to get. + /// A string representing a weak ETag for this module, as per RFC7232. The update operation is performed + /// only if this ETag matches the value maintained by the server, indicating that the module has not been modified since it was last retrieved. + /// The current ETag can be retrieved from the module identity last retrieved from the service. To force an unconditional update, set If-Match to the wildcard character (*). + /// The cancellation token. + /// The http response. + public virtual async Task DeleteIdentityAsync(string deviceId, string moduleId, string ifMatch = null, CancellationToken cancellationToken = default); + + /// + /// Get a device module twin. + /// + /// The unique identifier of the device. + /// The unique identifier of the device module. + /// The cancellation token. + /// The retrieved module twin. + public virtual async Task> GetTwinAsync(string deviceId, string moduleId, CancellationToken cancellationToken = default); + + /// + /// List a set of device module twins. + /// + /// The cancellation token. + /// A pageable set of device module twins. + public virtual async AsyncPageable GetTwinsAsync(CancellationToken cancellationToken = default); + + /// + /// Update a module's twin. + /// + /// The properties to update. Any existing properties not referenced by this patch will be unaffected by this patch. + /// A string representing a weak ETag for this twin, as per RFC7232. The update operation is performed + /// only if this ETag matches the value maintained by the server, indicating that the twin has not been modified since it was last retrieved. + /// To force an unconditional update, set If-Match to the wildcard character (*). + /// The cancellation token + /// The server's new representation of the device module twin. + public virtual async Task> UpdateTwinAsync(TwinData twinPatch, string ifMatch = null, CancellationToken cancellationToken = default); + + /// + /// Invoke a method on a device module. + /// + /// The unique identifier of the device that contains the module. + /// The unique identifier of the module. + /// The details of the method to invoke. + /// The cancellation token. + /// The result of the method invocation. + public virtual async Task> InvokeMethodAsync(string deviceId, string moduleId, CloudToDeviceMethodRequest cloudToDeviceMethodRequest, CancellationToken cancellationToken = default); +} ```