public async Task<ServerResponse> UploadGarbageData(MemoryStream garbageData) { using (var client = new HttpClient()) { InitializeClient(client); var response = await client.PostAsJsonAsync(string.Format("api/messenger/message/uploadgarbagedata"), garbageData); return HttpResponseMessageConverter.ConvertToServerResponse(response); } }
public async Task<ServerResponse> UpdateMessage(int id, string newMessage) { using (var client = new HttpClient()) { InitializeClient(client); var response = await client.PutAsJsonAsync(string.Format("api/messenger/message/{0}", id), newMessage); return HttpResponseMessageConverter.ConvertToServerResponse(response); } }
public async Task<ServerResponse> CreateMessage(Message message) { using (var client = new HttpClient()) { InitializeClient(client); var response = await client.PostAsJsonAsync("api/messenger/message", message); return HttpResponseMessageConverter.ConvertToServerResponse(response); } }
public async Task<ServerResponse<Message>> GetMessage(int id) { using (var client = new HttpClient()) { InitializeClient(client); var response = await client.GetAsync(string.Format("api/messenger/message/{0}", id)); return await HttpResponseMessageConverter<Message>.ConvertToServerResponse(response); } }
public async Task<ServerResponse<List<Message>>> GetAllMessages() { using (var client = new HttpClient()) { InitializeClient(client); var response = await client.GetAsync("api/messenger/message"); return await HttpResponseMessageConverter<List<Message>>.ConvertToServerResponse(response); } }
public async Task<ServerResponse> DeleteAllMessages() { using (var client = new HttpClient()) { InitializeClient(client); var response = await client.DeleteAsync("api/messenger/message"); return HttpResponseMessageConverter.ConvertToServerResponse(response); } }