Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add models operations to twin lifecycle sample #14781

Merged
merged 8 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -788,7 +788,7 @@ Mono<PagedResponse<ModelData>> createModelsSinglePageAsync(List<String> models,
objectPagedResponse.getHeaders(),
convertedList,
null,
((PagedResponseBase) objectPagedResponse).getDeserializedHeaders());
((ResponseBase) objectPagedResponse).getDeserializedHeaders());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

}
);
}
Expand Down Expand Up @@ -909,7 +909,7 @@ Mono<PagedResponse<ModelData>> listModelsNextSinglePageAsync(String nextLink, Co
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteModel(String modelId) {
return deleteModelWithResponse(modelId)
.map(Response::getValue);
.flatMap(voidResponse -> Mono.empty());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.map(Response::getValue) returns null, which is not a valid return item from a Mono. So we need to map it to Mono.empty() instead.

}

/**
Expand Down Expand Up @@ -939,7 +939,7 @@ PagedFlux<String> listRelationships(String digitalTwinId, String relationshipNam
*/
public Mono<Void> decommissionModel(String modelId) {
return decommissionModelWithResponse(modelId)
.map(Response::getValue);
.flatMap(voidResponse -> Mono.empty());
}

/**
Expand Down Expand Up @@ -1047,7 +1047,7 @@ <T> Mono<DigitalTwinsResponse<T>> getComponentWithResponse(String digitalTwinId,
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> updateComponent(String digitalTwinId, String componentPath, List<Object> componentUpdateOperations) {
return updateComponentWithResponse(digitalTwinId, componentPath, componentUpdateOperations, new UpdateComponentRequestOptions())
.map(DigitalTwinsResponse::getValue);
.flatMap(voidResponse -> Mono.empty());
}

/**
Expand Down
Loading