Interface ICommentUpdateBuilder
An interface that defines all the steps necessary to build a CommentUpdate object.
Namespace: Unity.Cloud.Annotation.Runtime
Syntax
public interface ICommentUpdateBuilder
Examples
public async Task<IComment> UpdateCommentOnTopic(ITopic topic,
IComment commentToUpdate)
{
ICommentUpdateBuilder commentUpdateBuilder = new CommentUpdateBuilder(commentToUpdate);
commentUpdateBuilder.SetText("Updated comment text")
.SetMarkAsRead(true);
ICommentUpdate commentUpdate = commentUpdateBuilder.GetCommentUpdate();
IComment updatedComment = await topic.UpdateCommentAsync(commentUpdate);
return updatedComment;
}
Methods
GetCommentUpdate()
Returns the instance of the CommentUpdate that's being built.
Declaration
ICommentUpdate GetCommentUpdate()
Returns
| Type | Description |
|---|---|
| ICommentUpdate | The instance of the CommentUpdate that's being built. |
Examples
public ICommentUpdate GetCommentUpdate(IComment commentToUpdate)
{
ICommentUpdateBuilder commentCreationBuilder = new CommentUpdateBuilder(commentToUpdate);
commentCreationBuilder.SetText("Updated comment text");
return commentCreationBuilder.GetCommentUpdate();
}
SetId(Guid)
Assigns a value to the Id property of the CommentUpdate that's being built.
Declaration
ICommentUpdateBuilder SetId(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The new ID value. |
Returns
| Type | Description |
|---|---|
| ICommentUpdateBuilder | The current instance of the ICommentUpdateBuilder interface. |
Examples
public async Task<IComment> UpdateCommentById(ITopic topic,
Guid commentId)
{
ICommentUpdateBuilder commentUpdateBuilder = new CommentUpdateBuilder();
commentUpdateBuilder.SetId(commentId)
.SetText("Update comment text");
ICommentUpdate commentUpdate = commentUpdateBuilder.GetCommentUpdate();
IComment updatedComment = await topic.UpdateCommentAsync(commentUpdate);
return updatedComment;
}
SetMarkAsRead(Boolean)
Assigns a value to the MarkAsRead property of the CommentUpdate that's being built.
Declaration
ICommentUpdateBuilder SetMarkAsRead(bool markAsRead)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | markAsRead | The new MarkAsRead value. |
Returns
| Type | Description |
|---|---|
| ICommentUpdateBuilder | The current instance of the ICommentUpdateBuilder interface. |
Examples
public async Task<IComment> UpdateCommentMarkAsReadOnTopic(ITopic topic,
IComment commentToUpdate)
{
ICommentUpdateBuilder commentUpdateBuilder = new CommentUpdateBuilder(commentToUpdate);
commentUpdateBuilder.SetMarkAsRead(true);
ICommentUpdate commentUpdate = commentUpdateBuilder.GetCommentUpdate();
IComment updatedComment = await topic.UpdateCommentAsync(commentUpdate);
return updatedComment;
}
SetText(String)
Assigns a value to the Text property of the CommentUpdate that's being built.
Declaration
ICommentUpdateBuilder SetText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | The new Text value. |
Returns
| Type | Description |
|---|---|
| ICommentUpdateBuilder | The current instance of the ICommentUpdateBuilder interface. |
Examples
public async Task<IComment> UpdateCommentTextOnTopic(ITopic topic,
IComment commentToUpdate)
{
ICommentUpdateBuilder commentUpdateBuilder = new CommentUpdateBuilder(commentToUpdate);
commentUpdateBuilder.SetText("Updated comment text");
ICommentUpdate commentUpdate = commentUpdateBuilder.GetCommentUpdate();
IComment updatedComment = await topic.UpdateCommentAsync(commentUpdate);
return updatedComment;
}