Class CommentUpdateBuilder
Implements the ICommentUpdateBuilder interface to create a CommentCreation object.
Inherited Members
Namespace: Unity.Cloud.Annotation.Runtime
Syntax
public class CommentUpdateBuilder : 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;
}
Constructors
CommentUpdateBuilder()
Initializes and returns an instance of CommentUpdateBuilder.
Declaration
[Obsolete("Use CommentUpdateBuilder(IComment comment) instead.")]
public CommentUpdateBuilder()
CommentUpdateBuilder(IComment)
Initializes and returns an instance of CommentUpdateBuilder.
Declaration
public CommentUpdateBuilder(IComment comment)
Parameters
| Type | Name | Description |
|---|---|---|
| IComment | comment | The comment to update. |
Methods
GetCommentUpdate()
Returns the instance of the CommentUpdate that's being built.
Declaration
public ICommentUpdate GetCommentUpdate()
Returns
| Type | Description |
|---|---|
| ICommentUpdate | The instance of the CommentUpdate that's being built. |
Implements
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
public 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. |
Implements
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
public 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. |
Implements
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
public 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. |
Implements
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;
}