public async Task <ToDoItemSingleResponse> DeleteItemAsync(string id) { httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", AccessToken); var response = await httpClient.DeleteAsync(_baseUrl + "/api/items/" + id); var responseAsString = await response.Content.ReadAsStringAsync(); ToDoItemSingleResponse toDoItemSingleResponse = JsonSerializer.Deserialize <ToDoItemSingleResponse>(responseAsString, serializerOptions); return(toDoItemSingleResponse); }
public async Task <ToDoItemSingleResponse> EditItemAsync(ToDoItemRequest toDoItemRequest) { httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", AccessToken); StringContent serializedToDoItemRequest = new StringContent(JsonSerializer.Serialize(toDoItemRequest, serializerOptions), Encoding.UTF8, "application/json"); var response = await httpClient.PutAsync(_baseUrl + "/api/items", serializedToDoItemRequest); var responseAsString = await response.Content.ReadAsStringAsync(); ToDoItemSingleResponse toDoItemSingleResponse = JsonSerializer.Deserialize <ToDoItemSingleResponse>(responseAsString, serializerOptions); return(toDoItemSingleResponse); }