Title: | A Wrapper for the 'Clockify' API |
---|---|
Description: | A wrapper for the Clockify API <https://docs.clockify.me/>, making it possible to query, insert and update time keeping data. |
Authors: | Andrew B. Collier [aut, cre] |
Maintainer: | Andrew B. Collier <[email protected]> |
License: | GPL-3 |
Version: | 0.1.6 |
Built: | 2024-10-31 04:20:12 UTC |
Source: | https://github.com/datawookie/clockify |
Get client
client(client_id, concise = TRUE)
client(client_id, concise = TRUE)
client_id |
Client ID |
concise |
Generate concise output |
A data frame with one record per client
## Not run: client("63a5493591ed63165538976d") ## End(Not run)
## Not run: client("63a5493591ed63165538976d") ## End(Not run)
Add a new client to workspace
client_create(name, concise = TRUE)
client_create(name, concise = TRUE)
name |
Client name |
concise |
Generate concise output |
A data frame with one row per record.
## Not run: client_create("RStudio") ## End(Not run)
## Not run: client_create("RStudio") ## End(Not run)
A client must first be archived before it can be deleted.
client_delete(client_id, archive = FALSE)
client_delete(client_id, archive = FALSE)
client_id |
Client ID |
archive |
Archive client before deleting. |
A Boolean: TRUE
on success or FALSE
on failure.
Update a client
client_update(client_id, name = NULL, note = NULL, archived = NULL)
client_update(client_id, name = NULL, note = NULL, archived = NULL)
client_id |
Client ID |
name |
Client name |
note |
Note about client |
archived |
Whether or not client is archived |
A data frame with one record for the updated client.
Parameters for client functions
client_id |
Client ID |
concise |
Generate concise output |
Get clients
clients(concise = TRUE)
clients(concise = TRUE)
concise |
Generate concise output |
A data frame with one record per client.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) clients() ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) clients() ## End(Not run)
Remove a custom field from a project
custom_field_delete(project_id, custom_field_id)
custom_field_delete(project_id, custom_field_id)
project_id |
Project ID |
custom_field_id |
Custom field ID |
Update a custom field on a project
custom_field_update( project_id, custom_field_id, default_value = NULL, status = NULL )
custom_field_update( project_id, custom_field_id, default_value = NULL, status = NULL )
project_id |
Project ID |
custom_field_id |
Custom field ID |
default_value |
A default value for the field |
status |
Status |
Custom fields are only listed for specific projects if the default values for those fields have been modified for those projects.
custom_fields(project_id = NULL)
custom_fields(project_id = NULL)
project_id |
Project ID |
Custom fields are only available on the Pro and Enterprise plans.
Get API key
get_api_key()
get_api_key()
The API key.
## Not run: CLOCKIFY_API_KEY <- Sys.getenv("CLOCKIFY_API_KEY") set_api_key(CLOCKIFY_API_KEY) get_api_key() ## End(Not run)
## Not run: CLOCKIFY_API_KEY <- Sys.getenv("CLOCKIFY_API_KEY") set_api_key(CLOCKIFY_API_KEY) get_api_key() ## End(Not run)
Title
paginate(path, query = NULL, pages = NULL, page_size = 50)
paginate(path, query = NULL, pages = NULL, page_size = 50)
path |
The path of the endpoint. |
query |
The query parameters. |
pages |
Maximum number of pages to retrieve. |
page_size |
Number of results requested per page. |
Paginated response from API.
Get project
project(project_id, concise = TRUE)
project(project_id, concise = TRUE)
project_id |
Project ID |
concise |
Generate concise output |
A data frame with one record per project
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) project("612b16c0bc325f120a1e5099") ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) project("612b16c0bc325f120a1e5099") ## End(Not run)
Create project
project_create(name, client_id = NULL)
project_create(name, client_id = NULL)
name |
Project name |
client_id |
Client ID |
An active project cannot be deleted. Archive the project first.
project_delete(project_id)
project_delete(project_id)
project_id |
Project ID |
Update user billable rate on project
project_update_billable_rate(project_id, user_id, rate, since = NULL)
project_update_billable_rate(project_id, user_id, rate, since = NULL)
project_id |
Project ID |
user_id |
User ID |
rate |
Rate |
since |
New rate will be applied to all time entries after this time |
Only available on a paid plan.
project_update_cost_rate(project_id, user_id, rate, since = NULL)
project_update_cost_rate(project_id, user_id, rate, since = NULL)
project_id |
Project ID |
user_id |
User ID |
rate |
Rate |
since |
New rate will be applied to all time entries after this time |
Update project memberships
project_update_memberships(project_id, user_id)
project_update_memberships(project_id, user_id)
project_id |
Project ID |
user_id |
One or more user IDs |
Adjust the project characteristics.
project_update(project_id, name = NULL, client_id = NULL, archived = NULL) project_update_template(project_id, is_template = TRUE)
project_update(project_id, name = NULL, client_id = NULL, archived = NULL) project_update_template(project_id, is_template = TRUE)
project_id |
Project ID |
name |
Project name |
client_id |
Client ID |
archived |
Whether or not project is archived |
is_template |
Whether or not project is a template |
These functions enable the following functionality:
change the project name
change the client ID associated with the project
toggle whether project is archived and
toggle whether project is a template (paid plan only).
Update project time & budget estimates
Only available on a paid plan.
project_update_estimate_time( project_id, estimate = NULL, manual = TRUE, active = TRUE, monthly = FALSE ) project_update_estimate_budget( project_id, estimate = NULL, manual = TRUE, active = TRUE, monthly = FALSE )
project_update_estimate_time( project_id, estimate = NULL, manual = TRUE, active = TRUE, monthly = FALSE ) project_update_estimate_budget( project_id, estimate = NULL, manual = TRUE, active = TRUE, monthly = FALSE )
project_id |
Project ID |
estimate |
Updated estimate |
manual |
Is the estimate for the whole project ( |
active |
Activate this estimate. Only one of either time or budget estimate may be active. |
monthly |
Should estimate be reset monthly? |
## Not run: project_update_estimate_time("612b16c0bc325f120a1e5099", "PT1H0M0S", TRUE, TRUE) ## End(Not run) ## Not run: project_update_estimate_budget("612b16c0bc325f120a1e5099", 1000, TRUE, TRUE) ## End(Not run)
## Not run: project_update_estimate_time("612b16c0bc325f120a1e5099", "PT1H0M0S", TRUE, TRUE) ## End(Not run) ## Not run: project_update_estimate_budget("612b16c0bc325f120a1e5099", 1000, TRUE, TRUE) ## End(Not run)
Get projects
projects(concise = TRUE)
projects(concise = TRUE)
concise |
Generate concise output |
A data frame with one record per project
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) projects() ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) projects() ## End(Not run)
Detailed report
reports_detailed(start, end, extra_args = list())
reports_detailed(start, end, extra_args = list())
start |
Start time |
end |
End time |
extra_args |
Extra arguments to be passed to the
API.
Example: |
A data frame with detailed time entries for the specified time period.
## Not run: report <- reports_detailed("2022-08-01", "2022-09-01") ## End(Not run)
## Not run: report <- reports_detailed("2022-08-01", "2022-09-01") ## End(Not run)
Summary report
reports_summary(start, end, extra_args = list())
reports_summary(start, end, extra_args = list())
start |
Start time |
end |
End time |
extra_args |
Extra arguments to be passed to the
API.
Example: |
A data frame with summarised time entries for the specified time period.
## Not run: report <- reports_summary("2022-08-01", "2022-09-01") # Summary per user. report # Summary per client/project. report %>% select(-duration, -amount, -amounts) %>% unnest(projects) # Summary per time entry. report %>% select(-duration, -amount, -amounts) %>% unnest(projects) %>% select(-duration, -amount) %>% unnest(entries) ## End(Not run)
## Not run: report <- reports_summary("2022-08-01", "2022-09-01") # Summary per user. report # Summary per client/project. report %>% select(-duration, -amount, -amounts) %>% unnest(projects) # Summary per time entry. report %>% select(-duration, -amount, -amounts) %>% unnest(projects) %>% select(-duration, -amount) %>% unnest(entries) ## End(Not run)
Weekly report
reports_weekly(start, end, extra_args = list())
reports_weekly(start, end, extra_args = list())
start |
Start time |
end |
End time |
extra_args |
Extra arguments to be passed to the
API.
Example: |
A data frame with a weekly summary of time entries for the specified time period.
## Not run: report <- reports_weekly("2022-08-01", "2022-08-08") report %>% select(-duration, -amount) %>% unnest(projects) ## End(Not run)
## Not run: report <- reports_weekly("2022-08-01", "2022-08-08") report %>% select(-duration, -amount) %>% unnest(projects) ## End(Not run)
These are parameters which occur commonly across functions for reports.
start |
Start time |
end |
End time |
Set API key
set_api_key(api_key)
set_api_key(api_key)
api_key |
A Clockify API key |
The API key.
## Not run: CLOCKIFY_API_KEY <- Sys.getenv("CLOCKIFY_API_KEY") set_api_key(CLOCKIFY_API_KEY) ## End(Not run)
## Not run: CLOCKIFY_API_KEY <- Sys.getenv("CLOCKIFY_API_KEY") set_api_key(CLOCKIFY_API_KEY) ## End(Not run)
Get tag
tag(tag_id)
tag(tag_id)
tag_id |
Tag ID |
A data frame with one record per tag
## Not run: tag("5f2d9bc659badb2a849c027e") ## End(Not run)
## Not run: tag("5f2d9bc659badb2a849c027e") ## End(Not run)
Create tag
tag_create(name)
tag_create(name)
name |
Tag name |
## Not run: tag_create("Size: S") tag_create("Size: M") tag_create("Size: L") tag_create("Size: XL") ## End(Not run)
## Not run: tag_create("Size: S") tag_create("Size: M") tag_create("Size: L") tag_create("Size: XL") ## End(Not run)
Delete tag
tag_delete(tag_id)
tag_delete(tag_id)
tag_id |
Tag ID |
## Not run: tag_delete("5f2d9bc659badb2a849c027e") ## End(Not run)
## Not run: tag_delete("5f2d9bc659badb2a849c027e") ## End(Not run)
Update tag
tag_update(tag_id, name = NULL, archived = NULL)
tag_update(tag_id, name = NULL, archived = NULL)
tag_id |
Tag ID |
name |
Tag name |
archived |
Whether or not item is archived |
## Not run: tag_update("5f2d9bc659badb2a849c027e", "Size: Large") tag_update("5f2d9bc659badb2a849c027e", archived = TRUE) tag_update("5f2d9bc659badb2a849c027e", "Size: L", FALSE) ## End(Not run)
## Not run: tag_update("5f2d9bc659badb2a849c027e", "Size: Large") tag_update("5f2d9bc659badb2a849c027e", archived = TRUE) tag_update("5f2d9bc659badb2a849c027e", "Size: L", FALSE) ## End(Not run)
Get tags
tags()
tags()
A data frame.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) tags() ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) tags() ## End(Not run)
Get task
task(project_id, task_id)
task(project_id, task_id)
project_id |
Project ID |
task_id |
Task ID |
A data frame.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) workspace("61343c45ab05e02be2c8c1fd") tasks("61343c9ba15c1d53ad33369f") ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) workspace("61343c45ab05e02be2c8c1fd") tasks("61343c9ba15c1d53ad33369f") ## End(Not run)
Delete task
task_delete(project_id, task_id)
task_delete(project_id, task_id)
project_id |
Project ID |
task_id |
Task ID |
## Not run: task_delete("630ce53290cfd8789366fd49", "630ce57e25e863294e5c6cf2") ## End(Not run)
## Not run: task_delete("630ce53290cfd8789366fd49", "630ce57e25e863294e5c6cf2") ## End(Not run)
Update a task
task_update( project_id, task_id, name, billable = NULL, status = NULL, assignee_id = NULL )
task_update( project_id, task_id, name, billable = NULL, status = NULL, assignee_id = NULL )
project_id |
Project ID |
task_id |
Task ID |
name |
Task name |
billable |
Is the task billable? |
status |
Is the task ACTIVE or DONE? |
assignee_id |
Assignee ID |
## Not run: task_update("630ce53290cfd8789366fd49", "630ce57e25e863294e5c6cf2", "Tests") task_create("630ce53290cfd8789366fd49", "630ce80a7f07da44c14ca9a2", "Docs", FALSE) ## End(Not run)
## Not run: task_update("630ce53290cfd8789366fd49", "630ce57e25e863294e5c6cf2", "Tests") task_create("630ce53290cfd8789366fd49", "630ce80a7f07da44c14ca9a2", "Docs", FALSE) ## End(Not run)
This feature is only available on the Standard, Pro and Enterprise plans.
task_update_billable_rate(project_id, task_id, rate, since = NULL)
task_update_billable_rate(project_id, task_id, rate, since = NULL)
project_id |
Project ID |
task_id |
Task ID |
rate |
Rate |
since |
New rate will be applied to all time entries after this time |
This feature is only available on the Pro and Enterprise plans.
task_update_cost_rate(project_id, task_id, rate, since = NULL)
task_update_cost_rate(project_id, task_id, rate, since = NULL)
project_id |
Project ID |
task_id |
Task ID |
rate |
Rate |
since |
New rate will be applied to all time entries after this time |
Create a task
task_create(project_id, name)
task_create(project_id, name)
project_id |
Project ID |
name |
Task name |
## Not run: task_create("630ce53290cfd8789366fd49", "tests") task_create("630ce53290cfd8789366fd49", "docs") ## End(Not run)
## Not run: task_create("630ce53290cfd8789366fd49", "tests") task_create("630ce53290cfd8789366fd49", "docs") ## End(Not run)
Get tasks
tasks(project_id)
tasks(project_id)
project_id |
Project ID |
A data frame.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) workspace("61343c45ab05e02be2c8c1fd") tasks("61343c9ba15c1d53ad33369f") ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) workspace("61343c45ab05e02be2c8c1fd") tasks("61343c9ba15c1d53ad33369f") ## End(Not run)
You send time according to your account's timezone (from Profile Settings) and get response with time in UTC.
time_entries( user_id = NULL, start = NULL, end = NULL, description = NULL, project_id = NULL, task = NULL, tags = NULL, finished = TRUE, concise = TRUE, ... )
time_entries( user_id = NULL, start = NULL, end = NULL, description = NULL, project_id = NULL, task = NULL, tags = NULL, finished = TRUE, concise = TRUE, ... )
user_id |
User ID. If not specified then use authenticated user. |
start |
If provided, only time entries that started after the specified datetime will be returned. |
end |
If provided, only time entries that started before the specified datetime will be returned. |
description |
If provided, time entries will be filtered by description. |
project_id |
If provided, time entries will be filtered by project. |
task |
If provided, time entries will be filtered by task. |
tags |
If provided, time entries will be filtered by tags. You can provide one or more tags. |
finished |
Whether to include only finished time intervals (intervals with both start and end time). |
concise |
Generate concise output |
... |
Further arguments passed to |
A data frame with one record per time entry.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) USER_ID <- "612b15a4f4c3bf0462192676" # Specify number of results per page (default: 50). time_entries(USER_ID, page_size = 200) # Specify number of pages. time_entries(USER_ID, pages = 3) ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) USER_ID <- "612b15a4f4c3bf0462192676" # Specify number of results per page (default: 50). time_entries(USER_ID, page_size = 200) # Specify number of pages. time_entries(USER_ID, pages = 3) ## End(Not run)
Get a specific time entry on workspace
time_entry(time_entry_id, concise = TRUE)
time_entry(time_entry_id, concise = TRUE)
time_entry_id |
Time entry ID |
concise |
Generate concise output |
A data frame with one record per time entry.
## Not run: time_entry("61343d27ab05e02be2c8c266") ## End(Not run)
## Not run: time_entry("61343d27ab05e02be2c8c266") ## End(Not run)
Creating time entries for other users is a paid feature.
time_entry_create( user_id = NULL, project_id = NULL, start, end = NULL, description = NULL, task_id = NULL )
time_entry_create( user_id = NULL, project_id = NULL, start, end = NULL, description = NULL, task_id = NULL )
user_id |
User ID |
project_id |
Project ID |
start |
Start time |
end |
End time |
description |
Description |
task_id |
Task ID |
A time entry ID.
## Not run: # Create a time entry for the authenticated user. time_entry_create( project_id = "600e73263e207962449a2c13", start = "2021-01-02 08:00:00", end = "2021-01-02 10:00:00", description = "Doing stuff" ) # Create a time entry for another user (paid feature). time_entry_create( "5df56293df753263139e60c5", "600e73263e207962449a2c13", "2021-01-02 10:00:00", "2021-01-02 12:00:00", "Doing other stuff" ) ## End(Not run)
## Not run: # Create a time entry for the authenticated user. time_entry_create( project_id = "600e73263e207962449a2c13", start = "2021-01-02 08:00:00", end = "2021-01-02 10:00:00", description = "Doing stuff" ) # Create a time entry for another user (paid feature). time_entry_create( "5df56293df753263139e60c5", "600e73263e207962449a2c13", "2021-01-02 10:00:00", "2021-01-02 12:00:00", "Doing other stuff" ) ## End(Not run)
Delete a time entry
time_entry_delete(time_entry_id = NULL)
time_entry_delete(time_entry_id = NULL)
time_entry_id |
Time entry ID |
A Boolean: TRUE
on success or FALSE
on failure.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) time_entry_delete("612c7bd2a34530476ab25c67") ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) time_entry_delete("612c7bd2a34530476ab25c67") ## End(Not run)
The time_entry_invoiced()
function will only work on a paid plan.
time_entry_invoiced(time_entry_id, invoiced = TRUE)
time_entry_invoiced(time_entry_id, invoiced = TRUE)
time_entry_id |
Time entry ID |
invoiced |
Has this time entry been invoiced? |
This does not update the time entry. It uses the same time entry ID but sets all details from scratch.
time_entry_set( time_entry_id, project_id = NULL, start, end = NULL, description = NULL )
time_entry_set( time_entry_id, project_id = NULL, start, end = NULL, description = NULL )
time_entry_id |
Time entry ID |
project_id |
Project ID |
start |
Start time |
end |
End time |
description |
Description |
Stop currently running timer
time_entry_stop(user_id = NULL, end = NULL)
time_entry_stop(user_id = NULL, end = NULL)
user_id |
User ID. If not specified then use authenticated user. |
end |
End time |
## Not run: # Start timer running. time_entry_create( user_id = "5df56293df753263139e60c5", project_id = "600e73263e207962449a2c13", start = "2022-09-02 14:00:00", description = "Doing other stuff" ) # Stop timer. time_entry_stop( user_id = "5df56293df753263139e60c5", end = "2022-09-02 15:00:00" ) ## End(Not run)
## Not run: # Start timer running. time_entry_create( user_id = "5df56293df753263139e60c5", project_id = "600e73263e207962449a2c13", start = "2022-09-02 14:00:00", description = "Doing other stuff" ) # Stop timer. time_entry_stop( user_id = "5df56293df753263139e60c5", end = "2022-09-02 15:00:00" ) ## End(Not run)
These are parameters which occur commonly across functions for time entries.
time_entry_id |
Time entry ID |
project_id |
Project ID |
start |
Start time |
end |
End time |
description |
Description |
Get information for authenticated user
user(concise = TRUE)
user(concise = TRUE)
concise |
Generate concise output |
A data frame with details of user profile.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) user() ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) user() ## End(Not run)
Create a user
user_create(email, send_email = TRUE)
user_create(email, send_email = TRUE)
email |
Email address for user |
send_email |
Whether to send email to user |
Delete user
user_delete(user_id)
user_delete(user_id)
user_id |
User ID |
Delete user roles
user_delete_role(user_id, role, entity_id)
user_delete_role(user_id, role, entity_id)
user_id |
User ID |
role |
One of |
entity_id |
Depending on |
Create a user group
user_group_create(name)
user_group_create(name)
name |
Name of user group |
Delete a user group
user_group_delete(group_id)
user_group_delete(group_id)
group_id |
User group ID |
Update a user group
user_group_update(group_id, name)
user_group_update(group_id, name)
group_id |
User group ID |
name |
Name of user group |
Add a user to a user group
user_group_user_add(group_id, user_id)
user_group_user_add(group_id, user_id)
group_id |
User group ID |
user_id |
User ID |
Remove a user from a user group
user_group_user_remove(group_id, user_id)
user_group_user_remove(group_id, user_id)
group_id |
User group ID |
user_id |
User ID |
Get user groups
user_groups()
user_groups()
A data frame with one record per user group.
## Not run: user_groups() ## End(Not run)
## Not run: user_groups() ## End(Not run)
For this to work you need to enable expenses (under the General tab in Workspace Settings). It's only available on the PRO plan.
user_update_cost_rate(user_id, rate, since = NULL)
user_update_cost_rate(user_id, rate, since = NULL)
user_id |
User ID |
rate |
Rate |
since |
New rate will be applied to all time entries after this time |
Update hourly rate
user_update_hourly_rate(user_id, rate, since = NULL)
user_update_hourly_rate(user_id, rate, since = NULL)
user_id |
User ID |
rate |
Rate |
since |
New rate will be applied to all time entries after this time |
Update status
user_update_status(user_id, active)
user_update_status(user_id, active)
user_id |
User ID |
active |
A Boolean indicating whether or not user is active. Can also specify either |
Update user roles
user_update_role(user_id, role, entity_id)
user_update_role(user_id, role, entity_id)
user_id |
User ID |
role |
One of |
entity_id |
Depending on |
Get list of users in active workspace
users(active = NULL, concise = TRUE)
users(active = NULL, concise = TRUE)
active |
Only include active users |
concise |
Generate concise output |
A data frame with one record per user.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) # Show only active users. users() # Show all users. users(active = FALSE) # Show active & default workspace for each user. users(concise = FALSE) ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) # Show only active users. users() # Show all users. users(active = FALSE) # Show active & default workspace for each user. users(concise = FALSE) ## End(Not run)
Get or set active workspace ID
workspace(workspace_id = NULL)
workspace(workspace_id = NULL)
workspace_id |
A workspace ID |
The ID of the active workspace.
## Not run: # Select default workspace for authenticated user. workspace() # Select a specific workspace. workspace("612b15a5f4c3bf0462192677") ## End(Not run)
## Not run: # Select default workspace for authenticated user. workspace() # Select a specific workspace. workspace("612b15a5f4c3bf0462192677") ## End(Not run)
Get a list of workspaces
workspaces()
workspaces()
A data frame with one record per workspace.
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) workspaces() ## End(Not run)
## Not run: set_api_key(Sys.getenv("CLOCKIFY_API_KEY")) workspaces() ## End(Not run)