public static RetrofitError httpError(string url, string response, Converter.Converter converter, Type successType) { var message = response; // string message = response.getStatus() + " " + response.getReason(); return(new RetrofitError(message, url, response, converter, successType, Kind.HTTP, null)); }
/// <summary> /// The converter used for serialization and deserialization of objects. /// </summary> /// <param name="converter"></param> /// <returns></returns> public Builder SetConverter(Converter.Converter converter) { if (converter == null) { throw new ArgumentException("Converter may not be null."); } this.converter = converter; return(this); }
public RetrofitError(string message, string url, string response, Converter.Converter converter, Type successType, Kind kind, Exception exception) : base(message, exception) { this.url = url; this.response = response; this.converter = converter; this.successType = successType; this.kind = kind; }
public void Awake() { methodInfoCache.Clear(); convert = new DefalutConvert(); httpImpl = SetHttpImpl(); interceptor = SetIntercepter(); rxSupport = new RxSupport(convert, httpImpl, interceptor); SetRestAPI(); StartCoroutine(GenMethodCache()); }
public void Init(bool enableLog, string baseUrl, HttpImplement httpImpl, RequestInterceptor requestInterceptor, Converter.Converter converter, ErrorHandler errorHandler) { methodInfoCache.Clear(); this.enableDebug = enableLog; this.baseUrl = baseUrl; this.httpImpl = httpImpl; this.interceptor = requestInterceptor; this.convert = converter; this.errorHandler = errorHandler; this.rxSupport = new RxSupport(convert, httpImpl, interceptor); }
private void Convert(string pythonModulePath, string cSharpProjectPath) { cSharpProjectPath += @"\Program"; Directory.CreateDirectory(cSharpProjectPath); File.WriteAllText(cSharpProjectPath + @"\Program.csproj", Resources.Program); File.WriteAllBytes(cSharpProjectPath + @"\Program.sln", Resources.Program1); File.WriteAllText(cSharpProjectPath + @"\Program.cs", Resources.Program2); Converter.Converter converter = new Converter.Converter(pythonModulePath, cSharpProjectPath + @"\Program.cs"); }
public BlogListManager() { _converter = new Converter.Converter(); _converter.Initialize(); data = new BindingList <FileTitlePair>(_loader.LoadPosts()); //TODO: lock directory and files InitializeComponent(); BlogListUI.DisplayMember = nameof(FileTitlePair.Title); BlogListUI.ValueMember = nameof(FileTitlePair.FileName); BlogListUI.DataSource = data; _tags = _loader.GetTags(); }
public void RxSendRequest <T>(UniRx.IObserver <T> o, Converter.Converter convert, object request) { HttpClientRequest httpClientRequest = request as HttpClientRequest; if (httpClientRequest != null) { if (EnableDebug) { Debug.LogFormat("Send on threadId:{0}", System.Threading.Thread.CurrentThread.ManagedThreadId); } httpClientRequest.Send(); } }
public object RxBuildRequest <T>(UniRx.IObserver <T> o, Converter.Converter convert, RestMethodInfo methodInfo, string url) { Action <HttpResponseMessage <string> > responseMessage = message => { string errorMessage = ""; if (IsRequestError(message, out errorMessage)) { o.OnError(new Exception(errorMessage)); return; } string result = GetSuccessResponse(message); // result = "[]"; // result = "[asd..s]"; if (EnableDebug) { Debug.LogFormat("Raw Response:{0}", result); } //Parse Json By Type if (typeof(T) == typeof(string)) { var resultData = (T)(object)result; o.OnNext(resultData); o.OnCompleted(); return; } T data = default(T); bool formatError = false; try { data = convert.FromBody <T>(result); } catch (ConversionException e) { formatError = true; o.OnError(new Exception(e.Message)); } if (!formatError) { o.OnNext(data); o.OnCompleted(); } }; HttpClientRequest httpClientRequest = new HttpClientRequest(new Uri(url), responseMessage); ConfigureRESTfulApi(methodInfo, httpClientRequest); return(httpClientRequest); }
private void EnsureSaneDefaults() { if (converter == null) { converter = new DefalutConvert(); } if (httpImpl == null) { httpImpl = new HttpClientImpl(); } if (errorHandler == null) { errorHandler = new DefaultErrorHandler(); } if (requestInterceptor == null) { requestInterceptor = new DefaultRequestInterceptor(); } }
public RxSupport(Converter.Converter convert, HttpImplement httpImpl, RequestInterceptor interceptor) { this.convert = convert; this.rxHttpImpl = httpImpl as RxHttpImplement; this.interceptor = interceptor; }
public static RetrofitError conversionError(string url, string response, Converter.Converter converter, Type successType, ConversionException exception) { return(new RetrofitError(exception.Message, url, response, converter, successType, Kind.CONVERSION, exception)); }