knitr::opts_chunk$set(comment = NA) library(dplyr)
An R wrapper around the Clockify API.
The documentation for {clockify}
is hosted at https://datawookie.github.io/clockify/.
You're going to need to have an API key from your Clockify account. If you don't yet have an account, create one. Then retrieve the API key from the account settings.
The first thing you'll need to do is set up your API key. I store mine in an environment variable called CLOCKIFY_API_KEY
.
CLOCKIFY_API_KEY <- Sys.getenv("CLOCKIFY_API_KEY")
Now load the {clockify}
package and specify the API key.
library(clockify) set_api_key(CLOCKIFY_API_KEY)
Let's turn on some logging so we can see what's happening behind the scenes.
library(logger) log_threshold(INFO)
log_appender(appender_stdout) log_layout(layout_glue_generator(format = "{time} — {msg}"))
Retrieve a list of available workspaces.
workspaces()
Select a specific workspace.
workspace("630c61ba9c3a3c3112812332")
Retrieve information on your user profile.
user()
Get a list of users.
users()
Get a list of clients.
clients()
Get a list of projects.
projects()
Retrieve the time entries for the authenticated user.
time_entries()
Retrieve time entries for another user specified by their user ID.
time_entries(user_id = "630f15d3b59c366b0e3ae2e6")
prepare_cran_entry <- time_entry_create( project_id = "630ce53290cfd8789366fd49", start = "2021-08-30 08:00:00", end = "2021-08-30 10:30:00", description = "Prepare for CRAN submission" )
Check on the ID for this new time entry.
prepare_cran_entry$time_entry_id
Confirm that it has been inserted.
time_entries(concise = FALSE) %>% select(time_entry_id, description, time_start, time_end)
time_entry_delete(prepare_cran_entry$time_entry_id)
Confirm that it has been deleted.
time_entries(concise = FALSE) %>% select(time_entry_id, description, time_start, time_end)
Endpoints which have currently been implemented in this package. Endpoints which are only available on a paid plan are indicated with a 💰.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.