---
title: "togglr"
author: "Vincent Guyader"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{togglr}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  eval= FALSE,
  collapse = TRUE,
  comment = "#>"
)
```

## Installation of `togglr`

### From CRAN
```R
install.packages("togglr")
```

### Development version, from GitHub
```R
if (!requireNamespace("remotes")) install.packages("remotes")
remotes::install_github("ThinkR-open/togglr")
```



## Set toggl Api token

Go on toogl.com website : `https://toggl.com/app/profile` 

```{r, eval = FALSE}
togglr::open_toggl_website_profile()
```

then select and copy your token api at the bottom of the page.

```{r, eval = FALSE}
library(togglr)
set_toggl_api_token("your_token_api")
```
You just need to do this once.


## Start the tracking system

Without any parameters it will create a new project using your Rstudio project names. 

```{r, eval = FALSE}
toggl_start()
```

By default the client name is "without client" you can choose (and eventualy create a client) by using :

```{r, eval = FALSE}
toggl_start(client = "my client")
```

But you can also choose the task and the project

```{r, eval = FALSE}
toggl_start(client = "my client",
            description = "what I'm doing",
            project_name = "my project")
```


## Stop the tracking system

```{r, eval = FALSE}
toggl_stop()
```


## Get total time passed on the current project

```{r, eval = FALSE}
get_current_duration()# the current track
get_current_project_task_detail() # the tasks of the current project (running entry included)

```

## Get all your dashboard

```{r, eval = FALSE}
get_dashboard()
```


## Use Rstudio Addins

This package comes with 2 Rstudio addins 'start toggl' and 'stop toggl', feel free to use keybindings for convenience.


## Some other useful functions are in this package

```{r, eval = FALSE}
ls(package:togglr)
```

