Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -741,13 +741,13 @@ Mono<PagedResponse<IncomingRelationship>> listIncomingRelationshipsNextSinglePag
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.createModels#Iterable}
*
* @param models The list of models to create. Each string corresponds to exactly one model.
* @param dtdlModels The list of models to create. Each string corresponds to exactly one model.
* @return A List of created models. Each {@link DigitalTwinsModelData} instance in this list
* will contain metadata about the created model, but will not contain the model itself.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<Iterable<DigitalTwinsModelData>> createModels(Iterable<String> models) {
return createModelsWithResponse(models, null)
public Mono<Iterable<DigitalTwinsModelData>> createModels(Iterable<String> dtdlModels) {
return createModelsWithResponse(dtdlModels, null)
.map(Response::getValue);
}

Expand All @@ -758,19 +758,19 @@ public Mono<Iterable<DigitalTwinsModelData>> createModels(Iterable<String> model
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.createModelsWithResponse#Iterable-Options}
*
* @param models The list of models to create. Each string corresponds to exactly one model.
* @param dtdlModels The list of models to create. Each string corresponds to exactly one model.
* @param options The optional parameters for this request. If null, the default option values will be used.
* @return A {@link Response} containing the list of created models. Each {@link DigitalTwinsModelData} instance in this list
* will contain metadata about the created model, but will not contain the model itself.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<Response<Iterable<DigitalTwinsModelData>>> createModelsWithResponse(Iterable<String> models, CreateModelsOptions options) {
return withContext(context -> createModelsWithResponse(models, options, context));
public Mono<Response<Iterable<DigitalTwinsModelData>>> createModelsWithResponse(Iterable<String> dtdlModels, CreateModelsOptions options) {
return withContext(context -> createModelsWithResponse(dtdlModels, options, context));
}

Mono<Response<Iterable<DigitalTwinsModelData>>> createModelsWithResponse(Iterable<String> models, CreateModelsOptions options, Context context) {
Mono<Response<Iterable<DigitalTwinsModelData>>> createModelsWithResponse(Iterable<String> dtdlModels, CreateModelsOptions options, Context context) {
List<Object> modelsPayload = new ArrayList<>();
for (String model : models) {
for (String model : dtdlModels) {
try {
modelsPayload.add(mapper.readValue(model, Object.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,13 @@ public PagedIterable<IncomingRelationship> listIncomingRelationships(String digi
*
* {@codesnippet com.azure.digitaltwins.core.syncClient.createModels#Iterable}
*
* @param models The list of models to create. Each string corresponds to exactly one model.
* @param dtdlModels The list of models to create. Each string corresponds to exactly one model.
* @return A List of created models. Each {@link DigitalTwinsModelData} instance in this list
* will contain metadata about the created model, but will not contain the model itself.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Iterable<DigitalTwinsModelData> createModels(Iterable<String> models) {
return createModelsWithResponse(models, null, Context.NONE).getValue();
public Iterable<DigitalTwinsModelData> createModels(Iterable<String> dtdlModels) {
return createModelsWithResponse(dtdlModels, null, Context.NONE).getValue();
}

/**
Expand All @@ -522,15 +522,15 @@ public Iterable<DigitalTwinsModelData> createModels(Iterable<String> models) {
*
* {@codesnippet com.azure.digitaltwins.core.syncClient.createModelsWithResponse#Iterable}
*
* @param models The list of models to create. Each string corresponds to exactly one model.
* @param dtdlModels The list of models to create. Each string corresponds to exactly one model.
* @param options The optional parameters for this request. If null, the default option values will be used.
* @param context Additional context that is passed through the Http pipeline during the service call.
* @return A {@link Response} containing the list of created models. Each {@link DigitalTwinsModelData} instance in this list
* will contain metadata about the created model, but will not contain the model itself.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Response<Iterable<DigitalTwinsModelData>> createModelsWithResponse(Iterable<String> models, CreateModelsOptions options, Context context) {
return digitalTwinsAsyncClient.createModelsWithResponse(models, options, context).block();
public Response<Iterable<DigitalTwinsModelData>> createModelsWithResponse(Iterable<String> dtdlModels, CreateModelsOptions options, Context context) {
return digitalTwinsAsyncClient.createModelsWithResponse(dtdlModels, options, context).block();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ public final class DigitalTwinsModelData {
private boolean decommissioned;

/*
* The model definition.
* The model definition that conforms to Digital Twins Definition Language (DTDL) v2.
*/
@JsonProperty(value = "model")
private String model;
private String dtdlModel;

/**
* Construct a new DigitalTwinsModelData instance. This class should only be constructed internally since the
* service never takes this as an input.
*
* @param modelId The Id of the model.
* @param model The contents of the model.
* @param dtdlModel The contents of the model.
* @param displayName The language map of the localized display names.
* @param description The language map of the localized descriptions.
* @param uploadTime The time when this model was uploaded.
* @param decommissioned If this model has been decommissioned.
*/
public DigitalTwinsModelData(String modelId,
String model,
String dtdlModel,
Map<String, String> displayName,
Map<String, String> description,
OffsetDateTime uploadTime,
Expand All @@ -76,7 +76,7 @@ public DigitalTwinsModelData(String modelId,
this.id = modelId;
this.uploadTime = uploadTime;
this.decommissioned = decommissioned;
this.model = model;
this.dtdlModel = dtdlModel;
}

/**
Expand Down Expand Up @@ -132,7 +132,7 @@ public boolean isDecommissioned() {
*
* @return the model value.
*/
public String getModel() {
return this.model;
public String getDtdlModel() {
return this.dtdlModel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void assertModelDataAreEqual(DigitalTwinsModelData expected, DigitalTwins
// ModelData objects that are obtained through the createModels API do not populate the model field, so it isn't
// worth comparing those ModelData objects with ModelData objects retrieved through getModel calls
if (compareModel) {
assertEquals(expected.getModel(), actual.getModel());
assertEquals(expected.getDtdlModel(), actual.getDtdlModel());
}

assertEquals(expected.getDescriptionLanguageMap().size(), actual.getDescriptionLanguageMap().size());
Expand Down