public async Task <TResponse> Post <TRequest, TResponse>(string url, TRequest request) where TRequest : Request where TResponse : Response { const string jsonMediaType = "application/json"; var data = new StringContent(_jsonParser.ToJson(request), Encoding.UTF8, jsonMediaType); var response = await _client.PostAsync(url, data); var contents = await response.Content.ReadAsStringAsync(); return(_jsonParser.FromJson <TResponse>(contents)); }
private Data LoadData() { var dataTextAsset = Resources.Load <TextAsset>("data"); var data = _jsonParser.FromJson <Data>(dataTextAsset.text); return(data); }