Title: | 'Toggl.com' Api for 'Rstudio' |
---|---|
Description: | Use the <https://toggl.com> time tracker api through R. |
Authors: | Vincent Guyader [aut, cre], ThinkR [cph, fnd] |
Maintainer: | Vincent Guyader <[email protected]> |
License: | GPL-3 |
Version: | 0.2.1 |
Built: | 2024-11-15 04:36:37 UTC |
Source: | https://github.com/ThinkR-open/togglr |
toggl.com API
vincent <[email protected]>
ask for the toggle api token
ask_toggl_api_token(msg = "toggl api token")
ask_toggl_api_token(msg = "toggl api token")
msg |
the message |
return client name from client id
client_id_to_name(id, api_token = get_toggl_api_token())
client_id_to_name(id, api_token = get_toggl_api_token())
id |
client id |
api_token |
the toggl api token |
the client name
return client id from client name
client_name_to_id(name, api_token = get_toggl_api_token())
client_name_to_id(name, api_token = get_toggl_api_token())
name |
client name |
api_token |
the toggl api token |
the client id
tricks to obtain iso 8601
correct_date(time)
correct_date(time)
time |
a POSIXt |
time in iso 8601
create a client
create_client( name = "wihtout client", api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
create_client( name = "wihtout client", api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
name |
client name |
api_token |
the toggl api token |
workspace_id |
workspace id |
## Not run: get_toggl_api_token()# set your api token here create_client("new client") ## End(Not run)
## Not run: get_toggl_api_token()# set your api token here create_client("new client") ## End(Not run)
delete the toggle api token
delete_toggl_api_token()
delete_toggl_api_token()
get_all_client_info
get_all_client_info( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
get_all_client_info( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
api_token |
the toggl api token |
workspace_id |
workspace_id |
a data.frame
## Not run: get_all_client_info() ## End(Not run)
## Not run: get_all_client_info() ## End(Not run)
get all client's name
get_all_client_names( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
get_all_client_names( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
a date |
until |
a date |
Get all project's names
get_all_project_names( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
get_all_project_names( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
a date |
until |
a date |
get_client_project
get_client_project( id, api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
get_client_project( id, api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
id |
client id |
api_token |
the toggl api token |
workspace_id |
workspace_id |
the client name
retrieve Rstudio projet if possible
get_context_project()
get_context_project()
retrieve current projet id
get_current(api_token = get_toggl_api_token())
get_current(api_token = get_toggl_api_token())
api_token |
the toggl api token |
get current duration
get_current_duration(api_token = get_toggl_api_token())
get_current_duration(api_token = get_toggl_api_token())
api_token |
the Token API |
a difftime
## Not run: get_current_duration() ## End(Not run)
## Not run: get_current_duration() ## End(Not run)
get all task from a project
get_current_project_task_detail( project_name = get_context_project(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), humain = TRUE )
get_current_project_task_detail( project_name = get_context_project(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), humain = TRUE )
project_name |
project name |
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
a date |
until |
a date |
humain |
boolean humain readable time |
get all data from <https://toggl.com>
get_dashboard( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
get_dashboard( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
begin date |
until |
stop date |
get detailled report by user then projet
get_detailled_report_paged( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(3), until = Sys.Date() + lubridate::days(1), page = 1, user_agent = "togglr" ) get_detailled_report( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), user_agent = "togglr", max_page = 10, memoise_cache_dir = getOption("togglr_memoise_dir", default = rappdirs::user_cache_dir("togglr")) ) clean_memoise_cache( memoise_cache_dir = getOption("togglr_memoise_dir", default = rappdirs::user_cache_dir("togglr")) )
get_detailled_report_paged( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(3), until = Sys.Date() + lubridate::days(1), page = 1, user_agent = "togglr" ) get_detailled_report( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), user_agent = "togglr", max_page = 10, memoise_cache_dir = getOption("togglr_memoise_dir", default = rappdirs::user_cache_dir("togglr")) ) clean_memoise_cache( memoise_cache_dir = getOption("togglr_memoise_dir", default = rappdirs::user_cache_dir("togglr")) )
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
begin date |
until |
stop date |
page |
page |
user_agent |
user_agent |
max_page |
max_page |
memoise_cache_dir |
cache folder for memoise function, can be edited with ‘options(’togglr_memoise_dir')' or 'rappdirs::user_cache_dir("togglr")' by default |
## Not run: clean_memoise_cache() ## End(Not run)
## Not run: clean_memoise_cache() ## End(Not run)
retrieve project id
get_project_id( project_name = get_context_project(), api_token = get_toggl_api_token(), create = FALSE, client = NULL, workspace_id = get_workspace_id(api_token), color = NULL )
get_project_id( project_name = get_context_project(), api_token = get_toggl_api_token(), create = FALSE, client = NULL, workspace_id = get_workspace_id(api_token), color = NULL )
project_name |
the project name |
api_token |
the toggl api token |
create |
boolean do you want to create the project if it doesnt exist ? |
client |
client name |
workspace_id |
workspace id |
color |
id of the color selected for the project |
retrieve project id and name
get_project_id_and_name( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
get_project_id_and_name( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
api_token |
the toggl api token |
workspace_id |
workspace id |
get project total time
get_project_total( project_name = get_context_project(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
get_project_total( project_name = get_context_project(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date() )
project_name |
project name |
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
a date |
until |
a date |
by user then projet
get_summary_report( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), user_agent = "togglr", users = get_workspace_users(api_token = api_token, workspace_id = workspace_id) )
get_summary_report( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), user_agent = "togglr", users = get_workspace_users(api_token = api_token, workspace_id = workspace_id) )
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
begin date |
until |
stop date |
user_agent |
user_agent |
users |
users |
Get all time entries between 2 dates
get_time_entries( api_token = get_toggl_api_token(), since = Sys.time() - lubridate::weeks(1), until = Sys.time() )
get_time_entries( api_token = get_toggl_api_token(), since = Sys.time() - lubridate::weeks(1), until = Sys.time() )
api_token |
the toggl api token |
since |
begin date (One week ago by default) |
until |
stop date (Now by defaut) |
a data.frame containing all time entries
## Not run: get_time_entries() ## End(Not run)
## Not run: get_time_entries() ## End(Not run)
return the toggle api token
get_toggl_api_token(ask = TRUE)
get_toggl_api_token(ask = TRUE)
ask |
booleen do we have to ask if missing |
get weekly report
get_weekly_report( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), user_agent = "togglr" )
get_weekly_report( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), since = Sys.Date() - lubridate::years(1), until = Sys.Date(), user_agent = "togglr" )
api_token |
the toggl api token |
workspace_id |
the workspace id |
since |
begin date |
until |
stop date |
user_agent |
user_agent |
Return the workspace id
get_workspace_id(api_token = get_toggl_api_token())
get_workspace_id(api_token = get_toggl_api_token())
api_token |
the toggl api token |
Title
get_workspace_users( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
get_workspace_users( api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
api_token |
the toggl api token |
workspace_id |
the workspace id |
show notification using message
notification(title, msg)
notification(title, msg)
title |
title of the notificatin |
msg |
content of the notification |
open toggle.com website on timesheet page
open_toggl_website_app()
open_toggl_website_app()
open toggle.com website on profile page
open_toggl_website_profile()
open_toggl_website_profile()
set the toggle api token
set_toggl_api_token(token)
set_toggl_api_token(token)
token |
toggl api token |
simplify copied from jsonlite
simplify(...)
simplify(...)
... |
Other parameters |
transforme time column into humain readable column
to_humain(df)
to_humain(df)
df |
a data.frame |
create a time entry
toggl_create( description = get_context(), start = now(), pid = get_project_id(), stop, duration, tags = NULL, api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
toggl_create( description = get_context(), start = now(), pid = get_project_id(), stop, duration, tags = NULL, api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
description |
the task you did |
start |
time in POSIXt |
pid |
pid |
stop |
time in POSIXt |
duration |
in seconds |
tags |
tags |
api_token |
the toggl api token |
workspace_id |
workspace id |
## Not run: options(toggl_api_token = "XXXXXXXX")# set your toggl api token here toggl_create(duration=1200) toggl_create( description="description", start=now(), pid = get_project_id(project_name = "projectname", create=TRUE,client = "client"), duration=1000, api_token=get_toggl_api_token()) ## End(Not run)
## Not run: options(toggl_api_token = "XXXXXXXX")# set your toggl api token here toggl_create(duration=1200) toggl_create( description="description", start=now(), pid = get_project_id(project_name = "projectname", create=TRUE,client = "client"), duration=1000, api_token=get_toggl_api_token()) ## End(Not run)
create a project
toggl_create_project( project_name = get_context_project(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), client = NULL, private = FALSE, color = NULL, active = TRUE )
toggl_create_project( project_name = get_context_project(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token), client = NULL, private = FALSE, color = NULL, active = TRUE )
project_name |
project name |
api_token |
the toggl api token#' |
workspace_id |
workspace_id |
client |
client name |
private |
whether project is accessible for only project users or for all workspace users (boolean, default false) |
color |
id of the color selected for the project |
active |
boolean set project as active, TRUE by default |
## Not run: toggl_create_project() ## End(Not run)
## Not run: toggl_create_project() ## End(Not run)
start a task
toggl_start( description = get_context(), client = "without client", project_name = get_context_project(), start = now(), api_token = get_toggl_api_token(), tags = "", workspace_id = get_workspace_id(api_token) )
toggl_start( description = get_context(), client = "without client", project_name = get_context_project(), start = now(), api_token = get_toggl_api_token(), tags = "", workspace_id = get_workspace_id(api_token) )
description |
the task you are doing |
client |
client name |
project_name |
nom du projet |
start |
start time in POSIXt |
api_token |
the toggl api token |
tags |
tags |
workspace_id |
workspace id |
## Not run: get_toggl_api_token()# set your api token here toggl_start() ## End(Not run)
## Not run: get_toggl_api_token()# set your api token here toggl_start() ## End(Not run)
stop the active task
toggl_stop( current = get_current(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
toggl_stop( current = get_current(), api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
current |
list task id and start time |
api_token |
the toggl api token |
workspace_id |
workspace id |
## Not run: options(toggl_api_token = "XXXXXXXX")# set your api token here toggl_start() toggl_stop() ## End(Not run)
## Not run: options(toggl_api_token = "XXXXXXXX")# set your api token here toggl_start() toggl_stop() ## End(Not run)
update time entries
toggl_update_entries( time_entry_ids, description = NULL, start = NULL, pid = NULL, stop = NULL, duration = NULL, tags = NULL, api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
toggl_update_entries( time_entry_ids, description = NULL, start = NULL, pid = NULL, stop = NULL, duration = NULL, tags = NULL, api_token = get_toggl_api_token(), workspace_id = get_workspace_id(api_token) )
time_entry_ids |
id(s) of time entries to update . |
description |
the task you did |
start |
time in POSIXt |
pid |
pid |
stop |
time in POSIXt |
duration |
in seconds |
tags |
tags |
api_token |
the toggl api token |
workspace_id |
workspace id |
## Not run: options(toggl_api_token = "XXXXXXXX")# set your toggl api token here time_entry_id <- toggl_create(duration=1200) toggl_update_entries( time_entry_id, description = "new description", duration = 100, tags = c("tag1", "tag2"), api_token=get_toggl_api_token()) ## End(Not run)
## Not run: options(toggl_api_token = "XXXXXXXX")# set your toggl api token here time_entry_id <- toggl_create(duration=1200) toggl_update_entries( time_entry_id, description = "new description", duration = 100, tags = c("tag1", "tag2"), api_token=get_toggl_api_token()) ## End(Not run)
update the toggle api token
update_toggl_api_token()
update_toggl_api_token()