Skip to content

Commit 5f76e7e

Browse files
authored
Review Models APIs (Azure#14381)
1 parent 1a32c0f commit 5f76e7e

File tree

1 file changed

+152
-2
lines changed

1 file changed

+152
-2
lines changed

sdk/digitaltwins/azure-digitaltwins-core/API design.md

Lines changed: 152 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,159 @@ When updating a model, the payload for a multi-operation json patch follows the
726726

727727
<details><summary><b>APIs</b></summary>
728728

729+
Async APIs
730+
729731
```java
730-
TODO:
732+
/**
733+
* Creates one or many models.
734+
* @param models The list of models to create. Each string corresponds to exactly one model.
735+
* @return The list of created models
736+
*/
737+
@ServiceMethod(returns = ReturnType.COLLECTION)
738+
public Mono<List<ModelData>> createModels(List<String> models) { }
739+
740+
/**
741+
* Creates one or many models.
742+
* @param models The list of models to create. Each string corresponds to exactly one model.
743+
* @return A REST response containing the list of created models.
744+
*/
745+
@ServiceMethod(returns = ReturnType.COLLECTION)
746+
public Mono<Response<List<ModelData>>> createModelsWithResponse(List<String> models) { }
747+
748+
/**
749+
* Gets a model, including the model metadata and the model definition.
750+
* @param modelId The Id of the model.
751+
* @return The application/json model
752+
*/
753+
@ServiceMethod(returns = ReturnType.SINGLE)
754+
public Mono<ModelData> getModel(String modelId) { }
755+
756+
/**
757+
* Gets a model, including the model metadata and the model definition asynchronously.
758+
* @param modelId The Id of the model.
759+
* @return A REST response containing the model.
760+
*/
761+
@ServiceMethod(returns = ReturnType.SINGLE)
762+
public Mono<Response<ModelData>> getModelWithResponse(String modelId) { }
763+
764+
/**
765+
* Gets the list of models by iterating through a collection.
766+
* @param dependenciesFor The model Ids to have dependencies retrieved.
767+
* @param includeModelDefinition Whether to include the model definition in the result. If false, only the model metadata will be returned.
768+
* @param options The options to follow when listing the models. For example, the page size hint can be specified.
769+
* @return A {@link PagedFlux} of ModelData.
770+
*/
771+
@ServiceMethod(returns = ReturnType.COLLECTION)
772+
public PagedFlux<ModelData> listModels(List<String> dependenciesFor, boolean includeModelDefinition, DigitalTwinModelsListOptions options) { }
773+
774+
/**
775+
* Deletes a model.
776+
* @param modelId The id for the model. The id is globally unique and case sensitive.
777+
*/
778+
@ServiceMethod(returns = ReturnType.SINGLE)
779+
public Mono<Void> deleteModel(String modelId) { }
780+
781+
/**
782+
* Deletes a model.
783+
* @param modelId The id for the model. The id is globally unique and case sensitive.
784+
* @return The http response.
785+
*/
786+
@ServiceMethod(returns = ReturnType.SINGLE)
787+
public Mono<Response> deleteModelWithResponse(String modelId) { }
788+
789+
/**
790+
* Decommissions a model.
791+
* @param modelId The Id of the model to decommission.
792+
*/
793+
@ServiceMethod(returns = ReturnType.SINGLE)
794+
public Mono<Void> decommissionModel(String modelId) { }
795+
796+
/**
797+
* Decommissions a model.
798+
* @param modelId The Id of the model to decommission.
799+
* @return The http response.
800+
*/
801+
@ServiceMethod(returns = ReturnType.SINGLE)
802+
public Mono<Response> decommissionModelWithResponse(String modelId) { }
803+
804+
```
805+
806+
Sync APIs
807+
```java
808+
/**
809+
* Creates one or many models.
810+
* @param models The list of models to create. Each string corresponds to exactly one model.
811+
* @return The list of created models
812+
*/
813+
@ServiceMethod(returns = ReturnType.COLLECTION)
814+
public List<ModelData> createModels(List<String> models) { }
815+
816+
/**
817+
* Creates one or many models.
818+
* @param models The list of models to create. Each string corresponds to exactly one model.
819+
* @return A REST response containing the list of created models.
820+
*/
821+
@ServiceMethod(returns = ReturnType.COLLECTION)
822+
public Response<List<ModelData>> createModelsWithResponse(List<String> models, Context context) { }
823+
824+
/**
825+
* Gets a model, including the model metadata and the model definition.
826+
* @param modelId The Id of the model.
827+
* @return The application/json model
828+
*/
829+
@ServiceMethod(returns = ReturnType.SINGLE)
830+
public ModelData getModel(String modelId) { }
831+
832+
/**
833+
* Gets a model, including the model metadata and the model definition.
834+
* @param modelId The Id of the model.
835+
* @return A REST response containing the model.
836+
*/
837+
@ServiceMethod(returns = ReturnType.SINGLE)
838+
public Response<ModelData> getModelWithResponse(String modelId, Context context) { }
839+
840+
/**
841+
* Gets the list of models by iterating through a collection.
842+
* @param dependenciesFor The model Ids to have dependencies retrieved.
843+
* @param includeModelDefinition Whether to include the model definition in the result. If false, only the model metadata will be returned.
844+
* @param options The options to follow when listing the models. For example, the page size hint can be specified.
845+
* @return A {@link PagedIterable} of ModelData.
846+
*/
847+
@ServiceMethod(returns = ReturnType.COLLECTION)
848+
public PagedIterable<ModelData> listModels(List<String> dependenciesFor, boolean includeModelDefinition, DigitalTwinModelsListOptions options, Context context) { }
849+
850+
/**
851+
* Deletes a model.
852+
* @param modelId The id for the model. The id is globally unique and case sensitive.
853+
*/
854+
@ServiceMethod(returns = ReturnType.SINGLE)
855+
public Mono<Void> deleteModel(String modelId) { }
856+
857+
/**
858+
* Deletes a model.
859+
* @param modelId The id for the model. The id is globally unique and case sensitive.
860+
* @return The http response.
861+
*/
862+
@ServiceMethod(returns = ReturnType.SINGLE)
863+
public Response deleteModelWithResponse(String modelId, Context context) { }
864+
865+
/**
866+
* Decommissions a model.
867+
* @param modelId The Id of the model to decommission.
868+
*/
869+
@ServiceMethod(returns = ReturnType.SINGLE)
870+
public Void decommissionModel(String modelId) { }
871+
872+
/**
873+
* Decommissions a model.
874+
* @param modelId The Id of the model to decommission.
875+
* @return The http response.
876+
*/
877+
@ServiceMethod(returns = ReturnType.SINGLE)
878+
public Response decommissionModelWithResponse(String modelId, Context context) { }
879+
731880
```
881+
732882
</details>
733883

734884
## Event Routes
@@ -795,4 +945,4 @@ The telemetry payload is a JSON object, as defined in the digital twin's DTDL.
795945
```java
796946
TODO:
797947
```
798-
</details>
948+
</details>

0 commit comments

Comments
 (0)