docs.unity3d.com
    Show / Hide Table of Contents

    Interface IFriendsService

    FriendsService is the managed service that let's user's interact with the Friends package's features

    Inherited Members
    IMessagingService.MessageAsync<T>(String, T)
    Namespace: Unity.Services.Friends
    Syntax
    public interface IFriendsService : IMessagingService

    Properties

    Blocks

    The list of the user's blocks.

    Declaration
    IReadOnlyList<Relationship> Blocks { get; }
    Property Value
    Type Description
    IReadOnlyList<Relationship>
    Exceptions
    Type Condition
    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    Friends

    The list of the user's friends.

    Declaration
    IReadOnlyList<Relationship> Friends { get; }
    Property Value
    Type Description
    IReadOnlyList<Relationship>
    Exceptions
    Type Condition
    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    IncomingFriendRequests

    The list of the user's incoming friend requests.

    Declaration
    IReadOnlyList<Relationship> IncomingFriendRequests { get; }
    Property Value
    Type Description
    IReadOnlyList<Relationship>
    Exceptions
    Type Condition
    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    OutgoingFriendRequests

    The list of the user's outgoing friend requests.

    Declaration
    IReadOnlyList<Relationship> OutgoingFriendRequests { get; }
    Property Value
    Type Description
    IReadOnlyList<Relationship>
    Exceptions
    Type Condition
    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    Relationships

    The full list of the user's relationships.

    Declaration
    IReadOnlyList<Relationship> Relationships { get; }
    Property Value
    Type Description
    IReadOnlyList<Relationship>
    Exceptions
    Type Condition
    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    Methods

    AddBlockAsync(String)

    Creates a block towards the targeted user

    Declaration
    Task<Relationship> AddBlockAsync(string memberId)
    Parameters
    Type Name Description
    String memberId

    The ID of the target user..

    Returns
    Type Description
    Task<Relationship>

    The relationship created

    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    AddFriendAsync(String)

    Creates a friend request or creates a friendship if the user had already an incoming friend request from the targeted user.

    Declaration
    Task<Relationship> AddFriendAsync(string memberId)
    Parameters
    Type Name Description
    String memberId

    The ID of the target user..

    Returns
    Type Description
    Task<Relationship>

    The relationship created

    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    AddFriendByNameAsync(String)

    Creates a friend request or creates a friendship if the user had already an incoming friend request from the targeted user by their member name.

    Declaration
    Task<Relationship> AddFriendByNameAsync(string name)
    Parameters
    Type Name Description
    String name

    The name of the target member

    Returns
    Type Description
    Task<Relationship>

    The relationship created

    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    DeleteBlockAsync(String)

    Deletes a block.

    Declaration
    Task DeleteBlockAsync(string memberId)
    Parameters
    Type Name Description
    String memberId

    The ID of the member that will be unblocked.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    DeleteFriendAsync(String)

    Deletes a friend.

    Declaration
    Task DeleteFriendAsync(string memberId)
    Parameters
    Type Name Description
    String memberId

    The ID of the friend to be deleted.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    DeleteIncomingFriendRequestAsync(String)

    Deletes an incoming friend request.

    Declaration
    Task DeleteIncomingFriendRequestAsync(string memberId)
    Parameters
    Type Name Description
    String memberId

    The ID of the user that sent the friend request.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    DeleteOutgoingFriendRequestAsync(String)

    Deletes an outgoing friend request.

    Declaration
    Task DeleteOutgoingFriendRequestAsync(string memberId)
    Parameters
    Type Name Description
    String memberId

    The ID of the user that a friend request was sent to.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    DeleteRelationshipAsync(String)

    Deletes a relationship.

    Declaration
    Task DeleteRelationshipAsync(string relationshipId)
    Parameters
    Type Name Description
    String relationshipId

    The ID of the relationship to be deleted.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    ForceRelationshipsRefreshAsync()

    Forcefully refreshes the list of relationships in case they were not refreshed automatically by the service

    Declaration
    Task ForceRelationshipsRefreshAsync()
    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    InitializeAsync(InitializeOptions)

    Initialize the Friends Service API. This must be called before using any other functionality of the Friends service. This can only be called when a user is signed in.

    Declaration
    Task InitializeAsync(InitializeOptions initializeOptions = null)
    Parameters
    Type Name Description
    InitializeOptions initializeOptions

    Options to initialize the friends service

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    SetPresenceActivityAsync<T>(T)

    Sets the user's presence activity value.

    Declaration
    Task SetPresenceActivityAsync<T>(T activity)
        where T : new()
    Parameters
    Type Name Description
    T activity

    The activity value to be set for the user's presence.

    Returns
    Type Description
    Task
    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    SetPresenceAsync<T>(PresenceAvailabilityOptions, T)

    Sets the presence for the user.

    Declaration
    Task SetPresenceAsync<T>(PresenceAvailabilityOptions availabilityOption, T activity)
        where T : new()
    Parameters
    Type Name Description
    PresenceAvailabilityOptions availabilityOption

    The type of availability to be set for the user's presence.

    T activity

    The activity value to be set for the user's presence.

    Returns
    Type Description
    Task
    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    SetPresenceAvailabilityAsync(PresenceAvailabilityOptions)

    Sets the user's presence availability.

    Declaration
    Task SetPresenceAvailabilityAsync(PresenceAvailabilityOptions availabilityOption)
    Parameters
    Type Name Description
    PresenceAvailabilityOptions availabilityOption

    The type of availability to be set for the user's presence.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentException

    Represents an error that occurs when an argument is incorrectly setup.

    RelationshipsServiceException

    An exception containing the HttpClientResponse with headers, response code, and string of error.

    InvalidOperationException

    Represents an error that occurs when the service has not been initialized.

    Events

    MessageReceived

    Event called when a message is received

    Declaration
    event Action<IMessageReceivedEvent> MessageReceived
    Event Type
    Type Description
    Action<IMessageReceivedEvent>

    PresenceUpdated

    Event called when a friend's presence is updated.

    Declaration
    event Action<IPresenceUpdatedEvent> PresenceUpdated
    Event Type
    Type Description
    Action<IPresenceUpdatedEvent>

    RelationshipAdded

    Event called when a relationship gets added.

    Declaration
    event Action<IRelationshipAddedEvent> RelationshipAdded
    Event Type
    Type Description
    Action<IRelationshipAddedEvent>

    RelationshipDeleted

    Event called when a relationship gets deleted.

    Declaration
    event Action<IRelationshipDeletedEvent> RelationshipDeleted
    Event Type
    Type Description
    Action<IRelationshipDeletedEvent>
    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