db_harvests_list <- function(db, colony_id = NULL, apiary_id = NULL) { api_get(db, "/v1/harvests", list(colony_id = colony_id, apiary_id = apiary_id)) } db_harvests_insert <- function(db, date, weight_kg, colony_id = NA, apiary_id = NA, type = NA, notes = NA, time = NA) { result <- api_post(db, "/v1/harvests", list( date = as.character(date), weight_kg = weight_kg, colony_id = colony_id, apiary_id = apiary_id, type = type, notes = notes, time = time )) result$id } db_harvests_get <- function(db, id) { api_get_one(db, paste0("/v1/harvests/", id)) } db_harvests_update <- function(db, id, date, weight_kg, notes = NA) { api_put(db, paste0("/v1/harvests/", id), list( date = as.character(date), weight_kg = weight_kg, notes = notes )) } db_harvests_delete <- function(db, id) { api_delete(db, paste0("/v1/harvests/", id)) } db_harvests_summary <- function(db) { api_get(db, "/v1/harvests/summary") }