private UserWebservice(){ _restClient = new RestClient (User.BaseURL()); _currentUser = null; _anyError = null; }
/** * Actual private method that fires up the web serivce client as tasks. This invokes the rest -client previously configured * to return the output as resonse string from web serivce request. It throws any exception it encounters during task running. * */ private async Task<String> InvokeWebserviceAtURLAsync(string URLString) { var responseString = string.Empty; try { responseString = await _restClient.MakeRequestAsync (URLString); } catch (HttpRequestException ex){ throw new CustomHttpException (ex.Message); } catch (WebException ex){ throw new CustomHttpException (ex.Message); } catch (JsonException ex) { _anyError = JsonConvert.DeserializeObject<APIError>(responseString); } return responseString; }