예제 #1
0
        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));
        }
예제 #2
0
        private Data LoadData()
        {
            var dataTextAsset = Resources.Load <TextAsset>("data");
            var data          = _jsonParser.FromJson <Data>(dataTextAsset.text);

            return(data);
        }