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);
     }
 }
예제 #2
0
        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);
            }
        }