Skip to content

Commit

Permalink
add extra args to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Jun 30, 2023
1 parent 32b1b19 commit 3336d41
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ License: GPL-3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Imports:
anytime,
dplyr,
Expand Down
10 changes: 7 additions & 3 deletions R/reports.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#'
#' @param start Start time
#' @param end End time
#' @param extra_args Extra arguments to be passed to the [API](https://docs.clockify.me/#tag/Time-Entry-Report).
NULL

#' Summary report
Expand Down Expand Up @@ -33,7 +34,7 @@ NULL
#' select(-duration, -amount) %>%
#' unnest(entries)
#' }
reports_summary <- function(start, end) {
reports_summary <- function(start, end, extra_args = list()) {
path <- sprintf("/workspaces/%s/reports/summary", workspace())

body <- list(
Expand All @@ -48,6 +49,7 @@ reports_summary <- function(start, end) {
),
timeZone = "Etc/UTC"
)
body[names(extra_args)] <- extra_args

response <- POST(
path,
Expand Down Expand Up @@ -105,7 +107,7 @@ reports_summary <- function(start, end) {
#' \dontrun{
#' report <- reports_detailed("2022-08-01", "2022-09-01")
#' }
reports_detailed <- function(start, end) {
reports_detailed <- function(start, end, extra_args = list()) {
path <- sprintf("/workspaces/%s/reports/detailed", workspace())

body <- list(
Expand All @@ -117,6 +119,7 @@ reports_detailed <- function(start, end) {
),
timeZone = "Etc/UTC"
)
body[names(extra_args)] <- extra_args

results <- list()
#
Expand Down Expand Up @@ -160,7 +163,7 @@ reports_detailed <- function(start, end) {
#' select(-duration, -amount) %>%
#' unnest(projects)
#' }
reports_weekly <- function(start, end) {
reports_weekly <- function(start, end, extra_args = list()) {
path <- sprintf("/workspaces/%s/reports/weekly", workspace())

body <- list(
Expand All @@ -172,6 +175,7 @@ reports_weekly <- function(start, end) {
),
timeZone = "Etc/UTC"
)
body[names(extra_args)] <- extra_args

response <- POST(
path,
Expand Down
2 changes: 2 additions & 0 deletions man/reports-parameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/reports_detailed.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/reports_summary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/reports_weekly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3336d41

Please sign in to comment.