public void Simple() { var feedbackService = new FeedbackService { RequestBuilder = ServerRequestBuilder.Instance }; var request = new FeedbackRequest { Since = 10.Days().Ago() }; feedbackService.Execute(request, Callback, ExceptionHandler.Handle); }
public void Execute(FeedbackRequest request, Action<FeedbackResponse> responseCallback, Action<Exception> exceptionCallback) { var url = "https://go.urbanairship.com/api/device_tokens/feedback/?since=" + request.Since.ToIso8601(); var webRequest = RequestBuilder.Build(url); webRequest.Method = "GET"; var asyncRequest = new AsyncRequest { ReadFromResponse = stream => responseCallback(FeedbackResponseDeSerializer.DeSerialize(stream)), Request = webRequest, ExceptionCallback = exceptionCallback, RequestContentType = "application/json" }; asyncRequest.Execute(); }
public void Execute(FeedbackRequest request, Action <FeedbackResponse> responseCallback, Action <Exception> exceptionCallback) { var url = "https://go.urbanairship.com/api/device_tokens/feedback/?since=" + request.Since.ToIso8601(); var webRequest = RequestBuilder.Build(url); webRequest.Method = "GET"; webRequest.ContentType = "application/json"; var asyncRequest = new AsyncRequest { ReadFromResponse = stream => responseCallback(FeedbackResponseDeSerializer.DeSerialize(stream)), Request = webRequest, ExceptionCallback = exceptionCallback, }; asyncRequest.Execute(); }
public void Integration() { var feedbackService = new FeedbackService { RequestBuilder = RequestBuilderHelper.Build() }; var helper = new AsyncTestHelper<FeedbackResponse>(); var request = new FeedbackRequest { Since = 10.Days().Ago() }; feedbackService.Execute(request, helper.Callback, helper.HandleException); helper.Wait(); var deviceFeedbacks = helper.Response.DeviceFeedbacks; Debug.WriteLine(deviceFeedbacks.Count); foreach (var deviceFeedback in deviceFeedbacks) { Debug.WriteLine(deviceFeedback.DeviceToken); Debug.WriteLine(deviceFeedback.MakedInactiveOn); } }