diff --git a/sdk/digitaltwins/azure-digitaltwins-core/API design.md b/sdk/digitaltwins/azure-digitaltwins-core/API design.md index 69930a8b59c7..907b9f8bd0a4 100644 --- a/sdk/digitaltwins/azure-digitaltwins-core/API design.md +++ b/sdk/digitaltwins/azure-digitaltwins-core/API design.md @@ -726,9 +726,159 @@ When updating a model, the payload for a multi-operation json patch follows the
APIs +Async APIs + ```java -TODO: + /** + * Creates one or many models. + * @param models The list of models to create. Each string corresponds to exactly one model. + * @return The list of created models + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public Mono> createModels(List models) { } + + /** + * Creates one or many models. + * @param models The list of models to create. Each string corresponds to exactly one model. + * @return A REST response containing the list of created models. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public Mono>> createModelsWithResponse(List models) { } + + /** + * Gets a model, including the model metadata and the model definition. + * @param modelId The Id of the model. + * @return The application/json model + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getModel(String modelId) { } + + /** + * Gets a model, including the model metadata and the model definition asynchronously. + * @param modelId The Id of the model. + * @return A REST response containing the model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponse(String modelId) { } + + /** + * Gets the list of models by iterating through a collection. + * @param dependenciesFor The model Ids to have dependencies retrieved. + * @param includeModelDefinition Whether to include the model definition in the result. If false, only the model metadata will be returned. + * @param options The options to follow when listing the models. For example, the page size hint can be specified. + * @return A {@link PagedFlux} of ModelData. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listModels(List dependenciesFor, boolean includeModelDefinition, DigitalTwinModelsListOptions options) { } + + /** + * Deletes a model. + * @param modelId The id for the model. The id is globally unique and case sensitive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteModel(String modelId) { } + + /** + * Deletes a model. + * @param modelId The id for the model. The id is globally unique and case sensitive. + * @return The http response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteModelWithResponse(String modelId) { } + + /** + * Decommissions a model. + * @param modelId The Id of the model to decommission. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono decommissionModel(String modelId) { } + + /** + * Decommissions a model. + * @param modelId The Id of the model to decommission. + * @return The http response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono decommissionModelWithResponse(String modelId) { } + +``` + +Sync APIs +```java + /** + * Creates one or many models. + * @param models The list of models to create. Each string corresponds to exactly one model. + * @return The list of created models + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public List createModels(List models) { } + + /** + * Creates one or many models. + * @param models The list of models to create. Each string corresponds to exactly one model. + * @return A REST response containing the list of created models. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public Response> createModelsWithResponse(List models, Context context) { } + + /** + * Gets a model, including the model metadata and the model definition. + * @param modelId The Id of the model. + * @return The application/json model + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelData getModel(String modelId) { } + + /** + * Gets a model, including the model metadata and the model definition. + * @param modelId The Id of the model. + * @return A REST response containing the model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(String modelId, Context context) { } + + /** + * Gets the list of models by iterating through a collection. + * @param dependenciesFor The model Ids to have dependencies retrieved. + * @param includeModelDefinition Whether to include the model definition in the result. If false, only the model metadata will be returned. + * @param options The options to follow when listing the models. For example, the page size hint can be specified. + * @return A {@link PagedIterable} of ModelData. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listModels(List dependenciesFor, boolean includeModelDefinition, DigitalTwinModelsListOptions options, Context context) { } + + /** + * Deletes a model. + * @param modelId The id for the model. The id is globally unique and case sensitive. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteModel(String modelId) { } + + /** + * Deletes a model. + * @param modelId The id for the model. The id is globally unique and case sensitive. + * @return The http response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteModelWithResponse(String modelId, Context context) { } + + /** + * Decommissions a model. + * @param modelId The Id of the model to decommission. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Void decommissionModel(String modelId) { } + + /** + * Decommissions a model. + * @param modelId The Id of the model to decommission. + * @return The http response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response decommissionModelWithResponse(String modelId, Context context) { } + ``` +
## Event Routes @@ -795,4 +945,4 @@ The telemetry payload is a JSON object, as defined in the digital twin's DTDL. ```java TODO: ``` - \ No newline at end of file +