59 lines
1.3 KiB
C#
59 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
namespace Studio.Setting.Connect
|
|
{
|
|
/// <summary>
|
|
/// API Domain,URL, Port Setting
|
|
/// </summary>
|
|
///
|
|
public enum APIState
|
|
{
|
|
Loaded, Loading, Error
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class ResponseModel<T>
|
|
{
|
|
public int requestsize;
|
|
public int status;
|
|
public string code;
|
|
public string message;
|
|
public T data;
|
|
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"ResponseModel status:{status}, 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;
|
|
}
|
|
}
|
|
}
|