docs.unity3d.com
    Show / Hide Table of Contents

    Interface ITopic

    An interface that represents a topic, which includes topic data, topic comments, CRUD operations, and monitoring.

    Namespace: Unity.Cloud.Annotation
    Syntax
    public interface ITopic

    Properties

    CreationAuthor

    Returns the author of the topic.

    Declaration
    Author CreationAuthor { get; }
    Property Value
    Type Description
    Author

    The author of the topic.

    CreationDate

    Returns the creation date of the topic.

    Declaration
    DateTime CreationDate { get; }
    Property Value
    Type Description
    DateTime

    The creation date of the topic.

    Description

    Returns the description of the topic.

    Declaration
    string Description { get; }
    Property Value
    Type Description
    String

    The description of the topic.

    Id

    Returns the topic ID.

    Declaration
    Guid Id { get; }
    Property Value
    Type Description
    Guid

    The topic ID.

    InstanceId

    Returns the instance ID of the object that the topic is associated with.

    Declaration
    string InstanceId { get; }
    Property Value
    Type Description
    String

    The instance ID of the object that the topic is associated with.

    LocalCameraTransform

    Returns the local transform of the camera that looks at the topic.

    Declaration
    AnnotationTransform LocalCameraTransform { get; }
    Property Value
    Type Description
    AnnotationTransform

    The local transform of the camera that looks at the topic.

    LocalTransform

    Returns the local transform of the topic relative to the associated object.

    Declaration
    AnnotationTransform LocalTransform { get; }
    Property Value
    Type Description
    AnnotationTransform

    The local transform of the topic relative to the associated object.

    ModifiedAuthor

    Returns the author that last modified the topic.

    Declaration
    Author ModifiedAuthor { get; }
    Property Value
    Type Description
    Author

    The author that last modified the topic.

    ModifiedDate

    Returns the modification date of the topic.

    Declaration
    DateTime ModifiedDate { get; }
    Property Value
    Type Description
    DateTime

    The modification date of the topic.

    Read

    Returns the read status of the topic.

    Declaration
    bool Read { get; }
    Property Value
    Type Description
    Boolean

    The read status of the topic.

    State

    Returns the state of the topic.

    Declaration
    TopicState State { get; }
    Property Value
    Type Description
    TopicState

    The state of the topic.

    Title

    Returns the title of the topic.

    Declaration
    string Title { get; }
    Property Value
    Type Description
    String

    The title of the topic.

    WorldCameraTransform

    Returns the world transform of the camera that looks at the topic.

    Declaration
    AnnotationTransform WorldCameraTransform { get; }
    Property Value
    Type Description
    AnnotationTransform

    The world transform of the camera that looks at the topic.

    WorldTransform

    Returns the world transform of the topic.

    Declaration
    AnnotationTransform WorldTransform { get; }
    Property Value
    Type Description
    AnnotationTransform

    The world transform of the topic.

    Methods

    CreateCommentAsync(ICommentCreation)

    Creates and adds an IComment to the topic, and synchronizes it with the IAnnotationDataSource assigned to the topic.

    Declaration
    Task<IComment> CreateCommentAsync(ICommentCreation commentCreation)
    Parameters
    Type Name Description
    ICommentCreation commentCreation

    The ICommentCreation object that contains the necessary information to create the new comment.

    Returns
    Type Description
    Task<IComment>

    A task whose result is the created comment.

    Examples
    async Task<IComment> CommentOnTopic(ITopic topic, string commentText)
    {
        // Creates and populates a CommentCreation request object.
        var commentCreation = new CommentCreation()
        {
            Text = commentText
        };
    
        // Sends the request to the repository and waits for the created comment.
        var comment = await topic.CreateCommentAsync(commentCreation);
        return comment;
    }

    DeleteCommentAsync(Guid)

    Removes an IComment from the topic and synchronizes it with the IAnnotationDataSource assigned to the topic.

    Declaration
    Task DeleteCommentAsync(Guid commentId)
    Parameters
    Type Name Description
    Guid commentId

    The ID of the comment you want to delete.

    Returns
    Type Description
    Task

    A task with no result.

    Examples
    async Task DeleteComment(ITopic topic, Guid commentId)
    {
        // Delete a specific topic in the repository.
        await topic.DeleteCommentAsync(commentId);
    }

    GetCommentAsync(Guid)

    Returns the IComment for the specific ID from the topic. Returns null if the IComment doesn't exist.

    Declaration
    Task<IComment> GetCommentAsync(Guid commentId)
    Parameters
    Type Name Description
    Guid commentId

    The ID of the comment you want to get.

    Returns
    Type Description
    Task<IComment>

    A task whose result is the fetched comment.

    Examples
    async Task<IComment> GetComment(ITopic topic, Guid commentId)
    {
        // Retrieve and return all topics in the repository.
        var comment = await topic.GetCommentAsync(commentId);
        return comment;
    }

    GetCommentsAsync()

    Calls the collection of IComments from the topic.

    Declaration
    Task<IEnumerable<IComment>> GetCommentsAsync()
    Returns
    Type Description
    Task<IEnumerable<IComment>>

    A task whose result is the collection of fetched comments.

    Examples
    async Task<IEnumerable<IComment>> GetComments(ITopic topic)
    {
        // Retrieve and return all topics in the repository.
        var comments = await topic.GetCommentsAsync();
        return comments;
    }

    UpdateCommentAsync(ICommentUpdate)

    Updates an IComment in the topic and synchronizes it with the IAnnotationDataSource assigned to the topic.

    Declaration
    Task<IComment> UpdateCommentAsync(ICommentUpdate commentUpdate)
    Parameters
    Type Name Description
    ICommentUpdate commentUpdate

    The ICommentUpdate object that contains the necessary information to update the comment.

    Returns
    Type Description
    Task<IComment>

    A task whose result is the updated comment.

    Examples
    async Task<IComment> UpdateComment(ITopic topic, IComment commentToUpdate, string commentText)
    {
        // Creates and populates a CommentUpdate request object.
        var commentCreation = new CommentUpdate(commentToUpdate)
        {
            Text = commentText
        };
    
        // Sends the request to the repository and waits for the created comment.
        var comment = await topic.UpdateCommentAsync(commentCreation);
        return comment;
    }

    Events

    CommentCreated

    Calls the methods in its invocation list when an IComment is created in the topic.

    Declaration
    event Action<IComment> CommentCreated
    Event Type
    Type Description
    Action<IComment>

    CommentRemoved

    Calls the methods in its invocation list when you remove an IComment from the topic.

    Declaration
    event Action<IComment> CommentRemoved
    Event Type
    Type Description
    Action<IComment>

    CommentUpdated

    Calls the methods in its invocation list when you update an IComment in the topic.

    Declaration
    event Action<IComment> CommentUpdated
    Event Type
    Type Description
    Action<IComment>
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023