public Tuple <ulong, byte[]> SendAttachment(PushAttachmentData attachment)// throws IOException { string response = makeRequest(string.Format(ATTACHMENT_PATH, ""), "GET", null); AttachmentDescriptor attachmentKey = JsonUtil.fromJson <AttachmentDescriptor>(response); if (attachmentKey == null || attachmentKey.getLocation() == null) { throw new Exception("Server failed to allocate an attachment key!"); } Debug.WriteLine("Got attachment content location: " + attachmentKey.getLocation(), TAG); byte[] digest = UploadAttachment("PUT", attachmentKey.getLocation(), attachment.getData(), attachment.getDataSize(), attachment.getKey()); return(new Tuple <ulong, byte[]>(attachmentKey.getId(), digest)); }
public async Task <ulong> sendAttachment(PushAttachmentData attachment)// throws IOException { string response = await makeRequest(string.Format(ATTACHMENT_PATH, ""), "GET", null); AttachmentDescriptor attachmentKey = JsonUtil.fromJson <AttachmentDescriptor>(response); if (attachmentKey == null || attachmentKey.getLocation() == null) { throw new Exception("Server failed to allocate an attachment key!"); } Debug.WriteLine("Got attachment content location: " + attachmentKey.getLocation(), TAG); /*uploadAttachment("PUT", attachmentKey.getLocation(), attachment.getData(), * attachment.getDataSize(), attachment.getKey()); */ throw new NotImplementedException("PushServiceSocket sendAttachment"); return(attachmentKey.getId()); }