52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
#nullable enable
|
|
|
|
namespace UVC.Network
|
|
{
|
|
public enum APIState
|
|
{
|
|
Loaded, Loading, Error
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class HttpResponseModel<T>
|
|
{
|
|
public int code;
|
|
public string message;
|
|
public T? data;
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"HttpResponseModel code:{code} message:{message} data:{data}";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Data로 한번 감싸진 response때문에
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
[System.Serializable]
|
|
public class ResponseDataModel<T>
|
|
{
|
|
public T? data;
|
|
}
|
|
|
|
public class EntityWithState<T>
|
|
{
|
|
private APIState state;
|
|
public APIState State { get => state; }
|
|
|
|
private T? entity;
|
|
public T? Entity { get => entity; }
|
|
|
|
private string? message;
|
|
public string? Message { get => message; }
|
|
|
|
public EntityWithState(APIState state, T? entity, string? message = null)
|
|
{
|
|
this.state = state;
|
|
this.entity = entity;
|
|
this.message = message;
|
|
}
|
|
}
|
|
}
|