42 lines
1.3 KiB
C#

using Assets.Scripts.Apis.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Apis
{
public class GameRoomApi : ApiBase
{
public async Task<JsonResult<object>> Add(string name,int routeId,string pwd,DateTime startTime,int closeTime,int maxMembers)
{
return await PostAsync<JsonResult<object>>($"GameRoom/Add", new {
name,
routeId,
pwd,
startTime,
closeTime,
maxMembers
});
}
public async Task<JsonResult<List<GameRoomModel>>> GetList(int pageIndex, int pageSize,int? id = null)
{
return await GetAsync<JsonResult<List<GameRoomModel>>>($"GameRoom/GetList?pageIndex={pageIndex}&pageSize={pageSize}&id={id}");
}
public JsonResult<GameRoomModel> GetDetail(int id)
{
return Get<JsonResult<GameRoomModel>>($"GameRoom/GetDetail?Id={id}");
}
public async Task<JsonResult<JObject>> ConfirmRoomPwd(int id,string pwd)
{
return await GetAsync<JsonResult<JObject>>($"GameRoom/ConfirmRoomPwd?id={id}&pwd={pwd}");
}
}
}