public void Execute(GetTagsForDeviceRequest request, Action<GetTagsForDeviceResponse> responseCallback, Action<Exception> exceptionCallback) { var webRequest = RequestBuilder.Build(string.Format("https://go.urbanairship.com/api/device_tokens/{0}/tags/", request.DeviceToken)); webRequest.Method = "GET"; var asyncRequest = new AsyncRequest { ReadFromResponse = stream => responseCallback(new GetTagsForDeviceResponse { Tags = TagDeSerializer.DeSerialize(stream).ToList() }), Request = webRequest, ExceptionCallback = exceptionCallback, RequestContentType = "application/json" }; asyncRequest.Execute(); }
public void TagsForDevices() { var service = new GetTagsForDeviceService { RequestBuilder = RequestBuilderHelper.Build() }; var helper = new AsyncTestHelper<GetTagsForDeviceResponse>(); var request = new GetTagsForDeviceRequest {DeviceToken = RemoteSettings.AppleDeviceId}; service.Execute(request, helper.Callback, helper.HandleException); helper.Wait(); foreach (var tag in helper.Response.Tags) { Debug.WriteLine(tag); } }
public void Execute(GetTagsForDeviceRequest request, Action <GetTagsForDeviceResponse> responseCallback, Action <Exception> exceptionCallback) { var webRequest = RequestBuilder.Build(string.Format("https://go.urbanairship.com/api/device_tokens/{0}/tags/", request.DeviceToken)); webRequest.Method = "GET"; webRequest.ContentType = "application/json"; var asyncRequest = new AsyncRequest { ReadFromResponse = stream => responseCallback(new GetTagsForDeviceResponse { Tags = TagDeSerializer.DeSerialize(stream).ToList() }), Request = webRequest, ExceptionCallback = exceptionCallback, }; asyncRequest.Execute(); }