Package 'togglr'

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

Help Index


ask_toggl_api_token

Description

ask for the toggle api token

Usage

ask_toggl_api_token(msg = "toggl api token")

Arguments

msg

the message


client_id_to_name

Description

return client name from client id

Usage

client_id_to_name(id, api_token = get_toggl_api_token())

Arguments

id

client id

api_token

the toggl api token

Value

the client name


client_name_to_id

Description

return client id from client name

Usage

client_name_to_id(name, api_token = get_toggl_api_token())

Arguments

name

client name

api_token

the toggl api token

Value

the client id


correct_date

Description

tricks to obtain iso 8601

Usage

correct_date(time)

Arguments

time

a POSIXt

Value

time in iso 8601


create_client

Description

create a client

Usage

create_client(
  name = "wihtout client",
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token)
)

Arguments

name

client name

api_token

the toggl api token

workspace_id

workspace id

Examples

## Not run: 
get_toggl_api_token()# set your api token here
create_client("new client")

## End(Not run)

delete_toggl_api_token

Description

delete the toggle api token

Usage

delete_toggl_api_token()

get_all_client_info

Description

get_all_client_info

Usage

get_all_client_info(
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token)
)

Arguments

api_token

the toggl api token

workspace_id

workspace_id

Value

a data.frame

Examples

## Not run: 
get_all_client_info()

## End(Not run)

get all client's name

Description

get all client's name

Usage

get_all_client_names(
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(),
  since = Sys.Date() - lubridate::years(1),
  until = Sys.Date()
)

Arguments

api_token

the toggl api token

workspace_id

the workspace id

since

a date

until

a date


Get all project's names

Description

Get all project's names

Usage

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()
)

Arguments

api_token

the toggl api token

workspace_id

the workspace id

since

a date

until

a date


get_client_project

Description

get_client_project

Usage

get_client_project(
  id,
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token)
)

Arguments

id

client id

api_token

the toggl api token

workspace_id

workspace_id

Value

the client name


get_context

Description

retrieve Rstudio projet if possible

Usage

get_context()

get_context_projet

Description

retrieve Rstudio projet if possible

Usage

get_context_project()

get_current

Description

retrieve current projet id

Usage

get_current(api_token = get_toggl_api_token())

Arguments

api_token

the toggl api token


get current duration

Description

get current duration

Usage

get_current_duration(api_token = get_toggl_api_token())

Arguments

api_token

the Token API

Value

a difftime

Examples

## Not run: 
get_current_duration()

## End(Not run)

get all task from a project

Description

get all task from a project

Usage

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
)

Arguments

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>

Description

get all data from <https://toggl.com>

Usage

get_dashboard(
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token),
  since = Sys.Date() - lubridate::years(1),
  until = Sys.Date()
)

Arguments

api_token

the toggl api token

workspace_id

the workspace id

since

begin date

until

stop date


get detailled report

Description

get detailled report by user then projet

Usage

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"))
)

Arguments

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

Examples

## Not run: 
clean_memoise_cache()

## End(Not run)

get_project_id

Description

retrieve project id

Usage

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
)

Arguments

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


get_project_id_and_name

Description

retrieve project id and name

Usage

get_project_id_and_name(
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token)
)

Arguments

api_token

the toggl api token

workspace_id

workspace id


get project total time

Description

get project total time

Usage

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()
)

Arguments

project_name

project name

api_token

the toggl api token

workspace_id

the workspace id

since

a date

until

a date


get summary report

Description

by user then projet

Usage

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)
)

Arguments

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

Description

Get all time entries between 2 dates

Usage

get_time_entries(
  api_token = get_toggl_api_token(),
  since = Sys.time() - lubridate::weeks(1),
  until = Sys.time()
)

Arguments

api_token

the toggl api token

since

begin date (One week ago by default)

until

stop date (Now by defaut)

Value

a data.frame containing all time entries

Examples

## Not run: 
get_time_entries()

## End(Not run)

get_toggl_api_token

Description

return the toggle api token

Usage

get_toggl_api_token(ask = TRUE)

Arguments

ask

booleen do we have to ask if missing


get weekly report

Description

get weekly report

Usage

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"
)

Arguments

api_token

the toggl api token

workspace_id

the workspace id

since

begin date

until

stop date

user_agent

user_agent


get_workspace_id

Description

Return the workspace id

Usage

get_workspace_id(api_token = get_toggl_api_token())

Arguments

api_token

the toggl api token


Title

Description

Title

Usage

get_workspace_users(
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token)
)

Arguments

api_token

the toggl api token

workspace_id

the workspace id


show notification

Description

show notification using message

Usage

notification(title, msg)

Arguments

title

title of the notificatin

msg

content of the notification


open toggle.com website on timesheet page

Description

open toggle.com website on timesheet page

Usage

open_toggl_website_app()

open toggle.com website on profile page

Description

open toggle.com website on profile page

Usage

open_toggl_website_profile()

set_toggl_api_token

Description

set the toggle api token

Usage

set_toggl_api_token(token)

Arguments

token

toggl api token


simplify copied from jsonlite

Description

simplify copied from jsonlite

Usage

simplify(...)

Arguments

...

Other parameters


transforme time column into humain readable column

Description

transforme time column into humain readable column

Usage

to_humain(df)

Arguments

df

a data.frame


toggl_create

Description

create a time entry

Usage

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)
)

Arguments

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

Examples

## 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)

toggl_create_project

Description

create a project

Usage

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
)

Arguments

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

Examples

## Not run: 
toggl_create_project()

## End(Not run)

toggl_start

Description

start a task

Usage

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)
)

Arguments

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

Examples

## Not run: 
get_toggl_api_token()# set your api token here
toggl_start()

## End(Not run)

toggl_stop

Description

stop the active task

Usage

toggl_stop(
  current = get_current(),
  api_token = get_toggl_api_token(),
  workspace_id = get_workspace_id(api_token)
)

Arguments

current

list task id and start time

api_token

the toggl api token

workspace_id

workspace id

Examples

## Not run: 
options(toggl_api_token = "XXXXXXXX")# set your api token here
toggl_start()
toggl_stop()

## End(Not run)

toggl_update_entries

Description

update time entries

Usage

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)
)

Arguments

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

Examples

## 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_toggl_api_token

Description

update the toggle api token

Usage

update_toggl_api_token()