Skip to content

Latest commit

 

History

History
505 lines (402 loc) · 15.8 KB

FriendsApi.md

File metadata and controls

505 lines (402 loc) · 15.8 KB

VRChat.API.Api.FriendsApi

All URIs are relative to https://api.vrchat.cloud/api/1

Method HTTP request Description
DeleteFriendRequest DELETE /user/{userId}/friendRequest Delete Friend Request
Friend POST /user/{userId}/friendRequest Send Friend Request
GetFriendStatus GET /user/{userId}/friendStatus Check Friend Status
GetFriends GET /auth/user/friends List Friends
Unfriend DELETE /auth/user/friends/{userId} Unfriend

DeleteFriendRequest

Success DeleteFriendRequest (string userId)

Delete Friend Request

Deletes an outgoing pending friend request to another user. To delete an incoming friend request, use the deleteNotification endpoint instead.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class DeleteFriendRequestExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new FriendsApi(config);
            var userId = "userId_example";  // string | Must be a valid user ID.

            try
            {
                // Delete Friend Request
                Success result = apiInstance.DeleteFriendRequest(userId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FriendsApi.DeleteFriendRequest: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteFriendRequestWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete Friend Request
    ApiResponse<Success> response = apiInstance.DeleteFriendRequestWithHttpInfo(userId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FriendsApi.DeleteFriendRequestWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
userId string Must be a valid user ID.

Return type

Success

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response after cancelling a friend request. -
401 Error response due to missing auth cookie. -
404 Error response when trying to delete a non-existent friend-request. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Friend

Notification Friend (string userId)

Send Friend Request

Send a friend request to another user.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class FriendExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new FriendsApi(config);
            var userId = "userId_example";  // string | Must be a valid user ID.

            try
            {
                // Send Friend Request
                Notification result = apiInstance.Friend(userId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FriendsApi.Friend: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the FriendWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Send Friend Request
    ApiResponse<Notification> response = apiInstance.FriendWithHttpInfo(userId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FriendsApi.FriendWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
userId string Must be a valid user ID.

Return type

Notification

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a single Notifcation object. -
400 Bad request error response when sending a friend request -
401 Error response due to missing auth cookie. -
404 Error response when trying to send a friend request to a user which doesn't exist. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetFriendStatus

FriendStatus GetFriendStatus (string userId)

Check Friend Status

Retrieve if the user is currently a friend with a given user, if they have an outgoing friend request, and if they have an incoming friend request. The proper way to receive and accept friend request is by checking if the user has an incoming Notification of type friendRequest, and then accepting that notification.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class GetFriendStatusExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new FriendsApi(config);
            var userId = "userId_example";  // string | Must be a valid user ID.

            try
            {
                // Check Friend Status
                FriendStatus result = apiInstance.GetFriendStatus(userId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FriendsApi.GetFriendStatus: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetFriendStatusWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Check Friend Status
    ApiResponse<FriendStatus> response = apiInstance.GetFriendStatusWithHttpInfo(userId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FriendsApi.GetFriendStatusWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
userId string Must be a valid user ID.

Return type

FriendStatus

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a users Friend Status. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetFriends

List<LimitedUser> GetFriends (int? offset = null, int? n = null, bool? offline = null)

List Friends

List information about friends.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class GetFriendsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new FriendsApi(config);
            var offset = 56;  // int? | A zero-based offset from the default object sorting from where search results start. (optional) 
            var n = 60;  // int? | The number of objects to return. (optional)  (default to 60)
            var offline = true;  // bool? | Returns *only* offline users if true, returns only online and active users if false (optional) 

            try
            {
                // List Friends
                List<LimitedUser> result = apiInstance.GetFriends(offset, n, offline);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FriendsApi.GetFriends: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetFriendsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // List Friends
    ApiResponse<List<LimitedUser>> response = apiInstance.GetFriendsWithHttpInfo(offset, n, offline);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FriendsApi.GetFriendsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
offset int? A zero-based offset from the default object sorting from where search results start. [optional]
n int? The number of objects to return. [optional] [default to 60]
offline bool? Returns only offline users if true, returns only online and active users if false [optional]

Return type

List<LimitedUser>

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a list of LimitedUser objects. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Unfriend

Success Unfriend (string userId)

Unfriend

Unfriend a user by ID.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class UnfriendExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new FriendsApi(config);
            var userId = "userId_example";  // string | Must be a valid user ID.

            try
            {
                // Unfriend
                Success result = apiInstance.Unfriend(userId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FriendsApi.Unfriend: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UnfriendWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Unfriend
    ApiResponse<Success> response = apiInstance.UnfriendWithHttpInfo(userId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FriendsApi.UnfriendWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
userId string Must be a valid user ID.

Return type

Success

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response after unfriending a user. -
400 Error response when trying to unfriend someone who is not a friend. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]