161 lines
5.4 KiB
C#
161 lines
5.4 KiB
C#
using Microsoft.AspNetCore.SignalR.Client;
|
|
using QtCNETAPI.Dtos.User;
|
|
using QtCNETAPI.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace QtCNETAPI.Services.GatewayService
|
|
{
|
|
public interface IGatewayService
|
|
{
|
|
// VARIABLES
|
|
|
|
/// <summary>
|
|
/// The Current Room The Current User Is In
|
|
/// </summary>
|
|
public Room? CurrentRoom { get; }
|
|
/// <summary>
|
|
/// Is The User Currently In The Lobby?
|
|
/// </summary>
|
|
public bool InLobby { get; }
|
|
/// <summary>
|
|
/// The Current Connection To The Gateway
|
|
/// </summary>
|
|
public HubConnection? HubConnection { get; }
|
|
|
|
// FUNCTIONS
|
|
|
|
/// <summary>
|
|
/// The Function Used To Connect To The Gateway Server Asynchronously
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Task StartAsync();
|
|
|
|
/// <summary>
|
|
/// Stops The Connection To The Gateway Server
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Task StopAsync();
|
|
|
|
/// <summary>
|
|
/// Disposes Of The Gateway Connection And Clears Other Variables
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Task DisposeAsync();
|
|
|
|
/// <summary>
|
|
/// Joins The Lobby Of The Server
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
/// <exception cref="InvalidOperationException">Thrown if the function is called before the connection is established.</exception>
|
|
public Task JoinLobbyAsync();
|
|
|
|
/// <summary>
|
|
/// Joins The Current User To A Room On The Server
|
|
/// </summary>
|
|
/// <param name="room">Room To Join</param>
|
|
/// <returns></returns>
|
|
/// <exception cref="InvalidOperationException">Thrown if the function is called before the connection is established.</exception>
|
|
public Task JoinRoomAsync(Room room);
|
|
|
|
/// <summary>
|
|
/// Leaves The Current Room The Current User Is In
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Task LeaveRoomAsync();
|
|
|
|
/// <summary>
|
|
/// Posts A Message To Whatever Room The User Is In
|
|
/// </summary>
|
|
/// <param name="message">Message To Post</param>
|
|
/// <returns></returns>
|
|
/// <exception cref="InvalidOperationException">Thrown if the function is called before the connection is established.</exception>
|
|
public Task PostMessageAsync(Message message);
|
|
|
|
/// <summary>
|
|
/// Sends A Direct Message To The Specified User
|
|
/// </summary>
|
|
/// <param name="user">The User You Wish To DM</param>
|
|
/// <param name="currentUser">Yourself</param>
|
|
/// <param name="message"></param>
|
|
/// <returns></returns>
|
|
public Task SendDirectMessageAsync(UserInformationDto user, Message message);
|
|
|
|
/// <summary>
|
|
/// Refreshes Contacts List For A Specified User
|
|
/// </summary>
|
|
/// <param name="user">The User You Wish To Refresh</param>
|
|
/// <param name="currentUser">Yourself</param>
|
|
/// <returns></returns>
|
|
public Task RefreshContactsForUser(UserInformationDto user);
|
|
|
|
/// <summary>
|
|
/// Updates The Status For The Current User
|
|
/// </summary>
|
|
/// <param name="status">The Status You Want To Set On The Current User</param>
|
|
/// <returns></returns>
|
|
public Task UpdateStatus(int status);
|
|
|
|
// EVENTS
|
|
|
|
/// <summary>
|
|
/// When A Room Message Is Received, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnRoomMessageReceived;
|
|
|
|
/// <summary>
|
|
/// Fires When The User List For A Room Is Received
|
|
/// </summary>
|
|
public event EventHandler OnRoomUserListReceived;
|
|
|
|
/// <summary>
|
|
/// When A Client Function/Event Is Received, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnClientFunctionReceived;
|
|
|
|
/// <summary>
|
|
/// When The Client Received A DM, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnDirectMessageReceived;
|
|
|
|
/// <summary>
|
|
/// Fires When The Client Receives The Request To Refresh Its User List
|
|
/// </summary>
|
|
public event EventHandler OnRefreshUserListsReceived;
|
|
|
|
/// <summary>
|
|
/// Fires When The Client Receives The Request To Refresh Its Room List
|
|
/// </summary>
|
|
public event EventHandler OnRefreshRoomListReceived;
|
|
|
|
/// <summary>
|
|
/// Fires When The Client Receives The Request To Refresh Its Contacts List
|
|
/// </summary>
|
|
public event EventHandler OnRefreshContactsListReceived;
|
|
|
|
/// <summary>
|
|
/// When The Server Config Is Received, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnServerConfigReceived;
|
|
|
|
/// <summary>
|
|
/// When The Connection To The Gateway Is Lost, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnServerDisconnect;
|
|
|
|
/// <summary>
|
|
/// When The Connection Attempts To Reconnect, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnServerReconnecting;
|
|
|
|
/// <summary>
|
|
/// When the Connection Reconnects, This Event Fires
|
|
/// </summary>
|
|
public event EventHandler OnServerReconnected;
|
|
}
|
|
}
|