mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 15:07:03 +01:00
Add missing methods to UserClient
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models;
|
||||
|
||||
@@ -13,9 +14,24 @@ namespace Tgstation.Server.Client
|
||||
/// Read the current user's information and general rights
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in the current <see cref="User"/></returns>
|
||||
Task<User> Read(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get a specific <paramref name="user"/>
|
||||
/// </summary>
|
||||
/// <param name="user">The <see cref="User"/> to get</param>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in the requested <paramref name="user"/></returns>
|
||||
Task<User> GetId(User user, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// List all <see cref="User"/>s
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> resulting in a <see cref="IReadOnlyList{T}"/> of all <see cref="User"/>s</returns>
|
||||
Task<IReadOnlyList<User>> List(CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <paramref name="user"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api;
|
||||
@@ -26,6 +27,12 @@ namespace Tgstation.Server.Client
|
||||
/// <inheritdoc />
|
||||
public Task<User> Create(UserUpdate user, CancellationToken cancellationToken) => apiClient.Create<UserUpdate, User>(Routes.User, user, cancellationToken);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<User> GetId(User user, CancellationToken cancellationToken) => apiClient.Read<User>(Routes.SetID(Routes.User, user.Id), cancellationToken);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<User>> List(CancellationToken cancellationToken) => apiClient.Read<IReadOnlyList<User>>(Routes.List(Routes.User), cancellationToken);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<User> Read(CancellationToken cancellationToken) => apiClient.Read<User>(Routes.User, cancellationToken);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user