|
|
|
@ -0,0 +1,128 @@
|
|
|
|
|
using Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http.Json;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Reflection.Metadata;
|
|
|
|
|
using System.Runtime.ConstrainedExecution;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
|
|
|
|
namespace HttpClient
|
|
|
|
|
{
|
|
|
|
|
public partial class HttpClientManager
|
|
|
|
|
{
|
|
|
|
|
public class ChampionManager : IChampionsManager
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly HttpClientManager parent;
|
|
|
|
|
|
|
|
|
|
private System.Net.Http.HttpClient httpc;
|
|
|
|
|
|
|
|
|
|
public string BaseAddress;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ChampionManager(HttpClientManager parent, System.Net.Http.HttpClient httpc) {
|
|
|
|
|
|
|
|
|
|
this.httpc = httpc;
|
|
|
|
|
this.parent = parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<Champion?> AddItem(Champion? item) //return le champion ajouté, null sinon ?
|
|
|
|
|
{
|
|
|
|
|
if(item==null) throw new ArgumentNullException("item is null");
|
|
|
|
|
var response = await httpc.PostAsJsonAsync("/Champion?Name = " + item.Name, item);
|
|
|
|
|
|
|
|
|
|
return response.IsSuccessStatusCode ? item : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<bool> DeleteItem(Champion? item)
|
|
|
|
|
{
|
|
|
|
|
HttpResponseMessage response = await httpc.DeleteAsync("/Champion?Name=" + item.Name);
|
|
|
|
|
return response.IsSuccessStatusCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return httpc.GetFromJsonAsync<IEnumerable<Champion>>("/Champion?index="+index+"&size="+count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return httpc.GetFromJsonAsync<IEnumerable<Champion>>("/Champion?name="+substring+"&index=" + index + "&size=" + count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItems()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByCharacteristic(string charName)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByClass(ChampionClass championClass)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByName(string substring)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByRunePage(RunePage? runePage)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsBySkill(Skill? skill)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsBySkill(string skill)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<Champion?> UpdateItem(Champion? oldItem, Champion? newItem)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|