コード例 #1
0
ファイル: Comicvine.cs プロジェクト: charles-opper/comic-base
        private T GetResource <T>(string RequestResourceUrl, params Parameter[] FieldsParameter) where T : new()
        {
            RestClient _Client = RestHelper.CreateComicVineClient(fApiKey);

            IRestRequest _Request = new RestRequest(RequestResourceUrl, Method.GET);

            if (FieldsParameter != null)
            {
                _Request.Parameters.AddRange(FieldsParameter.Where(w => w != null));
            }

            _Request.AddParameter(ApiResources.Format, ApiResources.FormatXML, ParameterType.QueryString);

            IRestResponse <T> _Response = _Client.Execute <T>(_Request);

            if (_Response.ErrorException != null)
            {
                throw _Response.ErrorException;
            }

            return(_Response.Data);
        }