public SendMessageResponse sendMessage(OutgoingPushMessageList bundle) { try { string responseText = makeRequest(string.Format(MESSAGE_PATH, bundle.getDestination()), "PUT", JsonUtil.toJson(bundle)); return(JsonUtil.fromJson <SendMessageResponse>(responseText)); } catch (NotFoundException nfe) { throw new UnregisteredUserException(bundle.getDestination(), nfe); } }
public async Task <SendMessageResponse> SendMessage(CancellationToken token, OutgoingPushMessageList bundle, UnidentifiedAccess?unidentifiedAccess) { try { string responseText = await MakeServiceRequestAsync(token, string.Format(MESSAGE_PATH, bundle.Destination), "PUT", JsonUtil.ToJson(bundle), unidentifiedAccess); return(JsonUtil.FromJson <SendMessageResponse>(responseText)); } catch (NotFoundException nfe) { throw new UnregisteredUserException(bundle.Destination, nfe); } }
public async Task <SendMessageResponse> SendMessage(OutgoingPushMessageList bundle, UnidentifiedAccess?unidentifiedAccess, CancellationToken?token = null) { if (token == null) { token = CancellationToken.None; } try { string responseText = await MakeServiceRequestAsync(string.Format(MESSAGE_PATH, bundle.Destination), "PUT", JsonUtil.ToJson(bundle), EmptyResponseCodeHandler, unidentifiedAccess, token); return(JsonUtil.FromJson <SendMessageResponse>(responseText)); } catch (NotFoundException nfe) { throw new UnregisteredUserException(bundle.Destination, nfe); } }
public async Task <SendMessageResponse> sendMessage(OutgoingPushMessageList bundle) //throws IOException { try { string responseText = await makeRequest(string.Format(MESSAGE_PATH, bundle.getDestination()), "PUT", JsonUtil.toJson(bundle)); if (responseText == null) { return(new SendMessageResponse(false)); } else { return(JsonUtil.fromJson <SendMessageResponse>(responseText)); } } catch (Exception nfe) { throw new UnregisteredUserException(bundle.getDestination(), nfe); } }