# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule VRChat.Api.Users do
@moduledoc """
API calls for all endpoints tagged `Users`.
"""
alias VRChat.Connection
import VRChat.RequestBuilder
@doc """
Get User by ID
Get public user information about a specific user using their ID.
## Parameters
- connection (VRChat.Connection): Connection to server
- user_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, VRChat.Model.User.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_user(Tesla.Env.client, String.t, keyword()) :: {:ok, VRChat.Model.User.t} | {:ok, VRChat.Model.Error.t} | {:error, Tesla.Env.t}
def get_user(connection, user_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/users/#{user_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %VRChat.Model.User{}},
{ 401, %VRChat.Model.Error{}}
])
end
@doc """
Get User by Username
Get public user information about a specific user using their name.
## Parameters
- connection (VRChat.Connection): Connection to server
- username (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, VRChat.Model.User.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_user_by_name(Tesla.Env.client, String.t, keyword()) :: {:ok, VRChat.Model.User.t} | {:ok, VRChat.Model.Error.t} | {:error, Tesla.Env.t}
def get_user_by_name(connection, username, _opts \\ []) do
%{}
|> method(:get)
|> url("/users/#{username}/name")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %VRChat.Model.User{}},
{ 401, %VRChat.Model.Error{}}
])
end
@doc """
Search All Users
Search and list any users by text query
## Parameters
- connection (VRChat.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :search (String.t): Searches by `displayName`. Will return empty array if search query is empty or missing.
- :developer_type (String.t): Active user by developer type, none for normal users and internal for moderators
- :n (integer()): The number of objects to return.
- :offset (integer()): A zero-based offset from the default object sorting from where search results start.
## Returns
{:ok, [%LimitedUser{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec search_users(Tesla.Env.client, keyword()) :: {:ok, VRChat.Model.Error.t} | {:ok, list(VRChat.Model.LimitedUser.t)} | {:error, Tesla.Env.t}
def search_users(connection, opts \\ []) do
optional_params = %{
:search => :query,
:developerType => :query,
:n => :query,
:offset => :query
}
%{}
|> method(:get)
|> url("/users")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%VRChat.Model.LimitedUser{}]},
{ 400, %VRChat.Model.Error{}},
{ 401, %VRChat.Model.Error{}}
])
end
@doc """
Update User Info
Update a users information such as the email and birthday.
## Parameters
- connection (VRChat.Connection): Connection to server
- user_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :body (UpdateUserRequest):
## Returns
{:ok, VRChat.Model.CurrentUser.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec update_user(Tesla.Env.client, String.t, keyword()) :: {:ok, VRChat.Model.CurrentUser.t} | {:error, Tesla.Env.t}
def update_user(connection, user_id, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/users/#{user_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %VRChat.Model.CurrentUser{}}
])
end
end