library(ggplot2) library(dplyr) library(wakatimer) key <- Sys.getenv("WAKATIME_KEY")
WakaTime API provide these API endpoints.
Parameters
resource <- "durations" param <- list(date = format(Sys.Date() - 1, "%m/%d/%Y")) %>% paste(names(.), ., sep = "=") res <- httr::GET( url = "https://wakatime.com/", path = paste0("api/v1/users/current/", resource, "?api_key=", key, "&", param), encode = "json" ) %>% .$url %>% jsonlite::fromJSON() %>% .$data res %>% dplyr::select(- c(dependencies, is_debugging)) %>% dplyr::group_by(project) %>% dplyr::summarise(cum.duration = sum(duration)) %>% ggplot(aes(project, cum.duration)) + geom_bar(stat = "identity")
Parameters
resource <- "stats" interval <- c("last_7_days", "last_30_days", "last_6_months", "last_year", "all_time") req <- httr::GET( url = "https://wakatime.com/", path = paste0( "api/v1/users/current/", resource, "/", interval[1], "?api_key=", key), encode = "json") %>% .$url %>% jsonlite::fromJSON() %>% .$data req$projects %>% ggplot(aes(name, percent, fill = name)) + geom_bar(width = 0.9, stat = "identity") + coord_polar(theta = "y")
Parameters
resource <- "summaries" param <- list(start = format(Sys.Date() - 7, "%m/%d/%Y"), end = format(Sys.Date() - 1, "%m/%d/%Y")) %>% paste(names(.), ., sep = "=") %>% unlist() %>% paste(collapse = "&")
param <- list(date = format(Sys.Date() - 1, "%m/%d/%Y")) %>% paste(names(.), ., sep = "=") %>% unlist() %>% paste(collapse = "&") param <- list(range = "", project = "wakatimer") %>% paste(names(.), ., sep = "=") %>% unlist() %>% paste(collapse = "&") param <- list(date = format(Sys.Date() -1, "%m/%d/%Y")) %>% paste(names(.), ., sep = "=")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.