From 0aa3da949a3ee6e914aa0b0b07cf367c9e443d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 12:45:52 +0200 Subject: [PATCH 001/137] Import tibble and tibblify --- DESCRIPTION | 23 ++++++++++++++++------- NAMESPACE | 2 ++ R/tibblify.R | 3 +++ 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 R/tibblify.R diff --git a/DESCRIPTION b/DESCRIPTION index b060b35..9da86a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ -Package: clickrup Type: Package +Package: clickrup Title: Interacting with the ClickUp v2 API from R Version: 0.0.4 Date: 2021-11-05 @@ -17,13 +17,22 @@ Maintainer: Peter Solymos Description: Work with the ClickUp productivity app from R to manage tasks, goals, time tracking, and more. License: MIT + file LICENSE -LazyLoad: yes -LazyData: true -Imports: httr, jsonlite, rlang -Suggests: knitr URL: https://github.com/psolymos/clickrup BugReports: https://github.com/psolymos/clickrup/issues -VignetteBuilder: knitr -RoxygenNote: 7.1.1 +Imports: + httr, + jsonlite, + rlang, + tibble, + tibblify +Suggests: + knitr, + testthat (>= 3.0.0) +VignetteBuilder: + knitr +Config/testthat/edition: 3 Encoding: UTF-8 +LazyData: true +LazyLoad: yes Roxygen: list(markdown = TRUE) +RoxygenNote: 7.1.2 diff --git a/NAMESPACE b/NAMESPACE index 639af83..2dfe98d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -127,3 +127,5 @@ export(cu_update_task) export(cu_update_time_entry) export(cu_update_view) export(cu_update_webhook) +import(tibble) +import(tibblify) diff --git a/R/tibblify.R b/R/tibblify.R new file mode 100644 index 0000000..71a4dc8 --- /dev/null +++ b/R/tibblify.R @@ -0,0 +1,3 @@ +#' @import tibble +#' @import tibblify +NULL From 35b91d77baca6148d3cf902932e3fda4aab9d5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 12:46:13 +0200 Subject: [PATCH 002/137] Unrelated: Project configuration --- clickrup.Rproj | 1 + 1 file changed, 1 insertion(+) diff --git a/clickrup.Rproj b/clickrup.Rproj index 82203aa..f342560 100644 --- a/clickrup.Rproj +++ b/clickrup.Rproj @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace From 584bb40cc7c265474fbaef2540ff3e31ac033b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 12:46:58 +0200 Subject: [PATCH 003/137] Add script snapshot --- .Rbuildignore | 1 + script/create.R | 7 +++++ script/tibblify.R | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 script/create.R create mode 100644 script/tibblify.R diff --git a/.Rbuildignore b/.Rbuildignore index 081c954..a598e68 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -12,3 +12,4 @@ ^CODE_OF_CONDUCT\.md$ ^docs$ ^_pkgdown\.yml$ +^script$ diff --git a/script/create.R b/script/create.R new file mode 100644 index 0000000..5f769be --- /dev/null +++ b/script/create.R @@ -0,0 +1,7 @@ +pkgload::load_all() + +team_id <- cuf_get_teams()$id[[1]] + +cuf_create_space(team_id, "Test space 1") +space_df_2 <- cuf_create_space(team_id, "Test space 2") +space_df_2 diff --git a/script/tibblify.R b/script/tibblify.R new file mode 100644 index 0000000..94b90ec --- /dev/null +++ b/script/tibblify.R @@ -0,0 +1,68 @@ +library(clickrup) +library(tibblify) + +cu_options( + baseurl = "https://api.clickup.com/api/v2" +) + +clip_spec <- function(x) { + name <- deparse(substitute(x)) + + out <- + x %>% + get_spec() %>% + format() %>% + fansi::strip_sgr() + + out <- paste0(gsub("^df_", "", name), "_spec <- ", out) + + out %>% + clipr::write_clip() +} + +teams <- cu_get_teams() +teams + +df_teams <- tibblify(teams$teams) +df_teams +df_teams %>% get_spec() + +clip_spec(df_teams) + +df_teams +df_teams$members + +spaces <- cu_get_spaces(df_teams$id[[1]]) +spaces + +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) + +clip_spec(df_spaces) + +asdf + +df_spaces +df_spaces$statuses +df_spaces$features +df_spaces$features$due_dates +df_spaces$features$time_tracking +df_spaces$features$tags +df_spaces$features$time_estimates +df_spaces$features$checklists +df_spaces$features$custom_fields +df_spaces$features$remap_dependencies +df_spaces$features$dependency_warning +df_spaces$features$portfolios + +folders <- cu_get_folders(df_spaces$id[[1]]) +folders + +df_folders <- tibblify::tibblify(folders$folders) +df_folders +df_folders %>% get_spec() + +folder <- cu_get_folder(df_folders$id[[1]]) +folder + +df_folder <- tibblify::tibblify(list(unclass(folder))) +df_folder %>% get_spec() From 4b737168e2d457488ed4870dc70b6b0ef1a26094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 12:50:58 +0200 Subject: [PATCH 004/137] Add copy of all API function files --- R/df-attachments.R | 67 ++++++ R/df-authorization.R | 61 ++++++ R/df-checklists.R | 163 ++++++++++++++ R/df-comments.R | 161 ++++++++++++++ R/df-customfields.R | 83 +++++++ R/df-dependencies.R | 119 ++++++++++ R/df-folders.R | 178 +++++++++++++++ R/df-goals.R | 186 ++++++++++++++++ R/df-guests.R | 238 ++++++++++++++++++++ R/df-lists.R | 169 +++++++++++++++ R/df-members.R | 41 ++++ R/df-sharedhierarchy.R | 32 +++ R/df-spaces.R | 218 +++++++++++++++++++ R/df-tags.R | 127 +++++++++++ R/df-tasks.R | 392 +++++++++++++++++++++++++++++++++ R/df-tasktemplates.R | 64 ++++++ R/df-teams.R | 79 +++++++ R/df-timetracking-legacy.R | 122 +++++++++++ R/df-timetracking-v2.R | 300 +++++++++++++++++++++++++ R/df-users.R | 100 +++++++++ R/df-views.R | 434 +++++++++++++++++++++++++++++++++++++ R/df-webhooks.R | 154 +++++++++++++ 22 files changed, 3488 insertions(+) create mode 100644 R/df-attachments.R create mode 100644 R/df-authorization.R create mode 100644 R/df-checklists.R create mode 100644 R/df-comments.R create mode 100644 R/df-customfields.R create mode 100644 R/df-dependencies.R create mode 100644 R/df-folders.R create mode 100644 R/df-goals.R create mode 100644 R/df-guests.R create mode 100644 R/df-lists.R create mode 100644 R/df-members.R create mode 100644 R/df-sharedhierarchy.R create mode 100644 R/df-spaces.R create mode 100644 R/df-tags.R create mode 100644 R/df-tasks.R create mode 100644 R/df-tasktemplates.R create mode 100644 R/df-teams.R create mode 100644 R/df-timetracking-legacy.R create mode 100644 R/df-timetracking-v2.R create mode 100644 R/df-users.R create mode 100644 R/df-views.R create mode 100644 R/df-webhooks.R diff --git a/R/df-attachments.R b/R/df-attachments.R new file mode 100644 index 0000000..66be01a --- /dev/null +++ b/R/df-attachments.R @@ -0,0 +1,67 @@ +#' Attachments +#' +#' Result from a call to the API endpoint +#' POST https://api.clickup.com/api/v2/task/task_id/attachment + +#' @param task_id Task ID. +#' @param attachment Path to a file. +#' @param filename File name as it will show up in CluckUp, +#' deduced from `attachment` when not provided (`NULL`). +#' @param ... Can be used to pass mime `type` argument to [httr::upload_file()], +#' mime type is guessed otherwise. +#' +#' @examples +#' \dontrun{ +#' ## produce a png image +#' f <- tempfile(fileext=".png") +#' png(f) +#' plot(1:10, col=1:10) +#' dev.off() +#' +#' ## attache the image to a task +#' cu_post_task_attachment("8ach57", f) +#' +#' unlink(f) # clean up the image +#' } +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @export +#' @name api-attachment + +## API documentation is actually incorrect about showing the curl request. +## The correct curl is this: +## +## curl --location \ +## --request POST 'https://api.clickup.com/api/v2/task/task_id/attachment' \ +## --header 'Authorization: pk_xx_xxx' \ +## --header 'Content-Type: multipart/form-data' \ +## --form 'filename=imagefilename.png' \ +## --form 'attachment=@/path/to/the/file/example.png' + +## ... can be used to pass type argument to httr::upload_file +cu_post_task_attachment <- function(task_id, attachment, filename=NULL, ...) { + task_id <- cu_task_id(task_id) + if (is.null(filename)) + filename <- basename(attachment) + resp <- httr::POST( + httr::modify_url(getOption("cu_options")$baseurl, + path = .cu_path("task", task_id, "attachment")), + httr::add_headers( + Authorization = cu_get_pat(), + "Content-Type" = "multipart/form-data"), + httr::accept_json(), + body=list( + filename=filename, + attachment=httr::upload_file(attachment, ...)), + encode="multipart", + httr::user_agent(getOption("cu_options")$useragent)) + cont <- .cu_process(resp) + class(cont) <- c(class(cont), "cu_post") + cont +} + diff --git a/R/df-authorization.R b/R/df-authorization.R new file mode 100644 index 0000000..36f03f0 --- /dev/null +++ b/R/df-authorization.R @@ -0,0 +1,61 @@ +#' Authorization +#' +#' These are the routes for authing the API and +#' going through the OAuth flow. +#' Applications utilizing the personal API token do not need these functions. + +#' @param client_id Oauth app client id. +#' @param client_secret Oauth app client secret. +#' @param code Code given in redirect URL. +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-authorization +NULL + +#' @export +#' @rdname api-authorization +## Authorization / Get Access Token +## POST https://api.clickup.com/api/v2/oauth/token?client_id=&client_secret=&code= +## client_id +## Oauth app client id +## String +## +## client_secret +## Oauth app client secret +## String +## +## code +## Code given in redirect url +## String +cu_get_access_token <- function(client_id, client_secret, code) { + .cu_post("oauth", "token", + query=list(client_id=client_id, + client_secret=client_secret, + code=code)) +} + + +#' @export +#' @rdname api-authorization +## Authorization / Get Authorized User +## GET https://api.clickup.com/api/v2/user +cu_get_authorized_user <- function() { + .cu_get("user") +} + + +#' @export +#' @rdname api-authorization +## Authorization / Get Authorized Teams +## GET https://api.clickup.com/api/v2/team +## +## Note: this is the same endpoint as for cu_get_teams +## +cu_get_authorized_teams <- function() { + .cu_get("team") +} diff --git a/R/df-checklists.R b/R/df-checklists.R new file mode 100644 index 0000000..e866c0d --- /dev/null +++ b/R/df-checklists.R @@ -0,0 +1,163 @@ +#' Checklists +#' +#' Working with checklists in ClickUp tasks. + +#' @param task_id Task ID. +#' @param name Checklist or checlist item name. +#' @param checklist_id Checklist ID. +#' @param position Position is the zero-based index of the order you want +#' the checklist to exist on the task. If you want the checklist to be +#' in the first position, pass 0. +#' @param checklist_item_id Checklist item ID. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @examples +#' \dontrun{ +#' ## create new checklist +#' cl <- cu_create_checklist("8ach57", "New checklist") +#' +#' ## change position of checklist +#' cu_edit_checklist(cl$checklist$id, position = 0) +#' +#' ## create checklist items +#' cli <- cu_create_checklist_item(cl$checklist$id, name="New item 1") +#' cli <- cu_create_checklist_item(cl$checklist$id, name="New item 2", +#' assignee = 4471793) +#' cli <- cu_create_checklist_item(cl$checklist$id, name="New item 3", +#' assignee = NA, resolved = TRUE, parent = NA) +#' +#' ## delete checklist items +#' cu_delete_checklist_item(cli$checklist$id, +#' cli$checklist$items[[1]]$id) +#' +#' ## delete checklist +#' cu_delete_checklist(cli$checklist$id) +#' } +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-checklists +NULL + +#' @export +#' @rdname api-checklists +## Checklists / Create Checklist +## POST https://api.clickup.com/api/v2/task/task_id/checklist +## task_id Example: 9hz. String +cu_create_checklist <- function(task_id, name) { + task_id <- cu_task_id(task_id) + .cu_post("task", task_id, "checklist", + body=list(name = name)) +} +#cu_create_checklist("8ach57", "New checklist") + + +#' @export +#' @rdname api-checklists +## Checklists / Edit Checklist +## PUT https://api.clickup.com/api/v2/checklist/checklist_id +## checklist_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. +## String +## position is the zero-based index of the order you want the checklist +## to exist on the task. If you want the checklist to be in the first +## position, pass '{ "position": 0 }' +cu_edit_checklist <- function(checklist_id, position) { + .cu_put("checklist", checklist_id, + body=list(position = position)) +} +#cu_edit_checklist("4bc57892-a1a6-44f4-894d-d98de71f4054", 0) + + +#' @export +#' @rdname api-checklists +## Checklists / Delete Checklist +## DELETE https://api.clickup.com/api/v2/checklist/checklist_id +## checklist_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. String +cu_delete_checklist <- function(checklist_id) { + .cu_delete("checklist", checklist_id) +} +#cu_delete_checklist("4bc57892-a1a6-44f4-894d-d98de71f4054") + + +#' @export +#' @rdname api-checklists +## Checklists / Create Checklist Item +## POST https://api.clickup.com/api/v2/checklist/checklist_id/checklist_item +## checklist_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. +## String +## +## Body: +## { +## "name": "Updated Checklist Item", +## "assignee": null, +## "resolved": true, +## "parent": null +## } +cu_create_checklist_item <- function(checklist_id, name, ...) { + .cu_post("checklist", checklist_id, "checklist_item", + body=list(name = name, ...)) +} +#cu_create_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", +# name="New item 1") +#cu_create_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", +# name="New item 2", assignee=4471793) +#cu_create_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", +# name="New item 3", +# assignee=NA, resolved=TRUE, parent=NA) + + +#' @export +#' @rdname api-checklists +## Checklists / Edit Checklist Item +## PUT https://api.clickup.com/api/v2/checklist/checklist_id/checklist_item/checklist_item_id +## checklist_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. +## String +## +## checklist_item_id +## e491-47f5-9fd8-d1dc4cedcc6f (uuid) +## Example: 21e08dc8. +## String +## +## parent is another checklist item that you want to nest the +## target checklist item underneath. +cu_edit_checklist_item <- function(checklist_id, checklist_item_id, ...) { + .cu_put("checklist", checklist_id, "checklist_item", checklist_item_id, + body=list(...)) +} +#cu_put_edit_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", +# "8849fcba-9db4-4400-a78e-cfced2ae6ce0", +# name="Renamed to that", resolved=TRUE) + + +#' @export +#' @rdname api-checklists +## Checklists / Delete Checklist Item +## DELETE https://api.clickup.com/api/v2/checklist/checklist_id/checklist_item/checklist_item_id +## checklist_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. +## String +## +## checklist_item_id +## e491-47f5-9fd8-d1dc4cedcc6f (uuid) +## Example: 21e08dc8. +## String +cu_delete_checklist_item <- function(checklist_id, checklist_item_id) { + .cu_delete("checklist", checklist_id, "checklist_item", checklist_item_id) +} +#cu_delete_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", +# "8849fcba-9db4-4400-a78e-cfced2ae6ce0") + diff --git a/R/df-comments.R b/R/df-comments.R new file mode 100644 index 0000000..0239064 --- /dev/null +++ b/R/df-comments.R @@ -0,0 +1,161 @@ +#' Comments +#' +#' Working with comments in ClickUp tasks. + +#' @param task_id Task ID. +#' @param view_id View ID. +#' @param list_id List ID. +#' @param comment_id Comment ID. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-comments +NULL + +#' @export +#' @rdname api-comments +## Comments / Post Task Comment +## POST https://api.clickup.com/api/v2/task/task_id/comment +## task_id +## Example: 9hz. +## String +## +## If notify_all is true, creation notifications will be sent to +## everyone including the creator of the comment. +## +## Body +## { +## "comment_text": "Task comment content", +## "assignee": 183, +## "notify_all": true +## } +cu_post_task_comment <- function(task_id, ...) { + task_id <- cu_task_id(task_id) + .cu_post("task", task_id, "comment", + body=list(...)) +} + + +#' @export +#' @rdname api-comments +## Comments / Post View Comment +## POST https://api.clickup.com/api/v2/view/view_id/comment +## view_id +## 105 (string) +## Example: 3c. +## String +## +## If notify_all is true, creation notifications will be sent to +## everyone including the creator of the comment. +## +## Body +## +## { +## "comment_text": "View comment content", +## "notify_all": true +## } +cu_post_view_comment <- function(view_id, ...) { + .cu_post("view", view_id, "comment", + body=list(...)) +} + + +#' @export +#' @rdname api-comments +## Comments / Post List Comment +## POST https://api.clickup.com/api/v2/list/list_id/comment +## list_id +## Example: 124. +## Number +## +## If notify_all is true, creation notifications will be sent to +## everyone including the creator of the comment. +## +## Body +## +## { +## "comment_text": "List comment content", +## "assignee": 183, +## "notify_all": true +## } +cu_post_list_comment <- function(list_id, ...) { + .cu_post("list", list_id, "comment", + body=list(...)) +} + + +#' @export +#' @rdname api-comments +## Comments / Get Task Comments +## GET https://api.clickup.com/api/v2/task/task_id/comment +## task_id +## Example: 9hz. +## String +cu_get_task_comments <- function(task_id) { + task_id <- cu_task_id(task_id) + .cu_get("task", task_id, "comment") +} + + +#' @export +#' @rdname api-comments +## Comments / Get View Comments +## GET https://api.clickup.com/api/v2/view/view_id/comment +## view_id +## 105 (string) +## Example: 3c. +## String +cu_get_view_comments <- function(view_id) { + .cu_get("view", view_id, "comment") +} + + +#' @export +#' @rdname api-comments +## Comments / Get List Comments +## GET https://api.clickup.com/api/v2/list/list_id/comment +## list_id +## Example: 124. +## Number +cu_get_list_comments <- function(list_id) { + .cu_get("list", list_id, "comment") +} + + +#' @export +#' @rdname api-comments +## Comments / Update Comment +## PUT https://api.clickup.com/api/v2/comment/comment_id +## comment_id +## Example: 456. +## Number +## +## Body +## +## { +## "comment_text": "Updated comment text" +## "assignee": 183, +## "resolved": true +## } +cu_put_update_comment <- function(comment_id, ...) { + .cu_put("comment", comment_id, + body=list(...)) +} + + +#' @export +#' @rdname api-comments +## Comments / Delete Comment +## DELET Ehttps://api.clickup.com/api/v2/comment/comment_id +## comment_id +## Example: 456. +## Number +cu_delete_comment <- function(comment_id) { + .cu_delete("comment", comment_id) +} diff --git a/R/df-customfields.R b/R/df-customfields.R new file mode 100644 index 0000000..07ceb00 --- /dev/null +++ b/R/df-customfields.R @@ -0,0 +1,83 @@ +#' Custom fields +#' +#' Working with custom fields in ClickUp tasks. + +#' @param list_id List ID. +#' @param task_id Task ID. +#' @param field_id Field ID. +#' @param ... Named arguments to be passed to API request body. +#' The accessible fields can be found on the task object from the +#' [cu_get_task()] route. This is where you can retrieve the `field_id`. +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-customfields +NULL + +#' @export +#' @rdname api-customfields +## Custom Fields / Get Accessible Custom Fields +## GET https://api.clickup.com/api/v2/list/list_id/field +## list_id +## Example: 123. +## Number +cu_get_accessible_custom_fields <- function(list_id) { + .cu_get("list", list_id, "field") +} + + +#' @export +#' @rdname api-customfields +## Custom Fields / Set Custom Field Value +## POST https://api.clickup.com/api/v2/task/task_id/field/field_id +## +## task_id +## Example: 9hv. +## String +## +## field_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. +## String +## +## The accessible fields can be found on the task object from the +## get task route. This is where you can retrieve the field_id. +## +## Body +## +## { +## "value": 80 +## } +#cu_set_custom_field_value +cu_set_custom_field_value <- function(task_id, field_id, ...) { + task_id <- cu_task_id(task_id) + .cu_post("task", task_id, "field", field_id, + body=list(...)) +} + + +#' @export +#' @rdname api-customfields +## Custom Fields / Remove Custom Field Value +## DELETE https://api.clickup.com/api/v2/task/task_id/field/field_id +## +## task_id +## Example: 9hv. +## String +## +## field_id +## b8a8-48d8-a0c6-b4200788a683 (uuid) +## Example: b955c4dc. +## String +## +## The accessible fields can be found on the task object from the +## get task route. This is where you can retrieve the field_id +cu_remove_field_value <- function(task_id, field_id) { + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id, "field", field_id) +} diff --git a/R/df-dependencies.R b/R/df-dependencies.R new file mode 100644 index 0000000..501d966 --- /dev/null +++ b/R/df-dependencies.R @@ -0,0 +1,119 @@ +#' Dependencies +#' +#' Working dependencies xyz in ClickUp tasks (). + +#' @param task_id Task ID. +#' @param depends_on A waiting on dependency of the task. +#' One and only one of `depends_on` or `dependency_of` must be passed. +#' @param dependency_of A blocking dependency of the task. +#' One and only one of `depends_on` or `dependency_of` must be passed. +#' @param links_to Link to another task. +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-dependencies +NULL + +#' @export +#' @rdname api-dependencies +## Dependencies / Add Dependency +## POST https://api.clickup.com/api/v2/task/task_id/dependency +## +## task_id +## Example: 9hv. +## String +## +## To create a waiting on dependency, pass the property depends_on in the body. +## To create a blocking dependency, pass the property dependency_of. +## Both can not be passed in the same request. +## +## { +## "depends_on": "9hw" +## } +cu_add_dependency <- function(task_id, depends_on, dependency_of) { + task_id <- cu_task_id(task_id) + if (missing(depends_on) && missing(dependency_of)) + stop("Provide one of depends_on or dependency_of", call.=FALSE) + if (!missing(depends_on) && !missing(dependency_of)) + stop("Provide only one of depends_on or dependency_of", call.=FALSE) + if (!missing(depends_on) && missing(dependency_of)) + body <- list(depends_on=depends_on) + if (missing(depends_on) && !missing(dependency_of)) + body <- list(dependency_of=dependency_of) + .cu_post("task", task_id, "dependency", + body=body) +} + + +#' @export +#' @rdname api-dependencies +## Dependencies / Delete Dependency +## DELETE https://api.clickup.com/api/v2/task/task_id/dependency?depends_on=9hz&dependency_of=9hz +## +## task_id +## Example: 9hv. +## String +## +## depends_on +## Example: 9hz. +## String +## +## dependency_of +## Example: 9hz. +## String +## +## One and only one of depends_on or dependency_of must be passed in the +## query params. +cu_delete_dependency <- function(task_id, depends_on, dependency_of) { + task_id <- cu_task_id(task_id) + if (missing(depends_on) && missing(dependency_of)) + stop("Provide one of depends_on or dependency_of", call.=FALSE) + if (!missing(depends_on) && !missing(dependency_of)) + stop("Provide only one of depends_on or dependency_of", call.=FALSE) + if (!missing(depends_on) && missing(dependency_of)) + query <- list(depends_on=depends_on) + if (missing(depends_on) && !missing(dependency_of)) + query <- list(dependency_of=dependency_of) + .cu_delete("task", task_id, "dependency", + query=query) +} + + +#' @export +#' @rdname api-dependencies +## Dependencies / Add Task Link +## POST https://api.clickup.com/api/v2/task/task_id/link/links_to +## +## task_id +## Example: 9hv. +## String +## +## links_to +## Example: 9hz. +## String +cu_add_task_link <- function(task_id, links_to) { + task_id <- cu_task_id(task_id) + .cu_post("task", task_id, "link", links_to) +} + + +#' @export +#' @rdname api-dependencies +## Dependencies / Delete Task Link +## DELETE https://api.clickup.com/api/v2/task/task_id/link/links_to +## +## task_id +## Example: 9hv. +## String +## +## links_to +## Example: 9hz. +## String +cu_delete_dependency <- function(task_id, links_to) { + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id, "link", links_to) +} diff --git a/R/df-folders.R b/R/df-folders.R new file mode 100644 index 0000000..7046d93 --- /dev/null +++ b/R/df-folders.R @@ -0,0 +1,178 @@ +#' Folders +#' +#' Working with folders in ClickUp tasks (). + +#' @param space_id Space ID. +#' @param name Name of the folder. +#' @param folder_id Folder ID. +#' @param archived Logical, to return archived (`TRUE`) folders. +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-folders +NULL + +#' @export +#' @rdname api-folders +## Folders / Create Folder +## POST https://api.clickup.com/api/v2/space/space_id/folder +## +## space_id +## Example: 789. +## Number +## +## Body +## +## { +## "name": "New Folder Name" +## } +cu_create_folder <- function(space_id, name) { + .cu_post("space", space_id, "folder", + body=list(name=name)) +} + + +#' @export +#' @rdname api-folders +## Folders / Update Folder +## PUT https://api.clickup.com/api/v2/folder/folder_id +## +## folder_id +## Example: 457. +## Number +## +## Body +## +## { +## "name": "Updated Folder Name" +## } +cu_update_folder <- function(folder_id, name) { + .cu_put("folder", folder_id, + body=list(name=name)) +} + + +#' @export +#' @rdname api-folders +## Folders / Delete Folder +## DELETE https://api.clickup.com/api/v2/folder/folder_id +## +## folder_id +## Example: 457. +## Number +cu_delete_folder <- function(folder_id, name) { + .cu_delete("folder", folder_id) +} + + +#' @export +#' @rdname api-folders +## Folders / Get Folders +## GET https://api.clickup.com/api/v2/space/space_id/folder?archived=false +## +## space_id +## Example: 789. +## Number +## +## archived +## Example: false. +## Boolean +cu_get_folders <- function(space_id, archived=FALSE) { + .cu_get("space", space_id, "folder", + query = list("archived" = tolower(archived))) +} + + +#' cuf_get_folders() +#' +#' `cuf_get_folders()` returns the same data as `cu_get_folders()` as a tibble. +#' +#' @export +#' @rdname api-folders +cuf_get_folders <- function(team_id, archived=FALSE) { + out <- cu_get_folders(team_id, archived)$folders + tibblify(out, lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + override_statuses = lcol_lgl("override_statuses"), + hidden = lcol_lgl("hidden"), + space = lcol_df( + "space", + id = lcol_chr("id"), + name = lcol_chr("name") + ), + task_count = lcol_chr("task_count"), + archived = lcol_lgl("archived"), + statuses = lcol_df_lst( + "statuses", + id = lcol_chr("id"), + status = lcol_chr("status"), + type = lcol_chr("type"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color"), + .default = NULL + ), + lists = lcol_df_lst( + "lists", + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + content = lcol_chr("content", .default = NA_character_), + status = lcol_df( + "status", + status = lcol_chr("status", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + .default = NULL + ), + priority = lcol_guess("priority", .default = NULL), + assignee = lcol_df( + "assignee", + color = lcol_chr("color", .default = NA_character_), + username = lcol_chr("username", .default = NA_character_), + initials = lcol_chr("initials", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + .default = NULL + ), + task_count = lcol_int("task_count"), + due_date = lcol_chr("due_date", .default = NA_character_), + start_date = lcol_chr("start_date", .default = NA_character_), + space = lcol_df( + "space", + id = lcol_chr("id"), + name = lcol_chr("name"), + access = lcol_lgl("access") + ), + archived = lcol_lgl("archived"), + override_statuses = lcol_lgl("override_statuses", .default = NA), + statuses = lcol_df_lst( + "statuses", + id = lcol_chr("id"), + status = lcol_chr("status"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color"), + type = lcol_chr("type") + ), + permission_level = lcol_chr("permission_level") + ), + permission_level = lcol_chr("permission_level") + )) +} + + + +#' @export +#' @rdname api-folders +## Folders / Get Folder +## GET https://api.clickup.com/api/v2/folder/folder_id +## +## folder_id +## Example: 457. +## Number +cu_get_folder <- function(folder_id) { + .cu_get("folder", folder_id) +} diff --git a/R/df-goals.R b/R/df-goals.R new file mode 100644 index 0000000..44bf314 --- /dev/null +++ b/R/df-goals.R @@ -0,0 +1,186 @@ +#' Goals +#' +#' Working with goals in ClickUp tasks. + +#' @param team_id Team ID. +#' @param goal_id Goal ID. +#' @param key_result_id Key result ID. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-goals +NULL + +#' @export +#' @rdname api-goals +## Goals / Create Goal +## POST https://api.clickup.com/api/v2/team/team_id/goal +## +## team_id +## Example: 512. +## Number +## +## Body +## +## { +## "name": "Goal Name", +## "due_date": 1568036964079, +## "description": "Goal Description", +## "multiple_owners": true, +## "owners": [ +## 183 +## ], +## "color": "#32a852" +## } +cu_create_goal <- function(team_id, ...) { + .cu_post("team", team_id, "goal", + body=list(...)) +} + + +#' @export +#' @rdname api-goals +## Goals / Update Goal +## PUT https://api.clickup.com/api/v2/goal/goal_id +## +## goal_id +## 900e-462d-a849-4a216b06d930 (uuid) +## Example: e53a033c. +## String +## +## Body +## +## { +## "name": "Updated Goal Name", +## "due_date": 1568036964079, +## "description": "Updated Goal Description", +## "rem_owners": [183], +## "add_owners": [182] +## "color": "#32a852" +## } +cu_update_goal <- function(goal_id, ...) { + .cu_put("goal", goal_id, + body=list(...)) +} + + +#' @export +#' @rdname api-goals +## Goals / Delete Goal +## DELETE https://api.clickup.com/api/v2/goal/goal_id +## +## goal_id +## 900e-462d-a849-4a216b06d930 (uuid) +## Example: e53a033c. +## String +cu_delete_goal <- function(goal_id) { + .cu_delete("goal", goal_id) +} + + +#' @export +#' @rdname api-goals +## Goals / Get Goals +## GET https://api.clickup.com/api/v2/team/team_id/goal +## +## team_id +## Example: 512. +## Number +cu_get_goals <- function(team_id) { + .cu_get("team", team_id, "goal") +} + + +#' @export +#' @rdname api-goals +## Goals / Get Goal +## GET https://api.clickup.com/api/v2/goal/goal_id +## +## goal_id +## 900e-462d-a849-4a216b06d930 (uuid) +## Example: e53a033c. +## String +cu_get_goal <- function(goal_id) { + .cu_get("goal", goal_id) +} + + +#' @export +#' @rdname api-goals +## Goals / Create Key Result +## POST https://api.clickup.com/api/v2/goal/goal_id/key_result +## +## goal_id +## 900e-462d-a849-4a216b06d930 (uuid) +## Example: e53a033c. +## String +## +## Key result types can be number, currency, boolean, percentage, +## or automatic. The task ID's array and list ID's array can be used +## to attach resources to the goal. +## +## Body +## +## { +## "name": "New Key Result Name", +## "owners": [ +## 183 +## ], +## "type": "number", +## "steps_start": 0, +## "steps_end": 10, +## "unit": "km", +## "task_ids": [], +## "list_ids": [] +## } +cu_create_key_result <- function(goal_id, ...) { + .cu_post("goal", goal_id, "key_result", + body=list(...)) +} + + +#' @export +#' @rdname api-goals +## Goals / Edit Key Result +## PUT https://api.clickup.com/api/v2/key_result/key_result_id +## +## key_result_id +## 8480-49bc-8c57-e569747efe93 (uuid) +## Example: 947d46ed. +## String +## +## All properties available in the create key result route may +## also be used along with the additional properties below. +## +## Body +## +## { +## "steps_current": 5, +## "note": "Target achieved" +## } +cu_edit_key_result <- function(key_result_id, ...) { + .cu_put("key_result", key_result_id, + body=list(...)) +} + + +#' @export +#' @rdname api-goals +## Goals / Delete Key Result +## DELETE https://api.clickup.com/api/v2/key_result/key_result_id +## +## key_result_id +## 8480-49bc-8c57-e569747efe93 (uuid) +## Example: 947d46ed. +## String +cu_delete_key_result <- function(key_result_id) { + .cu_delete("key_result", key_result_id) +} + + diff --git a/R/df-guests.R b/R/df-guests.R new file mode 100644 index 0000000..b92e293 --- /dev/null +++ b/R/df-guests.R @@ -0,0 +1,238 @@ +#' Guests +#' +#' Working with guests in ClickUp tasks (Enterprise only feature). + +#' @param team_id Team ID. +#' @param guest_id Guest ID. +#' @param permission_level Permisson level can be +#' `"read"`, `"comment"`, `"edit"`, or `"create"`. +#' @param folder_id Folder ID. +#' @param list_id List ID. +#' @param task_id Task ID. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-guests +NULL + +#' @export +#' @rdname api-guests +## Guests / Invite Guest To Workspace +## POST https://api.clickup.com/api/v2/team/team_id/guest +## +## team_id +## Example: 333. +## Number +## +## Note: not sure how this is supposed to work without email +## e.g. cu_invite_user_to_workspace(team_id, email) +## +cu_invite_guest_to_workspace <- function(team_id) { + .cu_post("team", team_id, "guest") +} + + +#' @export +#' @rdname api-guests +## Guests / Edit Guest On Workspace +## PUT https://api.clickup.com/api/v2/team/team_id/guest/guest_id +## +## team_id +## Example: 333. +## Number +## +## guest_id +## Example: 403. +## Number +## +## Body +## +## { +## "username": "Guest User", +## "can_edit_tags": true, +## "can_see_time_spent": true, +## "can_see_time_estimated": true +## } +cu_edit_guest_on_workspace <- function(team_id, guest_id, ...) { + .cu_put("team", team_id, "guest", guest_id, + body=list(...)) +} + + +#' @export +#' @rdname api-guests +## Guests / Remove Guest From Workspace +## DELETE https://api.clickup.com/api/v2/team/team_id/guest/guest_id +## +## team_id +## Example: 333. +## Number +## guest_id +## Example: 403. +## Number +cu_remove_guest_from_workspace <- function(team_id, guest_id) { + .cu_delete("team", team_id, "guest", guest_id) +} + + +#' @export +#' @rdname api-guests +## Guests / Get Guest +## GET https://api.clickup.com/api/v2/team/team_id/guest/guest_id +## +## team_id +## Example: 333. +## Number +## +## guest_id +## Example: 403. +## Number +cu_get_guest <- function(team_id, guest_id) { + .cu_get("team", team_id, "guest", guest_id) +} + + +#' @export +#' @rdname api-guests +## Guests / Add Guest To Task +## POST https://api.clickup.com/api/v2/task/task_id/guest/guest_id +## +## task_id +## Example: c04. +## String +## +## guest_id +## Example: 403. +## Number +## +## permisson_level can be read, comment, edit, or create +## +## Body +## +## { +## "permission_level": "read" +## } +cu_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { + task_id <- cu_task_id(task_id) + permission_level <- match.arg(permission_level, + c("read", "comment", "edit", "create")) + .cu_post("task", task_id, "guest", guest_id, + body=list(permission_level=permission_level)) +} + + +#' @export +#' @rdname api-guests +## Guests / Remove Guest From Task +## DELETE https://api.clickup.com/api/v2/task/task_id/guest/guest_id +## +## task_id +## Example: c04. +## String +## +## guest_id +## Example: 403. +## Number +cu_remove_guest_from_task <- function(task_id, guest_id) { + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id, "guest", guest_id) +} + + +#' @export +#' @rdname api-guests +## Guests / Add Guest To List +## POST https://api.clickup.com/api/v2/list/list_id/guest/guest_id +## +## list_id +## Example: 1427. +## Number +## +## guest_id +## Example: 403. +## Number +## +## permisson_level can be read, comment, edit, or create +## +## Body +## +## { +## "permission_level": "read" +## } +cu_add_guest_to_list <- function(list_id, guest_id, permission_level="read") { + permission_level <- match.arg(permission_level, + c("read", "comment", "edit", "create")) + .cu_post("list", list_id, "guest", guest_id, + body=list(permission_level=permission_level)) +} + + +#' @export +#' @rdname api-guests +## Guests / Remove Guest From List +## DELETE https://api.clickup.com/api/v2/list/list_id/guest/guest_id +## +## list_id +## Example: 1427. +## Number +## +## guest_id +## Example: 403. +## Number +cu_remove_guest_from_list <- function(list_id, guest_id) { + .cu_delete("list", list_id, "guest", guest_id) +} + + +#' @export +#' @rdname api-guests +## Guests / Add Guest To Folder +## POST https://api.clickup.com/api/v2/folder/folder_id/guest/guest_id +## +## folder_id +## Example: 1057. +## Number +## +## guest_id +## Example: 403. +## Number +## +## permisson_level can be read, comment, edit, or create +## +## Body +## +## { +## "permission_level": "read" +## } +cu_add_guest_to_folder <- function(folder_id, guest_id, + permission_level="read") { + permission_level <- match.arg(permission_level, + c("read", "comment", "edit", "create")) + .cu_post("folder", folder_id, "guest", guest_id, + body=list(permission_level=permission_level)) +} + + +#' @export +#' @rdname api-guests +## Guests / Remove Guest From Folder +## DELETE https://api.clickup.com/api/v2/folder/folder_id/guest/guest_id +## +## folder_id +## Example: 1057. +## Number +## +## guest_id +## Example: 403. +## Number +## +## +cu_remove_guest_from_folder <- function(folder_id, guest_id) { + .cu_delete("folder", folder_id, "guest", guest_id) +} diff --git a/R/df-lists.R b/R/df-lists.R new file mode 100644 index 0000000..9323975 --- /dev/null +++ b/R/df-lists.R @@ -0,0 +1,169 @@ +#' Lists +#' +#' Working with lists in ClickUp tasks. + +#' @param folder_id Folder ID. +#' @param space_id SPace ID. +#' @param list_id List ID. +#' @param archived Logical, to returne archived (`TRUE`) lists. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-lists +NULL + +#' @export +#' @rdname api-lists +## Lists / Create List +## POST https://api.clickup.com/api/v2/folder/folder_id/list +## +## folder_id +## Example: 456. +## Number +## +## assignee is a userid of the assignee to be added to this task. +## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. +## +## Body +## +## { +## "name": "New List Name", +## "content": "New List Content", +## "due_date": 1567780450202, +## "due_date_time": false, +## "priority": 1, +## "assignee": 183, +## "status": "red" +## } +cu_create_list <- function(folder_id, ...) { + .cu_post("folder", folder_id, "list", + body=list(...)) +} + + +#' @export +#' @rdname api-lists +## Lists / Create Folderless List +## POST https://api.clickup.com/api/v2/space/space_id/list +## +## space_id +## Example: 789. +## Number +## +## assignee is a userid of the assignee to be added to this task. +## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. +## +## Body +## +## { +## "name": "New List Name", +## "content": "New List Content", +## "due_date": 1567780450202, +## "due_date_time": false, +## "priority": 1, +## "assignee": 183, +## "status": "red" +## } +cu_create_folderless_list <- function(space_id, ...) { + .cu_post("space", space_id, "list", + body=list(...)) +} + + +#' @export +#' @rdname api-lists +## Lists / Update List +## PUT https://api.clickup.com/api/v2/list/list_id +## +## list_id +## Example: 124. +## String +## +## Only pass the properties you want to update. +## It is unnessary to pass the entire list object. +## assignee is a userid of the assignee to be added to this task. +## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. +## +## Body +## +## { +## "name": "Updated List Name", +## "content": "Updated List Content", +## "due_date": 1567780450202, +## "due_date_time": true, +## "priority": 2, +## "assignee": "none", +## "unset_status": true +## } +cu_update_list <- function(list_id, ...) { + .cu_put("list", list_id, + body=list(...)) +} + + +#' @export +#' @rdname api-lists +## Lists / Delete List +## DELET Ehttps://api.clickup.com/api/v2/list/list_id +## +## list_id +## Example: 124. +## Number +cu_delete_list <- function(list_id, ...) { + .cu_delete("list", list_id) +} + + +#' @export +#' @rdname api-lists +## Lists / Get Lists +## GET https://api.clickup.com/api/v2/folder/folder_id/list?archived=false +## +## folder_id +## Example: 456. +## Number +## +## archived +## Example: false. +## Boolean +cu_get_lists <- function(folder_id, archived=FALSE) { + .cu_get("folder", folder_id, "list", + query = list("archived" = tolower(archived))) +} + + +#' @export +#' @rdname api-lists +## Lists / Get Folderless Lists +## GET https://api.clickup.com/api/v2/space/space_id/list?archived=false +## +## space_id +## Example: 789. +## Number +## +## archived +## Example: false. +## Boolean +cu_get_lists_folderless <- function(space_id, archived=FALSE) { + .cu_get("space", space_id, "list", + query = list("archived" = tolower(archived))) +} + + +#' @export +#' @rdname api-lists +## Lists / Get List +## GET https://api.clickup.com/api/v2/list/list_id +## +## list_id +## Example: 124. +## Number +cu_get_list <- function(list_id) { + .cu_get("list", list_id) +} diff --git a/R/df-members.R b/R/df-members.R new file mode 100644 index 0000000..e84b51a --- /dev/null +++ b/R/df-members.R @@ -0,0 +1,41 @@ +#' Members +#' +#' Working with members in ClickUp tasks (). + +#' @param task_id Task ID. +#' @param list_id List ID. +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-members +NULL + +#' @export +#' @rdname api-members +## Members / Get Task Members +## GET https://api.clickup.com/api/v2/task/task_id/member +## +## task_id +## Example: 9hz. +## String +cu_get_task_members <- function(task_id) { + task_id <- cu_task_id(task_id) + .cu_get("task", task_id, "member") +} + + +#' @export +#' @rdname api-members +## Members / Get List Members +## GET https://api.clickup.com/api/v2/list/list_id/member +## +## list_id +## Example: 123. +## Number +cu_get_list_members <- function(list_id) { + .cu_get("list", list_id, "member") +} diff --git a/R/df-sharedhierarchy.R b/R/df-sharedhierarchy.R new file mode 100644 index 0000000..6a950f9 --- /dev/null +++ b/R/df-sharedhierarchy.R @@ -0,0 +1,32 @@ +#' Shared hierarchy +#' +#' Working with shared hierarchy in ClickUp tasks (). +#' Returns all resources you have access to where you don't have +#' access to its parent. For example, if you have access to a +#' shared task, but don't have access to its parent list, it will +#' come back in this request. + +#' @param team_id Team ID. +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @export +#' @name api-sharedhierarchy +## Shared Hierarchy / Shared Hierarchy +## GET https://api.clickup.com/api/v2/team/team_id/shared +## +## team_id +## Example: 333. +## Number +## +## Returns all resources you have access to where you don't have +## access to its parent. For example, if you have a access to a +## shared task, but don't have access to its parent list, it will +## come back in this request. +cu_get_shared <- function(team_id) { + .cu_get("team", team_id, "shared") +} diff --git a/R/df-spaces.R b/R/df-spaces.R new file mode 100644 index 0000000..653972a --- /dev/null +++ b/R/df-spaces.R @@ -0,0 +1,218 @@ +#' Spaces +#' +#' Working with spaces in ClickUp tasks. + +#' @param team_id Team ID. +#' @param name Name of the space. +#' @param space_id Space ID. +#' @param archived Logical, to returne archived (`TRUE`) spaces. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-spaces +NULL + +#' @export +#' @rdname api-spaces +## Spaces / Create Space +## POST https://api.clickup.com/api/v2/team/team_id/space +## +## team_id +## Example: 512. +## Number +## +## Body +## +## { +## "name": "New Space Name", +## "multiple_assignees": true, +## "features": { +## "due_dates": { +## "enabled": true, +## "start_date": false, +## "remap_due_dates": true, +## "remap_closed_due_date": false +## }, +## "time_tracking": { +## "enabled": false +## }, +## "tags": { +## "enabled": true +## }, +## "time_estimates": { +## "enabled": true +## }, +## "checklists": { +## "enabled": true +## }, +## "custom_fields": { +## "enabled": true +## }, +## "remap_dependencies": { +## "enabled": true +## }, +## "dependency_warning": { +## "enabled": true +## }, +## "portfolios": { +## "enabled": true +## } +## } +## } +cu_create_space <- function(team_id, name, ...) { + .cu_post("team", team_id, "space", + body=list(name=name, ...)) +} + + +#' cuf_create_space() +#' +#' `cuf_create_space()` returns the same data as `cu_create_space()` as a tibble. +#' +#' @export +#' @rdname api-spaces +cuf_create_space <- function(team_id, name, ...) { + out <- cu_create_space(team_id, name, ...) + tibblify(list(out), spaces_spec) +} + + +#' @export +#' @rdname api-spaces +## Spaces / Update Space +## PUT https://api.clickup.com/api/v2/space/space_id +## +## space_id +## Example: 790. +## Number +## +## Same body as for cu_create_space +cu_update_space <- function(space_id, ...) { + .cu_put("space", space_id, + body=list(...)) +} + + +#' @export +#' @rdname api-spaces +## Spaces / Delete Space +## DELETE https://api.clickup.com/api/v2/space/space_id +## +## space_id +## Example: 790. +## Number +cu_delete_space <- function(space_id) { + .cu_delete("space", space_id) +} + + +#' @export +#' @rdname api-spaces +## Spaces / Get Spaces +##GET https://api.clickup.com/api/v2/team/team_id/space?archived=false +## +## team_id +## Example: 512. +## Number +## +## archived +## Example: false. +## Boolean +cu_get_spaces <- function(team_id, archived=FALSE) { + .cu_get("team", team_id, "space", + query = list("archived" = tolower(archived))) +} + + +#' cuf_get_spaces() +#' +#' `cuf_get_spaces()` returns the same data as `cu_get_spaces()` as a tibble. +#' +#' @export +#' @rdname api-spaces +cuf_get_spaces <- function(team_id, archived=FALSE) { + out <- cu_get_spaces(team_id, archived)$spaces + tibblify(out, spaces_spec) +} + +spaces_spec <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + private = lcol_lgl("private"), + statuses = lcol_df_lst( + "statuses", + status = lcol_chr("status"), + type = lcol_chr("type"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color") + ), + multiple_assignees = lcol_lgl("multiple_assignees"), + features = lcol_df( + "features", + due_dates = lcol_df( + "due_dates", + enabled = lcol_lgl("enabled"), + start_date = lcol_lgl("start_date"), + remap_due_dates = lcol_lgl("remap_due_dates"), + remap_closed_due_date = lcol_lgl("remap_closed_due_date") + ), + time_tracking = lcol_df( + "time_tracking", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + tags = lcol_df( + "tags", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + time_estimates = lcol_df( + "time_estimates", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + checklists = lcol_df( + "checklists", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + custom_fields = lcol_df( + "custom_fields", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ), + remap_dependencies = lcol_df( + "remap_dependencies", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ), + dependency_warning = lcol_df( + "dependency_warning", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ), + portfolios = lcol_df( + "portfolios", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ) + ) +) + +#' @export +#' @rdname api-spaces +## Spaces / Get Space +## GET https://api.clickup.com/api/v2/space/space_id +## +## space_id +## Example: 790. +## Number +cu_get_space <- function(space_id) { + .cu_get("space", space_id) +} diff --git a/R/df-tags.R b/R/df-tags.R new file mode 100644 index 0000000..17acec0 --- /dev/null +++ b/R/df-tags.R @@ -0,0 +1,127 @@ +#' Tags +#' +#' Working with tags in ClickUp tasks. + +#' @param space_id Space ID. +#' @param task_id Task ID. +#' @param tag_name Tag name. +#' @param name Tag name. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-tags +NULL + +#' @export +#' @rdname api-tags +## Tags / Get Space Tags +## GET https://api.clickup.com/api/v2/space/space_id/tag +## +## space_id +## Example: 512. +## Number +cu_get_space_tags <- function(space_id) { + .cu_get("space", space_id, "tag") +} + + +#' @export +#' @rdname api-tags +## Tags / Create Space Tag +## POST https://api.clickup.com/api/v2/space/space_id/tag +## +## space_id +## Example: 512. +## Number +## +## Body +## +## { +## "tag": { +## "name": "Tag Name", +## "tag_fg": "#000000", +## "tag_bg": "#000000" +## } +## } +cu_create_space_tag <- function(space_id, name, ...) { + .cu_post("space", space_id, "tag", + body=list( + tag=list(name=name, ...))) +} + + +#' @export +#' @rdname api-tags +## Tags / Edit Space Tag +## PUT https://api.clickup.com/api/v2/space/space_id/tag/tag_name +## +## space_id +## Example: 512. +## Number +## +## tag_name +## Example: name. +## String +cu_edit_space_tag <- function(space_id, tag_name) { + .cu_put("space", space_id, "tag", tag_name) +} + + +#' @export +#' @rdname api-tags +## Tags / Delete Space Tag +## DELETE https://api.clickup.com/api/v2/space/space_id/tag/tag_name +## +## space_id +## Example: 512. +## Number +## +## tag_name +## Example: name. +## String +cu_delete_space_tag <- function(space_id) { + .cu_delete("space", space_id, "tag", tag_name) +} + + +#' @export +#' @rdname api-tags +## Tags / Add Tag To Task +## POST https://api.clickup.com/api/v2/task/task_id/tag/tag_name +## +## task_id +## Example: abc. +## String +## +## tag_name +## Example: name. +## String +cu_add_tag_to_task <- function(task_id, tag_name) { + task_id <- cu_task_id(task_id) + .cu_post("task", task_id, "tag", tag_name) +} + + +#' @export +#' @rdname api-tags +## Tags / Remove Tag From Task +## DELETE https://api.clickup.com/api/v2/task/task_id/tag/tag_name +## +## task_id +## Example: abc. +## String +## +## tag_name +## Example: name. +## String +cu_delete_space_tag <- function(task_id, tag_name) { + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id, "tag", tag_name) +} + diff --git a/R/df-tasks.R b/R/df-tasks.R new file mode 100644 index 0000000..737395e --- /dev/null +++ b/R/df-tasks.R @@ -0,0 +1,392 @@ +#' Tasks +#' +#' Working with tasks in ClickUp tasks. + +#' @details +#' +#' ### Create task +#' +#' `assignees` is an array of the assignees' userids to be added to this task. +#' `priority` is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low +#' ([cu_priority()]). Time estimate is in milliseconds. +#' See the fields section below to see the custom fields available on a list. +#' If `notify_all` is true, creation notifications will be sent to everyone +#' including the creator of the task. Instead of content you can pass +#' `markdown_content` with valid markdown syntax to add formatting to the +#' task description. Passing an existing task ID in the parent property +#' will make the new task a subtask of that parent. +#' The parent you pass must not be a subtask itself, +#' and must be part of the list that you pass in the URL params. +#' The `links_to` accepts a task ID to create a linked dependency on +#' the new task. +#' +#' ### Update task +#' +#' Only pass properties you want to update. +#' It is unnecessary to pass the entire task object. +#' +#' ### Get tasks +#' +#' The maximum number of tasks returned in this response is 100. +#' When you are paging this request, you should check list limit against +#' the length of each response to determine if you are on the last page. +#' By default this does not include closed tasks. To page tasks, +#' pass the page number you wish to fetch. [cu_get_all_team_tasks()] +#' is a wrapper to spare paging. +#' +#' ### Filter query parameters +#' +#' When value is an array, use `I()` to make sure atomic vectors +#' remain JSON arrays in the output. +#' +#' * archived: return archived tasks. +#' * page: page to fetch (starts at 0) +#' * order_by: order by field, defaults to created; options: id, created, +#' updated, due_date. +#' * reverse: reverse order. +#' * subtasks: include subtasks, default false. +#' * space_ids: spaces to query, array. +#' * project_ids: projects to query, array. +#' * statuses: statuses to query, array. +#' * include_closed: by default, the api does not include closed tasks. +#' Set this to true and dont send a status filter to include closed tasks. +#' * assignees: ssignees to query, array. +#' * due_date_gt: filter due date greater than posix time. +#' * due_date_lt: filter due date less than posix time. +#' * date_created_gt: filter date created greater than posix time. +#' * date_created_lt: filter date created less than posix time. +#' * date_updated_gt: filter date updated greater than posix time. +#' * date_updated_lt: filter date updated less than posix time +#' * custom_fields: filter by custom fields. Must be a stringified +#' JSON array of objects. See the custom fields section of the API docs +#' for more details. +#' +#' @param team_id Team (workspace) ID. +#' @param list_id List ID. +#' @param task_id Task ID. The ClickUp GUI prepends task IDs with a leading hash, [cu_task_id()] is used internally to normalize task IDs. +#' @param archived Logical, to returne archived (`TRUE`) lists. +#' @param ... Named arguments to be passed to API request body, +#' of as query parameters, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class, [cu_date_to()] and +#' [cu_date_from()] to work with POSIX dates, +#' [cu_get_all_team_tasks()] is a wrapper. [cu_task_id()] to remove leading hashes from task IDs. +#' +#' @name api-tasks +NULL + +#' @export +#' @rdname api-tasks +## Tasks / Create Task +## POST https://api.clickup.com/api/v2/list/list_id/task +## +## list_id +## Example: 123. +## Number +## +## assignees is an array of the assignees' userids to be added to this task. +## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. +## Time estimate is in milliseconds. +## See the fields section below to see the custom fields available on a list. +## If notify_all is true, creation notifications will be sent to everyone +## including the creator of the task. Instead of content you can pass +## markdown_content with valid markdown syntax to add formatting to the +## task description. Passing an existing task ID in the parent property +## will make the new task a subtask of that parent. +## The parent you pass must not be a subtask itself, +## and must be part of the list that you pass in the URL params. +## The links_to accepts a task ID to create a linked dependency on the new task. +## +## Body +## +## { +## "name": "New Task Name", +## "content": "New Task Content", +## "assignees": [ +## 183 +## ], +## "tags": [ +## "tag name 1" +## ], +## "status": "Open", +## "priority": 3, +## "due_date": 1508369194377, +## "due_date_time": false, +## "time_estimate": 8640000, +## "start_date": 1567780450202, +## "start_date_time": false, +## "notify_all": true, +## "parent": null, +## "links_to": null, +## "custom_fields": [ +## { +## "id": "0a52c486-5f05-403b-b4fd-c512ff05131c", +## "value": 23 +## }, +## { +## "id": "03efda77-c7a0-42d3-8afd-fd546353c2f5", +## "value": "Text field input" +## } +## ] +## } +## +## Use I() when providing arrays as part of the body +## list(a=1, b=I(2)) will be {"a":1,"b":[2]} +cu_create_task <- function(list_id, ...) { + .cu_post("list", list_id, "task", + body=list(...)) +} + + +#' @export +#' @rdname api-tasks +## Tasks / Update Task +## PUT https://api.clickup.com/api/v2/task/task_id +## +## task_id +## Example: 9hx. +## String +## +## Only pass properties you want to update. +## It is unnecessary to pass the entire task object. assignees is an +## array of the assignees' userids to be added to this task. +## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. +## Time estimate is in milliseconds. +## +## Body +## +## { +## "name": "Updated Task Name", +## "content": "Updated Task Content", +## "status": "in progress", +## "priority": 1, +## "time_estimate": 8640000, +## "assignees": { +## "add": [182], +## "rem": [183] +## }, +## "archived": false, +## } +cu_update_task <- function(task_id, ...) { + task_id <- cu_task_id(task_id) + .cu_put("task", task_id, + body=list(...)) +} + + +#' @export +#' @rdname api-tasks +## Tasks / Delete Task +## DELETE https://api.clickup.com/api/v2/task/task_id +## +## task_id +## Example: 9xh. +## String +cu_delete_task <- function(task_id) { + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id) +} + + +#' @export +#' @rdname api-tasks +## Tasks / Get Tasks +## GET https://api.clickup.com/api/v2/list/list_id/task?archived=false&page=&order_by=&reverse=&subtasks=&space_ids%5B%5D=&project_ids%5B%5D=&statuses%5B%5D=&include_closed=&assignees%5B%5D=&due_date_gt=&due_date_lt=&date_created_gt=&date_created_lt=&date_updated_gt=&date_updated_lt=&custom_fields= +## +## list_id +## Example: 123. +## Number +## +## archived +## Example: false. +## Boolean +## +## page +## Page to fetch (starts at 0) +## Integer +## +## order_by +## Order by field, defaults to created Options: id, created, +## updated, due_date +## String +## +## reverse +## Reverse order +## Boolean +## +## subtasks +## Include subtasks, default false +## Boolean +## +## space_ids[] +## Spaces to query +## Array +## +## project_ids[] +## Projects to query +## Array +## +## statuses[] +## Statuses to query +## Array +## +## include_closed +## By default, the api does not include closed tasks. +## Set this to true and dont send a status filter to include closed tasks. +## Boolean +## +## assignees[] +## Assignees to query +## Array +## +## due_date_gt +## Filter due date greater than posix time +## Integer +## +## due_date_lt +## Filter due date less than posix time +## Integer +## +## date_created_gt +## Filter date created greater than posix time +## Integer +## +## date_created_lt +## Filter date created less than posix time +## Integer +## +## date_updated_gt +## Filter date updated greater than posix time +## Integer +## +## date_updated_lt +## Filter date updated less than posix time +## Integer +## +## custom_fields +## Filter by custom fields. Must be a stringified JSON array of objects. +## See the custom fields section for more details. +## Object[] +## +## The maximum number of tasks returned in this response is 100. +## When you are paging this request, you should check list limit against +## the length of each response to determine if you are on the last page. +## +# ... takes parameters, most importantly page (starting at 0) +cu_get_tasks <- function(list_id, archived=FALSE, ...) { + .cu_get("list", list_id, "task", + query = list("archived" = tolower(archived), ...)) +} + + +#' @export +#' @rdname api-tasks +## Tasks / Get Task +## GET https://api.clickup.com/api/v2/task/task_id +## +## task_id +## Example: 9hz. +## String +cu_get_task <- function(task_id) { + task_id <- cu_task_id(task_id) + .cu_get("task", task_id) +} + + +#' @export +#' @rdname api-tasks +## Tasks / Get Filtered Team Tasks +## GET https://api.clickup.com/api/v2/team/team_id/task?page=&order_by=&reverse=&subtasks=&space_ids%5B%5D=&project_ids%5B%5D=&list_ids%5B%5D=&statuses%5B%5D=&include_closed=&assignees%5B%5D=&tags%5B%5D=&due_date_gt=&due_date_lt=&date_created_gt=&date_created_lt=&date_updated_gt=&date_updated_lt=&custom_fields%5B%5D= +## +## team_id +## Team ID of tasks +## Example: 123. +## String +## +## page +## Page to fetch +## Integer +## +## order_by +## Order by field, defaults to created Options: id, created, updated, due_date +## String +## +## reverse +## Reverse order +## Boolean +## +## subtasks +## Include subtasks, default false +## Boolean +## +## space_ids[] +## Spaces to query +## Array +## +## project_ids[] +## Projects to query +## Array +## +## list_ids[] +## Lists to query +## Array +## +## statuses[] +## Statuses to query +## Array +## +## include_closed +## By default, the api does not include closed tasks. +## Set this to true and dont send a status filter to include closed tasks. +## Boolean +## +## assignees[] +## Assignees to query +## Array +## +## tags[] +## Tag names to query +## Array +## +## due_date_gt +## Filter due date greater than posix time +## Integer +## +## due_date_lt +## Filter due date less than posix time +## Integer +## +## date_created_gt +## Filter date created greater than posix time +## Integer +## +## date_created_lt +## Filter date created less than posix time +## Integer +## +## date_updated_gt +## Filter date updated greater than posix time +## Integer +## +## date_updated_lt +## Filter date updated less than posix time +## Integer +## +## custom_fields[] +## Filter by custom fields. Must be a stringified JSON array of +## objects that must include fields field_id, value, operator. +## See the custom fields section for more details. +## Object[] +## +## By default this does not include closed tasks. To page tasks, +## pass the page number you wish to fetch. +cu_get_filtered_team_tasks <- function(team_id, ...) { + .cu_get("team", team_id, "task", + query = list(...)) +} + diff --git a/R/df-tasktemplates.R b/R/df-tasktemplates.R new file mode 100644 index 0000000..c215774 --- /dev/null +++ b/R/df-tasktemplates.R @@ -0,0 +1,64 @@ +#' Task templates +#' +#' Working with task templates in ClickUp tasks. + +#' @param team_id Team ID. +#' @param page Page to fetch (starts at 0). +#' To page task templates, pass the page number you wish to fetch. +#' @param list_id List ID. +#' @param template_id Template ID. +#' @param name Name of the task. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-tasktemplates +NULL + +#' @export +#' @rdname api-tasktemplates +## Task Templates / Get Task Templates +## GET https://api.clickup.com/api/v2/team/team_id/taskTemplate?page=0 +## +## team_id +## Example: 512. +## Number +## +## page +## Example: 0. +## Integer +## +## To page task templates, pass the page number you wish to fetch. +cu_get_task_templates <- function(team_id, page) { + .cu_get("team", team_id, "taskTemplate", + query = list(page = page)) +} + + +#' @export +#' @rdname api-tasktemplates +## Task Templates / Create Task From Template +## POST https://api.clickup.com/api/v2/list/list_id/taskTemplate/template_id +## +## list_id +## Example: 512. +## Number +## +## template_id +## Example: 9hz. +## String +## +## Body +## +## { +## "name": "New task name" +## } +cu_create_task_from_template <- function(list_id, template_id, name, ...) { + .cu_post("list", list_id, "taskTemplate", template_id, + body=list(name=name, ...)) +} diff --git a/R/df-teams.R b/R/df-teams.R new file mode 100644 index 0000000..942006a --- /dev/null +++ b/R/df-teams.R @@ -0,0 +1,79 @@ +#' Teams (workspaces) +#' +#' Working with teams (workspaces) in ClickUp tasks (). +#' Teams is the legacy term for what are now called workspaces in ClickUp. +#' For compatablitly, the term team is still used in the API v2. +#' This is NOT the new 'Teams' feature which represents a group of users. + +#' @examples +#' \dontrun{ +#' cu_get_teams() +#' } +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @export +#' @name api-teams +## Teams / Get Teams +## GET https://api.clickup.com/api/v2/team +## +## Teams is the legacy term for what are now called Workspaces in ClickUp. +## For compatablitly, the term team is still used in this API. +## This is NOT the new "Teams" feature which represents a group of users. +cu_get_teams <- function() { + .cu_get("team") +} +#cu_get_workspaces <- cu_get_teams + +#' cuf_get_teams +#' +#' `cuf_get_teams()` returns the same data as a nested tibble. +#' +#' @rdname api-teams +#' @export +cuf_get_teams <- function() { + out <- cu_get_teams()$teams + tibblify(out, teams_spec) +} + +teams_spec <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + color = lcol_chr("color"), + avatar = lcol_chr("avatar"), + members = lcol_df_lst( + "members", + user = lcol_df( + "user", + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + email = lcol_chr("email"), + color = lcol_chr("color", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + initials = lcol_chr("initials"), + role = lcol_int("role"), + custom_role = lcol_guess("custom_role", .default = NULL), + last_active = lcol_chr("last_active"), + date_joined = lcol_chr("date_joined"), + date_invited = lcol_chr("date_invited") + ), + invited_by = lcol_df( + "invited_by", + id = lcol_chr("id", .parser = as.character, .default = NA_character_), + username = lcol_chr("username", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + email = lcol_chr("email", .default = NA_character_), + initials = lcol_chr("initials", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + .default = NULL + ), + can_see_time_spent = lcol_lgl("can_see_time_spent", .default = NA), + can_see_time_estimated = lcol_lgl("can_see_time_estimated", .default = NA), + can_see_points_estimated = lcol_lgl("can_see_points_estimated", .default = NA), + can_edit_tags = lcol_lgl("can_edit_tags", .default = NA) + ) +) diff --git a/R/df-timetracking-legacy.R b/R/df-timetracking-legacy.R new file mode 100644 index 0000000..17c05f7 --- /dev/null +++ b/R/df-timetracking-legacy.R @@ -0,0 +1,122 @@ +#' Time tracking legacy +#' +#' Working with time tracking in ClickUp tasks. +#' Note: This is the legacy API for time tracking. +#' Please use the new Time tracking API. +#' You won't be able to update timer entries that uses our +#' Time Tracking 2.0 features that uses labels, descriptions, +#' and making time entries billable. + +#' @param task_id Task ID. +#' @param interval_id Interval ID. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' Edit the `start`, `end`, or total `time` of a time tracked entry. +#' +#' @return +#' +#' A cu object. +#' Note: the legacy API comes with a deprecation warning. +#' +#' @seealso [api-timetracking-2] for Time Tracking 2.0, +#' [cu-class] for the cu object class, +#' [cu_date_from()] and [cu_date_to()] to deal with POSIX times. +#' +#' @name api-timetracking-legacy +NULL + +#' @export +#' @rdname api-timetracking-legacy +## Time Tracking / Track time +## POST https://api.clickup.com/api/v2/task/task_id/time +## +## task_id +## Example: 9hv. +## String +## +## Include the total time or the start and end. +## The time is in milliseconds and the start and end are posix dates. +## +## { +## "start": 1567780450202, +## "end": 1508369194377, +## "time": 8640000 +## } +## +## use cu_time to turn POSIXct into unix time for start/end +## note: unix time is also in milliseconds (sec x 1000) +cu_track_time <- function(task_id, ...) { + .Deprecated("cu_create_time_entry") + task_id <- cu_task_id(task_id) + .cu_post("task", task_id, "time", + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-legacy +## Time Tracking / Get tracked time +## GET https://api.clickup.com/api/v2/task/task_id/time +## +## task_id +## Example: 9hv. +## String +## +## Get time tracked for a task. +cu_get_tracked_time <- function(task_id) { + .Deprecated("cu_get_time_entries_within_date_range") + task_id <- cu_task_id(task_id) + .cu_get("task", task_id, "time") +} + + +#' @export +#' @rdname api-timetracking-legacy +## Time Tracking / Edit time tracked +## PUT https://api.clickup.com/api/v2/task/task_id/time/interval_id +## +## task_id +## Example: 9hv. +## String +## +## interval_id +## Example: 123. +## String +## +## Edit the start, end, or total time of a time tracked entry. +## +## { +## "start": 1567780450202, +## "end": 1508369194377, +## "time": 8640000 +## } +## +## use cu_time to turn POSIXct into unix time for start/end +## note: unix time is also in milliseconds (sec x 1000) +cu_edit_time_tracked <- function(task_id, interval_id, ...) { + .Deprecated("cu_update_time_entry") + task_id <- cu_task_id(task_id) + .cu_put("task", task_id, "time", interval_id, + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-legacy +## Time Tracking / Delete time tracked +## DELETE https://api.clickup.com/api/v2/task/task_id/time/interval_id +## +## task_id +## Example: 9hv. +## String +## +## interval_id +## Example: 123. +## String +## +## Delete a time tracked entry +cu_delete_time_tracked <- function(task_id, interval_id) { + .Deprecated("cu_delete_time_entry") + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id, "time", interval_id) +} diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R new file mode 100644 index 0000000..4828731 --- /dev/null +++ b/R/df-timetracking-v2.R @@ -0,0 +1,300 @@ +#' Time tracking 2.0 +#' +#' Working with time tracking in ClickUp tasks. +#' Note: A time entry that has a negative duration means +#' that timer is currently ongoing for that user. + +#' @param team_id Team ID. +#' @param timer_id Timer ID. +#' @param start_date POSIX start time in milliseconds. +#' @param end_date POSIX end time in milliseconds. +#' @param assignee User ids to filter by separated by commas. +#' Note: Only Workspace Owners/Admins have access to do this. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [api-timetracking-legacy] for Time tracking legacy API, +#' [cu-class] for the cu object class, +#' [cu_date_from()] and [cu_date_to()] to deal with POSIX times. +#' +#' @name api-timetracking-2 +NULL + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Get time entries within a date range +## GET https://api.clickup.com/api/v2/team/team_id/time_entries?start_date=&end_date=&assignee= +## +## team_id +## Example: 512. +## Number +## +## start_date +## Posix Time in Milliseconds +## Number +## +## end_date +## Posix Time in Milliseconds +## Number +## +## assignee +## User ids to filter by separated by commas. +## Note: Only Workspace Owners/Admins have access to do this. +## Number +cu_get_time_entries_within_date_range <- function(team_id, +start_date, end_date, assignee) { + .cu_get("team", team_id, "time_entries", + query = list( + "start_date"=start_date, + "end_date"=end_date, + "assignee"=assignee)) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Get singular time entry +## GET https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id +## +## team_id +## Example: 512. +## Number +## +## timer_id +## Example: 1963465985517105840. +## String +cu_get_singular_time_entry <- function(team_id, timer_id) { + .cu_get("team", team_id, "time_entries", timer_id) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Get time entry history +## GET https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id/history +## +## team_id +## Example: 512. +## Number +## +## timer_id +## Example: 1963465985517105840. +## String +cu_get_time_entry_history <- function(team_id, timer_id) { + .cu_get("team", team_id, "time_entries", timer_id, "history") +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Get running time entry +## GET https://api.clickup.com/api/v2/team/team_id/time_entries/current +## +## team_id +## Example: 512. +## Number +cu_get_running_time_entry <- function(team_id, timer_id) { + .cu_get("team", team_id, "time_entries", "current") +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Create a time entry +## POST https://api.clickup.com/api/v2/team/team_id/time_entries +## +## team_id +## Example: 512. +## Number +## +## { +## "description": "from api", +## "tags": [ +## { +## "name": "name of tag", +## "tag_bg": "#BF55EC", +## "tag_fg": "#BF55EC" +## } +## ], +## "start": 1595282645000, +## "billable": true, +## "duration": 50000, +## "assignee": 1 +## } +cu_create_time_entry <- function(team_id, ...) { + .cu_post("team", team_id, "time_entries", + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Remove tags from time entries +## DELETE https://api.clickup.com/api/v2/team/team_id/time_entries/tags +## +## team_id +## Example: 512. +## Number +## +## { +## "time_entry_ids": [ +## "timer_id" +## ], +## "tags": [ +## "name of tag" +## ] +## } +cu_remove_tags_from_time_entries <- function(team_id, ...) { + .cu_delete("team", team_id, "time_entries", "tags", + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Get all tags from time entries +## GET https://api.clickup.com/api/v2/team/team_id/time_entries/tags +## +## team_id +## Example: 512. +## Number +cu_get_all_tags_from_time_entries <- function(team_id) { + .cu_get("team", team_id, "time_entries", "tags") +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Add tags from time entries +## POST https://api.clickup.com/api/v2/team/team_id/time_entries/tags +## +## team_id +## Example: 512. +## Number +## +## { +## "time_entry_ids": [ +## "timer_id" +## ], +## "tags": [ +## "name of tags" +## ] +## } +cu_add_tags_from_time_entries <- function(team_id, ...) { + .cu_post("team", team_id, "time_entries", "tags", + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Change tag names from time entries +## PUT https://api.clickup.com/api/v2/team/team_id/time_entries/tags +## +## team_id +## Example: 512. +## Number +## +## { +## "name": "old tag name", +## "new_name": "new tag name", +## "tag_bg": "#000000", +## "tag_fg": "#000000" +## } +cu_change_tag_names_from_time_entries <- function(team_id, ...) { + .cu_put("team", team_id, "time_entries", "tags", + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Start a time Entry +## POST https://api.clickup.com/api/v2/team/team_id/time_entries/start/timer_id +## +## team_id +## Example: 512. +## Number +## +## timer_id +## Example: 2004673344540003570. +## Number +## +## { +## "description": "from api", +## "tags": [ +## "tag1" +## ], +## "tid": "task_id", +## "billable": false +## } +cu_start_time_entry <- function(team_id, timer_id, ...) { + .cu_post("team", team_id, "time_entries", "start", timer_id, + body=list(...)) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Stop a time Entry +## POST https://api.clickup.com/api/v2/team/team_id/time_entries/stop +## +## team_id +## Example: 512. +## Number +cu_stop_time_entry <- function(team_id) { + .cu_post("team", team_id, "time_entries", "stop") +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Delete a time Entry +## DELETE https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id +## +## team_id +## Example: 512. +## Number +## +## timer_id +## List of timer ids to delete separated by commas +## Number +cu_delete_time_entry <- function(team_id, timer_id) { + .cu_delete("team", team_id, "time_entries", timer_id) +} + + +#' @export +#' @rdname api-timetracking-2 +## Time Tracking 2.0 / Update a time Entry +## PUT https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id +## +## team_id +## Example: 512. +## Number +## +## timer_id +## Example: 2004673344540003570. +## Number +## +## Accessible tag actions are ["replace", "add", "remove"] +## { +## "description": "", +## "tags": [ +## "name of tags" +## ], +## "tag_action": "add", +## "start": 1595289395842, +## "end": 1595289495842, +## "tid": "task_id", +## "billable": true, +## "duration": 100000 +## } +cu_update_time_entry <- function(team_id, timer_id, ...) { + .cu_put("team", team_id, "time_entries", timer_id, + body=list(...)) +} diff --git a/R/df-users.R b/R/df-users.R new file mode 100644 index 0000000..e7ef0c5 --- /dev/null +++ b/R/df-users.R @@ -0,0 +1,100 @@ +#' Users +#' +#' Working with users in ClickUp tasks (Enterprise only feture). + +#' @param team_id Team (workspace) ID. +#' @param email Email. +#' @param admin Logical, admin account or not +#' @param user_id User ID. +#' @param username User name. +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-users +NULL + +#' @export +#' @rdname api-users +## Users / Invite User To Workspace +## POST https://api.clickup.com/api/v2/team/team_id/user +## +## team_id +## Example: 333. +## Number +## +## Body +## +## { +## "email": "user@example.com", +## "admin": true +## } +cu_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { + .cu_post("team", team_id, "user", + body=list(email=email, admin=tolower(admin), ...)) +} + + +#' @export +#' @rdname api-users +## Users / Edit User On Workspace +## PUT https://api.clickup.com/api/v2/team/team_id/user/user_id +## +## team_id +## Example: 333. +## Number +## +## user_id +## Example: 403. +## Number +## +## Body +## +## { +## "username": "User Name", +## "admin": false +## } +cu_edit_user_on_workspace <- function(team_id, user_id, + username, admin=FALSE, ...) { + .cu_put("team", team_id, "user", user_id, + body=list(username=username, admin=tolower(admin), ...)) +} + + +#' @export +#' @rdname api-users +## Users / Remove User From Workspace +## DELETE https://api.clickup.com/api/v2/team/team_id/user/user_id +## +## team_id +## Example: 333. +## Number +## +## user_id +## Example: 403. +## Number +cu_remove_user_from_workspace <- function(team_id, user_id) { + .cu_delete("team", team_id, "user", user_id) +} + + +#' @export +#' @rdname api-users +## Users / Get User +## GET https://api.clickup.com/api/v2/team/team_id/user/user_id +## +## team_id +## Example: 333. +## Number +## +## user_id +## Example: 403. +## Number +cu_get_user <- function(team_id, user_id) { + .cu_get("team", team_id, "user", user_id) +} diff --git a/R/df-views.R b/R/df-views.R new file mode 100644 index 0000000..2b2a48f --- /dev/null +++ b/R/df-views.R @@ -0,0 +1,434 @@ +#' Views +#' +#' Working views in ClickUp tasks. + +#' @param team_id Team (workspace) ID. +#' @param name View name. +#' @param space_id Space ID. +#' @param folder_id Folder ID. +#' @param list_id List ID. +#' @param view_id View ID. +#' @param page Page to fetch (starts at 0). +#' @param ... Named arguments to be passed to API request body, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. +#' +#' @name api-views +NULL + +#' @export +#' @rdname api-views +## Views / Create Team View +## POST https://api.clickup.com/api/v2/team/team_id/view +## +## team_id +## Example: 512. +## Number +## +## Body +## +## { +## "name": "New Team View Name", +## "type": "list", +## "grouping": { +## "field": "status", +## "dir": 1, +## "collapsed": [], +## "ignore": false +## }, +## "divide": { +## "field": null, +## "dir": null, +## "collapsed": [] +## }, +## "sorting": { +## "fields": [] +## }, +## "filters": { +## "op": "AND", +## "fields": [], +## "search": "", +## "show_closed": false +## }, +## "columns": { +## "fields": [] +## }, +## "team_sidebar": { +## "assignees": [], +## "assigned_comments": false, +## "unassigned_tasks": false +## }, +## "settings": { +## "show_task_locations": false, +## "show_subtasks": 3, +## "show_subtask_parent_names": false, +## "show_closed_subtasks": false, +## "show_assignees": true, +## "show_images": true, +## "collapse_empty_columns": null, +## "me_comments": true, +## "me_subtasks": true, +## "me_checklists": true +## } +## } +cu_create_team_view <- function(team_id, name, ...) { + .cu_post("team", team_id, "view", + body=list(name=name, ...)) +} + + +#' @export +#' @rdname api-views +## Views / Create Space View +## POST https://api.clickup.com/api/v2/space/space_id/view +## +## space_id +## Example: 790. +## Number +## +## Body +## +## { +## "name": "New Space View Name", +## "type": "list", +## "grouping": { +## "field": "status", +## "dir": 1, +## "collapsed": [], +## "ignore": false +## }, +## "divide": { +## "field": null, +## "dir": null, +## "collapsed": [] +## }, +## "sorting": { +## "fields": [] +## }, +## "filters": { +## "op": "AND", +## "fields": [], +## "search": "", +## "show_closed": false +## }, +## "columns": { +## "fields": [] +## }, +## "team_sidebar": { +## "assignees": [], +## "assigned_comments": false, +## "unassigned_tasks": false +## }, +## "settings": { +## "show_task_locations": false, +## "show_subtasks": 3, +## "show_subtask_parent_names": false, +## "show_closed_subtasks": false, +## "show_assignees": true, +## "show_images": true, +## "collapse_empty_columns": null, +## "me_comments": true, +## "me_subtasks": true, +## "me_checklists": true +## } +## } +cu_create_space_view <- function(space_id, name, ...) { + .cu_post("space", space_id, "view", + body=list(name=name, ...)) +} + + +#' @export +#' @rdname api-views +## Views / Create Folder View +## POST https://api.clickup.com/api/v2/folder/folder_id/view +## +## folder_id +## Example: 457. +## Number +## +## Body +## +## { +## "name": "New Folder View Name", +## "type": "list", +## "grouping": { +## "field": "status", +## "dir": 1, +## "collapsed": [], +## "ignore": false +## }, +## "divide": { +## "field": null, +## "dir": null, +## "collapsed": [] +## }, +## "sorting": { +## "fields": [] +## }, +## "filters": { +## "op": "AND", +## "fields": [], +## "search": "", +## "show_closed": false +## }, +## "columns": { +## "fields": [] +## }, +## "team_sidebar": { +## "assignees": [], +## "assigned_comments": false, +## "unassigned_tasks": false +## }, +## "settings": { +## "show_task_locations": false, +## "show_subtasks": 3, +## "show_subtask_parent_names": false, +## "show_closed_subtasks": false, +## "show_assignees": true, +## "show_images": true, +## "collapse_empty_columns": null, +## "me_comments": true, +## "me_subtasks": true, +## "me_checklists": true +## } +## } +cu_create_folder_view <- function(folder_id, name, ...) { + .cu_post("folder", folder_id, "view", + body=list(name=name, ...)) +} + + +#' @export +#' @rdname api-views +## Views / Create List View +## POST https://api.clickup.com/api/v2/list/list_id/view +## +## list_id +## Example: 124. +## Number +## +## Body +## +## { +## "name": "New List View Name", +## "type": "list", +## "grouping": { +## "field": "status", +## "dir": 1, +## "collapsed": [], +## "ignore": false +## }, +## "divide": { +## "field": null, +## "dir": null, +## "collapsed": [] +## }, +## "sorting": { +## "fields": [] +## }, +## "filters": { +## "op": "AND", +## "fields": [], +## "search": "", +## "show_closed": false +## }, +## "columns": { +## "fields": [] +## }, +## "team_sidebar": { +## "assignees": [], +## "assigned_comments": false, +## "unassigned_tasks": false +## }, +## "settings": { +## "show_task_locations": false, +## "show_subtasks": 3, +## "show_subtask_parent_names": false, +## "show_closed_subtasks": false, +## "show_assignees": true, +## "show_images": true, +## "collapse_empty_columns": null, +## "me_comments": true, +## "me_subtasks": true, +## "me_checklists": true +## } +## } +cu_create_list_view <- function(list_id, name, ...) { + .cu_post("list", list_id, "view", + body=list(name=name, ...)) +} + + +#' @export +#' @rdname api-views +## Views / Get Team Views +## GET https://api.clickup.com/api/v2/team/team_id/view +## +## team_id +## Example: 512. +## Number +cu_get_team_views <- function(team_id) { + .cu_get("team", team_id, "view") +} + + +#' @export +#' @rdname api-views +## Views / Get Space Views +## GET https://api.clickup.com/api/v2/space/space_id/view +## +## space_id +## Example: 790. +## Number +cu_get_space_views <- function(space_id) { + .cu_get("space", space_id, "view") +} + + +#' @export +#' @rdname api-views +## Views / Get Folder Views +## GET https://api.clickup.com/api/v2/folder/folder_id/view +## +## folder_id +## Example: 457. +## Number +cu_get_folder_views <- function(folder_id) { + .cu_get("folder", folder_id, "view") +} + + +#' @export +#' @rdname api-views +## Views / Get List Views +## GET https://api.clickup.com/api/v2/list/list_id/view +## +## list_id +## Example: 124. +## Number +cu_get_list_views <- function(list_id) { + .cu_get("list", list_id, "view") +} + + +#' @export +#' @rdname api-views +## Views / Get View +## GET https://api.clickup.com/api/v2/view/view_id +## +## view_id +## 105 (string) +## Example: 3c. +## String +cu_get_view <- function(view_id) { + .cu_get("view", view_id) +} + + +#' @export +#' @rdname api-views +## Views / Get View Tasks +## GEThttps://api.clickup.com/api/v2/view/view_id/task?page=0 +## +## view_id +## 105 (string) +## Example: 3c. +## String +## +## page +## Example: 0. +## Integer +## +## To page the tasks returned, include the page param +cu_get_view_tasks <- function(view_id, page) { + .cu_get("view", view_id, "task", + query = list(page = page)) +} + + +#' @export +#' @rdname api-views +## Views / Update View +## PUT https://api.clickup.com/api/v2/view/view_id +## +## view_id +## 105 (string) +## Example: 3c. +## String +## +## Body +## +## { +## "name": "New View Name", +## "type": "list", +## "parent": { +## "id": "512", +## "type": 7 +## }, +## "grouping": { +## "field": "status", +## "dir": 1, +## "collapsed": [], +## "ignore": false +## }, +## "divide": { +## "field": null, +## "dir": null, +## "collapsed": [] +## }, +## "sorting": { +## "fields": [] +## }, +## "filters": { +## "op": "AND", +## "fields": [], +## "search": "", +## "show_closed": false +## }, +## "columns": { +## "fields": [] +## }, +## "team_sidebar": { +## "assignees": [], +## "assigned_comments": false, +## "unassigned_tasks": false +## }, +## "settings": { +## "show_task_locations": false, +## "show_subtasks": 3, +## "show_subtask_parent_names": false, +## "show_closed_subtasks": false, +## "show_assignees": true, +## "show_images": true, +## "collapse_empty_columns": null, +## "me_comments": true, +## "me_subtasks": true, +## "me_checklists": true +## } +## } +## Views / Update View +## PUT https://api.clickup.com/api/v2/view/view_id +cu_update_view <- function(view_id, ...) { + .cu_put("view", view_id, + body=list(...)) +} + + +#' @export +#' @rdname api-views +## Views / Delete View +## DELETE https://api.clickup.com/api/v2/view/view_id +## +## view_id +## 105 (string) +## Example: 3c. +## String +cu_delete_view <- function(view_id) { + .cu_delete("view", view_id) +} diff --git a/R/df-webhooks.R b/R/df-webhooks.R new file mode 100644 index 0000000..cb6d5c7 --- /dev/null +++ b/R/df-webhooks.R @@ -0,0 +1,154 @@ +#' Webhooks +#' +#' Working with webhooks in ClickUp tasks. + +#' @details +#' You may filter the location of resources that get sent to a webhook +#' by passing an optional `space_id`, `folder_id`, `list_id`, or +#' `task_id` in the body of the request. +#' Without specifying any events, all event types +#' will be sent to the webhook. However, you can filter for specific +#' actions by sending an events array. To subscribe to specific events, +#' pass an array of events that you want to subscribe to, +#' otherwise pass `"*"` to subscribe to everything. +#' +#' Events include: `"taskCreated"` +#' `"taskUpdated"` +#' `"taskDeleted"` +#' `"listCreated"` +#' `"listUpdated"` +#' `"listDeleted"` +#' `"folderCreated"` +#' `"folderUpdated"` +#' `"folderDeleted"` +#' `"spaceCreated"` +#' `"spaceUpdated"` +#' `"spaceDeleted"` +#' `"goalCreated"` +#' `"goalUpdated"` +#' `"goalDeleted"` +#' `"keyResultCreated"` +#' `"keyResultUpdated"` +#' `"keyResultDeleted"`. +#' +#' @param team_id Team ID. +#' @param endpoint Webhook endpoint. +#' @param events Events (see Details). +#' @param webhook_id Webhook ID. +#' @param ... Named arguments to be passed to API request body, +#' e.g. `"endpoint"`, `"events"`, or `"status"`, +#' see the ClickUp API documentation (). +#' +#' @return +#' +#' A cu object. +#' +#' @seealso [cu-class] for the cu object class. [cu_task_id()] to remove leading hashes from task IDs. +#' +#' @name api-webhooks +NULL + +#' @export +#' @rdname api-webhooks +## Webhooks / Create Webhook +## POST https://api.clickup.com/api/v2/team/team_id/webhook +## +## team_id +## Example: 512. +## Number +## +## You may filter the location of resources that get sent to a webhook +## by passing an optional space_id, folder_id, list_id, or task_id in the +## body of the request. Without specifying any events, all event types +## will be sent to the webhook. However, you can filter for specific +## actions by sending an events array. To subscribe to specific events, +## pass an array of events that you want to subscribe to, +## otherwise pass "*" to subscribe to everything. +## +## Body +## +## { +## "endpoint": "https://yourdomain.com/webhook", +## "events": [ +## "taskCreated", +## "taskUpdated", +## "taskDeleted", +## "listCreated", +## "listUpdated", +## "listDeleted", +## "folderCreated", +## "folderUpdated", +## "folderDeleted", +## "spaceCreated", +## "spaceUpdated", +## "spaceDeleted", +## "goalCreated", +## "goalUpdated", +## "goalDeleted", +## "keyResultCreated", +## "keyResultUpdated", +## "keyResultDeleted" +## ] +## } +## +## ... passes query params for optional filtering +## for space_id, folder_id, list_id, or task_id +cu_create_webhook <- function(team_id, endpoint, events="*", ...) { + .cu_post("team", team_id, "webhook", + body=list(endpoint=endpoint, events=events), + query=list(...)) +} + + +#' @export +#' @rdname api-webhooks +## Webhooks / Update Webhook +## PUT https://api.clickup.com/api/v2/webhook/webhook_id +## +## webhook_id +## e506-4a29-9d42-26e504e3435e (uuid) +## Example: 4b67ac88. +## String +## +## To subscribe to specific events, pass an array of events that +## you want to subscribe to, otherwise pass "*" to subscribe to everything. +## +## Body +## +## { +## "endpoint": "https://yourdomain.com/webhook", +## "events": "*", +## "status": "active" +## } +## ... passes props to body +cu_update_webhook <- function(webhook_id, ...) { + .cu_put("webhook", webhook_id, + body=list(...)) +} + + +#' @export +#' @rdname api-webhooks +## Webhooks / Delete Webhook +## DELETE https://api.clickup.com/api/v2/webhook/webhook_id +## +## webhook_id +## e506-4a29-9d42-26e504e3435e (uuid) +## Example: 4b67ac88. +## String +cu_delete_webhook <- function(webhook_id) { + .cu_delete("webhook", webhook_id) +} + + +#' @export +#' @rdname api-webhooks +## Webhooks / Get Webhooks +## GET https://api.clickup.com/api/v2/team/team_id/webhook +## +## team_id +## Example: 512. +## Number +cu_get_webhooks <- function(team_id) { + .cu_get("team", team_id, "webhook") +} From a6713e13cb9d711521bf5495a6cf4845dfd23b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 12:52:05 +0200 Subject: [PATCH 005/137] cu_ -> cuf_ --- R/df-attachments.R | 2 +- R/df-authorization.R | 6 +++--- R/df-checklists.R | 12 ++++++------ R/df-comments.R | 16 ++++++++-------- R/df-customfields.R | 6 +++--- R/df-dependencies.R | 8 ++++---- R/df-folders.R | 10 +++++----- R/df-goals.R | 16 ++++++++-------- R/df-guests.R | 20 ++++++++++---------- R/df-lists.R | 14 +++++++------- R/df-members.R | 4 ++-- R/df-sharedhierarchy.R | 2 +- R/df-spaces.R | 10 +++++----- R/df-tags.R | 12 ++++++------ R/df-tasks.R | 12 ++++++------ R/df-tasktemplates.R | 4 ++-- R/df-teams.R | 4 ++-- R/df-timetracking-legacy.R | 8 ++++---- R/df-timetracking-v2.R | 26 +++++++++++++------------- R/df-users.R | 8 ++++---- R/df-views.R | 24 ++++++++++++------------ R/df-webhooks.R | 8 ++++---- 22 files changed, 116 insertions(+), 116 deletions(-) diff --git a/R/df-attachments.R b/R/df-attachments.R index 66be01a..0d25d50 100644 --- a/R/df-attachments.R +++ b/R/df-attachments.R @@ -44,7 +44,7 @@ ## --form 'attachment=@/path/to/the/file/example.png' ## ... can be used to pass type argument to httr::upload_file -cu_post_task_attachment <- function(task_id, attachment, filename=NULL, ...) { +cuf_post_task_attachment <- function(task_id, attachment, filename=NULL, ...) { task_id <- cu_task_id(task_id) if (is.null(filename)) filename <- basename(attachment) diff --git a/R/df-authorization.R b/R/df-authorization.R index 36f03f0..cfc1dab 100644 --- a/R/df-authorization.R +++ b/R/df-authorization.R @@ -32,7 +32,7 @@ NULL ## code ## Code given in redirect url ## String -cu_get_access_token <- function(client_id, client_secret, code) { +cuf_get_access_token <- function(client_id, client_secret, code) { .cu_post("oauth", "token", query=list(client_id=client_id, client_secret=client_secret, @@ -44,7 +44,7 @@ cu_get_access_token <- function(client_id, client_secret, code) { #' @rdname api-authorization ## Authorization / Get Authorized User ## GET https://api.clickup.com/api/v2/user -cu_get_authorized_user <- function() { +cuf_get_authorized_user <- function() { .cu_get("user") } @@ -56,6 +56,6 @@ cu_get_authorized_user <- function() { ## ## Note: this is the same endpoint as for cu_get_teams ## -cu_get_authorized_teams <- function() { +cuf_get_authorized_teams <- function() { .cu_get("team") } diff --git a/R/df-checklists.R b/R/df-checklists.R index e866c0d..b17f739 100644 --- a/R/df-checklists.R +++ b/R/df-checklists.R @@ -49,7 +49,7 @@ NULL ## Checklists / Create Checklist ## POST https://api.clickup.com/api/v2/task/task_id/checklist ## task_id Example: 9hz. String -cu_create_checklist <- function(task_id, name) { +cuf_create_checklist <- function(task_id, name) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "checklist", body=list(name = name)) @@ -68,7 +68,7 @@ cu_create_checklist <- function(task_id, name) { ## position is the zero-based index of the order you want the checklist ## to exist on the task. If you want the checklist to be in the first ## position, pass '{ "position": 0 }' -cu_edit_checklist <- function(checklist_id, position) { +cuf_edit_checklist <- function(checklist_id, position) { .cu_put("checklist", checklist_id, body=list(position = position)) } @@ -82,7 +82,7 @@ cu_edit_checklist <- function(checklist_id, position) { ## checklist_id ## b8a8-48d8-a0c6-b4200788a683 (uuid) ## Example: b955c4dc. String -cu_delete_checklist <- function(checklist_id) { +cuf_delete_checklist <- function(checklist_id) { .cu_delete("checklist", checklist_id) } #cu_delete_checklist("4bc57892-a1a6-44f4-894d-d98de71f4054") @@ -104,7 +104,7 @@ cu_delete_checklist <- function(checklist_id) { ## "resolved": true, ## "parent": null ## } -cu_create_checklist_item <- function(checklist_id, name, ...) { +cuf_create_checklist_item <- function(checklist_id, name, ...) { .cu_post("checklist", checklist_id, "checklist_item", body=list(name = name, ...)) } @@ -133,7 +133,7 @@ cu_create_checklist_item <- function(checklist_id, name, ...) { ## ## parent is another checklist item that you want to nest the ## target checklist item underneath. -cu_edit_checklist_item <- function(checklist_id, checklist_item_id, ...) { +cuf_edit_checklist_item <- function(checklist_id, checklist_item_id, ...) { .cu_put("checklist", checklist_id, "checklist_item", checklist_item_id, body=list(...)) } @@ -155,7 +155,7 @@ cu_edit_checklist_item <- function(checklist_id, checklist_item_id, ...) { ## e491-47f5-9fd8-d1dc4cedcc6f (uuid) ## Example: 21e08dc8. ## String -cu_delete_checklist_item <- function(checklist_id, checklist_item_id) { +cuf_delete_checklist_item <- function(checklist_id, checklist_item_id) { .cu_delete("checklist", checklist_id, "checklist_item", checklist_item_id) } #cu_delete_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", diff --git a/R/df-comments.R b/R/df-comments.R index 0239064..1ce664e 100644 --- a/R/df-comments.R +++ b/R/df-comments.R @@ -35,7 +35,7 @@ NULL ## "assignee": 183, ## "notify_all": true ## } -cu_post_task_comment <- function(task_id, ...) { +cuf_post_task_comment <- function(task_id, ...) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "comment", body=list(...)) @@ -60,7 +60,7 @@ cu_post_task_comment <- function(task_id, ...) { ## "comment_text": "View comment content", ## "notify_all": true ## } -cu_post_view_comment <- function(view_id, ...) { +cuf_post_view_comment <- function(view_id, ...) { .cu_post("view", view_id, "comment", body=list(...)) } @@ -84,7 +84,7 @@ cu_post_view_comment <- function(view_id, ...) { ## "assignee": 183, ## "notify_all": true ## } -cu_post_list_comment <- function(list_id, ...) { +cuf_post_list_comment <- function(list_id, ...) { .cu_post("list", list_id, "comment", body=list(...)) } @@ -97,7 +97,7 @@ cu_post_list_comment <- function(list_id, ...) { ## task_id ## Example: 9hz. ## String -cu_get_task_comments <- function(task_id) { +cuf_get_task_comments <- function(task_id) { task_id <- cu_task_id(task_id) .cu_get("task", task_id, "comment") } @@ -111,7 +111,7 @@ cu_get_task_comments <- function(task_id) { ## 105 (string) ## Example: 3c. ## String -cu_get_view_comments <- function(view_id) { +cuf_get_view_comments <- function(view_id) { .cu_get("view", view_id, "comment") } @@ -123,7 +123,7 @@ cu_get_view_comments <- function(view_id) { ## list_id ## Example: 124. ## Number -cu_get_list_comments <- function(list_id) { +cuf_get_list_comments <- function(list_id) { .cu_get("list", list_id, "comment") } @@ -143,7 +143,7 @@ cu_get_list_comments <- function(list_id) { ## "assignee": 183, ## "resolved": true ## } -cu_put_update_comment <- function(comment_id, ...) { +cuf_put_update_comment <- function(comment_id, ...) { .cu_put("comment", comment_id, body=list(...)) } @@ -156,6 +156,6 @@ cu_put_update_comment <- function(comment_id, ...) { ## comment_id ## Example: 456. ## Number -cu_delete_comment <- function(comment_id) { +cuf_delete_comment <- function(comment_id) { .cu_delete("comment", comment_id) } diff --git a/R/df-customfields.R b/R/df-customfields.R index 07ceb00..014ca46 100644 --- a/R/df-customfields.R +++ b/R/df-customfields.R @@ -26,7 +26,7 @@ NULL ## list_id ## Example: 123. ## Number -cu_get_accessible_custom_fields <- function(list_id) { +cuf_get_accessible_custom_fields <- function(list_id) { .cu_get("list", list_id, "field") } @@ -54,7 +54,7 @@ cu_get_accessible_custom_fields <- function(list_id) { ## "value": 80 ## } #cu_set_custom_field_value -cu_set_custom_field_value <- function(task_id, field_id, ...) { +cuf_set_custom_field_value <- function(task_id, field_id, ...) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "field", field_id, body=list(...)) @@ -77,7 +77,7 @@ cu_set_custom_field_value <- function(task_id, field_id, ...) { ## ## The accessible fields can be found on the task object from the ## get task route. This is where you can retrieve the field_id -cu_remove_field_value <- function(task_id, field_id) { +cuf_remove_field_value <- function(task_id, field_id) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "field", field_id) } diff --git a/R/df-dependencies.R b/R/df-dependencies.R index 501d966..b5793cc 100644 --- a/R/df-dependencies.R +++ b/R/df-dependencies.R @@ -34,7 +34,7 @@ NULL ## { ## "depends_on": "9hw" ## } -cu_add_dependency <- function(task_id, depends_on, dependency_of) { +cuf_add_dependency <- function(task_id, depends_on, dependency_of) { task_id <- cu_task_id(task_id) if (missing(depends_on) && missing(dependency_of)) stop("Provide one of depends_on or dependency_of", call.=FALSE) @@ -68,7 +68,7 @@ cu_add_dependency <- function(task_id, depends_on, dependency_of) { ## ## One and only one of depends_on or dependency_of must be passed in the ## query params. -cu_delete_dependency <- function(task_id, depends_on, dependency_of) { +cuf_delete_dependency <- function(task_id, depends_on, dependency_of) { task_id <- cu_task_id(task_id) if (missing(depends_on) && missing(dependency_of)) stop("Provide one of depends_on or dependency_of", call.=FALSE) @@ -95,7 +95,7 @@ cu_delete_dependency <- function(task_id, depends_on, dependency_of) { ## links_to ## Example: 9hz. ## String -cu_add_task_link <- function(task_id, links_to) { +cuf_add_task_link <- function(task_id, links_to) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "link", links_to) } @@ -113,7 +113,7 @@ cu_add_task_link <- function(task_id, links_to) { ## links_to ## Example: 9hz. ## String -cu_delete_dependency <- function(task_id, links_to) { +cuf_delete_dependency <- function(task_id, links_to) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "link", links_to) } diff --git a/R/df-folders.R b/R/df-folders.R index 7046d93..282e661 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -30,7 +30,7 @@ NULL ## { ## "name": "New Folder Name" ## } -cu_create_folder <- function(space_id, name) { +cuf_create_folder <- function(space_id, name) { .cu_post("space", space_id, "folder", body=list(name=name)) } @@ -50,7 +50,7 @@ cu_create_folder <- function(space_id, name) { ## { ## "name": "Updated Folder Name" ## } -cu_update_folder <- function(folder_id, name) { +cuf_update_folder <- function(folder_id, name) { .cu_put("folder", folder_id, body=list(name=name)) } @@ -64,7 +64,7 @@ cu_update_folder <- function(folder_id, name) { ## folder_id ## Example: 457. ## Number -cu_delete_folder <- function(folder_id, name) { +cuf_delete_folder <- function(folder_id, name) { .cu_delete("folder", folder_id) } @@ -81,7 +81,7 @@ cu_delete_folder <- function(folder_id, name) { ## archived ## Example: false. ## Boolean -cu_get_folders <- function(space_id, archived=FALSE) { +cuf_get_folders <- function(space_id, archived=FALSE) { .cu_get("space", space_id, "folder", query = list("archived" = tolower(archived))) } @@ -173,6 +173,6 @@ cuf_get_folders <- function(team_id, archived=FALSE) { ## folder_id ## Example: 457. ## Number -cu_get_folder <- function(folder_id) { +cuf_get_folder <- function(folder_id) { .cu_get("folder", folder_id) } diff --git a/R/df-goals.R b/R/df-goals.R index 44bf314..b3a5743 100644 --- a/R/df-goals.R +++ b/R/df-goals.R @@ -38,7 +38,7 @@ NULL ## ], ## "color": "#32a852" ## } -cu_create_goal <- function(team_id, ...) { +cuf_create_goal <- function(team_id, ...) { .cu_post("team", team_id, "goal", body=list(...)) } @@ -64,7 +64,7 @@ cu_create_goal <- function(team_id, ...) { ## "add_owners": [182] ## "color": "#32a852" ## } -cu_update_goal <- function(goal_id, ...) { +cuf_update_goal <- function(goal_id, ...) { .cu_put("goal", goal_id, body=list(...)) } @@ -79,7 +79,7 @@ cu_update_goal <- function(goal_id, ...) { ## 900e-462d-a849-4a216b06d930 (uuid) ## Example: e53a033c. ## String -cu_delete_goal <- function(goal_id) { +cuf_delete_goal <- function(goal_id) { .cu_delete("goal", goal_id) } @@ -92,7 +92,7 @@ cu_delete_goal <- function(goal_id) { ## team_id ## Example: 512. ## Number -cu_get_goals <- function(team_id) { +cuf_get_goals <- function(team_id) { .cu_get("team", team_id, "goal") } @@ -106,7 +106,7 @@ cu_get_goals <- function(team_id) { ## 900e-462d-a849-4a216b06d930 (uuid) ## Example: e53a033c. ## String -cu_get_goal <- function(goal_id) { +cuf_get_goal <- function(goal_id) { .cu_get("goal", goal_id) } @@ -139,7 +139,7 @@ cu_get_goal <- function(goal_id) { ## "task_ids": [], ## "list_ids": [] ## } -cu_create_key_result <- function(goal_id, ...) { +cuf_create_key_result <- function(goal_id, ...) { .cu_post("goal", goal_id, "key_result", body=list(...)) } @@ -164,7 +164,7 @@ cu_create_key_result <- function(goal_id, ...) { ## "steps_current": 5, ## "note": "Target achieved" ## } -cu_edit_key_result <- function(key_result_id, ...) { +cuf_edit_key_result <- function(key_result_id, ...) { .cu_put("key_result", key_result_id, body=list(...)) } @@ -179,7 +179,7 @@ cu_edit_key_result <- function(key_result_id, ...) { ## 8480-49bc-8c57-e569747efe93 (uuid) ## Example: 947d46ed. ## String -cu_delete_key_result <- function(key_result_id) { +cuf_delete_key_result <- function(key_result_id) { .cu_delete("key_result", key_result_id) } diff --git a/R/df-guests.R b/R/df-guests.R index b92e293..5c5ee99 100644 --- a/R/df-guests.R +++ b/R/df-guests.R @@ -33,7 +33,7 @@ NULL ## Note: not sure how this is supposed to work without email ## e.g. cu_invite_user_to_workspace(team_id, email) ## -cu_invite_guest_to_workspace <- function(team_id) { +cuf_invite_guest_to_workspace <- function(team_id) { .cu_post("team", team_id, "guest") } @@ -59,7 +59,7 @@ cu_invite_guest_to_workspace <- function(team_id) { ## "can_see_time_spent": true, ## "can_see_time_estimated": true ## } -cu_edit_guest_on_workspace <- function(team_id, guest_id, ...) { +cuf_edit_guest_on_workspace <- function(team_id, guest_id, ...) { .cu_put("team", team_id, "guest", guest_id, body=list(...)) } @@ -76,7 +76,7 @@ cu_edit_guest_on_workspace <- function(team_id, guest_id, ...) { ## guest_id ## Example: 403. ## Number -cu_remove_guest_from_workspace <- function(team_id, guest_id) { +cuf_remove_guest_from_workspace <- function(team_id, guest_id) { .cu_delete("team", team_id, "guest", guest_id) } @@ -93,7 +93,7 @@ cu_remove_guest_from_workspace <- function(team_id, guest_id) { ## guest_id ## Example: 403. ## Number -cu_get_guest <- function(team_id, guest_id) { +cuf_get_guest <- function(team_id, guest_id) { .cu_get("team", team_id, "guest", guest_id) } @@ -118,7 +118,7 @@ cu_get_guest <- function(team_id, guest_id) { ## { ## "permission_level": "read" ## } -cu_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { +cuf_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { task_id <- cu_task_id(task_id) permission_level <- match.arg(permission_level, c("read", "comment", "edit", "create")) @@ -139,7 +139,7 @@ cu_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { ## guest_id ## Example: 403. ## Number -cu_remove_guest_from_task <- function(task_id, guest_id) { +cuf_remove_guest_from_task <- function(task_id, guest_id) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "guest", guest_id) } @@ -165,7 +165,7 @@ cu_remove_guest_from_task <- function(task_id, guest_id) { ## { ## "permission_level": "read" ## } -cu_add_guest_to_list <- function(list_id, guest_id, permission_level="read") { +cuf_add_guest_to_list <- function(list_id, guest_id, permission_level="read") { permission_level <- match.arg(permission_level, c("read", "comment", "edit", "create")) .cu_post("list", list_id, "guest", guest_id, @@ -185,7 +185,7 @@ cu_add_guest_to_list <- function(list_id, guest_id, permission_level="read") { ## guest_id ## Example: 403. ## Number -cu_remove_guest_from_list <- function(list_id, guest_id) { +cuf_remove_guest_from_list <- function(list_id, guest_id) { .cu_delete("list", list_id, "guest", guest_id) } @@ -210,7 +210,7 @@ cu_remove_guest_from_list <- function(list_id, guest_id) { ## { ## "permission_level": "read" ## } -cu_add_guest_to_folder <- function(folder_id, guest_id, +cuf_add_guest_to_folder <- function(folder_id, guest_id, permission_level="read") { permission_level <- match.arg(permission_level, c("read", "comment", "edit", "create")) @@ -233,6 +233,6 @@ cu_add_guest_to_folder <- function(folder_id, guest_id, ## Number ## ## -cu_remove_guest_from_folder <- function(folder_id, guest_id) { +cuf_remove_guest_from_folder <- function(folder_id, guest_id) { .cu_delete("folder", folder_id, "guest", guest_id) } diff --git a/R/df-lists.R b/R/df-lists.R index 9323975..4ca24a2 100644 --- a/R/df-lists.R +++ b/R/df-lists.R @@ -41,7 +41,7 @@ NULL ## "assignee": 183, ## "status": "red" ## } -cu_create_list <- function(folder_id, ...) { +cuf_create_list <- function(folder_id, ...) { .cu_post("folder", folder_id, "list", body=list(...)) } @@ -70,7 +70,7 @@ cu_create_list <- function(folder_id, ...) { ## "assignee": 183, ## "status": "red" ## } -cu_create_folderless_list <- function(space_id, ...) { +cuf_create_folderless_list <- function(space_id, ...) { .cu_post("space", space_id, "list", body=list(...)) } @@ -101,7 +101,7 @@ cu_create_folderless_list <- function(space_id, ...) { ## "assignee": "none", ## "unset_status": true ## } -cu_update_list <- function(list_id, ...) { +cuf_update_list <- function(list_id, ...) { .cu_put("list", list_id, body=list(...)) } @@ -115,7 +115,7 @@ cu_update_list <- function(list_id, ...) { ## list_id ## Example: 124. ## Number -cu_delete_list <- function(list_id, ...) { +cuf_delete_list <- function(list_id, ...) { .cu_delete("list", list_id) } @@ -132,7 +132,7 @@ cu_delete_list <- function(list_id, ...) { ## archived ## Example: false. ## Boolean -cu_get_lists <- function(folder_id, archived=FALSE) { +cuf_get_lists <- function(folder_id, archived=FALSE) { .cu_get("folder", folder_id, "list", query = list("archived" = tolower(archived))) } @@ -150,7 +150,7 @@ cu_get_lists <- function(folder_id, archived=FALSE) { ## archived ## Example: false. ## Boolean -cu_get_lists_folderless <- function(space_id, archived=FALSE) { +cuf_get_lists_folderless <- function(space_id, archived=FALSE) { .cu_get("space", space_id, "list", query = list("archived" = tolower(archived))) } @@ -164,6 +164,6 @@ cu_get_lists_folderless <- function(space_id, archived=FALSE) { ## list_id ## Example: 124. ## Number -cu_get_list <- function(list_id) { +cuf_get_list <- function(list_id) { .cu_get("list", list_id) } diff --git a/R/df-members.R b/R/df-members.R index e84b51a..d7eb0d0 100644 --- a/R/df-members.R +++ b/R/df-members.R @@ -22,7 +22,7 @@ NULL ## task_id ## Example: 9hz. ## String -cu_get_task_members <- function(task_id) { +cuf_get_task_members <- function(task_id) { task_id <- cu_task_id(task_id) .cu_get("task", task_id, "member") } @@ -36,6 +36,6 @@ cu_get_task_members <- function(task_id) { ## list_id ## Example: 123. ## Number -cu_get_list_members <- function(list_id) { +cuf_get_list_members <- function(list_id) { .cu_get("list", list_id, "member") } diff --git a/R/df-sharedhierarchy.R b/R/df-sharedhierarchy.R index 6a950f9..e2f2d84 100644 --- a/R/df-sharedhierarchy.R +++ b/R/df-sharedhierarchy.R @@ -27,6 +27,6 @@ ## access to its parent. For example, if you have a access to a ## shared task, but don't have access to its parent list, it will ## come back in this request. -cu_get_shared <- function(team_id) { +cuf_get_shared <- function(team_id) { .cu_get("team", team_id, "shared") } diff --git a/R/df-spaces.R b/R/df-spaces.R index 653972a..b93406a 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -65,7 +65,7 @@ NULL ## } ## } ## } -cu_create_space <- function(team_id, name, ...) { +cuf_create_space <- function(team_id, name, ...) { .cu_post("team", team_id, "space", body=list(name=name, ...)) } @@ -93,7 +93,7 @@ cuf_create_space <- function(team_id, name, ...) { ## Number ## ## Same body as for cu_create_space -cu_update_space <- function(space_id, ...) { +cuf_update_space <- function(space_id, ...) { .cu_put("space", space_id, body=list(...)) } @@ -107,7 +107,7 @@ cu_update_space <- function(space_id, ...) { ## space_id ## Example: 790. ## Number -cu_delete_space <- function(space_id) { +cuf_delete_space <- function(space_id) { .cu_delete("space", space_id) } @@ -124,7 +124,7 @@ cu_delete_space <- function(space_id) { ## archived ## Example: false. ## Boolean -cu_get_spaces <- function(team_id, archived=FALSE) { +cuf_get_spaces <- function(team_id, archived=FALSE) { .cu_get("team", team_id, "space", query = list("archived" = tolower(archived))) } @@ -213,6 +213,6 @@ spaces_spec <- lcols( ## space_id ## Example: 790. ## Number -cu_get_space <- function(space_id) { +cuf_get_space <- function(space_id) { .cu_get("space", space_id) } diff --git a/R/df-tags.R b/R/df-tags.R index 17acec0..c0f3280 100644 --- a/R/df-tags.R +++ b/R/df-tags.R @@ -26,7 +26,7 @@ NULL ## space_id ## Example: 512. ## Number -cu_get_space_tags <- function(space_id) { +cuf_get_space_tags <- function(space_id) { .cu_get("space", space_id, "tag") } @@ -49,7 +49,7 @@ cu_get_space_tags <- function(space_id) { ## "tag_bg": "#000000" ## } ## } -cu_create_space_tag <- function(space_id, name, ...) { +cuf_create_space_tag <- function(space_id, name, ...) { .cu_post("space", space_id, "tag", body=list( tag=list(name=name, ...))) @@ -68,7 +68,7 @@ cu_create_space_tag <- function(space_id, name, ...) { ## tag_name ## Example: name. ## String -cu_edit_space_tag <- function(space_id, tag_name) { +cuf_edit_space_tag <- function(space_id, tag_name) { .cu_put("space", space_id, "tag", tag_name) } @@ -85,7 +85,7 @@ cu_edit_space_tag <- function(space_id, tag_name) { ## tag_name ## Example: name. ## String -cu_delete_space_tag <- function(space_id) { +cuf_delete_space_tag <- function(space_id) { .cu_delete("space", space_id, "tag", tag_name) } @@ -102,7 +102,7 @@ cu_delete_space_tag <- function(space_id) { ## tag_name ## Example: name. ## String -cu_add_tag_to_task <- function(task_id, tag_name) { +cuf_add_tag_to_task <- function(task_id, tag_name) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "tag", tag_name) } @@ -120,7 +120,7 @@ cu_add_tag_to_task <- function(task_id, tag_name) { ## tag_name ## Example: name. ## String -cu_delete_space_tag <- function(task_id, tag_name) { +cuf_delete_space_tag <- function(task_id, tag_name) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "tag", tag_name) } diff --git a/R/df-tasks.R b/R/df-tasks.R index 737395e..041c893 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -137,7 +137,7 @@ NULL ## ## Use I() when providing arrays as part of the body ## list(a=1, b=I(2)) will be {"a":1,"b":[2]} -cu_create_task <- function(list_id, ...) { +cuf_create_task <- function(list_id, ...) { .cu_post("list", list_id, "task", body=list(...)) } @@ -172,7 +172,7 @@ cu_create_task <- function(list_id, ...) { ## }, ## "archived": false, ## } -cu_update_task <- function(task_id, ...) { +cuf_update_task <- function(task_id, ...) { task_id <- cu_task_id(task_id) .cu_put("task", task_id, body=list(...)) @@ -187,7 +187,7 @@ cu_update_task <- function(task_id, ...) { ## task_id ## Example: 9xh. ## String -cu_delete_task <- function(task_id) { +cuf_delete_task <- function(task_id) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id) } @@ -278,7 +278,7 @@ cu_delete_task <- function(task_id) { ## the length of each response to determine if you are on the last page. ## # ... takes parameters, most importantly page (starting at 0) -cu_get_tasks <- function(list_id, archived=FALSE, ...) { +cuf_get_tasks <- function(list_id, archived=FALSE, ...) { .cu_get("list", list_id, "task", query = list("archived" = tolower(archived), ...)) } @@ -292,7 +292,7 @@ cu_get_tasks <- function(list_id, archived=FALSE, ...) { ## task_id ## Example: 9hz. ## String -cu_get_task <- function(task_id) { +cuf_get_task <- function(task_id) { task_id <- cu_task_id(task_id) .cu_get("task", task_id) } @@ -385,7 +385,7 @@ cu_get_task <- function(task_id) { ## ## By default this does not include closed tasks. To page tasks, ## pass the page number you wish to fetch. -cu_get_filtered_team_tasks <- function(team_id, ...) { +cuf_get_filtered_team_tasks <- function(team_id, ...) { .cu_get("team", team_id, "task", query = list(...)) } diff --git a/R/df-tasktemplates.R b/R/df-tasktemplates.R index c215774..5c7855f 100644 --- a/R/df-tasktemplates.R +++ b/R/df-tasktemplates.R @@ -34,7 +34,7 @@ NULL ## Integer ## ## To page task templates, pass the page number you wish to fetch. -cu_get_task_templates <- function(team_id, page) { +cuf_get_task_templates <- function(team_id, page) { .cu_get("team", team_id, "taskTemplate", query = list(page = page)) } @@ -58,7 +58,7 @@ cu_get_task_templates <- function(team_id, page) { ## { ## "name": "New task name" ## } -cu_create_task_from_template <- function(list_id, template_id, name, ...) { +cuf_create_task_from_template <- function(list_id, template_id, name, ...) { .cu_post("list", list_id, "taskTemplate", template_id, body=list(name=name, ...)) } diff --git a/R/df-teams.R b/R/df-teams.R index 942006a..a3d7f4f 100644 --- a/R/df-teams.R +++ b/R/df-teams.R @@ -24,10 +24,10 @@ ## Teams is the legacy term for what are now called Workspaces in ClickUp. ## For compatablitly, the term team is still used in this API. ## This is NOT the new "Teams" feature which represents a group of users. -cu_get_teams <- function() { +cuf_get_teams <- function() { .cu_get("team") } -#cu_get_workspaces <- cu_get_teams +#cuf_get_workspaces <- cu_get_teams #' cuf_get_teams #' diff --git a/R/df-timetracking-legacy.R b/R/df-timetracking-legacy.R index 17c05f7..036962c 100644 --- a/R/df-timetracking-legacy.R +++ b/R/df-timetracking-legacy.R @@ -45,7 +45,7 @@ NULL ## ## use cu_time to turn POSIXct into unix time for start/end ## note: unix time is also in milliseconds (sec x 1000) -cu_track_time <- function(task_id, ...) { +cuf_track_time <- function(task_id, ...) { .Deprecated("cu_create_time_entry") task_id <- cu_task_id(task_id) .cu_post("task", task_id, "time", @@ -63,7 +63,7 @@ cu_track_time <- function(task_id, ...) { ## String ## ## Get time tracked for a task. -cu_get_tracked_time <- function(task_id) { +cuf_get_tracked_time <- function(task_id) { .Deprecated("cu_get_time_entries_within_date_range") task_id <- cu_task_id(task_id) .cu_get("task", task_id, "time") @@ -93,7 +93,7 @@ cu_get_tracked_time <- function(task_id) { ## ## use cu_time to turn POSIXct into unix time for start/end ## note: unix time is also in milliseconds (sec x 1000) -cu_edit_time_tracked <- function(task_id, interval_id, ...) { +cuf_edit_time_tracked <- function(task_id, interval_id, ...) { .Deprecated("cu_update_time_entry") task_id <- cu_task_id(task_id) .cu_put("task", task_id, "time", interval_id, @@ -115,7 +115,7 @@ cu_edit_time_tracked <- function(task_id, interval_id, ...) { ## String ## ## Delete a time tracked entry -cu_delete_time_tracked <- function(task_id, interval_id) { +cuf_delete_time_tracked <- function(task_id, interval_id) { .Deprecated("cu_delete_time_entry") task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "time", interval_id) diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index 4828731..b627b4b 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -45,7 +45,7 @@ NULL ## User ids to filter by separated by commas. ## Note: Only Workspace Owners/Admins have access to do this. ## Number -cu_get_time_entries_within_date_range <- function(team_id, +cuf_get_time_entries_within_date_range <- function(team_id, start_date, end_date, assignee) { .cu_get("team", team_id, "time_entries", query = list( @@ -67,7 +67,7 @@ start_date, end_date, assignee) { ## timer_id ## Example: 1963465985517105840. ## String -cu_get_singular_time_entry <- function(team_id, timer_id) { +cuf_get_singular_time_entry <- function(team_id, timer_id) { .cu_get("team", team_id, "time_entries", timer_id) } @@ -84,7 +84,7 @@ cu_get_singular_time_entry <- function(team_id, timer_id) { ## timer_id ## Example: 1963465985517105840. ## String -cu_get_time_entry_history <- function(team_id, timer_id) { +cuf_get_time_entry_history <- function(team_id, timer_id) { .cu_get("team", team_id, "time_entries", timer_id, "history") } @@ -97,7 +97,7 @@ cu_get_time_entry_history <- function(team_id, timer_id) { ## team_id ## Example: 512. ## Number -cu_get_running_time_entry <- function(team_id, timer_id) { +cuf_get_running_time_entry <- function(team_id, timer_id) { .cu_get("team", team_id, "time_entries", "current") } @@ -125,7 +125,7 @@ cu_get_running_time_entry <- function(team_id, timer_id) { ## "duration": 50000, ## "assignee": 1 ## } -cu_create_time_entry <- function(team_id, ...) { +cuf_create_time_entry <- function(team_id, ...) { .cu_post("team", team_id, "time_entries", body=list(...)) } @@ -148,7 +148,7 @@ cu_create_time_entry <- function(team_id, ...) { ## "name of tag" ## ] ## } -cu_remove_tags_from_time_entries <- function(team_id, ...) { +cuf_remove_tags_from_time_entries <- function(team_id, ...) { .cu_delete("team", team_id, "time_entries", "tags", body=list(...)) } @@ -162,7 +162,7 @@ cu_remove_tags_from_time_entries <- function(team_id, ...) { ## team_id ## Example: 512. ## Number -cu_get_all_tags_from_time_entries <- function(team_id) { +cuf_get_all_tags_from_time_entries <- function(team_id) { .cu_get("team", team_id, "time_entries", "tags") } @@ -184,7 +184,7 @@ cu_get_all_tags_from_time_entries <- function(team_id) { ## "name of tags" ## ] ## } -cu_add_tags_from_time_entries <- function(team_id, ...) { +cuf_add_tags_from_time_entries <- function(team_id, ...) { .cu_post("team", team_id, "time_entries", "tags", body=list(...)) } @@ -205,7 +205,7 @@ cu_add_tags_from_time_entries <- function(team_id, ...) { ## "tag_bg": "#000000", ## "tag_fg": "#000000" ## } -cu_change_tag_names_from_time_entries <- function(team_id, ...) { +cuf_change_tag_names_from_time_entries <- function(team_id, ...) { .cu_put("team", team_id, "time_entries", "tags", body=list(...)) } @@ -232,7 +232,7 @@ cu_change_tag_names_from_time_entries <- function(team_id, ...) { ## "tid": "task_id", ## "billable": false ## } -cu_start_time_entry <- function(team_id, timer_id, ...) { +cuf_start_time_entry <- function(team_id, timer_id, ...) { .cu_post("team", team_id, "time_entries", "start", timer_id, body=list(...)) } @@ -246,7 +246,7 @@ cu_start_time_entry <- function(team_id, timer_id, ...) { ## team_id ## Example: 512. ## Number -cu_stop_time_entry <- function(team_id) { +cuf_stop_time_entry <- function(team_id) { .cu_post("team", team_id, "time_entries", "stop") } @@ -263,7 +263,7 @@ cu_stop_time_entry <- function(team_id) { ## timer_id ## List of timer ids to delete separated by commas ## Number -cu_delete_time_entry <- function(team_id, timer_id) { +cuf_delete_time_entry <- function(team_id, timer_id) { .cu_delete("team", team_id, "time_entries", timer_id) } @@ -294,7 +294,7 @@ cu_delete_time_entry <- function(team_id, timer_id) { ## "billable": true, ## "duration": 100000 ## } -cu_update_time_entry <- function(team_id, timer_id, ...) { +cuf_update_time_entry <- function(team_id, timer_id, ...) { .cu_put("team", team_id, "time_entries", timer_id, body=list(...)) } diff --git a/R/df-users.R b/R/df-users.R index e7ef0c5..4191f20 100644 --- a/R/df-users.R +++ b/R/df-users.R @@ -34,7 +34,7 @@ NULL ## "email": "user@example.com", ## "admin": true ## } -cu_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { +cuf_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { .cu_post("team", team_id, "user", body=list(email=email, admin=tolower(admin), ...)) } @@ -59,7 +59,7 @@ cu_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { ## "username": "User Name", ## "admin": false ## } -cu_edit_user_on_workspace <- function(team_id, user_id, +cuf_edit_user_on_workspace <- function(team_id, user_id, username, admin=FALSE, ...) { .cu_put("team", team_id, "user", user_id, body=list(username=username, admin=tolower(admin), ...)) @@ -78,7 +78,7 @@ cu_edit_user_on_workspace <- function(team_id, user_id, ## user_id ## Example: 403. ## Number -cu_remove_user_from_workspace <- function(team_id, user_id) { +cuf_remove_user_from_workspace <- function(team_id, user_id) { .cu_delete("team", team_id, "user", user_id) } @@ -95,6 +95,6 @@ cu_remove_user_from_workspace <- function(team_id, user_id) { ## user_id ## Example: 403. ## Number -cu_get_user <- function(team_id, user_id) { +cuf_get_user <- function(team_id, user_id) { .cu_get("team", team_id, "user", user_id) } diff --git a/R/df-views.R b/R/df-views.R index 2b2a48f..91f6574 100644 --- a/R/df-views.R +++ b/R/df-views.R @@ -76,7 +76,7 @@ NULL ## "me_checklists": true ## } ## } -cu_create_team_view <- function(team_id, name, ...) { +cuf_create_team_view <- function(team_id, name, ...) { .cu_post("team", team_id, "view", body=list(name=name, ...)) } @@ -137,7 +137,7 @@ cu_create_team_view <- function(team_id, name, ...) { ## "me_checklists": true ## } ## } -cu_create_space_view <- function(space_id, name, ...) { +cuf_create_space_view <- function(space_id, name, ...) { .cu_post("space", space_id, "view", body=list(name=name, ...)) } @@ -198,7 +198,7 @@ cu_create_space_view <- function(space_id, name, ...) { ## "me_checklists": true ## } ## } -cu_create_folder_view <- function(folder_id, name, ...) { +cuf_create_folder_view <- function(folder_id, name, ...) { .cu_post("folder", folder_id, "view", body=list(name=name, ...)) } @@ -259,7 +259,7 @@ cu_create_folder_view <- function(folder_id, name, ...) { ## "me_checklists": true ## } ## } -cu_create_list_view <- function(list_id, name, ...) { +cuf_create_list_view <- function(list_id, name, ...) { .cu_post("list", list_id, "view", body=list(name=name, ...)) } @@ -273,7 +273,7 @@ cu_create_list_view <- function(list_id, name, ...) { ## team_id ## Example: 512. ## Number -cu_get_team_views <- function(team_id) { +cuf_get_team_views <- function(team_id) { .cu_get("team", team_id, "view") } @@ -286,7 +286,7 @@ cu_get_team_views <- function(team_id) { ## space_id ## Example: 790. ## Number -cu_get_space_views <- function(space_id) { +cuf_get_space_views <- function(space_id) { .cu_get("space", space_id, "view") } @@ -299,7 +299,7 @@ cu_get_space_views <- function(space_id) { ## folder_id ## Example: 457. ## Number -cu_get_folder_views <- function(folder_id) { +cuf_get_folder_views <- function(folder_id) { .cu_get("folder", folder_id, "view") } @@ -312,7 +312,7 @@ cu_get_folder_views <- function(folder_id) { ## list_id ## Example: 124. ## Number -cu_get_list_views <- function(list_id) { +cuf_get_list_views <- function(list_id) { .cu_get("list", list_id, "view") } @@ -326,7 +326,7 @@ cu_get_list_views <- function(list_id) { ## 105 (string) ## Example: 3c. ## String -cu_get_view <- function(view_id) { +cuf_get_view <- function(view_id) { .cu_get("view", view_id) } @@ -346,7 +346,7 @@ cu_get_view <- function(view_id) { ## Integer ## ## To page the tasks returned, include the page param -cu_get_view_tasks <- function(view_id, page) { +cuf_get_view_tasks <- function(view_id, page) { .cu_get("view", view_id, "task", query = list(page = page)) } @@ -414,7 +414,7 @@ cu_get_view_tasks <- function(view_id, page) { ## } ## Views / Update View ## PUT https://api.clickup.com/api/v2/view/view_id -cu_update_view <- function(view_id, ...) { +cuf_update_view <- function(view_id, ...) { .cu_put("view", view_id, body=list(...)) } @@ -429,6 +429,6 @@ cu_update_view <- function(view_id, ...) { ## 105 (string) ## Example: 3c. ## String -cu_delete_view <- function(view_id) { +cuf_delete_view <- function(view_id) { .cu_delete("view", view_id) } diff --git a/R/df-webhooks.R b/R/df-webhooks.R index cb6d5c7..33e592b 100644 --- a/R/df-webhooks.R +++ b/R/df-webhooks.R @@ -93,7 +93,7 @@ NULL ## ## ... passes query params for optional filtering ## for space_id, folder_id, list_id, or task_id -cu_create_webhook <- function(team_id, endpoint, events="*", ...) { +cuf_create_webhook <- function(team_id, endpoint, events="*", ...) { .cu_post("team", team_id, "webhook", body=list(endpoint=endpoint, events=events), query=list(...)) @@ -121,7 +121,7 @@ cu_create_webhook <- function(team_id, endpoint, events="*", ...) { ## "status": "active" ## } ## ... passes props to body -cu_update_webhook <- function(webhook_id, ...) { +cuf_update_webhook <- function(webhook_id, ...) { .cu_put("webhook", webhook_id, body=list(...)) } @@ -136,7 +136,7 @@ cu_update_webhook <- function(webhook_id, ...) { ## e506-4a29-9d42-26e504e3435e (uuid) ## Example: 4b67ac88. ## String -cu_delete_webhook <- function(webhook_id) { +cuf_delete_webhook <- function(webhook_id) { .cu_delete("webhook", webhook_id) } @@ -149,6 +149,6 @@ cu_delete_webhook <- function(webhook_id) { ## team_id ## Example: 512. ## Number -cu_get_webhooks <- function(team_id) { +cuf_get_webhooks <- function(team_id) { .cu_get("team", team_id, "webhook") } From 84aeaf972b38fe18998d22f09d6a25b575c8ec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 12:55:16 +0200 Subject: [PATCH 006/137] Export --- NAMESPACE | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 2dfe98d..a33245b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -127,5 +127,118 @@ export(cu_update_task) export(cu_update_time_entry) export(cu_update_view) export(cu_update_webhook) +export(cuf_add_dependency) +export(cuf_add_guest_to_folder) +export(cuf_add_guest_to_list) +export(cuf_add_guest_to_task) +export(cuf_add_tag_to_task) +export(cuf_add_tags_from_time_entries) +export(cuf_add_task_link) +export(cuf_change_tag_names_from_time_entries) +export(cuf_create_checklist) +export(cuf_create_checklist_item) +export(cuf_create_folder) +export(cuf_create_folder_view) +export(cuf_create_folderless_list) +export(cuf_create_goal) +export(cuf_create_key_result) +export(cuf_create_list) +export(cuf_create_list_view) +export(cuf_create_space) +export(cuf_create_space_tag) +export(cuf_create_space_view) +export(cuf_create_task) +export(cuf_create_task_from_template) +export(cuf_create_team_view) +export(cuf_create_time_entry) +export(cuf_create_webhook) +export(cuf_delete_checklist) +export(cuf_delete_checklist_item) +export(cuf_delete_comment) +export(cuf_delete_dependency) +export(cuf_delete_folder) +export(cuf_delete_goal) +export(cuf_delete_key_result) +export(cuf_delete_list) +export(cuf_delete_space) +export(cuf_delete_space_tag) +export(cuf_delete_task) +export(cuf_delete_time_entry) +export(cuf_delete_time_tracked) +export(cuf_delete_view) +export(cuf_delete_webhook) +export(cuf_edit_checklist) +export(cuf_edit_checklist_item) +export(cuf_edit_guest_on_workspace) +export(cuf_edit_key_result) +export(cuf_edit_space_tag) +export(cuf_edit_time_tracked) +export(cuf_edit_user_on_workspace) +export(cuf_get_access_token) +export(cuf_get_accessible_custom_fields) +export(cuf_get_all_tags_from_time_entries) +export(cuf_get_authorized_teams) +export(cuf_get_authorized_user) +export(cuf_get_filtered_team_tasks) +export(cuf_get_folder) +export(cuf_get_folder_views) +export(cuf_get_folders) +export(cuf_get_goal) +export(cuf_get_goals) +export(cuf_get_guest) +export(cuf_get_list) +export(cuf_get_list_comments) +export(cuf_get_list_members) +export(cuf_get_list_views) +export(cuf_get_lists) +export(cuf_get_lists_folderless) +export(cuf_get_running_time_entry) +export(cuf_get_shared) +export(cuf_get_singular_time_entry) +export(cuf_get_space) +export(cuf_get_space_tags) +export(cuf_get_space_views) +export(cuf_get_spaces) +export(cuf_get_task) +export(cuf_get_task_comments) +export(cuf_get_task_members) +export(cuf_get_task_templates) +export(cuf_get_tasks) +export(cuf_get_team_views) +export(cuf_get_teams) +export(cuf_get_time_entries_within_date_range) +export(cuf_get_time_entry_history) +export(cuf_get_tracked_time) +export(cuf_get_user) +export(cuf_get_view) +export(cuf_get_view_comments) +export(cuf_get_view_tasks) +export(cuf_get_webhooks) +export(cuf_invite_guest_to_workspace) +export(cuf_invite_user_to_workspace) +export(cuf_post_list_comment) +export(cuf_post_task_attachment) +export(cuf_post_task_comment) +export(cuf_post_view_comment) +export(cuf_put_update_comment) +export(cuf_remove_field_value) +export(cuf_remove_guest_from_folder) +export(cuf_remove_guest_from_list) +export(cuf_remove_guest_from_task) +export(cuf_remove_guest_from_workspace) +export(cuf_remove_tags_from_time_entries) +export(cuf_remove_user_from_workspace) +export(cuf_set_custom_field_value) +export(cuf_start_time_entry) +export(cuf_stop_time_entry) +export(cuf_track_time) +export(cuf_update_folder) +export(cuf_update_goal) +export(cuf_update_list) +export(cuf_update_space) +export(cuf_update_task) +export(cuf_update_time_entry) +export(cuf_update_view) +export(cuf_update_webhook) import(tibble) import(tibblify) From 00fb1108c9293064db3c08c17e5ba2a10e3f125c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:00:18 +0200 Subject: [PATCH 007/137] Prune roxygen2 --- R/df-attachments.R | 33 +--------------- R/df-authorization.R | 17 +------- R/df-checklists.R | 44 +-------------------- R/df-comments.R | 20 +--------- R/df-customfields.R | 19 +-------- R/df-dependencies.R | 18 +-------- R/df-folders.R | 20 +--------- R/df-goals.R | 19 +-------- R/df-guests.R | 23 +---------- R/df-lists.R | 18 +-------- R/df-members.R | 14 +------ R/df-sharedhierarchy.R | 17 +------- R/df-spaces.R | 26 +------------ R/df-tags.R | 18 +-------- R/df-tasks.R | 80 +------------------------------------- R/df-tasktemplates.R | 20 +--------- R/df-teams.R | 23 +---------- R/df-timetracking-legacy.R | 25 +----------- R/df-timetracking-v2.R | 24 +----------- R/df-users.R | 19 +-------- R/df-views.R | 21 +--------- R/df-webhooks.R | 48 +---------------------- 22 files changed, 25 insertions(+), 541 deletions(-) diff --git a/R/df-attachments.R b/R/df-attachments.R index 0d25d50..67929de 100644 --- a/R/df-attachments.R +++ b/R/df-attachments.R @@ -1,37 +1,6 @@ -#' Attachments -#' -#' Result from a call to the API endpoint -#' POST https://api.clickup.com/api/v2/task/task_id/attachment -#' @param task_id Task ID. -#' @param attachment Path to a file. -#' @param filename File name as it will show up in CluckUp, -#' deduced from `attachment` when not provided (`NULL`). -#' @param ... Can be used to pass mime `type` argument to [httr::upload_file()], -#' mime type is guessed otherwise. -#' -#' @examples -#' \dontrun{ -#' ## produce a png image -#' f <- tempfile(fileext=".png") -#' png(f) -#' plot(1:10, col=1:10) -#' dev.off() -#' -#' ## attache the image to a task -#' cu_post_task_attachment("8ach57", f) -#' -#' unlink(f) # clean up the image -#' } -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' #' @export -#' @name api-attachment +#' @rdname api-attachment ## API documentation is actually incorrect about showing the curl request. ## The correct curl is this: diff --git a/R/df-authorization.R b/R/df-authorization.R index cfc1dab..c90c433 100644 --- a/R/df-authorization.R +++ b/R/df-authorization.R @@ -1,20 +1,5 @@ -#' Authorization -#' -#' These are the routes for authing the API and -#' going through the OAuth flow. -#' Applications utilizing the personal API token do not need these functions. -#' @param client_id Oauth app client id. -#' @param client_secret Oauth app client secret. -#' @param code Code given in redirect URL. -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-authorization +#' @rdname api-authorization NULL #' @export diff --git a/R/df-checklists.R b/R/df-checklists.R index b17f739..ebcdfe1 100644 --- a/R/df-checklists.R +++ b/R/df-checklists.R @@ -1,47 +1,5 @@ -#' Checklists -#' -#' Working with checklists in ClickUp tasks. -#' @param task_id Task ID. -#' @param name Checklist or checlist item name. -#' @param checklist_id Checklist ID. -#' @param position Position is the zero-based index of the order you want -#' the checklist to exist on the task. If you want the checklist to be -#' in the first position, pass 0. -#' @param checklist_item_id Checklist item ID. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @examples -#' \dontrun{ -#' ## create new checklist -#' cl <- cu_create_checklist("8ach57", "New checklist") -#' -#' ## change position of checklist -#' cu_edit_checklist(cl$checklist$id, position = 0) -#' -#' ## create checklist items -#' cli <- cu_create_checklist_item(cl$checklist$id, name="New item 1") -#' cli <- cu_create_checklist_item(cl$checklist$id, name="New item 2", -#' assignee = 4471793) -#' cli <- cu_create_checklist_item(cl$checklist$id, name="New item 3", -#' assignee = NA, resolved = TRUE, parent = NA) -#' -#' ## delete checklist items -#' cu_delete_checklist_item(cli$checklist$id, -#' cli$checklist$items[[1]]$id) -#' -#' ## delete checklist -#' cu_delete_checklist(cli$checklist$id) -#' } -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-checklists +#' @rdname api-checklists NULL #' @export diff --git a/R/df-comments.R b/R/df-comments.R index 1ce664e..ca6fc92 100644 --- a/R/df-comments.R +++ b/R/df-comments.R @@ -1,21 +1,5 @@ -#' Comments -#' -#' Working with comments in ClickUp tasks. - -#' @param task_id Task ID. -#' @param view_id View ID. -#' @param list_id List ID. -#' @param comment_id Comment ID. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-comments + +#' @rdname api-comments NULL #' @export diff --git a/R/df-customfields.R b/R/df-customfields.R index 014ca46..d9ab171 100644 --- a/R/df-customfields.R +++ b/R/df-customfields.R @@ -1,22 +1,5 @@ -#' Custom fields -#' -#' Working with custom fields in ClickUp tasks. -#' @param list_id List ID. -#' @param task_id Task ID. -#' @param field_id Field ID. -#' @param ... Named arguments to be passed to API request body. -#' The accessible fields can be found on the task object from the -#' [cu_get_task()] route. This is where you can retrieve the `field_id`. -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-customfields +#' @rdname api-customfields NULL #' @export diff --git a/R/df-dependencies.R b/R/df-dependencies.R index b5793cc..e5dbc14 100644 --- a/R/df-dependencies.R +++ b/R/df-dependencies.R @@ -1,21 +1,5 @@ -#' Dependencies -#' -#' Working dependencies xyz in ClickUp tasks (). -#' @param task_id Task ID. -#' @param depends_on A waiting on dependency of the task. -#' One and only one of `depends_on` or `dependency_of` must be passed. -#' @param dependency_of A blocking dependency of the task. -#' One and only one of `depends_on` or `dependency_of` must be passed. -#' @param links_to Link to another task. -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-dependencies +#' @rdname api-dependencies NULL #' @export diff --git a/R/df-folders.R b/R/df-folders.R index 282e661..71dbf3d 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -1,19 +1,5 @@ -#' Folders -#' -#' Working with folders in ClickUp tasks (). -#' @param space_id Space ID. -#' @param name Name of the folder. -#' @param folder_id Folder ID. -#' @param archived Logical, to return archived (`TRUE`) folders. -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-folders +#' @rdname api-folders NULL #' @export @@ -87,10 +73,6 @@ cuf_get_folders <- function(space_id, archived=FALSE) { } -#' cuf_get_folders() -#' -#' `cuf_get_folders()` returns the same data as `cu_get_folders()` as a tibble. -#' #' @export #' @rdname api-folders cuf_get_folders <- function(team_id, archived=FALSE) { diff --git a/R/df-goals.R b/R/df-goals.R index b3a5743..5b83e68 100644 --- a/R/df-goals.R +++ b/R/df-goals.R @@ -1,20 +1,5 @@ -#' Goals -#' -#' Working with goals in ClickUp tasks. - -#' @param team_id Team ID. -#' @param goal_id Goal ID. -#' @param key_result_id Key result ID. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-goals + +#' @rdname api-goals NULL #' @export diff --git a/R/df-guests.R b/R/df-guests.R index 5c5ee99..041b8cc 100644 --- a/R/df-guests.R +++ b/R/df-guests.R @@ -1,24 +1,5 @@ -#' Guests -#' -#' Working with guests in ClickUp tasks (Enterprise only feature). - -#' @param team_id Team ID. -#' @param guest_id Guest ID. -#' @param permission_level Permisson level can be -#' `"read"`, `"comment"`, `"edit"`, or `"create"`. -#' @param folder_id Folder ID. -#' @param list_id List ID. -#' @param task_id Task ID. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-guests + +#' @rdname api-guests NULL #' @export diff --git a/R/df-lists.R b/R/df-lists.R index 4ca24a2..13afa0a 100644 --- a/R/df-lists.R +++ b/R/df-lists.R @@ -1,21 +1,5 @@ -#' Lists -#' -#' Working with lists in ClickUp tasks. -#' @param folder_id Folder ID. -#' @param space_id SPace ID. -#' @param list_id List ID. -#' @param archived Logical, to returne archived (`TRUE`) lists. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-lists +#' @rdname api-lists NULL #' @export diff --git a/R/df-members.R b/R/df-members.R index d7eb0d0..262b4aa 100644 --- a/R/df-members.R +++ b/R/df-members.R @@ -1,17 +1,5 @@ -#' Members -#' -#' Working with members in ClickUp tasks (). -#' @param task_id Task ID. -#' @param list_id List ID. -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-members +#' @rdname api-members NULL #' @export diff --git a/R/df-sharedhierarchy.R b/R/df-sharedhierarchy.R index e2f2d84..87f41e0 100644 --- a/R/df-sharedhierarchy.R +++ b/R/df-sharedhierarchy.R @@ -1,21 +1,6 @@ -#' Shared hierarchy -#' -#' Working with shared hierarchy in ClickUp tasks (). -#' Returns all resources you have access to where you don't have -#' access to its parent. For example, if you have access to a -#' shared task, but don't have access to its parent list, it will -#' come back in this request. -#' @param team_id Team ID. -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' #' @export -#' @name api-sharedhierarchy +#' @rdname api-sharedhierarchy ## Shared Hierarchy / Shared Hierarchy ## GET https://api.clickup.com/api/v2/team/team_id/shared ## diff --git a/R/df-spaces.R b/R/df-spaces.R index b93406a..272af48 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -1,21 +1,5 @@ -#' Spaces -#' -#' Working with spaces in ClickUp tasks. -#' @param team_id Team ID. -#' @param name Name of the space. -#' @param space_id Space ID. -#' @param archived Logical, to returne archived (`TRUE`) spaces. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-spaces +#' @rdname api-spaces NULL #' @export @@ -71,10 +55,6 @@ cuf_create_space <- function(team_id, name, ...) { } -#' cuf_create_space() -#' -#' `cuf_create_space()` returns the same data as `cu_create_space()` as a tibble. -#' #' @export #' @rdname api-spaces cuf_create_space <- function(team_id, name, ...) { @@ -130,10 +110,6 @@ cuf_get_spaces <- function(team_id, archived=FALSE) { } -#' cuf_get_spaces() -#' -#' `cuf_get_spaces()` returns the same data as `cu_get_spaces()` as a tibble. -#' #' @export #' @rdname api-spaces cuf_get_spaces <- function(team_id, archived=FALSE) { diff --git a/R/df-tags.R b/R/df-tags.R index c0f3280..2dfc2fb 100644 --- a/R/df-tags.R +++ b/R/df-tags.R @@ -1,21 +1,5 @@ -#' Tags -#' -#' Working with tags in ClickUp tasks. -#' @param space_id Space ID. -#' @param task_id Task ID. -#' @param tag_name Tag name. -#' @param name Tag name. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-tags +#' @rdname api-tags NULL #' @export diff --git a/R/df-tasks.R b/R/df-tasks.R index 041c893..0cc311b 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -1,83 +1,5 @@ -#' Tasks -#' -#' Working with tasks in ClickUp tasks. -#' @details -#' -#' ### Create task -#' -#' `assignees` is an array of the assignees' userids to be added to this task. -#' `priority` is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low -#' ([cu_priority()]). Time estimate is in milliseconds. -#' See the fields section below to see the custom fields available on a list. -#' If `notify_all` is true, creation notifications will be sent to everyone -#' including the creator of the task. Instead of content you can pass -#' `markdown_content` with valid markdown syntax to add formatting to the -#' task description. Passing an existing task ID in the parent property -#' will make the new task a subtask of that parent. -#' The parent you pass must not be a subtask itself, -#' and must be part of the list that you pass in the URL params. -#' The `links_to` accepts a task ID to create a linked dependency on -#' the new task. -#' -#' ### Update task -#' -#' Only pass properties you want to update. -#' It is unnecessary to pass the entire task object. -#' -#' ### Get tasks -#' -#' The maximum number of tasks returned in this response is 100. -#' When you are paging this request, you should check list limit against -#' the length of each response to determine if you are on the last page. -#' By default this does not include closed tasks. To page tasks, -#' pass the page number you wish to fetch. [cu_get_all_team_tasks()] -#' is a wrapper to spare paging. -#' -#' ### Filter query parameters -#' -#' When value is an array, use `I()` to make sure atomic vectors -#' remain JSON arrays in the output. -#' -#' * archived: return archived tasks. -#' * page: page to fetch (starts at 0) -#' * order_by: order by field, defaults to created; options: id, created, -#' updated, due_date. -#' * reverse: reverse order. -#' * subtasks: include subtasks, default false. -#' * space_ids: spaces to query, array. -#' * project_ids: projects to query, array. -#' * statuses: statuses to query, array. -#' * include_closed: by default, the api does not include closed tasks. -#' Set this to true and dont send a status filter to include closed tasks. -#' * assignees: ssignees to query, array. -#' * due_date_gt: filter due date greater than posix time. -#' * due_date_lt: filter due date less than posix time. -#' * date_created_gt: filter date created greater than posix time. -#' * date_created_lt: filter date created less than posix time. -#' * date_updated_gt: filter date updated greater than posix time. -#' * date_updated_lt: filter date updated less than posix time -#' * custom_fields: filter by custom fields. Must be a stringified -#' JSON array of objects. See the custom fields section of the API docs -#' for more details. -#' -#' @param team_id Team (workspace) ID. -#' @param list_id List ID. -#' @param task_id Task ID. The ClickUp GUI prepends task IDs with a leading hash, [cu_task_id()] is used internally to normalize task IDs. -#' @param archived Logical, to returne archived (`TRUE`) lists. -#' @param ... Named arguments to be passed to API request body, -#' of as query parameters, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class, [cu_date_to()] and -#' [cu_date_from()] to work with POSIX dates, -#' [cu_get_all_team_tasks()] is a wrapper. [cu_task_id()] to remove leading hashes from task IDs. -#' -#' @name api-tasks +#' @rdname api-tasks NULL #' @export diff --git a/R/df-tasktemplates.R b/R/df-tasktemplates.R index 5c7855f..75a99e2 100644 --- a/R/df-tasktemplates.R +++ b/R/df-tasktemplates.R @@ -1,23 +1,5 @@ -#' Task templates -#' -#' Working with task templates in ClickUp tasks. -#' @param team_id Team ID. -#' @param page Page to fetch (starts at 0). -#' To page task templates, pass the page number you wish to fetch. -#' @param list_id List ID. -#' @param template_id Template ID. -#' @param name Name of the task. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-tasktemplates +#' @rdname api-tasktemplates NULL #' @export diff --git a/R/df-teams.R b/R/df-teams.R index a3d7f4f..98be21f 100644 --- a/R/df-teams.R +++ b/R/df-teams.R @@ -1,23 +1,6 @@ -#' Teams (workspaces) -#' -#' Working with teams (workspaces) in ClickUp tasks (). -#' Teams is the legacy term for what are now called workspaces in ClickUp. -#' For compatablitly, the term team is still used in the API v2. -#' This is NOT the new 'Teams' feature which represents a group of users. -#' @examples -#' \dontrun{ -#' cu_get_teams() -#' } -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' #' @export -#' @name api-teams +#' @rdname api-teams ## Teams / Get Teams ## GET https://api.clickup.com/api/v2/team ## @@ -29,10 +12,6 @@ cuf_get_teams <- function() { } #cuf_get_workspaces <- cu_get_teams -#' cuf_get_teams -#' -#' `cuf_get_teams()` returns the same data as a nested tibble. -#' #' @rdname api-teams #' @export cuf_get_teams <- function() { diff --git a/R/df-timetracking-legacy.R b/R/df-timetracking-legacy.R index 036962c..885bf34 100644 --- a/R/df-timetracking-legacy.R +++ b/R/df-timetracking-legacy.R @@ -1,28 +1,5 @@ -#' Time tracking legacy -#' -#' Working with time tracking in ClickUp tasks. -#' Note: This is the legacy API for time tracking. -#' Please use the new Time tracking API. -#' You won't be able to update timer entries that uses our -#' Time Tracking 2.0 features that uses labels, descriptions, -#' and making time entries billable. -#' @param task_id Task ID. -#' @param interval_id Interval ID. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' Edit the `start`, `end`, or total `time` of a time tracked entry. -#' -#' @return -#' -#' A cu object. -#' Note: the legacy API comes with a deprecation warning. -#' -#' @seealso [api-timetracking-2] for Time Tracking 2.0, -#' [cu-class] for the cu object class, -#' [cu_date_from()] and [cu_date_to()] to deal with POSIX times. -#' -#' @name api-timetracking-legacy +#' @rdname api-timetracking-legacy NULL #' @export diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index b627b4b..5d5a591 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -1,27 +1,5 @@ -#' Time tracking 2.0 -#' -#' Working with time tracking in ClickUp tasks. -#' Note: A time entry that has a negative duration means -#' that timer is currently ongoing for that user. -#' @param team_id Team ID. -#' @param timer_id Timer ID. -#' @param start_date POSIX start time in milliseconds. -#' @param end_date POSIX end time in milliseconds. -#' @param assignee User ids to filter by separated by commas. -#' Note: Only Workspace Owners/Admins have access to do this. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [api-timetracking-legacy] for Time tracking legacy API, -#' [cu-class] for the cu object class, -#' [cu_date_from()] and [cu_date_to()] to deal with POSIX times. -#' -#' @name api-timetracking-2 +#' @rdname api-timetracking-2 NULL #' @export diff --git a/R/df-users.R b/R/df-users.R index 4191f20..198b811 100644 --- a/R/df-users.R +++ b/R/df-users.R @@ -1,22 +1,5 @@ -#' Users -#' -#' Working with users in ClickUp tasks (Enterprise only feture). -#' @param team_id Team (workspace) ID. -#' @param email Email. -#' @param admin Logical, admin account or not -#' @param user_id User ID. -#' @param username User name. -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-users +#' @rdname api-users NULL #' @export diff --git a/R/df-views.R b/R/df-views.R index 91f6574..50b0628 100644 --- a/R/df-views.R +++ b/R/df-views.R @@ -1,24 +1,5 @@ -#' Views -#' -#' Working views in ClickUp tasks. -#' @param team_id Team (workspace) ID. -#' @param name View name. -#' @param space_id Space ID. -#' @param folder_id Folder ID. -#' @param list_id List ID. -#' @param view_id View ID. -#' @param page Page to fetch (starts at 0). -#' @param ... Named arguments to be passed to API request body, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. -#' -#' @name api-views +#' @rdname api-views NULL #' @export diff --git a/R/df-webhooks.R b/R/df-webhooks.R index 33e592b..658306e 100644 --- a/R/df-webhooks.R +++ b/R/df-webhooks.R @@ -1,51 +1,5 @@ -#' Webhooks -#' -#' Working with webhooks in ClickUp tasks. -#' @details -#' You may filter the location of resources that get sent to a webhook -#' by passing an optional `space_id`, `folder_id`, `list_id`, or -#' `task_id` in the body of the request. -#' Without specifying any events, all event types -#' will be sent to the webhook. However, you can filter for specific -#' actions by sending an events array. To subscribe to specific events, -#' pass an array of events that you want to subscribe to, -#' otherwise pass `"*"` to subscribe to everything. -#' -#' Events include: `"taskCreated"` -#' `"taskUpdated"` -#' `"taskDeleted"` -#' `"listCreated"` -#' `"listUpdated"` -#' `"listDeleted"` -#' `"folderCreated"` -#' `"folderUpdated"` -#' `"folderDeleted"` -#' `"spaceCreated"` -#' `"spaceUpdated"` -#' `"spaceDeleted"` -#' `"goalCreated"` -#' `"goalUpdated"` -#' `"goalDeleted"` -#' `"keyResultCreated"` -#' `"keyResultUpdated"` -#' `"keyResultDeleted"`. -#' -#' @param team_id Team ID. -#' @param endpoint Webhook endpoint. -#' @param events Events (see Details). -#' @param webhook_id Webhook ID. -#' @param ... Named arguments to be passed to API request body, -#' e.g. `"endpoint"`, `"events"`, or `"status"`, -#' see the ClickUp API documentation (). -#' -#' @return -#' -#' A cu object. -#' -#' @seealso [cu-class] for the cu object class. [cu_task_id()] to remove leading hashes from task IDs. -#' -#' @name api-webhooks +#' @rdname api-webhooks NULL #' @export From 6492c76bd39a610bfcf1bf01a2de287aaeff2fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:01:35 +0200 Subject: [PATCH 008/137] Document --- man/api-attachment.Rd | 5 ++++- man/api-authorization.Rd | 11 ++++++++- man/api-checklists.Rd | 20 ++++++++++++++++- man/api-comments.Rd | 26 ++++++++++++++++++++- man/api-customfields.Rd | 11 ++++++++- man/api-dependencies.Rd | 13 ++++++++++- man/api-folders.Rd | 19 +++++++++++++++- man/api-goals.Rd | 26 ++++++++++++++++++++- man/api-guests.Rd | 32 +++++++++++++++++++++++++- man/api-lists.Rd | 23 ++++++++++++++++++- man/api-members.Rd | 8 ++++++- man/api-sharedhierarchy.Rd | 5 ++++- man/api-spaces.Rd | 21 ++++++++++++++++- man/api-tags.Rd | 19 +++++++++++++++- man/api-tasks.Rd | 20 ++++++++++++++++- man/api-tasktemplates.Rd | 8 ++++++- man/api-teams.Rd | 7 +++++- man/api-timetracking-2.Rd | 41 +++++++++++++++++++++++++++++++++- man/api-timetracking-legacy.Rd | 15 ++++++++++++- man/api-users.Rd | 14 +++++++++++- man/api-views.Rd | 38 ++++++++++++++++++++++++++++++- man/api-webhooks.Rd | 14 +++++++++++- 22 files changed, 374 insertions(+), 22 deletions(-) diff --git a/man/api-attachment.Rd b/man/api-attachment.Rd index 091fb2f..7c8ab5e 100644 --- a/man/api-attachment.Rd +++ b/man/api-attachment.Rd @@ -1,11 +1,14 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-attachments.R +% Please edit documentation in R/api-attachments.R, R/df-attachments.R \name{api-attachment} \alias{api-attachment} \alias{cu_post_task_attachment} +\alias{cuf_post_task_attachment} \title{Attachments} \usage{ cu_post_task_attachment(task_id, attachment, filename = NULL, ...) + +cuf_post_task_attachment(task_id, attachment, filename = NULL, ...) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-authorization.Rd b/man/api-authorization.Rd index e970187..31a23f7 100644 --- a/man/api-authorization.Rd +++ b/man/api-authorization.Rd @@ -1,10 +1,13 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-authorization.R +% Please edit documentation in R/api-authorization.R, R/df-authorization.R \name{api-authorization} \alias{api-authorization} \alias{cu_get_access_token} \alias{cu_get_authorized_user} \alias{cu_get_authorized_teams} +\alias{cuf_get_access_token} +\alias{cuf_get_authorized_user} +\alias{cuf_get_authorized_teams} \title{Authorization} \usage{ cu_get_access_token(client_id, client_secret, code) @@ -12,6 +15,12 @@ cu_get_access_token(client_id, client_secret, code) cu_get_authorized_user() cu_get_authorized_teams() + +cuf_get_access_token(client_id, client_secret, code) + +cuf_get_authorized_user() + +cuf_get_authorized_teams() } \arguments{ \item{client_id}{Oauth app client id.} diff --git a/man/api-checklists.Rd b/man/api-checklists.Rd index 8ef6704..bab4bd4 100644 --- a/man/api-checklists.Rd +++ b/man/api-checklists.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-checklists.R +% Please edit documentation in R/api-checklists.R, R/df-checklists.R \name{api-checklists} \alias{api-checklists} \alias{cu_create_checklist} @@ -8,6 +8,12 @@ \alias{cu_create_checklist_item} \alias{cu_edit_checklist_item} \alias{cu_delete_checklist_item} +\alias{cuf_create_checklist} +\alias{cuf_edit_checklist} +\alias{cuf_delete_checklist} +\alias{cuf_create_checklist_item} +\alias{cuf_edit_checklist_item} +\alias{cuf_delete_checklist_item} \title{Checklists} \usage{ cu_create_checklist(task_id, name) @@ -21,6 +27,18 @@ cu_create_checklist_item(checklist_id, name, ...) cu_edit_checklist_item(checklist_id, checklist_item_id, ...) cu_delete_checklist_item(checklist_id, checklist_item_id) + +cuf_create_checklist(task_id, name) + +cuf_edit_checklist(checklist_id, position) + +cuf_delete_checklist(checklist_id) + +cuf_create_checklist_item(checklist_id, name, ...) + +cuf_edit_checklist_item(checklist_id, checklist_item_id, ...) + +cuf_delete_checklist_item(checklist_id, checklist_item_id) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-comments.Rd b/man/api-comments.Rd index fc013d5..6463509 100644 --- a/man/api-comments.Rd +++ b/man/api-comments.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-comments.R +% Please edit documentation in R/api-comments.R, R/df-comments.R \name{api-comments} \alias{api-comments} \alias{cu_post_task_comment} @@ -10,6 +10,14 @@ \alias{cu_get_list_comments} \alias{cu_put_update_comment} \alias{cu_delete_comment} +\alias{cuf_post_task_comment} +\alias{cuf_post_view_comment} +\alias{cuf_post_list_comment} +\alias{cuf_get_task_comments} +\alias{cuf_get_view_comments} +\alias{cuf_get_list_comments} +\alias{cuf_put_update_comment} +\alias{cuf_delete_comment} \title{Comments} \usage{ cu_post_task_comment(task_id, ...) @@ -27,6 +35,22 @@ cu_get_list_comments(list_id) cu_put_update_comment(comment_id, ...) cu_delete_comment(comment_id) + +cuf_post_task_comment(task_id, ...) + +cuf_post_view_comment(view_id, ...) + +cuf_post_list_comment(list_id, ...) + +cuf_get_task_comments(task_id) + +cuf_get_view_comments(view_id) + +cuf_get_list_comments(list_id) + +cuf_put_update_comment(comment_id, ...) + +cuf_delete_comment(comment_id) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-customfields.Rd b/man/api-customfields.Rd index 3a5e203..6cf3fc2 100644 --- a/man/api-customfields.Rd +++ b/man/api-customfields.Rd @@ -1,10 +1,13 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-customfields.R +% Please edit documentation in R/api-customfields.R, R/df-customfields.R \name{api-customfields} \alias{api-customfields} \alias{cu_get_accessible_custom_fields} \alias{cu_set_custom_field_value} \alias{cu_remove_field_value} +\alias{cuf_get_accessible_custom_fields} +\alias{cuf_set_custom_field_value} +\alias{cuf_remove_field_value} \title{Custom fields} \usage{ cu_get_accessible_custom_fields(list_id) @@ -12,6 +15,12 @@ cu_get_accessible_custom_fields(list_id) cu_set_custom_field_value(task_id, field_id, ...) cu_remove_field_value(task_id, field_id) + +cuf_get_accessible_custom_fields(list_id) + +cuf_set_custom_field_value(task_id, field_id, ...) + +cuf_remove_field_value(task_id, field_id) } \arguments{ \item{list_id}{List ID.} diff --git a/man/api-dependencies.Rd b/man/api-dependencies.Rd index 623748e..54f94b2 100644 --- a/man/api-dependencies.Rd +++ b/man/api-dependencies.Rd @@ -1,10 +1,13 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-dependencies.R +% Please edit documentation in R/api-dependencies.R, R/df-dependencies.R \name{api-dependencies} \alias{api-dependencies} \alias{cu_add_dependency} \alias{cu_delete_dependency} \alias{cu_add_task_link} +\alias{cuf_add_dependency} +\alias{cuf_delete_dependency} +\alias{cuf_add_task_link} \title{Dependencies} \usage{ cu_add_dependency(task_id, depends_on, dependency_of) @@ -14,6 +17,14 @@ cu_delete_dependency(task_id, links_to) cu_add_task_link(task_id, links_to) cu_delete_dependency(task_id, links_to) + +cuf_add_dependency(task_id, depends_on, dependency_of) + +cuf_delete_dependency(task_id, links_to) + +cuf_add_task_link(task_id, links_to) + +cuf_delete_dependency(task_id, links_to) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-folders.Rd b/man/api-folders.Rd index d9c15c3..7b35822 100644 --- a/man/api-folders.Rd +++ b/man/api-folders.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-folders.R +% Please edit documentation in R/api-folders.R, R/df-folders.R \name{api-folders} \alias{api-folders} \alias{cu_create_folder} @@ -7,6 +7,11 @@ \alias{cu_delete_folder} \alias{cu_get_folders} \alias{cu_get_folder} +\alias{cuf_create_folder} +\alias{cuf_update_folder} +\alias{cuf_delete_folder} +\alias{cuf_get_folders} +\alias{cuf_get_folder} \title{Folders} \usage{ cu_create_folder(space_id, name) @@ -18,6 +23,18 @@ cu_delete_folder(folder_id, name) cu_get_folders(space_id, archived = FALSE) cu_get_folder(folder_id) + +cuf_create_folder(space_id, name) + +cuf_update_folder(folder_id, name) + +cuf_delete_folder(folder_id, name) + +cuf_get_folders(team_id, archived = FALSE) + +cuf_get_folders(team_id, archived = FALSE) + +cuf_get_folder(folder_id) } \arguments{ \item{space_id}{Space ID.} diff --git a/man/api-goals.Rd b/man/api-goals.Rd index dc07440..f30181c 100644 --- a/man/api-goals.Rd +++ b/man/api-goals.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-goals.R +% Please edit documentation in R/api-goals.R, R/df-goals.R \name{api-goals} \alias{api-goals} \alias{cu_create_goal} @@ -10,6 +10,14 @@ \alias{cu_create_key_result} \alias{cu_edit_key_result} \alias{cu_delete_key_result} +\alias{cuf_create_goal} +\alias{cuf_update_goal} +\alias{cuf_delete_goal} +\alias{cuf_get_goals} +\alias{cuf_get_goal} +\alias{cuf_create_key_result} +\alias{cuf_edit_key_result} +\alias{cuf_delete_key_result} \title{Goals} \usage{ cu_create_goal(team_id, ...) @@ -27,6 +35,22 @@ cu_create_key_result(goal_id, ...) cu_edit_key_result(key_result_id, ...) cu_delete_key_result(key_result_id) + +cuf_create_goal(team_id, ...) + +cuf_update_goal(goal_id, ...) + +cuf_delete_goal(goal_id) + +cuf_get_goals(team_id) + +cuf_get_goal(goal_id) + +cuf_create_key_result(goal_id, ...) + +cuf_edit_key_result(key_result_id, ...) + +cuf_delete_key_result(key_result_id) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-guests.Rd b/man/api-guests.Rd index e9f2f5a..2863916 100644 --- a/man/api-guests.Rd +++ b/man/api-guests.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-guests.R +% Please edit documentation in R/api-guests.R, R/df-guests.R \name{api-guests} \alias{api-guests} \alias{cu_invite_guest_to_workspace} @@ -12,6 +12,16 @@ \alias{cu_remove_guest_from_list} \alias{cu_add_guest_to_folder} \alias{cu_remove_guest_from_folder} +\alias{cuf_invite_guest_to_workspace} +\alias{cuf_edit_guest_on_workspace} +\alias{cuf_remove_guest_from_workspace} +\alias{cuf_get_guest} +\alias{cuf_add_guest_to_task} +\alias{cuf_remove_guest_from_task} +\alias{cuf_add_guest_to_list} +\alias{cuf_remove_guest_from_list} +\alias{cuf_add_guest_to_folder} +\alias{cuf_remove_guest_from_folder} \title{Guests} \usage{ cu_invite_guest_to_workspace(team_id) @@ -33,6 +43,26 @@ cu_remove_guest_from_list(list_id, guest_id) cu_add_guest_to_folder(folder_id, guest_id, permission_level = "read") cu_remove_guest_from_folder(folder_id, guest_id) + +cuf_invite_guest_to_workspace(team_id) + +cuf_edit_guest_on_workspace(team_id, guest_id, ...) + +cuf_remove_guest_from_workspace(team_id, guest_id) + +cuf_get_guest(team_id, guest_id) + +cuf_add_guest_to_task(task_id, guest_id, permission_level = "read") + +cuf_remove_guest_from_task(task_id, guest_id) + +cuf_add_guest_to_list(list_id, guest_id, permission_level = "read") + +cuf_remove_guest_from_list(list_id, guest_id) + +cuf_add_guest_to_folder(folder_id, guest_id, permission_level = "read") + +cuf_remove_guest_from_folder(folder_id, guest_id) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-lists.Rd b/man/api-lists.Rd index 80655d0..7160c4c 100644 --- a/man/api-lists.Rd +++ b/man/api-lists.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-lists.R +% Please edit documentation in R/api-lists.R, R/df-lists.R \name{api-lists} \alias{api-lists} \alias{cu_create_list} @@ -9,6 +9,13 @@ \alias{cu_get_lists} \alias{cu_get_lists_folderless} \alias{cu_get_list} +\alias{cuf_create_list} +\alias{cuf_create_folderless_list} +\alias{cuf_update_list} +\alias{cuf_delete_list} +\alias{cuf_get_lists} +\alias{cuf_get_lists_folderless} +\alias{cuf_get_list} \title{Lists} \usage{ cu_create_list(folder_id, ...) @@ -24,6 +31,20 @@ cu_get_lists(folder_id, archived = FALSE) cu_get_lists_folderless(space_id, archived = FALSE) cu_get_list(list_id) + +cuf_create_list(folder_id, ...) + +cuf_create_folderless_list(space_id, ...) + +cuf_update_list(list_id, ...) + +cuf_delete_list(list_id, ...) + +cuf_get_lists(folder_id, archived = FALSE) + +cuf_get_lists_folderless(space_id, archived = FALSE) + +cuf_get_list(list_id) } \arguments{ \item{folder_id}{Folder ID.} diff --git a/man/api-members.Rd b/man/api-members.Rd index 62ce6c8..7b593a7 100644 --- a/man/api-members.Rd +++ b/man/api-members.Rd @@ -1,14 +1,20 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-members.R +% Please edit documentation in R/api-members.R, R/df-members.R \name{api-members} \alias{api-members} \alias{cu_get_task_members} \alias{cu_get_list_members} +\alias{cuf_get_task_members} +\alias{cuf_get_list_members} \title{Members} \usage{ cu_get_task_members(task_id) cu_get_list_members(list_id) + +cuf_get_task_members(task_id) + +cuf_get_list_members(list_id) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-sharedhierarchy.Rd b/man/api-sharedhierarchy.Rd index 12c4466..bbf38d1 100644 --- a/man/api-sharedhierarchy.Rd +++ b/man/api-sharedhierarchy.Rd @@ -1,11 +1,14 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-sharedhierarchy.R +% Please edit documentation in R/api-sharedhierarchy.R, R/df-sharedhierarchy.R \name{api-sharedhierarchy} \alias{api-sharedhierarchy} \alias{cu_get_shared} +\alias{cuf_get_shared} \title{Shared hierarchy} \usage{ cu_get_shared(team_id) + +cuf_get_shared(team_id) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-spaces.Rd b/man/api-spaces.Rd index 139c423..032e184 100644 --- a/man/api-spaces.Rd +++ b/man/api-spaces.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-spaces.R +% Please edit documentation in R/api-spaces.R, R/df-spaces.R \name{api-spaces} \alias{api-spaces} \alias{cu_create_space} @@ -7,6 +7,11 @@ \alias{cu_delete_space} \alias{cu_get_spaces} \alias{cu_get_space} +\alias{cuf_create_space} +\alias{cuf_update_space} +\alias{cuf_delete_space} +\alias{cuf_get_spaces} +\alias{cuf_get_space} \title{Spaces} \usage{ cu_create_space(team_id, name, ...) @@ -18,6 +23,20 @@ cu_delete_space(space_id) cu_get_spaces(team_id, archived = FALSE) cu_get_space(space_id) + +cuf_create_space(team_id, name, ...) + +cuf_create_space(team_id, name, ...) + +cuf_update_space(space_id, ...) + +cuf_delete_space(space_id) + +cuf_get_spaces(team_id, archived = FALSE) + +cuf_get_spaces(team_id, archived = FALSE) + +cuf_get_space(space_id) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-tags.Rd b/man/api-tags.Rd index 1185856..47e2c2d 100644 --- a/man/api-tags.Rd +++ b/man/api-tags.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-tags.R +% Please edit documentation in R/api-tags.R, R/df-tags.R \name{api-tags} \alias{api-tags} \alias{cu_get_space_tags} @@ -7,6 +7,11 @@ \alias{cu_edit_space_tag} \alias{cu_delete_space_tag} \alias{cu_add_tag_to_task} +\alias{cuf_get_space_tags} +\alias{cuf_create_space_tag} +\alias{cuf_edit_space_tag} +\alias{cuf_delete_space_tag} +\alias{cuf_add_tag_to_task} \title{Tags} \usage{ cu_get_space_tags(space_id) @@ -20,6 +25,18 @@ cu_delete_space_tag(task_id, tag_name) cu_add_tag_to_task(task_id, tag_name) cu_delete_space_tag(task_id, tag_name) + +cuf_get_space_tags(space_id) + +cuf_create_space_tag(space_id, name, ...) + +cuf_edit_space_tag(space_id, tag_name) + +cuf_delete_space_tag(task_id, tag_name) + +cuf_add_tag_to_task(task_id, tag_name) + +cuf_delete_space_tag(task_id, tag_name) } \arguments{ \item{space_id}{Space ID.} diff --git a/man/api-tasks.Rd b/man/api-tasks.Rd index 51a1e09..473b606 100644 --- a/man/api-tasks.Rd +++ b/man/api-tasks.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-tasks.R +% Please edit documentation in R/api-tasks.R, R/df-tasks.R \name{api-tasks} \alias{api-tasks} \alias{cu_create_task} @@ -8,6 +8,12 @@ \alias{cu_get_tasks} \alias{cu_get_task} \alias{cu_get_filtered_team_tasks} +\alias{cuf_create_task} +\alias{cuf_update_task} +\alias{cuf_delete_task} +\alias{cuf_get_tasks} +\alias{cuf_get_task} +\alias{cuf_get_filtered_team_tasks} \title{Tasks} \usage{ cu_create_task(list_id, ...) @@ -21,6 +27,18 @@ cu_get_tasks(list_id, archived = FALSE, ...) cu_get_task(task_id) cu_get_filtered_team_tasks(team_id, ...) + +cuf_create_task(list_id, ...) + +cuf_update_task(task_id, ...) + +cuf_delete_task(task_id) + +cuf_get_tasks(list_id, archived = FALSE, ...) + +cuf_get_task(task_id) + +cuf_get_filtered_team_tasks(team_id, ...) } \arguments{ \item{list_id}{List ID.} diff --git a/man/api-tasktemplates.Rd b/man/api-tasktemplates.Rd index 5145b61..b57e65f 100644 --- a/man/api-tasktemplates.Rd +++ b/man/api-tasktemplates.Rd @@ -1,14 +1,20 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-tasktemplates.R +% Please edit documentation in R/api-tasktemplates.R, R/df-tasktemplates.R \name{api-tasktemplates} \alias{api-tasktemplates} \alias{cu_get_task_templates} \alias{cu_create_task_from_template} +\alias{cuf_get_task_templates} +\alias{cuf_create_task_from_template} \title{Task templates} \usage{ cu_get_task_templates(team_id, page) cu_create_task_from_template(list_id, template_id, name, ...) + +cuf_get_task_templates(team_id, page) + +cuf_create_task_from_template(list_id, template_id, name, ...) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-teams.Rd b/man/api-teams.Rd index 8a48afd..6a1bc84 100644 --- a/man/api-teams.Rd +++ b/man/api-teams.Rd @@ -1,11 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-teams.R +% Please edit documentation in R/api-teams.R, R/df-teams.R \name{api-teams} \alias{api-teams} \alias{cu_get_teams} +\alias{cuf_get_teams} \title{Teams (workspaces)} \usage{ cu_get_teams() + +cuf_get_teams() + +cuf_get_teams() } \value{ A cu object. diff --git a/man/api-timetracking-2.Rd b/man/api-timetracking-2.Rd index 4c20a45..afadc97 100644 --- a/man/api-timetracking-2.Rd +++ b/man/api-timetracking-2.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-timetracking-v2.R +% Please edit documentation in R/api-timetracking-v2.R, R/df-timetracking-v2.R \name{api-timetracking-2} \alias{api-timetracking-2} \alias{cu_get_time_entries_within_date_range} @@ -15,6 +15,19 @@ \alias{cu_stop_time_entry} \alias{cu_delete_time_entry} \alias{cu_update_time_entry} +\alias{cuf_get_time_entries_within_date_range} +\alias{cuf_get_singular_time_entry} +\alias{cuf_get_time_entry_history} +\alias{cuf_get_running_time_entry} +\alias{cuf_create_time_entry} +\alias{cuf_remove_tags_from_time_entries} +\alias{cuf_get_all_tags_from_time_entries} +\alias{cuf_add_tags_from_time_entries} +\alias{cuf_change_tag_names_from_time_entries} +\alias{cuf_start_time_entry} +\alias{cuf_stop_time_entry} +\alias{cuf_delete_time_entry} +\alias{cuf_update_time_entry} \title{Time tracking 2.0} \usage{ cu_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) @@ -42,6 +55,32 @@ cu_stop_time_entry(team_id) cu_delete_time_entry(team_id, timer_id) cu_update_time_entry(team_id, timer_id, ...) + +cuf_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) + +cuf_get_singular_time_entry(team_id, timer_id) + +cuf_get_time_entry_history(team_id, timer_id) + +cuf_get_running_time_entry(team_id, timer_id) + +cuf_create_time_entry(team_id, ...) + +cuf_remove_tags_from_time_entries(team_id, ...) + +cuf_get_all_tags_from_time_entries(team_id) + +cuf_add_tags_from_time_entries(team_id, ...) + +cuf_change_tag_names_from_time_entries(team_id, ...) + +cuf_start_time_entry(team_id, timer_id, ...) + +cuf_stop_time_entry(team_id) + +cuf_delete_time_entry(team_id, timer_id) + +cuf_update_time_entry(team_id, timer_id, ...) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-timetracking-legacy.Rd b/man/api-timetracking-legacy.Rd index 85a0bcb..56e191d 100644 --- a/man/api-timetracking-legacy.Rd +++ b/man/api-timetracking-legacy.Rd @@ -1,11 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-timetracking-legacy.R +% Please edit documentation in R/api-timetracking-legacy.R, +% R/df-timetracking-legacy.R \name{api-timetracking-legacy} \alias{api-timetracking-legacy} \alias{cu_track_time} \alias{cu_get_tracked_time} \alias{cu_edit_time_tracked} \alias{cu_delete_time_tracked} +\alias{cuf_track_time} +\alias{cuf_get_tracked_time} +\alias{cuf_edit_time_tracked} +\alias{cuf_delete_time_tracked} \title{Time tracking legacy} \usage{ cu_track_time(task_id, ...) @@ -15,6 +20,14 @@ cu_get_tracked_time(task_id) cu_edit_time_tracked(task_id, interval_id, ...) cu_delete_time_tracked(task_id, interval_id) + +cuf_track_time(task_id, ...) + +cuf_get_tracked_time(task_id) + +cuf_edit_time_tracked(task_id, interval_id, ...) + +cuf_delete_time_tracked(task_id, interval_id) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-users.Rd b/man/api-users.Rd index 7e28e67..3fa60e0 100644 --- a/man/api-users.Rd +++ b/man/api-users.Rd @@ -1,11 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-users.R +% Please edit documentation in R/api-users.R, R/df-users.R \name{api-users} \alias{api-users} \alias{cu_invite_user_to_workspace} \alias{cu_edit_user_on_workspace} \alias{cu_remove_user_from_workspace} \alias{cu_get_user} +\alias{cuf_invite_user_to_workspace} +\alias{cuf_edit_user_on_workspace} +\alias{cuf_remove_user_from_workspace} +\alias{cuf_get_user} \title{Users} \usage{ cu_invite_user_to_workspace(team_id, email, admin = FALSE, ...) @@ -15,6 +19,14 @@ cu_edit_user_on_workspace(team_id, user_id, username, admin = FALSE, ...) cu_remove_user_from_workspace(team_id, user_id) cu_get_user(team_id, user_id) + +cuf_invite_user_to_workspace(team_id, email, admin = FALSE, ...) + +cuf_edit_user_on_workspace(team_id, user_id, username, admin = FALSE, ...) + +cuf_remove_user_from_workspace(team_id, user_id) + +cuf_get_user(team_id, user_id) } \arguments{ \item{team_id}{Team (workspace) ID.} diff --git a/man/api-views.Rd b/man/api-views.Rd index 0693f7a..e34a573 100644 --- a/man/api-views.Rd +++ b/man/api-views.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-views.R +% Please edit documentation in R/api-views.R, R/df-views.R \name{api-views} \alias{api-views} \alias{cu_create_team_view} @@ -14,6 +14,18 @@ \alias{cu_get_view_tasks} \alias{cu_update_view} \alias{cu_delete_view} +\alias{cuf_create_team_view} +\alias{cuf_create_space_view} +\alias{cuf_create_folder_view} +\alias{cuf_create_list_view} +\alias{cuf_get_team_views} +\alias{cuf_get_space_views} +\alias{cuf_get_folder_views} +\alias{cuf_get_list_views} +\alias{cuf_get_view} +\alias{cuf_get_view_tasks} +\alias{cuf_update_view} +\alias{cuf_delete_view} \title{Views} \usage{ cu_create_team_view(team_id, name, ...) @@ -39,6 +51,30 @@ cu_get_view_tasks(view_id, page) cu_update_view(view_id, ...) cu_delete_view(view_id) + +cuf_create_team_view(team_id, name, ...) + +cuf_create_space_view(space_id, name, ...) + +cuf_create_folder_view(folder_id, name, ...) + +cuf_create_list_view(list_id, name, ...) + +cuf_get_team_views(team_id) + +cuf_get_space_views(space_id) + +cuf_get_folder_views(folder_id) + +cuf_get_list_views(list_id) + +cuf_get_view(view_id) + +cuf_get_view_tasks(view_id, page) + +cuf_update_view(view_id, ...) + +cuf_delete_view(view_id) } \arguments{ \item{team_id}{Team (workspace) ID.} diff --git a/man/api-webhooks.Rd b/man/api-webhooks.Rd index 8e65285..9cb1ab2 100644 --- a/man/api-webhooks.Rd +++ b/man/api-webhooks.Rd @@ -1,11 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/api-webhooks.R +% Please edit documentation in R/api-webhooks.R, R/df-webhooks.R \name{api-webhooks} \alias{api-webhooks} \alias{cu_create_webhook} \alias{cu_update_webhook} \alias{cu_delete_webhook} \alias{cu_get_webhooks} +\alias{cuf_create_webhook} +\alias{cuf_update_webhook} +\alias{cuf_delete_webhook} +\alias{cuf_get_webhooks} \title{Webhooks} \usage{ cu_create_webhook(team_id, endpoint, events = "*", ...) @@ -15,6 +19,14 @@ cu_update_webhook(webhook_id, ...) cu_delete_webhook(webhook_id) cu_get_webhooks(team_id) + +cuf_create_webhook(team_id, endpoint, events = "*", ...) + +cuf_update_webhook(webhook_id, ...) + +cuf_delete_webhook(webhook_id) + +cuf_get_webhooks(team_id) } \arguments{ \item{team_id}{Team ID.} From 5929d522862cb8a37fab63c7c18648a725323ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:05:25 +0200 Subject: [PATCH 009/137] cuf_get_teams() --- R/df-teams.R | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/R/df-teams.R b/R/df-teams.R index 98be21f..855e0c1 100644 --- a/R/df-teams.R +++ b/R/df-teams.R @@ -8,17 +8,11 @@ ## For compatablitly, the term team is still used in this API. ## This is NOT the new "Teams" feature which represents a group of users. cuf_get_teams <- function() { - .cu_get("team") + out <- cu_get_teams() + tibblify(out$teams, teams_spec) } #cuf_get_workspaces <- cu_get_teams -#' @rdname api-teams -#' @export -cuf_get_teams <- function() { - out <- cu_get_teams()$teams - tibblify(out, teams_spec) -} - teams_spec <- lcols( id = lcol_chr("id"), name = lcol_chr("name"), From a5f66758f3046ffa8af56befc33dfcefc58e29ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:08:41 +0200 Subject: [PATCH 010/137] Spaces --- R/df-spaces.R | 58 ++++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 45 deletions(-) diff --git a/R/df-spaces.R b/R/df-spaces.R index 272af48..4c7ee59 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -1,7 +1,3 @@ - -#' @rdname api-spaces -NULL - #' @export #' @rdname api-spaces ## Spaces / Create Space @@ -49,14 +45,6 @@ NULL ## } ## } ## } -cuf_create_space <- function(team_id, name, ...) { - .cu_post("team", team_id, "space", - body=list(name=name, ...)) -} - - -#' @export -#' @rdname api-spaces cuf_create_space <- function(team_id, name, ...) { out <- cu_create_space(team_id, name, ...) tibblify(list(out), spaces_spec) @@ -74,21 +62,8 @@ cuf_create_space <- function(team_id, name, ...) { ## ## Same body as for cu_create_space cuf_update_space <- function(space_id, ...) { - .cu_put("space", space_id, - body=list(...)) -} - - -#' @export -#' @rdname api-spaces -## Spaces / Delete Space -## DELETE https://api.clickup.com/api/v2/space/space_id -## -## space_id -## Example: 790. -## Number -cuf_delete_space <- function(space_id) { - .cu_delete("space", space_id) + out <- cu_update_space(team_id, name, ...) + tibblify(list(out), spaces_spec) } @@ -105,16 +80,21 @@ cuf_delete_space <- function(space_id) { ## Example: false. ## Boolean cuf_get_spaces <- function(team_id, archived=FALSE) { - .cu_get("team", team_id, "space", - query = list("archived" = tolower(archived))) + out <- cu_get_spaces(team_id, archived) + tibblify(out$spaces, spaces_spec) } - #' @export #' @rdname api-spaces -cuf_get_spaces <- function(team_id, archived=FALSE) { - out <- cu_get_spaces(team_id, archived)$spaces - tibblify(out, spaces_spec) +## Spaces / Get Space +## GET https://api.clickup.com/api/v2/space/space_id +## +## space_id +## Example: 790. +## Number +cuf_get_space <- function(space_id) { + out <- cu_get_space(space_id) + tibblify(list(out), spaces_spec) } spaces_spec <- lcols( @@ -180,15 +160,3 @@ spaces_spec <- lcols( ) ) ) - -#' @export -#' @rdname api-spaces -## Spaces / Get Space -## GET https://api.clickup.com/api/v2/space/space_id -## -## space_id -## Example: 790. -## Number -cuf_get_space <- function(space_id) { - .cu_get("space", space_id) -} From 195a8404bbe6293069b3f14021b0a3c27afeabea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:13:36 +0200 Subject: [PATCH 011/137] Folders --- R/df-folders.R | 156 ++++++++++++++++++++++--------------------------- 1 file changed, 70 insertions(+), 86 deletions(-) diff --git a/R/df-folders.R b/R/df-folders.R index 71dbf3d..8931a36 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -17,8 +17,8 @@ NULL ## "name": "New Folder Name" ## } cuf_create_folder <- function(space_id, name) { - .cu_post("space", space_id, "folder", - body=list(name=name)) + out <- cu_create_folder(space_id, name) + tibblify(list(out), spec_folder) } @@ -37,21 +37,8 @@ cuf_create_folder <- function(space_id, name) { ## "name": "Updated Folder Name" ## } cuf_update_folder <- function(folder_id, name) { - .cu_put("folder", folder_id, - body=list(name=name)) -} - - -#' @export -#' @rdname api-folders -## Folders / Delete Folder -## DELETE https://api.clickup.com/api/v2/folder/folder_id -## -## folder_id -## Example: 457. -## Number -cuf_delete_folder <- function(folder_id, name) { - .cu_delete("folder", folder_id) + out <- cu_update_folder(folder_id, name) + tibblify(list(out), spec_folder) } @@ -68,93 +55,90 @@ cuf_delete_folder <- function(folder_id, name) { ## Example: false. ## Boolean cuf_get_folders <- function(space_id, archived=FALSE) { - .cu_get("space", space_id, "folder", - query = list("archived" = tolower(archived))) + out <- cu_get_folders(space_id, archived) + tibblify(out$folders, spec_folder) } + #' @export #' @rdname api-folders -cuf_get_folders <- function(team_id, archived=FALSE) { - out <- cu_get_folders(team_id, archived)$folders - tibblify(out, lcols( +## Folders / Get Folder +## GET https://api.clickup.com/api/v2/folder/folder_id +## +## folder_id +## Example: 457. +## Number +cuf_get_folder <- function(folder_id) { + out <- cu_get_folder(folder_id) + tibblify(list(out), spec_folder) +} + + + +spec_folder <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + override_statuses = lcol_lgl("override_statuses"), + hidden = lcol_lgl("hidden"), + space = lcol_df( + "space", + id = lcol_chr("id"), + name = lcol_chr("name") + ), + task_count = lcol_chr("task_count"), + archived = lcol_lgl("archived"), + statuses = lcol_df_lst( + "statuses", + id = lcol_chr("id"), + status = lcol_chr("status"), + type = lcol_chr("type"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color"), + .default = NULL + ), + lists = lcol_df_lst( + "lists", id = lcol_chr("id"), name = lcol_chr("name"), orderindex = lcol_int("orderindex"), - override_statuses = lcol_lgl("override_statuses"), - hidden = lcol_lgl("hidden"), + content = lcol_chr("content", .default = NA_character_), + status = lcol_df( + "status", + status = lcol_chr("status", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + .default = NULL + ), + priority = lcol_guess("priority", .default = NULL), + assignee = lcol_df( + "assignee", + color = lcol_chr("color", .default = NA_character_), + username = lcol_chr("username", .default = NA_character_), + initials = lcol_chr("initials", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + .default = NULL + ), + task_count = lcol_int("task_count"), + due_date = lcol_chr("due_date", .default = NA_character_), + start_date = lcol_chr("start_date", .default = NA_character_), space = lcol_df( "space", id = lcol_chr("id"), - name = lcol_chr("name") + name = lcol_chr("name"), + access = lcol_lgl("access") ), - task_count = lcol_chr("task_count"), archived = lcol_lgl("archived"), + override_statuses = lcol_lgl("override_statuses", .default = NA), statuses = lcol_df_lst( "statuses", id = lcol_chr("id"), status = lcol_chr("status"), - type = lcol_chr("type"), orderindex = lcol_int("orderindex"), color = lcol_chr("color"), - .default = NULL - ), - lists = lcol_df_lst( - "lists", - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), - content = lcol_chr("content", .default = NA_character_), - status = lcol_df( - "status", - status = lcol_chr("status", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - .default = NULL - ), - priority = lcol_guess("priority", .default = NULL), - assignee = lcol_df( - "assignee", - color = lcol_chr("color", .default = NA_character_), - username = lcol_chr("username", .default = NA_character_), - initials = lcol_chr("initials", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL - ), - task_count = lcol_int("task_count"), - due_date = lcol_chr("due_date", .default = NA_character_), - start_date = lcol_chr("start_date", .default = NA_character_), - space = lcol_df( - "space", - id = lcol_chr("id"), - name = lcol_chr("name"), - access = lcol_lgl("access") - ), - archived = lcol_lgl("archived"), - override_statuses = lcol_lgl("override_statuses", .default = NA), - statuses = lcol_df_lst( - "statuses", - id = lcol_chr("id"), - status = lcol_chr("status"), - orderindex = lcol_int("orderindex"), - color = lcol_chr("color"), - type = lcol_chr("type") - ), - permission_level = lcol_chr("permission_level") + type = lcol_chr("type") ), permission_level = lcol_chr("permission_level") - )) -} - - - -#' @export -#' @rdname api-folders -## Folders / Get Folder -## GET https://api.clickup.com/api/v2/folder/folder_id -## -## folder_id -## Example: 457. -## Number -cuf_get_folder <- function(folder_id) { - .cu_get("folder", folder_id) -} + ), + permission_level = lcol_chr("permission_level") +) From be40451b9127957b2059e8aa2ed396f68ed2bd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:38:07 +0200 Subject: [PATCH 012/137] Clean up --- R/df-attachments.R | 10 -- R/df-authorization.R | 20 --- R/df-checklists.R | 56 ------- R/df-comments.R | 81 ---------- R/df-customfields.R | 39 ----- R/df-dependencies.R | 51 ------ R/df-folders.R | 40 ----- R/df-goals.R | 107 ------------ R/df-guests.R | 134 --------------- R/df-lists.R | 97 ----------- R/df-members.R | 12 -- R/df-sharedhierarchy.R | 11 -- R/df-spaces.R | 68 -------- R/df-tags.R | 62 ------- R/df-tasks.R | 261 ------------------------------ R/df-tasktemplates.R | 28 ---- R/df-teams.R | 6 - R/df-timetracking-legacy.R | 59 ------- R/df-timetracking-v2.R | 174 -------------------- R/df-users.R | 50 ------ R/df-views.R | 323 ------------------------------------- R/df-webhooks.R | 75 --------- 22 files changed, 1764 deletions(-) diff --git a/R/df-attachments.R b/R/df-attachments.R index 67929de..e20d29f 100644 --- a/R/df-attachments.R +++ b/R/df-attachments.R @@ -2,17 +2,7 @@ #' @export #' @rdname api-attachment -## API documentation is actually incorrect about showing the curl request. -## The correct curl is this: -## -## curl --location \ -## --request POST 'https://api.clickup.com/api/v2/task/task_id/attachment' \ -## --header 'Authorization: pk_xx_xxx' \ -## --header 'Content-Type: multipart/form-data' \ -## --form 'filename=imagefilename.png' \ -## --form 'attachment=@/path/to/the/file/example.png' -## ... can be used to pass type argument to httr::upload_file cuf_post_task_attachment <- function(task_id, attachment, filename=NULL, ...) { task_id <- cu_task_id(task_id) if (is.null(filename)) diff --git a/R/df-authorization.R b/R/df-authorization.R index c90c433..bfda504 100644 --- a/R/df-authorization.R +++ b/R/df-authorization.R @@ -4,19 +4,6 @@ NULL #' @export #' @rdname api-authorization -## Authorization / Get Access Token -## POST https://api.clickup.com/api/v2/oauth/token?client_id=&client_secret=&code= -## client_id -## Oauth app client id -## String -## -## client_secret -## Oauth app client secret -## String -## -## code -## Code given in redirect url -## String cuf_get_access_token <- function(client_id, client_secret, code) { .cu_post("oauth", "token", query=list(client_id=client_id, @@ -27,8 +14,6 @@ cuf_get_access_token <- function(client_id, client_secret, code) { #' @export #' @rdname api-authorization -## Authorization / Get Authorized User -## GET https://api.clickup.com/api/v2/user cuf_get_authorized_user <- function() { .cu_get("user") } @@ -36,11 +21,6 @@ cuf_get_authorized_user <- function() { #' @export #' @rdname api-authorization -## Authorization / Get Authorized Teams -## GET https://api.clickup.com/api/v2/team -## -## Note: this is the same endpoint as for cu_get_teams -## cuf_get_authorized_teams <- function() { .cu_get("team") } diff --git a/R/df-checklists.R b/R/df-checklists.R index ebcdfe1..f9f5872 100644 --- a/R/df-checklists.R +++ b/R/df-checklists.R @@ -4,9 +4,6 @@ NULL #' @export #' @rdname api-checklists -## Checklists / Create Checklist -## POST https://api.clickup.com/api/v2/task/task_id/checklist -## task_id Example: 9hz. String cuf_create_checklist <- function(task_id, name) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "checklist", @@ -17,15 +14,6 @@ cuf_create_checklist <- function(task_id, name) { #' @export #' @rdname api-checklists -## Checklists / Edit Checklist -## PUT https://api.clickup.com/api/v2/checklist/checklist_id -## checklist_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. -## String -## position is the zero-based index of the order you want the checklist -## to exist on the task. If you want the checklist to be in the first -## position, pass '{ "position": 0 }' cuf_edit_checklist <- function(checklist_id, position) { .cu_put("checklist", checklist_id, body=list(position = position)) @@ -35,11 +23,6 @@ cuf_edit_checklist <- function(checklist_id, position) { #' @export #' @rdname api-checklists -## Checklists / Delete Checklist -## DELETE https://api.clickup.com/api/v2/checklist/checklist_id -## checklist_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. String cuf_delete_checklist <- function(checklist_id) { .cu_delete("checklist", checklist_id) } @@ -48,20 +31,6 @@ cuf_delete_checklist <- function(checklist_id) { #' @export #' @rdname api-checklists -## Checklists / Create Checklist Item -## POST https://api.clickup.com/api/v2/checklist/checklist_id/checklist_item -## checklist_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. -## String -## -## Body: -## { -## "name": "Updated Checklist Item", -## "assignee": null, -## "resolved": true, -## "parent": null -## } cuf_create_checklist_item <- function(checklist_id, name, ...) { .cu_post("checklist", checklist_id, "checklist_item", body=list(name = name, ...)) @@ -77,20 +46,6 @@ cuf_create_checklist_item <- function(checklist_id, name, ...) { #' @export #' @rdname api-checklists -## Checklists / Edit Checklist Item -## PUT https://api.clickup.com/api/v2/checklist/checklist_id/checklist_item/checklist_item_id -## checklist_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. -## String -## -## checklist_item_id -## e491-47f5-9fd8-d1dc4cedcc6f (uuid) -## Example: 21e08dc8. -## String -## -## parent is another checklist item that you want to nest the -## target checklist item underneath. cuf_edit_checklist_item <- function(checklist_id, checklist_item_id, ...) { .cu_put("checklist", checklist_id, "checklist_item", checklist_item_id, body=list(...)) @@ -102,17 +57,6 @@ cuf_edit_checklist_item <- function(checklist_id, checklist_item_id, ...) { #' @export #' @rdname api-checklists -## Checklists / Delete Checklist Item -## DELETE https://api.clickup.com/api/v2/checklist/checklist_id/checklist_item/checklist_item_id -## checklist_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. -## String -## -## checklist_item_id -## e491-47f5-9fd8-d1dc4cedcc6f (uuid) -## Example: 21e08dc8. -## String cuf_delete_checklist_item <- function(checklist_id, checklist_item_id) { .cu_delete("checklist", checklist_id, "checklist_item", checklist_item_id) } diff --git a/R/df-comments.R b/R/df-comments.R index ca6fc92..2f8c232 100644 --- a/R/df-comments.R +++ b/R/df-comments.R @@ -4,21 +4,6 @@ NULL #' @export #' @rdname api-comments -## Comments / Post Task Comment -## POST https://api.clickup.com/api/v2/task/task_id/comment -## task_id -## Example: 9hz. -## String -## -## If notify_all is true, creation notifications will be sent to -## everyone including the creator of the comment. -## -## Body -## { -## "comment_text": "Task comment content", -## "assignee": 183, -## "notify_all": true -## } cuf_post_task_comment <- function(task_id, ...) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "comment", @@ -28,22 +13,6 @@ cuf_post_task_comment <- function(task_id, ...) { #' @export #' @rdname api-comments -## Comments / Post View Comment -## POST https://api.clickup.com/api/v2/view/view_id/comment -## view_id -## 105 (string) -## Example: 3c. -## String -## -## If notify_all is true, creation notifications will be sent to -## everyone including the creator of the comment. -## -## Body -## -## { -## "comment_text": "View comment content", -## "notify_all": true -## } cuf_post_view_comment <- function(view_id, ...) { .cu_post("view", view_id, "comment", body=list(...)) @@ -52,22 +21,6 @@ cuf_post_view_comment <- function(view_id, ...) { #' @export #' @rdname api-comments -## Comments / Post List Comment -## POST https://api.clickup.com/api/v2/list/list_id/comment -## list_id -## Example: 124. -## Number -## -## If notify_all is true, creation notifications will be sent to -## everyone including the creator of the comment. -## -## Body -## -## { -## "comment_text": "List comment content", -## "assignee": 183, -## "notify_all": true -## } cuf_post_list_comment <- function(list_id, ...) { .cu_post("list", list_id, "comment", body=list(...)) @@ -76,11 +29,6 @@ cuf_post_list_comment <- function(list_id, ...) { #' @export #' @rdname api-comments -## Comments / Get Task Comments -## GET https://api.clickup.com/api/v2/task/task_id/comment -## task_id -## Example: 9hz. -## String cuf_get_task_comments <- function(task_id) { task_id <- cu_task_id(task_id) .cu_get("task", task_id, "comment") @@ -89,12 +37,6 @@ cuf_get_task_comments <- function(task_id) { #' @export #' @rdname api-comments -## Comments / Get View Comments -## GET https://api.clickup.com/api/v2/view/view_id/comment -## view_id -## 105 (string) -## Example: 3c. -## String cuf_get_view_comments <- function(view_id) { .cu_get("view", view_id, "comment") } @@ -102,11 +44,6 @@ cuf_get_view_comments <- function(view_id) { #' @export #' @rdname api-comments -## Comments / Get List Comments -## GET https://api.clickup.com/api/v2/list/list_id/comment -## list_id -## Example: 124. -## Number cuf_get_list_comments <- function(list_id) { .cu_get("list", list_id, "comment") } @@ -114,19 +51,6 @@ cuf_get_list_comments <- function(list_id) { #' @export #' @rdname api-comments -## Comments / Update Comment -## PUT https://api.clickup.com/api/v2/comment/comment_id -## comment_id -## Example: 456. -## Number -## -## Body -## -## { -## "comment_text": "Updated comment text" -## "assignee": 183, -## "resolved": true -## } cuf_put_update_comment <- function(comment_id, ...) { .cu_put("comment", comment_id, body=list(...)) @@ -135,11 +59,6 @@ cuf_put_update_comment <- function(comment_id, ...) { #' @export #' @rdname api-comments -## Comments / Delete Comment -## DELET Ehttps://api.clickup.com/api/v2/comment/comment_id -## comment_id -## Example: 456. -## Number cuf_delete_comment <- function(comment_id) { .cu_delete("comment", comment_id) } diff --git a/R/df-customfields.R b/R/df-customfields.R index d9ab171..db29336 100644 --- a/R/df-customfields.R +++ b/R/df-customfields.R @@ -4,11 +4,6 @@ NULL #' @export #' @rdname api-customfields -## Custom Fields / Get Accessible Custom Fields -## GET https://api.clickup.com/api/v2/list/list_id/field -## list_id -## Example: 123. -## Number cuf_get_accessible_custom_fields <- function(list_id) { .cu_get("list", list_id, "field") } @@ -16,26 +11,6 @@ cuf_get_accessible_custom_fields <- function(list_id) { #' @export #' @rdname api-customfields -## Custom Fields / Set Custom Field Value -## POST https://api.clickup.com/api/v2/task/task_id/field/field_id -## -## task_id -## Example: 9hv. -## String -## -## field_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. -## String -## -## The accessible fields can be found on the task object from the -## get task route. This is where you can retrieve the field_id. -## -## Body -## -## { -## "value": 80 -## } #cu_set_custom_field_value cuf_set_custom_field_value <- function(task_id, field_id, ...) { task_id <- cu_task_id(task_id) @@ -46,20 +21,6 @@ cuf_set_custom_field_value <- function(task_id, field_id, ...) { #' @export #' @rdname api-customfields -## Custom Fields / Remove Custom Field Value -## DELETE https://api.clickup.com/api/v2/task/task_id/field/field_id -## -## task_id -## Example: 9hv. -## String -## -## field_id -## b8a8-48d8-a0c6-b4200788a683 (uuid) -## Example: b955c4dc. -## String -## -## The accessible fields can be found on the task object from the -## get task route. This is where you can retrieve the field_id cuf_remove_field_value <- function(task_id, field_id) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "field", field_id) diff --git a/R/df-dependencies.R b/R/df-dependencies.R index e5dbc14..e76e6b9 100644 --- a/R/df-dependencies.R +++ b/R/df-dependencies.R @@ -4,20 +4,6 @@ NULL #' @export #' @rdname api-dependencies -## Dependencies / Add Dependency -## POST https://api.clickup.com/api/v2/task/task_id/dependency -## -## task_id -## Example: 9hv. -## String -## -## To create a waiting on dependency, pass the property depends_on in the body. -## To create a blocking dependency, pass the property dependency_of. -## Both can not be passed in the same request. -## -## { -## "depends_on": "9hw" -## } cuf_add_dependency <- function(task_id, depends_on, dependency_of) { task_id <- cu_task_id(task_id) if (missing(depends_on) && missing(dependency_of)) @@ -35,23 +21,6 @@ cuf_add_dependency <- function(task_id, depends_on, dependency_of) { #' @export #' @rdname api-dependencies -## Dependencies / Delete Dependency -## DELETE https://api.clickup.com/api/v2/task/task_id/dependency?depends_on=9hz&dependency_of=9hz -## -## task_id -## Example: 9hv. -## String -## -## depends_on -## Example: 9hz. -## String -## -## dependency_of -## Example: 9hz. -## String -## -## One and only one of depends_on or dependency_of must be passed in the -## query params. cuf_delete_dependency <- function(task_id, depends_on, dependency_of) { task_id <- cu_task_id(task_id) if (missing(depends_on) && missing(dependency_of)) @@ -69,16 +38,6 @@ cuf_delete_dependency <- function(task_id, depends_on, dependency_of) { #' @export #' @rdname api-dependencies -## Dependencies / Add Task Link -## POST https://api.clickup.com/api/v2/task/task_id/link/links_to -## -## task_id -## Example: 9hv. -## String -## -## links_to -## Example: 9hz. -## String cuf_add_task_link <- function(task_id, links_to) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "link", links_to) @@ -87,16 +46,6 @@ cuf_add_task_link <- function(task_id, links_to) { #' @export #' @rdname api-dependencies -## Dependencies / Delete Task Link -## DELETE https://api.clickup.com/api/v2/task/task_id/link/links_to -## -## task_id -## Example: 9hv. -## String -## -## links_to -## Example: 9hz. -## String cuf_delete_dependency <- function(task_id, links_to) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "link", links_to) diff --git a/R/df-folders.R b/R/df-folders.R index 8931a36..dab99a2 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -4,18 +4,6 @@ NULL #' @export #' @rdname api-folders -## Folders / Create Folder -## POST https://api.clickup.com/api/v2/space/space_id/folder -## -## space_id -## Example: 789. -## Number -## -## Body -## -## { -## "name": "New Folder Name" -## } cuf_create_folder <- function(space_id, name) { out <- cu_create_folder(space_id, name) tibblify(list(out), spec_folder) @@ -24,18 +12,6 @@ cuf_create_folder <- function(space_id, name) { #' @export #' @rdname api-folders -## Folders / Update Folder -## PUT https://api.clickup.com/api/v2/folder/folder_id -## -## folder_id -## Example: 457. -## Number -## -## Body -## -## { -## "name": "Updated Folder Name" -## } cuf_update_folder <- function(folder_id, name) { out <- cu_update_folder(folder_id, name) tibblify(list(out), spec_folder) @@ -44,16 +20,6 @@ cuf_update_folder <- function(folder_id, name) { #' @export #' @rdname api-folders -## Folders / Get Folders -## GET https://api.clickup.com/api/v2/space/space_id/folder?archived=false -## -## space_id -## Example: 789. -## Number -## -## archived -## Example: false. -## Boolean cuf_get_folders <- function(space_id, archived=FALSE) { out <- cu_get_folders(space_id, archived) tibblify(out$folders, spec_folder) @@ -63,12 +29,6 @@ cuf_get_folders <- function(space_id, archived=FALSE) { #' @export #' @rdname api-folders -## Folders / Get Folder -## GET https://api.clickup.com/api/v2/folder/folder_id -## -## folder_id -## Example: 457. -## Number cuf_get_folder <- function(folder_id) { out <- cu_get_folder(folder_id) tibblify(list(out), spec_folder) diff --git a/R/df-goals.R b/R/df-goals.R index 5b83e68..a160dcb 100644 --- a/R/df-goals.R +++ b/R/df-goals.R @@ -4,25 +4,6 @@ NULL #' @export #' @rdname api-goals -## Goals / Create Goal -## POST https://api.clickup.com/api/v2/team/team_id/goal -## -## team_id -## Example: 512. -## Number -## -## Body -## -## { -## "name": "Goal Name", -## "due_date": 1568036964079, -## "description": "Goal Description", -## "multiple_owners": true, -## "owners": [ -## 183 -## ], -## "color": "#32a852" -## } cuf_create_goal <- function(team_id, ...) { .cu_post("team", team_id, "goal", body=list(...)) @@ -31,24 +12,6 @@ cuf_create_goal <- function(team_id, ...) { #' @export #' @rdname api-goals -## Goals / Update Goal -## PUT https://api.clickup.com/api/v2/goal/goal_id -## -## goal_id -## 900e-462d-a849-4a216b06d930 (uuid) -## Example: e53a033c. -## String -## -## Body -## -## { -## "name": "Updated Goal Name", -## "due_date": 1568036964079, -## "description": "Updated Goal Description", -## "rem_owners": [183], -## "add_owners": [182] -## "color": "#32a852" -## } cuf_update_goal <- function(goal_id, ...) { .cu_put("goal", goal_id, body=list(...)) @@ -57,13 +20,6 @@ cuf_update_goal <- function(goal_id, ...) { #' @export #' @rdname api-goals -## Goals / Delete Goal -## DELETE https://api.clickup.com/api/v2/goal/goal_id -## -## goal_id -## 900e-462d-a849-4a216b06d930 (uuid) -## Example: e53a033c. -## String cuf_delete_goal <- function(goal_id) { .cu_delete("goal", goal_id) } @@ -71,12 +27,6 @@ cuf_delete_goal <- function(goal_id) { #' @export #' @rdname api-goals -## Goals / Get Goals -## GET https://api.clickup.com/api/v2/team/team_id/goal -## -## team_id -## Example: 512. -## Number cuf_get_goals <- function(team_id) { .cu_get("team", team_id, "goal") } @@ -84,13 +34,6 @@ cuf_get_goals <- function(team_id) { #' @export #' @rdname api-goals -## Goals / Get Goal -## GET https://api.clickup.com/api/v2/goal/goal_id -## -## goal_id -## 900e-462d-a849-4a216b06d930 (uuid) -## Example: e53a033c. -## String cuf_get_goal <- function(goal_id) { .cu_get("goal", goal_id) } @@ -98,32 +41,6 @@ cuf_get_goal <- function(goal_id) { #' @export #' @rdname api-goals -## Goals / Create Key Result -## POST https://api.clickup.com/api/v2/goal/goal_id/key_result -## -## goal_id -## 900e-462d-a849-4a216b06d930 (uuid) -## Example: e53a033c. -## String -## -## Key result types can be number, currency, boolean, percentage, -## or automatic. The task ID's array and list ID's array can be used -## to attach resources to the goal. -## -## Body -## -## { -## "name": "New Key Result Name", -## "owners": [ -## 183 -## ], -## "type": "number", -## "steps_start": 0, -## "steps_end": 10, -## "unit": "km", -## "task_ids": [], -## "list_ids": [] -## } cuf_create_key_result <- function(goal_id, ...) { .cu_post("goal", goal_id, "key_result", body=list(...)) @@ -132,23 +49,6 @@ cuf_create_key_result <- function(goal_id, ...) { #' @export #' @rdname api-goals -## Goals / Edit Key Result -## PUT https://api.clickup.com/api/v2/key_result/key_result_id -## -## key_result_id -## 8480-49bc-8c57-e569747efe93 (uuid) -## Example: 947d46ed. -## String -## -## All properties available in the create key result route may -## also be used along with the additional properties below. -## -## Body -## -## { -## "steps_current": 5, -## "note": "Target achieved" -## } cuf_edit_key_result <- function(key_result_id, ...) { .cu_put("key_result", key_result_id, body=list(...)) @@ -157,13 +57,6 @@ cuf_edit_key_result <- function(key_result_id, ...) { #' @export #' @rdname api-goals -## Goals / Delete Key Result -## DELETE https://api.clickup.com/api/v2/key_result/key_result_id -## -## key_result_id -## 8480-49bc-8c57-e569747efe93 (uuid) -## Example: 947d46ed. -## String cuf_delete_key_result <- function(key_result_id) { .cu_delete("key_result", key_result_id) } diff --git a/R/df-guests.R b/R/df-guests.R index 041b8cc..e00fbb8 100644 --- a/R/df-guests.R +++ b/R/df-guests.R @@ -4,16 +4,6 @@ NULL #' @export #' @rdname api-guests -## Guests / Invite Guest To Workspace -## POST https://api.clickup.com/api/v2/team/team_id/guest -## -## team_id -## Example: 333. -## Number -## -## Note: not sure how this is supposed to work without email -## e.g. cu_invite_user_to_workspace(team_id, email) -## cuf_invite_guest_to_workspace <- function(team_id) { .cu_post("team", team_id, "guest") } @@ -21,25 +11,6 @@ cuf_invite_guest_to_workspace <- function(team_id) { #' @export #' @rdname api-guests -## Guests / Edit Guest On Workspace -## PUT https://api.clickup.com/api/v2/team/team_id/guest/guest_id -## -## team_id -## Example: 333. -## Number -## -## guest_id -## Example: 403. -## Number -## -## Body -## -## { -## "username": "Guest User", -## "can_edit_tags": true, -## "can_see_time_spent": true, -## "can_see_time_estimated": true -## } cuf_edit_guest_on_workspace <- function(team_id, guest_id, ...) { .cu_put("team", team_id, "guest", guest_id, body=list(...)) @@ -48,15 +19,6 @@ cuf_edit_guest_on_workspace <- function(team_id, guest_id, ...) { #' @export #' @rdname api-guests -## Guests / Remove Guest From Workspace -## DELETE https://api.clickup.com/api/v2/team/team_id/guest/guest_id -## -## team_id -## Example: 333. -## Number -## guest_id -## Example: 403. -## Number cuf_remove_guest_from_workspace <- function(team_id, guest_id) { .cu_delete("team", team_id, "guest", guest_id) } @@ -64,16 +26,6 @@ cuf_remove_guest_from_workspace <- function(team_id, guest_id) { #' @export #' @rdname api-guests -## Guests / Get Guest -## GET https://api.clickup.com/api/v2/team/team_id/guest/guest_id -## -## team_id -## Example: 333. -## Number -## -## guest_id -## Example: 403. -## Number cuf_get_guest <- function(team_id, guest_id) { .cu_get("team", team_id, "guest", guest_id) } @@ -81,24 +33,6 @@ cuf_get_guest <- function(team_id, guest_id) { #' @export #' @rdname api-guests -## Guests / Add Guest To Task -## POST https://api.clickup.com/api/v2/task/task_id/guest/guest_id -## -## task_id -## Example: c04. -## String -## -## guest_id -## Example: 403. -## Number -## -## permisson_level can be read, comment, edit, or create -## -## Body -## -## { -## "permission_level": "read" -## } cuf_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { task_id <- cu_task_id(task_id) permission_level <- match.arg(permission_level, @@ -110,16 +44,6 @@ cuf_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { #' @export #' @rdname api-guests -## Guests / Remove Guest From Task -## DELETE https://api.clickup.com/api/v2/task/task_id/guest/guest_id -## -## task_id -## Example: c04. -## String -## -## guest_id -## Example: 403. -## Number cuf_remove_guest_from_task <- function(task_id, guest_id) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "guest", guest_id) @@ -128,24 +52,6 @@ cuf_remove_guest_from_task <- function(task_id, guest_id) { #' @export #' @rdname api-guests -## Guests / Add Guest To List -## POST https://api.clickup.com/api/v2/list/list_id/guest/guest_id -## -## list_id -## Example: 1427. -## Number -## -## guest_id -## Example: 403. -## Number -## -## permisson_level can be read, comment, edit, or create -## -## Body -## -## { -## "permission_level": "read" -## } cuf_add_guest_to_list <- function(list_id, guest_id, permission_level="read") { permission_level <- match.arg(permission_level, c("read", "comment", "edit", "create")) @@ -156,16 +62,6 @@ cuf_add_guest_to_list <- function(list_id, guest_id, permission_level="read") { #' @export #' @rdname api-guests -## Guests / Remove Guest From List -## DELETE https://api.clickup.com/api/v2/list/list_id/guest/guest_id -## -## list_id -## Example: 1427. -## Number -## -## guest_id -## Example: 403. -## Number cuf_remove_guest_from_list <- function(list_id, guest_id) { .cu_delete("list", list_id, "guest", guest_id) } @@ -173,24 +69,6 @@ cuf_remove_guest_from_list <- function(list_id, guest_id) { #' @export #' @rdname api-guests -## Guests / Add Guest To Folder -## POST https://api.clickup.com/api/v2/folder/folder_id/guest/guest_id -## -## folder_id -## Example: 1057. -## Number -## -## guest_id -## Example: 403. -## Number -## -## permisson_level can be read, comment, edit, or create -## -## Body -## -## { -## "permission_level": "read" -## } cuf_add_guest_to_folder <- function(folder_id, guest_id, permission_level="read") { permission_level <- match.arg(permission_level, @@ -202,18 +80,6 @@ cuf_add_guest_to_folder <- function(folder_id, guest_id, #' @export #' @rdname api-guests -## Guests / Remove Guest From Folder -## DELETE https://api.clickup.com/api/v2/folder/folder_id/guest/guest_id -## -## folder_id -## Example: 1057. -## Number -## -## guest_id -## Example: 403. -## Number -## -## cuf_remove_guest_from_folder <- function(folder_id, guest_id) { .cu_delete("folder", folder_id, "guest", guest_id) } diff --git a/R/df-lists.R b/R/df-lists.R index 13afa0a..17a39ca 100644 --- a/R/df-lists.R +++ b/R/df-lists.R @@ -4,27 +4,6 @@ NULL #' @export #' @rdname api-lists -## Lists / Create List -## POST https://api.clickup.com/api/v2/folder/folder_id/list -## -## folder_id -## Example: 456. -## Number -## -## assignee is a userid of the assignee to be added to this task. -## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. -## -## Body -## -## { -## "name": "New List Name", -## "content": "New List Content", -## "due_date": 1567780450202, -## "due_date_time": false, -## "priority": 1, -## "assignee": 183, -## "status": "red" -## } cuf_create_list <- function(folder_id, ...) { .cu_post("folder", folder_id, "list", body=list(...)) @@ -33,27 +12,6 @@ cuf_create_list <- function(folder_id, ...) { #' @export #' @rdname api-lists -## Lists / Create Folderless List -## POST https://api.clickup.com/api/v2/space/space_id/list -## -## space_id -## Example: 789. -## Number -## -## assignee is a userid of the assignee to be added to this task. -## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. -## -## Body -## -## { -## "name": "New List Name", -## "content": "New List Content", -## "due_date": 1567780450202, -## "due_date_time": false, -## "priority": 1, -## "assignee": 183, -## "status": "red" -## } cuf_create_folderless_list <- function(space_id, ...) { .cu_post("space", space_id, "list", body=list(...)) @@ -62,29 +20,6 @@ cuf_create_folderless_list <- function(space_id, ...) { #' @export #' @rdname api-lists -## Lists / Update List -## PUT https://api.clickup.com/api/v2/list/list_id -## -## list_id -## Example: 124. -## String -## -## Only pass the properties you want to update. -## It is unnessary to pass the entire list object. -## assignee is a userid of the assignee to be added to this task. -## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. -## -## Body -## -## { -## "name": "Updated List Name", -## "content": "Updated List Content", -## "due_date": 1567780450202, -## "due_date_time": true, -## "priority": 2, -## "assignee": "none", -## "unset_status": true -## } cuf_update_list <- function(list_id, ...) { .cu_put("list", list_id, body=list(...)) @@ -93,12 +28,6 @@ cuf_update_list <- function(list_id, ...) { #' @export #' @rdname api-lists -## Lists / Delete List -## DELET Ehttps://api.clickup.com/api/v2/list/list_id -## -## list_id -## Example: 124. -## Number cuf_delete_list <- function(list_id, ...) { .cu_delete("list", list_id) } @@ -106,16 +35,6 @@ cuf_delete_list <- function(list_id, ...) { #' @export #' @rdname api-lists -## Lists / Get Lists -## GET https://api.clickup.com/api/v2/folder/folder_id/list?archived=false -## -## folder_id -## Example: 456. -## Number -## -## archived -## Example: false. -## Boolean cuf_get_lists <- function(folder_id, archived=FALSE) { .cu_get("folder", folder_id, "list", query = list("archived" = tolower(archived))) @@ -124,16 +43,6 @@ cuf_get_lists <- function(folder_id, archived=FALSE) { #' @export #' @rdname api-lists -## Lists / Get Folderless Lists -## GET https://api.clickup.com/api/v2/space/space_id/list?archived=false -## -## space_id -## Example: 789. -## Number -## -## archived -## Example: false. -## Boolean cuf_get_lists_folderless <- function(space_id, archived=FALSE) { .cu_get("space", space_id, "list", query = list("archived" = tolower(archived))) @@ -142,12 +51,6 @@ cuf_get_lists_folderless <- function(space_id, archived=FALSE) { #' @export #' @rdname api-lists -## Lists / Get List -## GET https://api.clickup.com/api/v2/list/list_id -## -## list_id -## Example: 124. -## Number cuf_get_list <- function(list_id) { .cu_get("list", list_id) } diff --git a/R/df-members.R b/R/df-members.R index 262b4aa..7a73c77 100644 --- a/R/df-members.R +++ b/R/df-members.R @@ -4,12 +4,6 @@ NULL #' @export #' @rdname api-members -## Members / Get Task Members -## GET https://api.clickup.com/api/v2/task/task_id/member -## -## task_id -## Example: 9hz. -## String cuf_get_task_members <- function(task_id) { task_id <- cu_task_id(task_id) .cu_get("task", task_id, "member") @@ -18,12 +12,6 @@ cuf_get_task_members <- function(task_id) { #' @export #' @rdname api-members -## Members / Get List Members -## GET https://api.clickup.com/api/v2/list/list_id/member -## -## list_id -## Example: 123. -## Number cuf_get_list_members <- function(list_id) { .cu_get("list", list_id, "member") } diff --git a/R/df-sharedhierarchy.R b/R/df-sharedhierarchy.R index 87f41e0..e9b04c2 100644 --- a/R/df-sharedhierarchy.R +++ b/R/df-sharedhierarchy.R @@ -1,17 +1,6 @@ #' @export #' @rdname api-sharedhierarchy -## Shared Hierarchy / Shared Hierarchy -## GET https://api.clickup.com/api/v2/team/team_id/shared -## -## team_id -## Example: 333. -## Number -## -## Returns all resources you have access to where you don't have -## access to its parent. For example, if you have a access to a -## shared task, but don't have access to its parent list, it will -## come back in this request. cuf_get_shared <- function(team_id) { .cu_get("team", team_id, "shared") } diff --git a/R/df-spaces.R b/R/df-spaces.R index 4c7ee59..9b3a14d 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -1,50 +1,5 @@ #' @export #' @rdname api-spaces -## Spaces / Create Space -## POST https://api.clickup.com/api/v2/team/team_id/space -## -## team_id -## Example: 512. -## Number -## -## Body -## -## { -## "name": "New Space Name", -## "multiple_assignees": true, -## "features": { -## "due_dates": { -## "enabled": true, -## "start_date": false, -## "remap_due_dates": true, -## "remap_closed_due_date": false -## }, -## "time_tracking": { -## "enabled": false -## }, -## "tags": { -## "enabled": true -## }, -## "time_estimates": { -## "enabled": true -## }, -## "checklists": { -## "enabled": true -## }, -## "custom_fields": { -## "enabled": true -## }, -## "remap_dependencies": { -## "enabled": true -## }, -## "dependency_warning": { -## "enabled": true -## }, -## "portfolios": { -## "enabled": true -## } -## } -## } cuf_create_space <- function(team_id, name, ...) { out <- cu_create_space(team_id, name, ...) tibblify(list(out), spaces_spec) @@ -53,14 +8,6 @@ cuf_create_space <- function(team_id, name, ...) { #' @export #' @rdname api-spaces -## Spaces / Update Space -## PUT https://api.clickup.com/api/v2/space/space_id -## -## space_id -## Example: 790. -## Number -## -## Same body as for cu_create_space cuf_update_space <- function(space_id, ...) { out <- cu_update_space(team_id, name, ...) tibblify(list(out), spaces_spec) @@ -69,16 +16,7 @@ cuf_update_space <- function(space_id, ...) { #' @export #' @rdname api-spaces -## Spaces / Get Spaces ##GET https://api.clickup.com/api/v2/team/team_id/space?archived=false -## -## team_id -## Example: 512. -## Number -## -## archived -## Example: false. -## Boolean cuf_get_spaces <- function(team_id, archived=FALSE) { out <- cu_get_spaces(team_id, archived) tibblify(out$spaces, spaces_spec) @@ -86,12 +24,6 @@ cuf_get_spaces <- function(team_id, archived=FALSE) { #' @export #' @rdname api-spaces -## Spaces / Get Space -## GET https://api.clickup.com/api/v2/space/space_id -## -## space_id -## Example: 790. -## Number cuf_get_space <- function(space_id) { out <- cu_get_space(space_id) tibblify(list(out), spaces_spec) diff --git a/R/df-tags.R b/R/df-tags.R index 2dfc2fb..1378476 100644 --- a/R/df-tags.R +++ b/R/df-tags.R @@ -4,12 +4,6 @@ NULL #' @export #' @rdname api-tags -## Tags / Get Space Tags -## GET https://api.clickup.com/api/v2/space/space_id/tag -## -## space_id -## Example: 512. -## Number cuf_get_space_tags <- function(space_id) { .cu_get("space", space_id, "tag") } @@ -17,22 +11,6 @@ cuf_get_space_tags <- function(space_id) { #' @export #' @rdname api-tags -## Tags / Create Space Tag -## POST https://api.clickup.com/api/v2/space/space_id/tag -## -## space_id -## Example: 512. -## Number -## -## Body -## -## { -## "tag": { -## "name": "Tag Name", -## "tag_fg": "#000000", -## "tag_bg": "#000000" -## } -## } cuf_create_space_tag <- function(space_id, name, ...) { .cu_post("space", space_id, "tag", body=list( @@ -42,16 +20,6 @@ cuf_create_space_tag <- function(space_id, name, ...) { #' @export #' @rdname api-tags -## Tags / Edit Space Tag -## PUT https://api.clickup.com/api/v2/space/space_id/tag/tag_name -## -## space_id -## Example: 512. -## Number -## -## tag_name -## Example: name. -## String cuf_edit_space_tag <- function(space_id, tag_name) { .cu_put("space", space_id, "tag", tag_name) } @@ -59,16 +27,6 @@ cuf_edit_space_tag <- function(space_id, tag_name) { #' @export #' @rdname api-tags -## Tags / Delete Space Tag -## DELETE https://api.clickup.com/api/v2/space/space_id/tag/tag_name -## -## space_id -## Example: 512. -## Number -## -## tag_name -## Example: name. -## String cuf_delete_space_tag <- function(space_id) { .cu_delete("space", space_id, "tag", tag_name) } @@ -76,16 +34,6 @@ cuf_delete_space_tag <- function(space_id) { #' @export #' @rdname api-tags -## Tags / Add Tag To Task -## POST https://api.clickup.com/api/v2/task/task_id/tag/tag_name -## -## task_id -## Example: abc. -## String -## -## tag_name -## Example: name. -## String cuf_add_tag_to_task <- function(task_id, tag_name) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "tag", tag_name) @@ -94,16 +42,6 @@ cuf_add_tag_to_task <- function(task_id, tag_name) { #' @export #' @rdname api-tags -## Tags / Remove Tag From Task -## DELETE https://api.clickup.com/api/v2/task/task_id/tag/tag_name -## -## task_id -## Example: abc. -## String -## -## tag_name -## Example: name. -## String cuf_delete_space_tag <- function(task_id, tag_name) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id, "tag", tag_name) diff --git a/R/df-tasks.R b/R/df-tasks.R index 0cc311b..9a8fd4b 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -4,61 +4,6 @@ NULL #' @export #' @rdname api-tasks -## Tasks / Create Task -## POST https://api.clickup.com/api/v2/list/list_id/task -## -## list_id -## Example: 123. -## Number -## -## assignees is an array of the assignees' userids to be added to this task. -## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. -## Time estimate is in milliseconds. -## See the fields section below to see the custom fields available on a list. -## If notify_all is true, creation notifications will be sent to everyone -## including the creator of the task. Instead of content you can pass -## markdown_content with valid markdown syntax to add formatting to the -## task description. Passing an existing task ID in the parent property -## will make the new task a subtask of that parent. -## The parent you pass must not be a subtask itself, -## and must be part of the list that you pass in the URL params. -## The links_to accepts a task ID to create a linked dependency on the new task. -## -## Body -## -## { -## "name": "New Task Name", -## "content": "New Task Content", -## "assignees": [ -## 183 -## ], -## "tags": [ -## "tag name 1" -## ], -## "status": "Open", -## "priority": 3, -## "due_date": 1508369194377, -## "due_date_time": false, -## "time_estimate": 8640000, -## "start_date": 1567780450202, -## "start_date_time": false, -## "notify_all": true, -## "parent": null, -## "links_to": null, -## "custom_fields": [ -## { -## "id": "0a52c486-5f05-403b-b4fd-c512ff05131c", -## "value": 23 -## }, -## { -## "id": "03efda77-c7a0-42d3-8afd-fd546353c2f5", -## "value": "Text field input" -## } -## ] -## } -## -## Use I() when providing arrays as part of the body -## list(a=1, b=I(2)) will be {"a":1,"b":[2]} cuf_create_task <- function(list_id, ...) { .cu_post("list", list_id, "task", body=list(...)) @@ -67,33 +12,6 @@ cuf_create_task <- function(list_id, ...) { #' @export #' @rdname api-tasks -## Tasks / Update Task -## PUT https://api.clickup.com/api/v2/task/task_id -## -## task_id -## Example: 9hx. -## String -## -## Only pass properties you want to update. -## It is unnecessary to pass the entire task object. assignees is an -## array of the assignees' userids to be added to this task. -## priority is an integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low. -## Time estimate is in milliseconds. -## -## Body -## -## { -## "name": "Updated Task Name", -## "content": "Updated Task Content", -## "status": "in progress", -## "priority": 1, -## "time_estimate": 8640000, -## "assignees": { -## "add": [182], -## "rem": [183] -## }, -## "archived": false, -## } cuf_update_task <- function(task_id, ...) { task_id <- cu_task_id(task_id) .cu_put("task", task_id, @@ -103,12 +21,6 @@ cuf_update_task <- function(task_id, ...) { #' @export #' @rdname api-tasks -## Tasks / Delete Task -## DELETE https://api.clickup.com/api/v2/task/task_id -## -## task_id -## Example: 9xh. -## String cuf_delete_task <- function(task_id) { task_id <- cu_task_id(task_id) .cu_delete("task", task_id) @@ -117,88 +29,6 @@ cuf_delete_task <- function(task_id) { #' @export #' @rdname api-tasks -## Tasks / Get Tasks -## GET https://api.clickup.com/api/v2/list/list_id/task?archived=false&page=&order_by=&reverse=&subtasks=&space_ids%5B%5D=&project_ids%5B%5D=&statuses%5B%5D=&include_closed=&assignees%5B%5D=&due_date_gt=&due_date_lt=&date_created_gt=&date_created_lt=&date_updated_gt=&date_updated_lt=&custom_fields= -## -## list_id -## Example: 123. -## Number -## -## archived -## Example: false. -## Boolean -## -## page -## Page to fetch (starts at 0) -## Integer -## -## order_by -## Order by field, defaults to created Options: id, created, -## updated, due_date -## String -## -## reverse -## Reverse order -## Boolean -## -## subtasks -## Include subtasks, default false -## Boolean -## -## space_ids[] -## Spaces to query -## Array -## -## project_ids[] -## Projects to query -## Array -## -## statuses[] -## Statuses to query -## Array -## -## include_closed -## By default, the api does not include closed tasks. -## Set this to true and dont send a status filter to include closed tasks. -## Boolean -## -## assignees[] -## Assignees to query -## Array -## -## due_date_gt -## Filter due date greater than posix time -## Integer -## -## due_date_lt -## Filter due date less than posix time -## Integer -## -## date_created_gt -## Filter date created greater than posix time -## Integer -## -## date_created_lt -## Filter date created less than posix time -## Integer -## -## date_updated_gt -## Filter date updated greater than posix time -## Integer -## -## date_updated_lt -## Filter date updated less than posix time -## Integer -## -## custom_fields -## Filter by custom fields. Must be a stringified JSON array of objects. -## See the custom fields section for more details. -## Object[] -## -## The maximum number of tasks returned in this response is 100. -## When you are paging this request, you should check list limit against -## the length of each response to determine if you are on the last page. -## # ... takes parameters, most importantly page (starting at 0) cuf_get_tasks <- function(list_id, archived=FALSE, ...) { .cu_get("list", list_id, "task", @@ -208,12 +38,6 @@ cuf_get_tasks <- function(list_id, archived=FALSE, ...) { #' @export #' @rdname api-tasks -## Tasks / Get Task -## GET https://api.clickup.com/api/v2/task/task_id -## -## task_id -## Example: 9hz. -## String cuf_get_task <- function(task_id) { task_id <- cu_task_id(task_id) .cu_get("task", task_id) @@ -222,91 +46,6 @@ cuf_get_task <- function(task_id) { #' @export #' @rdname api-tasks -## Tasks / Get Filtered Team Tasks -## GET https://api.clickup.com/api/v2/team/team_id/task?page=&order_by=&reverse=&subtasks=&space_ids%5B%5D=&project_ids%5B%5D=&list_ids%5B%5D=&statuses%5B%5D=&include_closed=&assignees%5B%5D=&tags%5B%5D=&due_date_gt=&due_date_lt=&date_created_gt=&date_created_lt=&date_updated_gt=&date_updated_lt=&custom_fields%5B%5D= -## -## team_id -## Team ID of tasks -## Example: 123. -## String -## -## page -## Page to fetch -## Integer -## -## order_by -## Order by field, defaults to created Options: id, created, updated, due_date -## String -## -## reverse -## Reverse order -## Boolean -## -## subtasks -## Include subtasks, default false -## Boolean -## -## space_ids[] -## Spaces to query -## Array -## -## project_ids[] -## Projects to query -## Array -## -## list_ids[] -## Lists to query -## Array -## -## statuses[] -## Statuses to query -## Array -## -## include_closed -## By default, the api does not include closed tasks. -## Set this to true and dont send a status filter to include closed tasks. -## Boolean -## -## assignees[] -## Assignees to query -## Array -## -## tags[] -## Tag names to query -## Array -## -## due_date_gt -## Filter due date greater than posix time -## Integer -## -## due_date_lt -## Filter due date less than posix time -## Integer -## -## date_created_gt -## Filter date created greater than posix time -## Integer -## -## date_created_lt -## Filter date created less than posix time -## Integer -## -## date_updated_gt -## Filter date updated greater than posix time -## Integer -## -## date_updated_lt -## Filter date updated less than posix time -## Integer -## -## custom_fields[] -## Filter by custom fields. Must be a stringified JSON array of -## objects that must include fields field_id, value, operator. -## See the custom fields section for more details. -## Object[] -## -## By default this does not include closed tasks. To page tasks, -## pass the page number you wish to fetch. cuf_get_filtered_team_tasks <- function(team_id, ...) { .cu_get("team", team_id, "task", query = list(...)) diff --git a/R/df-tasktemplates.R b/R/df-tasktemplates.R index 75a99e2..0f92888 100644 --- a/R/df-tasktemplates.R +++ b/R/df-tasktemplates.R @@ -4,18 +4,6 @@ NULL #' @export #' @rdname api-tasktemplates -## Task Templates / Get Task Templates -## GET https://api.clickup.com/api/v2/team/team_id/taskTemplate?page=0 -## -## team_id -## Example: 512. -## Number -## -## page -## Example: 0. -## Integer -## -## To page task templates, pass the page number you wish to fetch. cuf_get_task_templates <- function(team_id, page) { .cu_get("team", team_id, "taskTemplate", query = list(page = page)) @@ -24,22 +12,6 @@ cuf_get_task_templates <- function(team_id, page) { #' @export #' @rdname api-tasktemplates -## Task Templates / Create Task From Template -## POST https://api.clickup.com/api/v2/list/list_id/taskTemplate/template_id -## -## list_id -## Example: 512. -## Number -## -## template_id -## Example: 9hz. -## String -## -## Body -## -## { -## "name": "New task name" -## } cuf_create_task_from_template <- function(list_id, template_id, name, ...) { .cu_post("list", list_id, "taskTemplate", template_id, body=list(name=name, ...)) diff --git a/R/df-teams.R b/R/df-teams.R index 855e0c1..d66abdb 100644 --- a/R/df-teams.R +++ b/R/df-teams.R @@ -1,12 +1,6 @@ #' @export #' @rdname api-teams -## Teams / Get Teams -## GET https://api.clickup.com/api/v2/team -## -## Teams is the legacy term for what are now called Workspaces in ClickUp. -## For compatablitly, the term team is still used in this API. -## This is NOT the new "Teams" feature which represents a group of users. cuf_get_teams <- function() { out <- cu_get_teams() tibblify(out$teams, teams_spec) diff --git a/R/df-timetracking-legacy.R b/R/df-timetracking-legacy.R index 885bf34..056176b 100644 --- a/R/df-timetracking-legacy.R +++ b/R/df-timetracking-legacy.R @@ -4,24 +4,6 @@ NULL #' @export #' @rdname api-timetracking-legacy -## Time Tracking / Track time -## POST https://api.clickup.com/api/v2/task/task_id/time -## -## task_id -## Example: 9hv. -## String -## -## Include the total time or the start and end. -## The time is in milliseconds and the start and end are posix dates. -## -## { -## "start": 1567780450202, -## "end": 1508369194377, -## "time": 8640000 -## } -## -## use cu_time to turn POSIXct into unix time for start/end -## note: unix time is also in milliseconds (sec x 1000) cuf_track_time <- function(task_id, ...) { .Deprecated("cu_create_time_entry") task_id <- cu_task_id(task_id) @@ -32,14 +14,6 @@ cuf_track_time <- function(task_id, ...) { #' @export #' @rdname api-timetracking-legacy -## Time Tracking / Get tracked time -## GET https://api.clickup.com/api/v2/task/task_id/time -## -## task_id -## Example: 9hv. -## String -## -## Get time tracked for a task. cuf_get_tracked_time <- function(task_id) { .Deprecated("cu_get_time_entries_within_date_range") task_id <- cu_task_id(task_id) @@ -49,27 +23,6 @@ cuf_get_tracked_time <- function(task_id) { #' @export #' @rdname api-timetracking-legacy -## Time Tracking / Edit time tracked -## PUT https://api.clickup.com/api/v2/task/task_id/time/interval_id -## -## task_id -## Example: 9hv. -## String -## -## interval_id -## Example: 123. -## String -## -## Edit the start, end, or total time of a time tracked entry. -## -## { -## "start": 1567780450202, -## "end": 1508369194377, -## "time": 8640000 -## } -## -## use cu_time to turn POSIXct into unix time for start/end -## note: unix time is also in milliseconds (sec x 1000) cuf_edit_time_tracked <- function(task_id, interval_id, ...) { .Deprecated("cu_update_time_entry") task_id <- cu_task_id(task_id) @@ -80,18 +33,6 @@ cuf_edit_time_tracked <- function(task_id, interval_id, ...) { #' @export #' @rdname api-timetracking-legacy -## Time Tracking / Delete time tracked -## DELETE https://api.clickup.com/api/v2/task/task_id/time/interval_id -## -## task_id -## Example: 9hv. -## String -## -## interval_id -## Example: 123. -## String -## -## Delete a time tracked entry cuf_delete_time_tracked <- function(task_id, interval_id) { .Deprecated("cu_delete_time_entry") task_id <- cu_task_id(task_id) diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index 5d5a591..e54d721 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -4,25 +4,6 @@ NULL #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Get time entries within a date range -## GET https://api.clickup.com/api/v2/team/team_id/time_entries?start_date=&end_date=&assignee= -## -## team_id -## Example: 512. -## Number -## -## start_date -## Posix Time in Milliseconds -## Number -## -## end_date -## Posix Time in Milliseconds -## Number -## -## assignee -## User ids to filter by separated by commas. -## Note: Only Workspace Owners/Admins have access to do this. -## Number cuf_get_time_entries_within_date_range <- function(team_id, start_date, end_date, assignee) { .cu_get("team", team_id, "time_entries", @@ -35,16 +16,6 @@ start_date, end_date, assignee) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Get singular time entry -## GET https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id -## -## team_id -## Example: 512. -## Number -## -## timer_id -## Example: 1963465985517105840. -## String cuf_get_singular_time_entry <- function(team_id, timer_id) { .cu_get("team", team_id, "time_entries", timer_id) } @@ -52,16 +23,6 @@ cuf_get_singular_time_entry <- function(team_id, timer_id) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Get time entry history -## GET https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id/history -## -## team_id -## Example: 512. -## Number -## -## timer_id -## Example: 1963465985517105840. -## String cuf_get_time_entry_history <- function(team_id, timer_id) { .cu_get("team", team_id, "time_entries", timer_id, "history") } @@ -69,12 +30,6 @@ cuf_get_time_entry_history <- function(team_id, timer_id) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Get running time entry -## GET https://api.clickup.com/api/v2/team/team_id/time_entries/current -## -## team_id -## Example: 512. -## Number cuf_get_running_time_entry <- function(team_id, timer_id) { .cu_get("team", team_id, "time_entries", "current") } @@ -82,27 +37,6 @@ cuf_get_running_time_entry <- function(team_id, timer_id) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Create a time entry -## POST https://api.clickup.com/api/v2/team/team_id/time_entries -## -## team_id -## Example: 512. -## Number -## -## { -## "description": "from api", -## "tags": [ -## { -## "name": "name of tag", -## "tag_bg": "#BF55EC", -## "tag_fg": "#BF55EC" -## } -## ], -## "start": 1595282645000, -## "billable": true, -## "duration": 50000, -## "assignee": 1 -## } cuf_create_time_entry <- function(team_id, ...) { .cu_post("team", team_id, "time_entries", body=list(...)) @@ -111,21 +45,6 @@ cuf_create_time_entry <- function(team_id, ...) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Remove tags from time entries -## DELETE https://api.clickup.com/api/v2/team/team_id/time_entries/tags -## -## team_id -## Example: 512. -## Number -## -## { -## "time_entry_ids": [ -## "timer_id" -## ], -## "tags": [ -## "name of tag" -## ] -## } cuf_remove_tags_from_time_entries <- function(team_id, ...) { .cu_delete("team", team_id, "time_entries", "tags", body=list(...)) @@ -134,12 +53,6 @@ cuf_remove_tags_from_time_entries <- function(team_id, ...) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Get all tags from time entries -## GET https://api.clickup.com/api/v2/team/team_id/time_entries/tags -## -## team_id -## Example: 512. -## Number cuf_get_all_tags_from_time_entries <- function(team_id) { .cu_get("team", team_id, "time_entries", "tags") } @@ -147,21 +60,6 @@ cuf_get_all_tags_from_time_entries <- function(team_id) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Add tags from time entries -## POST https://api.clickup.com/api/v2/team/team_id/time_entries/tags -## -## team_id -## Example: 512. -## Number -## -## { -## "time_entry_ids": [ -## "timer_id" -## ], -## "tags": [ -## "name of tags" -## ] -## } cuf_add_tags_from_time_entries <- function(team_id, ...) { .cu_post("team", team_id, "time_entries", "tags", body=list(...)) @@ -170,19 +68,6 @@ cuf_add_tags_from_time_entries <- function(team_id, ...) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Change tag names from time entries -## PUT https://api.clickup.com/api/v2/team/team_id/time_entries/tags -## -## team_id -## Example: 512. -## Number -## -## { -## "name": "old tag name", -## "new_name": "new tag name", -## "tag_bg": "#000000", -## "tag_fg": "#000000" -## } cuf_change_tag_names_from_time_entries <- function(team_id, ...) { .cu_put("team", team_id, "time_entries", "tags", body=list(...)) @@ -191,25 +76,6 @@ cuf_change_tag_names_from_time_entries <- function(team_id, ...) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Start a time Entry -## POST https://api.clickup.com/api/v2/team/team_id/time_entries/start/timer_id -## -## team_id -## Example: 512. -## Number -## -## timer_id -## Example: 2004673344540003570. -## Number -## -## { -## "description": "from api", -## "tags": [ -## "tag1" -## ], -## "tid": "task_id", -## "billable": false -## } cuf_start_time_entry <- function(team_id, timer_id, ...) { .cu_post("team", team_id, "time_entries", "start", timer_id, body=list(...)) @@ -218,12 +84,6 @@ cuf_start_time_entry <- function(team_id, timer_id, ...) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Stop a time Entry -## POST https://api.clickup.com/api/v2/team/team_id/time_entries/stop -## -## team_id -## Example: 512. -## Number cuf_stop_time_entry <- function(team_id) { .cu_post("team", team_id, "time_entries", "stop") } @@ -231,16 +91,6 @@ cuf_stop_time_entry <- function(team_id) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Delete a time Entry -## DELETE https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id -## -## team_id -## Example: 512. -## Number -## -## timer_id -## List of timer ids to delete separated by commas -## Number cuf_delete_time_entry <- function(team_id, timer_id) { .cu_delete("team", team_id, "time_entries", timer_id) } @@ -248,30 +98,6 @@ cuf_delete_time_entry <- function(team_id, timer_id) { #' @export #' @rdname api-timetracking-2 -## Time Tracking 2.0 / Update a time Entry -## PUT https://api.clickup.com/api/v2/team/team_id/time_entries/timer_id -## -## team_id -## Example: 512. -## Number -## -## timer_id -## Example: 2004673344540003570. -## Number -## -## Accessible tag actions are ["replace", "add", "remove"] -## { -## "description": "", -## "tags": [ -## "name of tags" -## ], -## "tag_action": "add", -## "start": 1595289395842, -## "end": 1595289495842, -## "tid": "task_id", -## "billable": true, -## "duration": 100000 -## } cuf_update_time_entry <- function(team_id, timer_id, ...) { .cu_put("team", team_id, "time_entries", timer_id, body=list(...)) diff --git a/R/df-users.R b/R/df-users.R index 198b811..d6c3c8f 100644 --- a/R/df-users.R +++ b/R/df-users.R @@ -4,19 +4,6 @@ NULL #' @export #' @rdname api-users -## Users / Invite User To Workspace -## POST https://api.clickup.com/api/v2/team/team_id/user -## -## team_id -## Example: 333. -## Number -## -## Body -## -## { -## "email": "user@example.com", -## "admin": true -## } cuf_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { .cu_post("team", team_id, "user", body=list(email=email, admin=tolower(admin), ...)) @@ -25,23 +12,6 @@ cuf_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { #' @export #' @rdname api-users -## Users / Edit User On Workspace -## PUT https://api.clickup.com/api/v2/team/team_id/user/user_id -## -## team_id -## Example: 333. -## Number -## -## user_id -## Example: 403. -## Number -## -## Body -## -## { -## "username": "User Name", -## "admin": false -## } cuf_edit_user_on_workspace <- function(team_id, user_id, username, admin=FALSE, ...) { .cu_put("team", team_id, "user", user_id, @@ -51,16 +21,6 @@ cuf_edit_user_on_workspace <- function(team_id, user_id, #' @export #' @rdname api-users -## Users / Remove User From Workspace -## DELETE https://api.clickup.com/api/v2/team/team_id/user/user_id -## -## team_id -## Example: 333. -## Number -## -## user_id -## Example: 403. -## Number cuf_remove_user_from_workspace <- function(team_id, user_id) { .cu_delete("team", team_id, "user", user_id) } @@ -68,16 +28,6 @@ cuf_remove_user_from_workspace <- function(team_id, user_id) { #' @export #' @rdname api-users -## Users / Get User -## GET https://api.clickup.com/api/v2/team/team_id/user/user_id -## -## team_id -## Example: 333. -## Number -## -## user_id -## Example: 403. -## Number cuf_get_user <- function(team_id, user_id) { .cu_get("team", team_id, "user", user_id) } diff --git a/R/df-views.R b/R/df-views.R index 50b0628..47ffb68 100644 --- a/R/df-views.R +++ b/R/df-views.R @@ -4,59 +4,6 @@ NULL #' @export #' @rdname api-views -## Views / Create Team View -## POST https://api.clickup.com/api/v2/team/team_id/view -## -## team_id -## Example: 512. -## Number -## -## Body -## -## { -## "name": "New Team View Name", -## "type": "list", -## "grouping": { -## "field": "status", -## "dir": 1, -## "collapsed": [], -## "ignore": false -## }, -## "divide": { -## "field": null, -## "dir": null, -## "collapsed": [] -## }, -## "sorting": { -## "fields": [] -## }, -## "filters": { -## "op": "AND", -## "fields": [], -## "search": "", -## "show_closed": false -## }, -## "columns": { -## "fields": [] -## }, -## "team_sidebar": { -## "assignees": [], -## "assigned_comments": false, -## "unassigned_tasks": false -## }, -## "settings": { -## "show_task_locations": false, -## "show_subtasks": 3, -## "show_subtask_parent_names": false, -## "show_closed_subtasks": false, -## "show_assignees": true, -## "show_images": true, -## "collapse_empty_columns": null, -## "me_comments": true, -## "me_subtasks": true, -## "me_checklists": true -## } -## } cuf_create_team_view <- function(team_id, name, ...) { .cu_post("team", team_id, "view", body=list(name=name, ...)) @@ -65,59 +12,6 @@ cuf_create_team_view <- function(team_id, name, ...) { #' @export #' @rdname api-views -## Views / Create Space View -## POST https://api.clickup.com/api/v2/space/space_id/view -## -## space_id -## Example: 790. -## Number -## -## Body -## -## { -## "name": "New Space View Name", -## "type": "list", -## "grouping": { -## "field": "status", -## "dir": 1, -## "collapsed": [], -## "ignore": false -## }, -## "divide": { -## "field": null, -## "dir": null, -## "collapsed": [] -## }, -## "sorting": { -## "fields": [] -## }, -## "filters": { -## "op": "AND", -## "fields": [], -## "search": "", -## "show_closed": false -## }, -## "columns": { -## "fields": [] -## }, -## "team_sidebar": { -## "assignees": [], -## "assigned_comments": false, -## "unassigned_tasks": false -## }, -## "settings": { -## "show_task_locations": false, -## "show_subtasks": 3, -## "show_subtask_parent_names": false, -## "show_closed_subtasks": false, -## "show_assignees": true, -## "show_images": true, -## "collapse_empty_columns": null, -## "me_comments": true, -## "me_subtasks": true, -## "me_checklists": true -## } -## } cuf_create_space_view <- function(space_id, name, ...) { .cu_post("space", space_id, "view", body=list(name=name, ...)) @@ -126,59 +20,6 @@ cuf_create_space_view <- function(space_id, name, ...) { #' @export #' @rdname api-views -## Views / Create Folder View -## POST https://api.clickup.com/api/v2/folder/folder_id/view -## -## folder_id -## Example: 457. -## Number -## -## Body -## -## { -## "name": "New Folder View Name", -## "type": "list", -## "grouping": { -## "field": "status", -## "dir": 1, -## "collapsed": [], -## "ignore": false -## }, -## "divide": { -## "field": null, -## "dir": null, -## "collapsed": [] -## }, -## "sorting": { -## "fields": [] -## }, -## "filters": { -## "op": "AND", -## "fields": [], -## "search": "", -## "show_closed": false -## }, -## "columns": { -## "fields": [] -## }, -## "team_sidebar": { -## "assignees": [], -## "assigned_comments": false, -## "unassigned_tasks": false -## }, -## "settings": { -## "show_task_locations": false, -## "show_subtasks": 3, -## "show_subtask_parent_names": false, -## "show_closed_subtasks": false, -## "show_assignees": true, -## "show_images": true, -## "collapse_empty_columns": null, -## "me_comments": true, -## "me_subtasks": true, -## "me_checklists": true -## } -## } cuf_create_folder_view <- function(folder_id, name, ...) { .cu_post("folder", folder_id, "view", body=list(name=name, ...)) @@ -187,59 +28,6 @@ cuf_create_folder_view <- function(folder_id, name, ...) { #' @export #' @rdname api-views -## Views / Create List View -## POST https://api.clickup.com/api/v2/list/list_id/view -## -## list_id -## Example: 124. -## Number -## -## Body -## -## { -## "name": "New List View Name", -## "type": "list", -## "grouping": { -## "field": "status", -## "dir": 1, -## "collapsed": [], -## "ignore": false -## }, -## "divide": { -## "field": null, -## "dir": null, -## "collapsed": [] -## }, -## "sorting": { -## "fields": [] -## }, -## "filters": { -## "op": "AND", -## "fields": [], -## "search": "", -## "show_closed": false -## }, -## "columns": { -## "fields": [] -## }, -## "team_sidebar": { -## "assignees": [], -## "assigned_comments": false, -## "unassigned_tasks": false -## }, -## "settings": { -## "show_task_locations": false, -## "show_subtasks": 3, -## "show_subtask_parent_names": false, -## "show_closed_subtasks": false, -## "show_assignees": true, -## "show_images": true, -## "collapse_empty_columns": null, -## "me_comments": true, -## "me_subtasks": true, -## "me_checklists": true -## } -## } cuf_create_list_view <- function(list_id, name, ...) { .cu_post("list", list_id, "view", body=list(name=name, ...)) @@ -248,12 +36,6 @@ cuf_create_list_view <- function(list_id, name, ...) { #' @export #' @rdname api-views -## Views / Get Team Views -## GET https://api.clickup.com/api/v2/team/team_id/view -## -## team_id -## Example: 512. -## Number cuf_get_team_views <- function(team_id) { .cu_get("team", team_id, "view") } @@ -261,12 +43,6 @@ cuf_get_team_views <- function(team_id) { #' @export #' @rdname api-views -## Views / Get Space Views -## GET https://api.clickup.com/api/v2/space/space_id/view -## -## space_id -## Example: 790. -## Number cuf_get_space_views <- function(space_id) { .cu_get("space", space_id, "view") } @@ -274,12 +50,6 @@ cuf_get_space_views <- function(space_id) { #' @export #' @rdname api-views -## Views / Get Folder Views -## GET https://api.clickup.com/api/v2/folder/folder_id/view -## -## folder_id -## Example: 457. -## Number cuf_get_folder_views <- function(folder_id) { .cu_get("folder", folder_id, "view") } @@ -287,12 +57,6 @@ cuf_get_folder_views <- function(folder_id) { #' @export #' @rdname api-views -## Views / Get List Views -## GET https://api.clickup.com/api/v2/list/list_id/view -## -## list_id -## Example: 124. -## Number cuf_get_list_views <- function(list_id) { .cu_get("list", list_id, "view") } @@ -300,13 +64,6 @@ cuf_get_list_views <- function(list_id) { #' @export #' @rdname api-views -## Views / Get View -## GET https://api.clickup.com/api/v2/view/view_id -## -## view_id -## 105 (string) -## Example: 3c. -## String cuf_get_view <- function(view_id) { .cu_get("view", view_id) } @@ -314,19 +71,6 @@ cuf_get_view <- function(view_id) { #' @export #' @rdname api-views -## Views / Get View Tasks -## GEThttps://api.clickup.com/api/v2/view/view_id/task?page=0 -## -## view_id -## 105 (string) -## Example: 3c. -## String -## -## page -## Example: 0. -## Integer -## -## To page the tasks returned, include the page param cuf_get_view_tasks <- function(view_id, page) { .cu_get("view", view_id, "task", query = list(page = page)) @@ -335,66 +79,6 @@ cuf_get_view_tasks <- function(view_id, page) { #' @export #' @rdname api-views -## Views / Update View -## PUT https://api.clickup.com/api/v2/view/view_id -## -## view_id -## 105 (string) -## Example: 3c. -## String -## -## Body -## -## { -## "name": "New View Name", -## "type": "list", -## "parent": { -## "id": "512", -## "type": 7 -## }, -## "grouping": { -## "field": "status", -## "dir": 1, -## "collapsed": [], -## "ignore": false -## }, -## "divide": { -## "field": null, -## "dir": null, -## "collapsed": [] -## }, -## "sorting": { -## "fields": [] -## }, -## "filters": { -## "op": "AND", -## "fields": [], -## "search": "", -## "show_closed": false -## }, -## "columns": { -## "fields": [] -## }, -## "team_sidebar": { -## "assignees": [], -## "assigned_comments": false, -## "unassigned_tasks": false -## }, -## "settings": { -## "show_task_locations": false, -## "show_subtasks": 3, -## "show_subtask_parent_names": false, -## "show_closed_subtasks": false, -## "show_assignees": true, -## "show_images": true, -## "collapse_empty_columns": null, -## "me_comments": true, -## "me_subtasks": true, -## "me_checklists": true -## } -## } -## Views / Update View -## PUT https://api.clickup.com/api/v2/view/view_id cuf_update_view <- function(view_id, ...) { .cu_put("view", view_id, body=list(...)) @@ -403,13 +87,6 @@ cuf_update_view <- function(view_id, ...) { #' @export #' @rdname api-views -## Views / Delete View -## DELETE https://api.clickup.com/api/v2/view/view_id -## -## view_id -## 105 (string) -## Example: 3c. -## String cuf_delete_view <- function(view_id) { .cu_delete("view", view_id) } diff --git a/R/df-webhooks.R b/R/df-webhooks.R index 658306e..b20e069 100644 --- a/R/df-webhooks.R +++ b/R/df-webhooks.R @@ -4,49 +4,6 @@ NULL #' @export #' @rdname api-webhooks -## Webhooks / Create Webhook -## POST https://api.clickup.com/api/v2/team/team_id/webhook -## -## team_id -## Example: 512. -## Number -## -## You may filter the location of resources that get sent to a webhook -## by passing an optional space_id, folder_id, list_id, or task_id in the -## body of the request. Without specifying any events, all event types -## will be sent to the webhook. However, you can filter for specific -## actions by sending an events array. To subscribe to specific events, -## pass an array of events that you want to subscribe to, -## otherwise pass "*" to subscribe to everything. -## -## Body -## -## { -## "endpoint": "https://yourdomain.com/webhook", -## "events": [ -## "taskCreated", -## "taskUpdated", -## "taskDeleted", -## "listCreated", -## "listUpdated", -## "listDeleted", -## "folderCreated", -## "folderUpdated", -## "folderDeleted", -## "spaceCreated", -## "spaceUpdated", -## "spaceDeleted", -## "goalCreated", -## "goalUpdated", -## "goalDeleted", -## "keyResultCreated", -## "keyResultUpdated", -## "keyResultDeleted" -## ] -## } -## -## ... passes query params for optional filtering -## for space_id, folder_id, list_id, or task_id cuf_create_webhook <- function(team_id, endpoint, events="*", ...) { .cu_post("team", team_id, "webhook", body=list(endpoint=endpoint, events=events), @@ -56,25 +13,6 @@ cuf_create_webhook <- function(team_id, endpoint, events="*", ...) { #' @export #' @rdname api-webhooks -## Webhooks / Update Webhook -## PUT https://api.clickup.com/api/v2/webhook/webhook_id -## -## webhook_id -## e506-4a29-9d42-26e504e3435e (uuid) -## Example: 4b67ac88. -## String -## -## To subscribe to specific events, pass an array of events that -## you want to subscribe to, otherwise pass "*" to subscribe to everything. -## -## Body -## -## { -## "endpoint": "https://yourdomain.com/webhook", -## "events": "*", -## "status": "active" -## } -## ... passes props to body cuf_update_webhook <- function(webhook_id, ...) { .cu_put("webhook", webhook_id, body=list(...)) @@ -83,13 +21,6 @@ cuf_update_webhook <- function(webhook_id, ...) { #' @export #' @rdname api-webhooks -## Webhooks / Delete Webhook -## DELETE https://api.clickup.com/api/v2/webhook/webhook_id -## -## webhook_id -## e506-4a29-9d42-26e504e3435e (uuid) -## Example: 4b67ac88. -## String cuf_delete_webhook <- function(webhook_id) { .cu_delete("webhook", webhook_id) } @@ -97,12 +28,6 @@ cuf_delete_webhook <- function(webhook_id) { #' @export #' @rdname api-webhooks -## Webhooks / Get Webhooks -## GET https://api.clickup.com/api/v2/team/team_id/webhook -## -## team_id -## Example: 512. -## Number cuf_get_webhooks <- function(team_id) { .cu_get("team", team_id, "webhook") } From 201b32cb3d52366c4a2989ff1214212e0a1afe15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:16:02 +0200 Subject: [PATCH 013/137] Document --- NAMESPACE | 2 -- man/api-folders.Rd | 7 +------ man/api-spaces.Rd | 7 ------- man/api-teams.Rd | 2 -- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index a33245b..7e26d6a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -156,11 +156,9 @@ export(cuf_delete_checklist) export(cuf_delete_checklist_item) export(cuf_delete_comment) export(cuf_delete_dependency) -export(cuf_delete_folder) export(cuf_delete_goal) export(cuf_delete_key_result) export(cuf_delete_list) -export(cuf_delete_space) export(cuf_delete_space_tag) export(cuf_delete_task) export(cuf_delete_time_entry) diff --git a/man/api-folders.Rd b/man/api-folders.Rd index 7b35822..026bf58 100644 --- a/man/api-folders.Rd +++ b/man/api-folders.Rd @@ -9,7 +9,6 @@ \alias{cu_get_folder} \alias{cuf_create_folder} \alias{cuf_update_folder} -\alias{cuf_delete_folder} \alias{cuf_get_folders} \alias{cuf_get_folder} \title{Folders} @@ -28,11 +27,7 @@ cuf_create_folder(space_id, name) cuf_update_folder(folder_id, name) -cuf_delete_folder(folder_id, name) - -cuf_get_folders(team_id, archived = FALSE) - -cuf_get_folders(team_id, archived = FALSE) +cuf_get_folders(space_id, archived = FALSE) cuf_get_folder(folder_id) } diff --git a/man/api-spaces.Rd b/man/api-spaces.Rd index 032e184..c7ee28d 100644 --- a/man/api-spaces.Rd +++ b/man/api-spaces.Rd @@ -9,7 +9,6 @@ \alias{cu_get_space} \alias{cuf_create_space} \alias{cuf_update_space} -\alias{cuf_delete_space} \alias{cuf_get_spaces} \alias{cuf_get_space} \title{Spaces} @@ -26,14 +25,8 @@ cu_get_space(space_id) cuf_create_space(team_id, name, ...) -cuf_create_space(team_id, name, ...) - cuf_update_space(space_id, ...) -cuf_delete_space(space_id) - -cuf_get_spaces(team_id, archived = FALSE) - cuf_get_spaces(team_id, archived = FALSE) cuf_get_space(space_id) diff --git a/man/api-teams.Rd b/man/api-teams.Rd index 6a1bc84..6fcdeac 100644 --- a/man/api-teams.Rd +++ b/man/api-teams.Rd @@ -8,8 +8,6 @@ \usage{ cu_get_teams() -cuf_get_teams() - cuf_get_teams() } \value{ From c59e76d105e02f2ec8f60e6b4f3c2629c2bde497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:21:22 +0200 Subject: [PATCH 014/137] Tweak --- script/tibblify.R | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/script/tibblify.R b/script/tibblify.R index 94b90ec..c8974a1 100644 --- a/script/tibblify.R +++ b/script/tibblify.R @@ -1,10 +1,6 @@ -library(clickrup) +pkgload::load_all() library(tibblify) -cu_options( - baseurl = "https://api.clickup.com/api/v2" -) - clip_spec <- function(x) { name <- deparse(substitute(x)) @@ -14,10 +10,11 @@ clip_spec <- function(x) { format() %>% fansi::strip_sgr() - out <- paste0(gsub("^df_", "", name), "_spec <- ", out) + base_name <- gsub("^df_", "", name) + + out <- paste0(base_name, "_spec <- ", out) - out %>% - clipr::write_clip() + # writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) } teams <- cu_get_teams() @@ -39,8 +36,6 @@ df_spaces <- cuf_get_spaces(df_teams$id[[1]]) clip_spec(df_spaces) -asdf - df_spaces df_spaces$statuses df_spaces$features @@ -61,8 +56,4 @@ df_folders <- tibblify::tibblify(folders$folders) df_folders df_folders %>% get_spec() -folder <- cu_get_folder(df_folders$id[[1]]) -folder - -df_folder <- tibblify::tibblify(list(unclass(folder))) -df_folder %>% get_spec() +clip_spec(df_folders) From bd4d70e1562e8ebe68b8a3ae11c1ec5366e66060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 13:23:10 +0200 Subject: [PATCH 015/137] Purge --- script/create.R | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/script/create.R b/script/create.R index 5f769be..ae58e3d 100644 --- a/script/create.R +++ b/script/create.R @@ -1,7 +1,15 @@ pkgload::load_all() +library(tidyverse) -team_id <- cuf_get_teams()$id[[1]] +# team_id <- cuf_get_teams()$id[[1]] +team_id <- "24312410" + +spaces <- cuf_get_spaces(team_id) + +walk(spaces, cu_delete_space) + +asdf cuf_create_space(team_id, "Test space 1") -space_df_2 <- cuf_create_space(team_id, "Test space 2") +cuf_create_space(team_id, "Test space 2") space_df_2 From 9a76c84e60526ad7c41ef2537fa16e7c2cdc2005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 15:04:42 +0200 Subject: [PATCH 016/137] Create more --- script/create.R | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/script/create.R b/script/create.R index ae58e3d..698fef3 100644 --- a/script/create.R +++ b/script/create.R @@ -6,10 +6,13 @@ team_id <- "24312410" spaces <- cuf_get_spaces(team_id) -walk(spaces, cu_delete_space) +walk(spaces$id, cu_delete_space) -asdf +space_1 <- cuf_create_space(team_id, "Test space 1") +space_1 -cuf_create_space(team_id, "Test space 1") -cuf_create_space(team_id, "Test space 2") -space_df_2 +space_2 <- cuf_create_space(team_id, "Test space 2") +space_2 + +folder_1 <- cu_create_folder(space_1$id, "Folder in space 1") +folder_1 From 5c9d900a04822d1958f2f0026aa42e1c62050669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 15:08:57 +0200 Subject: [PATCH 017/137] Extract spec to separate files --- R/df-folders.R | 69 ---------------------------------------------- R/df-spaces.R | 72 +++--------------------------------------------- R/df-teams.R | 40 +-------------------------- R/spec-folders.R | 66 ++++++++++++++++++++++++++++++++++++++++++++ R/spec-spaces.R | 63 ++++++++++++++++++++++++++++++++++++++++++ R/spec-teams.R | 37 +++++++++++++++++++++++++ 6 files changed, 171 insertions(+), 176 deletions(-) create mode 100644 R/spec-folders.R create mode 100644 R/spec-spaces.R create mode 100644 R/spec-teams.R diff --git a/R/df-folders.R b/R/df-folders.R index dab99a2..8d85d87 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -33,72 +33,3 @@ cuf_get_folder <- function(folder_id) { out <- cu_get_folder(folder_id) tibblify(list(out), spec_folder) } - - - -spec_folder <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), - override_statuses = lcol_lgl("override_statuses"), - hidden = lcol_lgl("hidden"), - space = lcol_df( - "space", - id = lcol_chr("id"), - name = lcol_chr("name") - ), - task_count = lcol_chr("task_count"), - archived = lcol_lgl("archived"), - statuses = lcol_df_lst( - "statuses", - id = lcol_chr("id"), - status = lcol_chr("status"), - type = lcol_chr("type"), - orderindex = lcol_int("orderindex"), - color = lcol_chr("color"), - .default = NULL - ), - lists = lcol_df_lst( - "lists", - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), - content = lcol_chr("content", .default = NA_character_), - status = lcol_df( - "status", - status = lcol_chr("status", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - .default = NULL - ), - priority = lcol_guess("priority", .default = NULL), - assignee = lcol_df( - "assignee", - color = lcol_chr("color", .default = NA_character_), - username = lcol_chr("username", .default = NA_character_), - initials = lcol_chr("initials", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL - ), - task_count = lcol_int("task_count"), - due_date = lcol_chr("due_date", .default = NA_character_), - start_date = lcol_chr("start_date", .default = NA_character_), - space = lcol_df( - "space", - id = lcol_chr("id"), - name = lcol_chr("name"), - access = lcol_lgl("access") - ), - archived = lcol_lgl("archived"), - override_statuses = lcol_lgl("override_statuses", .default = NA), - statuses = lcol_df_lst( - "statuses", - id = lcol_chr("id"), - status = lcol_chr("status"), - orderindex = lcol_int("orderindex"), - color = lcol_chr("color"), - type = lcol_chr("type") - ), - permission_level = lcol_chr("permission_level") - ), - permission_level = lcol_chr("permission_level") -) diff --git a/R/df-spaces.R b/R/df-spaces.R index 9b3a14d..8434037 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -2,7 +2,7 @@ #' @rdname api-spaces cuf_create_space <- function(team_id, name, ...) { out <- cu_create_space(team_id, name, ...) - tibblify(list(out), spaces_spec) + tibblify(list(out), spec_spaces) } @@ -10,7 +10,7 @@ cuf_create_space <- function(team_id, name, ...) { #' @rdname api-spaces cuf_update_space <- function(space_id, ...) { out <- cu_update_space(team_id, name, ...) - tibblify(list(out), spaces_spec) + tibblify(list(out), spec_spaces) } @@ -19,76 +19,12 @@ cuf_update_space <- function(space_id, ...) { ##GET https://api.clickup.com/api/v2/team/team_id/space?archived=false cuf_get_spaces <- function(team_id, archived=FALSE) { out <- cu_get_spaces(team_id, archived) - tibblify(out$spaces, spaces_spec) + tibblify(out$spaces, spec_spaces) } #' @export #' @rdname api-spaces cuf_get_space <- function(space_id) { out <- cu_get_space(space_id) - tibblify(list(out), spaces_spec) + tibblify(list(out), spec_spaces) } - -spaces_spec <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - private = lcol_lgl("private"), - statuses = lcol_df_lst( - "statuses", - status = lcol_chr("status"), - type = lcol_chr("type"), - orderindex = lcol_int("orderindex"), - color = lcol_chr("color") - ), - multiple_assignees = lcol_lgl("multiple_assignees"), - features = lcol_df( - "features", - due_dates = lcol_df( - "due_dates", - enabled = lcol_lgl("enabled"), - start_date = lcol_lgl("start_date"), - remap_due_dates = lcol_lgl("remap_due_dates"), - remap_closed_due_date = lcol_lgl("remap_closed_due_date") - ), - time_tracking = lcol_df( - "time_tracking", - enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) - ), - tags = lcol_df( - "tags", - enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) - ), - time_estimates = lcol_df( - "time_estimates", - enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) - ), - checklists = lcol_df( - "checklists", - enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) - ), - custom_fields = lcol_df( - "custom_fields", - enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) - ), - remap_dependencies = lcol_df( - "remap_dependencies", - enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) - ), - dependency_warning = lcol_df( - "dependency_warning", - enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) - ), - portfolios = lcol_df( - "portfolios", - enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) - ) - ) -) diff --git a/R/df-teams.R b/R/df-teams.R index d66abdb..e2e987c 100644 --- a/R/df-teams.R +++ b/R/df-teams.R @@ -3,44 +3,6 @@ #' @rdname api-teams cuf_get_teams <- function() { out <- cu_get_teams() - tibblify(out$teams, teams_spec) + tibblify(out$teams, spec_teams) } #cuf_get_workspaces <- cu_get_teams - -teams_spec <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - color = lcol_chr("color"), - avatar = lcol_chr("avatar"), - members = lcol_df_lst( - "members", - user = lcol_df( - "user", - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - email = lcol_chr("email"), - color = lcol_chr("color", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - initials = lcol_chr("initials"), - role = lcol_int("role"), - custom_role = lcol_guess("custom_role", .default = NULL), - last_active = lcol_chr("last_active"), - date_joined = lcol_chr("date_joined"), - date_invited = lcol_chr("date_invited") - ), - invited_by = lcol_df( - "invited_by", - id = lcol_chr("id", .parser = as.character, .default = NA_character_), - username = lcol_chr("username", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - email = lcol_chr("email", .default = NA_character_), - initials = lcol_chr("initials", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL - ), - can_see_time_spent = lcol_lgl("can_see_time_spent", .default = NA), - can_see_time_estimated = lcol_lgl("can_see_time_estimated", .default = NA), - can_see_points_estimated = lcol_lgl("can_see_points_estimated", .default = NA), - can_edit_tags = lcol_lgl("can_edit_tags", .default = NA) - ) -) diff --git a/R/spec-folders.R b/R/spec-folders.R new file mode 100644 index 0000000..0fe410a --- /dev/null +++ b/R/spec-folders.R @@ -0,0 +1,66 @@ +spec_folders <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + override_statuses = lcol_lgl("override_statuses"), + hidden = lcol_lgl("hidden"), + space = lcol_df( + "space", + id = lcol_chr("id"), + name = lcol_chr("name") + ), + task_count = lcol_chr("task_count"), + archived = lcol_lgl("archived"), + statuses = lcol_df_lst( + "statuses", + id = lcol_chr("id"), + status = lcol_chr("status"), + type = lcol_chr("type"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color"), + .default = NULL + ), + lists = lcol_df_lst( + "lists", + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + content = lcol_chr("content", .default = NA_character_), + status = lcol_df( + "status", + status = lcol_chr("status", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + .default = NULL + ), + priority = lcol_guess("priority", .default = NULL), + assignee = lcol_df( + "assignee", + color = lcol_chr("color", .default = NA_character_), + username = lcol_chr("username", .default = NA_character_), + initials = lcol_chr("initials", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + .default = NULL + ), + task_count = lcol_int("task_count"), + due_date = lcol_chr("due_date", .default = NA_character_), + start_date = lcol_chr("start_date", .default = NA_character_), + space = lcol_df( + "space", + id = lcol_chr("id"), + name = lcol_chr("name"), + access = lcol_lgl("access") + ), + archived = lcol_lgl("archived"), + override_statuses = lcol_lgl("override_statuses", .default = NA), + statuses = lcol_df_lst( + "statuses", + id = lcol_chr("id"), + status = lcol_chr("status"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color"), + type = lcol_chr("type") + ), + permission_level = lcol_chr("permission_level") + ), + permission_level = lcol_chr("permission_level") +) diff --git a/R/spec-spaces.R b/R/spec-spaces.R new file mode 100644 index 0000000..6bdb990 --- /dev/null +++ b/R/spec-spaces.R @@ -0,0 +1,63 @@ +spec_spaces <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + private = lcol_lgl("private"), + statuses = lcol_df_lst( + "statuses", + status = lcol_chr("status"), + type = lcol_chr("type"), + orderindex = lcol_int("orderindex"), + color = lcol_chr("color") + ), + multiple_assignees = lcol_lgl("multiple_assignees"), + features = lcol_df( + "features", + due_dates = lcol_df( + "due_dates", + enabled = lcol_lgl("enabled"), + start_date = lcol_lgl("start_date"), + remap_due_dates = lcol_lgl("remap_due_dates"), + remap_closed_due_date = lcol_lgl("remap_closed_due_date") + ), + time_tracking = lcol_df( + "time_tracking", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + tags = lcol_df( + "tags", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + time_estimates = lcol_df( + "time_estimates", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + checklists = lcol_df( + "checklists", + enabled = lcol_lgl("enabled"), + .default = tibble(enabled = NA) + ), + custom_fields = lcol_df( + "custom_fields", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ), + remap_dependencies = lcol_df( + "remap_dependencies", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ), + dependency_warning = lcol_df( + "dependency_warning", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ), + portfolios = lcol_df( + "portfolios", + enabled = lcol_lgl("enabled", .default = NA), + .default = tibble(enabled = NA) + ) + ) +) diff --git a/R/spec-teams.R b/R/spec-teams.R new file mode 100644 index 0000000..9cd8d72 --- /dev/null +++ b/R/spec-teams.R @@ -0,0 +1,37 @@ +spec_teams <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + color = lcol_chr("color"), + avatar = lcol_chr("avatar"), + members = lcol_df_lst( + "members", + user = lcol_df( + "user", + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + email = lcol_chr("email"), + color = lcol_chr("color", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + initials = lcol_chr("initials"), + role = lcol_int("role"), + custom_role = lcol_guess("custom_role", .default = NULL), + last_active = lcol_chr("last_active"), + date_joined = lcol_chr("date_joined"), + date_invited = lcol_chr("date_invited") + ), + invited_by = lcol_df( + "invited_by", + id = lcol_chr("id", .parser = as.character, .default = NA_character_), + username = lcol_chr("username", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + email = lcol_chr("email", .default = NA_character_), + initials = lcol_chr("initials", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + .default = NULL + ), + can_see_time_spent = lcol_lgl("can_see_time_spent", .default = NA), + can_see_time_estimated = lcol_lgl("can_see_time_estimated", .default = NA), + can_see_points_estimated = lcol_lgl("can_see_points_estimated", .default = NA), + can_edit_tags = lcol_lgl("can_edit_tags", .default = NA) + ) +) From 1dd8ff978486c6c2c951cc6d5d1bef16f27a9aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 15:14:09 +0200 Subject: [PATCH 018/137] Indent --- script/tibblify.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/script/tibblify.R b/script/tibblify.R index c8974a1..f6f47e9 100644 --- a/script/tibblify.R +++ b/script/tibblify.R @@ -12,9 +12,10 @@ clip_spec <- function(x) { base_name <- gsub("^df_", "", name) - out <- paste0(base_name, "_spec <- ", out) + out <- paste0(base_name, "spec_", name, " <- ", out) + out <- gsub(" ", " ", out) - # writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) + writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) } teams <- cu_get_teams() @@ -57,3 +58,9 @@ df_folders df_folders %>% get_spec() clip_spec(df_folders) + +folder <- cu_get_folder(df_folders$id[[1]]) +folder + +df_folder <- tibblify::tibblify(list(unclass(folder))) +df_folder %>% get_spec() From 3073b1b7cdea9989ddc7e02ac60283dbab5128c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Oct 2021 15:38:54 +0200 Subject: [PATCH 019/137] Autogenerate specs --- script/tibblify.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/tibblify.R b/script/tibblify.R index f6f47e9..b82856f 100644 --- a/script/tibblify.R +++ b/script/tibblify.R @@ -12,7 +12,7 @@ clip_spec <- function(x) { base_name <- gsub("^df_", "", name) - out <- paste0(base_name, "spec_", name, " <- ", out) + out <- paste0("spec_", base_name, " <- ", out) out <- gsub(" ", " ", out) writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) @@ -33,7 +33,12 @@ df_teams$members spaces <- cu_get_spaces(df_teams$id[[1]]) spaces -df_spaces <- cuf_get_spaces(df_teams$id[[1]]) +df_spaces <- + spaces$spaces %>% + tibblify() + +df_spaces %>% + get_spec() clip_spec(df_spaces) From 27113970e3cecc597f06932e83538b26bbbfa5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 04:58:13 +0200 Subject: [PATCH 020/137] Extract write_spec() --- DESCRIPTION | 1 + R/tibblify.R | 17 +++++++++++++++++ script/tibblify.R | 26 +++++--------------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9da86a5..8cf7932 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,6 +26,7 @@ Imports: tibble, tibblify Suggests: + fansi, knitr, testthat (>= 3.0.0) VignetteBuilder: diff --git a/R/tibblify.R b/R/tibblify.R index 71a4dc8..c95d703 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -1,3 +1,20 @@ #' @import tibble #' @import tibblify NULL + +write_spec <- function(x) { + name <- deparse(substitute(x)) + + out <- + x %>% + get_spec() %>% + format() %>% + fansi::strip_sgr() + + base_name <- gsub("^df_", "", name) + + out <- paste0("spec_", base_name, " <- ", out) + out <- gsub(" ", " ", out) + + writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) +} diff --git a/script/tibblify.R b/script/tibblify.R index b82856f..e53c841 100644 --- a/script/tibblify.R +++ b/script/tibblify.R @@ -1,22 +1,6 @@ pkgload::load_all() library(tibblify) - -clip_spec <- function(x) { - name <- deparse(substitute(x)) - - out <- - x %>% - get_spec() %>% - format() %>% - fansi::strip_sgr() - - base_name <- gsub("^df_", "", name) - - out <- paste0("spec_", base_name, " <- ", out) - out <- gsub(" ", " ", out) - - writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) -} +library(tidyverse) teams <- cu_get_teams() teams @@ -25,11 +9,11 @@ df_teams <- tibblify(teams$teams) df_teams df_teams %>% get_spec() -clip_spec(df_teams) - df_teams df_teams$members +write_spec(df_teams) + spaces <- cu_get_spaces(df_teams$id[[1]]) spaces @@ -40,7 +24,7 @@ df_spaces <- df_spaces %>% get_spec() -clip_spec(df_spaces) +write_spec(df_spaces) df_spaces df_spaces$statuses @@ -62,7 +46,7 @@ df_folders <- tibblify::tibblify(folders$folders) df_folders df_folders %>% get_spec() -clip_spec(df_folders) +write_spec(df_folders) folder <- cu_get_folder(df_folders$id[[1]]) folder From 0d45a98df21aab3aea83c10a9ec46aba0ee40e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:01:42 +0200 Subject: [PATCH 021/137] Split --- script/tibblify-01-teams.R | 15 ++++++++++ script/tibblify-02-spaces.R | 16 +++++++++++ script/tibblify-03-folders.R | 15 ++++++++++ script/tibblify.R | 55 ------------------------------------ 4 files changed, 46 insertions(+), 55 deletions(-) create mode 100644 script/tibblify-01-teams.R create mode 100644 script/tibblify-02-spaces.R create mode 100644 script/tibblify-03-folders.R delete mode 100644 script/tibblify.R diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R new file mode 100644 index 0000000..fa6e389 --- /dev/null +++ b/script/tibblify-01-teams.R @@ -0,0 +1,15 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +teams <- cu_get_teams() +teams + +df_teams <- tibblify(teams$teams) +df_teams +df_teams %>% get_spec() + +df_teams +df_teams$members + +write_spec(df_teams) diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R new file mode 100644 index 0000000..65af9fa --- /dev/null +++ b/script/tibblify-02-spaces.R @@ -0,0 +1,16 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +df_teams <- cuf_get_teams() +spaces <- cu_get_spaces(df_teams$id[[1]]) +spaces + +df_spaces <- + spaces$spaces %>% + tibblify() + +df_spaces %>% + get_spec() + +write_spec(df_spaces) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R new file mode 100644 index 0000000..98abea8 --- /dev/null +++ b/script/tibblify-03-folders.R @@ -0,0 +1,15 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +df_teams <- cuf_get_teams() +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) + +folders <- cu_get_folders(df_spaces$id[[1]]) +folders + +df_folders <- tibblify::tibblify(folders$folders) +df_folders +df_folders %>% get_spec() + +write_spec(df_folders) diff --git a/script/tibblify.R b/script/tibblify.R deleted file mode 100644 index e53c841..0000000 --- a/script/tibblify.R +++ /dev/null @@ -1,55 +0,0 @@ -pkgload::load_all() -library(tibblify) -library(tidyverse) - -teams <- cu_get_teams() -teams - -df_teams <- tibblify(teams$teams) -df_teams -df_teams %>% get_spec() - -df_teams -df_teams$members - -write_spec(df_teams) - -spaces <- cu_get_spaces(df_teams$id[[1]]) -spaces - -df_spaces <- - spaces$spaces %>% - tibblify() - -df_spaces %>% - get_spec() - -write_spec(df_spaces) - -df_spaces -df_spaces$statuses -df_spaces$features -df_spaces$features$due_dates -df_spaces$features$time_tracking -df_spaces$features$tags -df_spaces$features$time_estimates -df_spaces$features$checklists -df_spaces$features$custom_fields -df_spaces$features$remap_dependencies -df_spaces$features$dependency_warning -df_spaces$features$portfolios - -folders <- cu_get_folders(df_spaces$id[[1]]) -folders - -df_folders <- tibblify::tibblify(folders$folders) -df_folders -df_folders %>% get_spec() - -write_spec(df_folders) - -folder <- cu_get_folder(df_folders$id[[1]]) -folder - -df_folder <- tibblify::tibblify(list(unclass(folder))) -df_folder %>% get_spec() From 175b08b2fbc8c097f4fb98e6aa278874fa58ebad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:08:02 +0200 Subject: [PATCH 022/137] Character ID columns --- R/tibblify.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/tibblify.R b/R/tibblify.R index c95d703..b63bf71 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -14,7 +14,12 @@ write_spec <- function(x) { base_name <- gsub("^df_", "", name) out <- paste0("spec_", base_name, " <- ", out) - out <- gsub(" ", " ", out) + out <- gsub(" ", " ", out, fixed = TRUE) + out <- gsub('lcol_int("id")', 'lcol_chr("id")', out, fixed = TRUE) + out <- gsub('lcol_int("id", .default = NA_integer_', 'lcol_chr("id", .default = NA_character_', out, fixed = TRUE) + + # Dogfood first + eval(parse(text = out)) writeLines(out, file.path("R", paste0("spec-", base_name, ".R"))) } From de699da1bf7f3b535eb18888651556f49332a07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:08:21 +0200 Subject: [PATCH 023/137] Refresh teams --- R/spec-teams.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/spec-teams.R b/R/spec-teams.R index 9cd8d72..5585d49 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -7,7 +7,7 @@ spec_teams <- lcols( "members", user = lcol_df( "user", - id = lcol_chr("id", .parser = as.character), + id = lcol_chr("id"), username = lcol_chr("username"), email = lcol_chr("email"), color = lcol_chr("color", .default = NA_character_), @@ -21,7 +21,7 @@ spec_teams <- lcols( ), invited_by = lcol_df( "invited_by", - id = lcol_chr("id", .parser = as.character, .default = NA_character_), + id = lcol_chr("id", .default = NA_character_), username = lcol_chr("username", .default = NA_character_), color = lcol_chr("color", .default = NA_character_), email = lcol_chr("email", .default = NA_character_), From 43c2789c3673fe3056de2f1dc1a607343752ff9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:09:14 +0200 Subject: [PATCH 024/137] Need .parser --- R/spec-teams.R | 4 ++-- R/tibblify.R | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/spec-teams.R b/R/spec-teams.R index 5585d49..9cd8d72 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -7,7 +7,7 @@ spec_teams <- lcols( "members", user = lcol_df( "user", - id = lcol_chr("id"), + id = lcol_chr("id", .parser = as.character), username = lcol_chr("username"), email = lcol_chr("email"), color = lcol_chr("color", .default = NA_character_), @@ -21,7 +21,7 @@ spec_teams <- lcols( ), invited_by = lcol_df( "invited_by", - id = lcol_chr("id", .default = NA_character_), + id = lcol_chr("id", .parser = as.character, .default = NA_character_), username = lcol_chr("username", .default = NA_character_), color = lcol_chr("color", .default = NA_character_), email = lcol_chr("email", .default = NA_character_), diff --git a/R/tibblify.R b/R/tibblify.R index b63bf71..b5966b4 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -15,8 +15,8 @@ write_spec <- function(x) { out <- paste0("spec_", base_name, " <- ", out) out <- gsub(" ", " ", out, fixed = TRUE) - out <- gsub('lcol_int("id")', 'lcol_chr("id")', out, fixed = TRUE) - out <- gsub('lcol_int("id", .default = NA_integer_', 'lcol_chr("id", .default = NA_character_', out, fixed = TRUE) + out <- gsub('lcol_int("id")', 'lcol_chr("id", .parser = as.character)', out, fixed = TRUE) + out <- gsub('lcol_int("id", .default = NA_integer_', 'lcol_chr("id", .parser = as.character, .default = NA_character_', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From 2b83750af267b40ff6f071234ca3e8cd086c3371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:09:55 +0200 Subject: [PATCH 025/137] Refresh spaces --- R/spec-spaces.R | 88 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 16 deletions(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 6bdb990..b3b71a1 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -4,6 +4,7 @@ spec_spaces <- lcols( private = lcol_lgl("private"), statuses = lcol_df_lst( "statuses", + id = lcol_chr("id"), status = lcol_chr("status"), type = lcol_chr("type"), orderindex = lcol_int("orderindex"), @@ -19,45 +20,100 @@ spec_spaces <- lcols( remap_due_dates = lcol_lgl("remap_due_dates"), remap_closed_due_date = lcol_lgl("remap_closed_due_date") ), + sprints = lcol_df( + "sprints", + enabled = lcol_lgl("enabled") + ), time_tracking = lcol_df( "time_tracking", enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) + harvest = lcol_lgl("harvest"), + rollup = lcol_lgl("rollup") + ), + points = lcol_df( + "points", + enabled = lcol_lgl("enabled") + ), + custom_items = lcol_df( + "custom_items", + enabled = lcol_lgl("enabled") + ), + priorities = lcol_df( + "priorities", + enabled = lcol_lgl("enabled"), + priorities = lcol_df_lst( + "priorities", + id = lcol_chr("id"), + priority = lcol_chr("priority"), + color = lcol_chr("color"), + orderindex = lcol_chr("orderindex") + ) ), tags = lcol_df( "tags", - enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) + enabled = lcol_lgl("enabled") + ), + wip_limits = lcol_df( + "wip_limits", + enabled = lcol_lgl("enabled", .default = NA), + .default = NULL ), time_estimates = lcol_df( "time_estimates", - enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) + enabled = lcol_lgl("enabled", .default = NA), + rollup = lcol_lgl("rollup", .default = NA), + per_assignee = lcol_lgl("per_assignee", .default = NA), + .default = NULL ), - checklists = lcol_df( - "checklists", + check_unresolved = lcol_df( + "check_unresolved", enabled = lcol_lgl("enabled"), - .default = tibble(enabled = NA) + subtasks = lcol_lgl("subtasks", .default = NA), + checklists = lcol_guess("checklists", .default = NULL), + comments = lcol_guess("comments", .default = NULL) + ), + zoom = lcol_df( + "zoom", + enabled = lcol_lgl("enabled") + ), + milestones = lcol_df( + "milestones", + enabled = lcol_lgl("enabled") ), custom_fields = lcol_df( "custom_fields", - enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) + enabled = lcol_lgl("enabled") ), remap_dependencies = lcol_df( "remap_dependencies", enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) + .default = NULL ), dependency_warning = lcol_df( "dependency_warning", - enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) + enabled = lcol_lgl("enabled") ), - portfolios = lcol_df( - "portfolios", + multiple_assignees = lcol_df( + "multiple_assignees", enabled = lcol_lgl("enabled", .default = NA), - .default = tibble(enabled = NA) + .default = NULL + ), + emails = lcol_df( + "emails", + enabled = lcol_lgl("enabled") ) + ), + archived = lcol_lgl("archived"), + members = lcol_df_lst( + "members", + user = lcol_df( + "user", + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + color = lcol_chr("color"), + profilePicture = lcol_chr("profilePicture"), + initials = lcol_chr("initials") + ), + .default = NULL ) ) From 7176085d7d308ad1ffc0813d6a901ba1443a1539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:13:23 +0200 Subject: [PATCH 026/137] Tweak type of orderindex --- R/spec-spaces.R | 2 +- R/tibblify.R | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index b3b71a1..44f1935 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -46,7 +46,7 @@ spec_spaces <- lcols( id = lcol_chr("id"), priority = lcol_chr("priority"), color = lcol_chr("color"), - orderindex = lcol_chr("orderindex") + orderindex = lcol_int("orderindex", .parser = as.integer) ) ), tags = lcol_df( diff --git a/R/tibblify.R b/R/tibblify.R index b5966b4..b5b99e8 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -15,9 +15,12 @@ write_spec <- function(x) { out <- paste0("spec_", base_name, " <- ", out) out <- gsub(" ", " ", out, fixed = TRUE) + out <- gsub('lcol_int("id")', 'lcol_chr("id", .parser = as.character)', out, fixed = TRUE) out <- gsub('lcol_int("id", .default = NA_integer_', 'lcol_chr("id", .parser = as.character, .default = NA_character_', out, fixed = TRUE) + out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) + # Dogfood first eval(parse(text = out)) From adff4e295212634af7d0f6f60abdaa598d870d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:22:57 +0200 Subject: [PATCH 027/137] lcol_dtt --- R/spec-teams.R | 6 +++--- R/tibblify.R | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/R/spec-teams.R b/R/spec-teams.R index 9cd8d72..5b8d5dc 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -15,9 +15,9 @@ spec_teams <- lcols( initials = lcol_chr("initials"), role = lcol_int("role"), custom_role = lcol_guess("custom_role", .default = NULL), - last_active = lcol_chr("last_active"), - date_joined = lcol_chr("date_joined"), - date_invited = lcol_chr("date_invited") + last_active = lcol_dtt("last_active", .parser = cu_date_from), + date_joined = lcol_dtt("date_joined", .parser = cu_date_from), + date_invited = lcol_dtt("date_invited", .parser = cu_date_from) ), invited_by = lcol_df( "invited_by", diff --git a/R/tibblify.R b/R/tibblify.R index b5b99e8..7b7b913 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,6 +21,8 @@ write_spec <- function(x) { out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) + out <- gsub('lcol_chr[(]"(last_active|date_joined|date_invited)"', 'lcol_dtt("\\1", .parser = cu_date_from', out) + # Dogfood first eval(parse(text = out)) From afa244329a84e0651b364d3e5cfa42f673602a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:30:51 +0200 Subject: [PATCH 028/137] Get all folders --- script/tibblify-03-folders.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index 98abea8..751f053 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -5,10 +5,14 @@ library(tidyverse) df_teams <- cuf_get_teams() df_spaces <- cuf_get_spaces(df_teams$id[[1]]) -folders <- cu_get_folders(df_spaces$id[[1]]) +folders <- + df_spaces$id %>% + map(cu_get_folders) %>% + map("folders") %>% + unlist(recursive = FALSE) folders -df_folders <- tibblify::tibblify(folders$folders) +df_folders <- tibblify::tibblify(folders) df_folders df_folders %>% get_spec() From 94da9513fca7cbb158a22d36b4a718cb69e2094c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:31:56 +0200 Subject: [PATCH 029/137] Tweak --- R/df-folders.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/df-folders.R b/R/df-folders.R index 8d85d87..48183e6 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -6,7 +6,7 @@ NULL #' @rdname api-folders cuf_create_folder <- function(space_id, name) { out <- cu_create_folder(space_id, name) - tibblify(list(out), spec_folder) + tibblify(list(out), spec_folders) } @@ -14,7 +14,7 @@ cuf_create_folder <- function(space_id, name) { #' @rdname api-folders cuf_update_folder <- function(folder_id, name) { out <- cu_update_folder(folder_id, name) - tibblify(list(out), spec_folder) + tibblify(list(out), spec_folders) } @@ -22,7 +22,7 @@ cuf_update_folder <- function(folder_id, name) { #' @rdname api-folders cuf_get_folders <- function(space_id, archived=FALSE) { out <- cu_get_folders(space_id, archived) - tibblify(out$folders, spec_folder) + tibblify(out$folders, spec_folders) } @@ -31,5 +31,5 @@ cuf_get_folders <- function(space_id, archived=FALSE) { #' @rdname api-folders cuf_get_folder <- function(folder_id) { out <- cu_get_folder(folder_id) - tibblify(list(out), spec_folder) + tibblify(list(out), spec_folders) } From 24d88c28e0db5314ba50e96126643d35e0f0133b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:36:36 +0200 Subject: [PATCH 030/137] Lists --- NAMESPACE | 1 - R/df-lists.R | 30 ++++++++++++------------------ R/spec-lists.R | 28 ++++++++++++++++++++++++++++ man/api-lists.Rd | 3 --- script/tibblify-04-lists.R | 17 +++++++++++++++++ 5 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 R/spec-lists.R create mode 100644 script/tibblify-04-lists.R diff --git a/NAMESPACE b/NAMESPACE index 7e26d6a..2203509 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -158,7 +158,6 @@ export(cuf_delete_comment) export(cuf_delete_dependency) export(cuf_delete_goal) export(cuf_delete_key_result) -export(cuf_delete_list) export(cuf_delete_space_tag) export(cuf_delete_task) export(cuf_delete_time_entry) diff --git a/R/df-lists.R b/R/df-lists.R index 17a39ca..15281d2 100644 --- a/R/df-lists.R +++ b/R/df-lists.R @@ -5,52 +5,46 @@ NULL #' @export #' @rdname api-lists cuf_create_list <- function(folder_id, ...) { - .cu_post("folder", folder_id, "list", - body=list(...)) + out <- cu_create_list(folder_id, ...) + tibblify(list(out), spec_lists) } #' @export #' @rdname api-lists cuf_create_folderless_list <- function(space_id, ...) { - .cu_post("space", space_id, "list", - body=list(...)) + out <- cu_create_folderless_list(space_id, ...) + tibblify(list(out), spec_lists) } #' @export #' @rdname api-lists cuf_update_list <- function(list_id, ...) { - .cu_put("list", list_id, - body=list(...)) -} - - -#' @export -#' @rdname api-lists -cuf_delete_list <- function(list_id, ...) { - .cu_delete("list", list_id) + out <- cu_update_list(folder_id, ...) + tibblify(list(out), spec_lists) } #' @export #' @rdname api-lists cuf_get_lists <- function(folder_id, archived=FALSE) { - .cu_get("folder", folder_id, "list", - query = list("archived" = tolower(archived))) + out <- cu_get_lists(folder_id, archived) + tibblify(out$lists, spec_lists) } #' @export #' @rdname api-lists cuf_get_lists_folderless <- function(space_id, archived=FALSE) { - .cu_get("space", space_id, "list", - query = list("archived" = tolower(archived))) + out <- cu_get_lists_folderless(folder_id, archived) + tibblify(out$lists, spec_lists) } #' @export #' @rdname api-lists cuf_get_list <- function(list_id) { - .cu_get("list", list_id) + out <- cu_get_list(list_id) + tibblify(list(out), spec_lists) } diff --git a/R/spec-lists.R b/R/spec-lists.R new file mode 100644 index 0000000..4cc99b4 --- /dev/null +++ b/R/spec-lists.R @@ -0,0 +1,28 @@ +spec_lists <- lcols( + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + content = lcol_chr("content", .default = NA_character_), + status = lcol_guess("status", .default = NULL), + priority = lcol_guess("priority", .default = NULL), + assignee = lcol_guess("assignee", .default = NULL), + task_count = lcol_int("task_count"), + due_date = lcol_guess("due_date", .default = NULL), + start_date = lcol_guess("start_date", .default = NULL), + folder = lcol_df( + "folder", + id = lcol_chr("id"), + name = lcol_chr("name"), + hidden = lcol_lgl("hidden"), + access = lcol_lgl("access") + ), + space = lcol_df( + "space", + id = lcol_chr("id"), + name = lcol_chr("name"), + access = lcol_lgl("access") + ), + archived = lcol_lgl("archived"), + override_statuses = lcol_lgl("override_statuses", .default = NA), + permission_level = lcol_chr("permission_level") +) diff --git a/man/api-lists.Rd b/man/api-lists.Rd index 7160c4c..b6ebdc4 100644 --- a/man/api-lists.Rd +++ b/man/api-lists.Rd @@ -12,7 +12,6 @@ \alias{cuf_create_list} \alias{cuf_create_folderless_list} \alias{cuf_update_list} -\alias{cuf_delete_list} \alias{cuf_get_lists} \alias{cuf_get_lists_folderless} \alias{cuf_get_list} @@ -38,8 +37,6 @@ cuf_create_folderless_list(space_id, ...) cuf_update_list(list_id, ...) -cuf_delete_list(list_id, ...) - cuf_get_lists(folder_id, archived = FALSE) cuf_get_lists_folderless(space_id, archived = FALSE) diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R new file mode 100644 index 0000000..ce43d8f --- /dev/null +++ b/script/tibblify-04-lists.R @@ -0,0 +1,17 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +df_teams <- cuf_get_teams() +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) + +df_folders <- cuf_get_folders(df_spaces$id[[1]]) +df_folders + +lists <- cu_get_lists(df_folders$id[[1]]) + +df_lists <- tibblify::tibblify(lists$lists) +df_lists +df_lists %>% get_spec() + +write_spec(df_lists) From cabc4dbb8c361d78e610c58ee8ef9aa860a05163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:44:43 +0200 Subject: [PATCH 031/137] Tasks --- NAMESPACE | 1 - R/df-tasks.R | 29 ++++------ R/spec-tasks.R | 112 +++++++++++++++++++++++++++++++++++++ man/api-tasks.Rd | 3 - script/tibblify-05-tasks.R | 20 +++++++ 5 files changed, 142 insertions(+), 23 deletions(-) create mode 100644 R/spec-tasks.R create mode 100644 script/tibblify-05-tasks.R diff --git a/NAMESPACE b/NAMESPACE index 2203509..253677b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -159,7 +159,6 @@ export(cuf_delete_dependency) export(cuf_delete_goal) export(cuf_delete_key_result) export(cuf_delete_space_tag) -export(cuf_delete_task) export(cuf_delete_time_entry) export(cuf_delete_time_tracked) export(cuf_delete_view) diff --git a/R/df-tasks.R b/R/df-tasks.R index 9a8fd4b..f33c01c 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -5,25 +5,16 @@ NULL #' @export #' @rdname api-tasks cuf_create_task <- function(list_id, ...) { - .cu_post("list", list_id, "task", - body=list(...)) + out <- cu_create_task(list_id, ...) + tibblify(list(out), spec_tasks) } #' @export #' @rdname api-tasks cuf_update_task <- function(task_id, ...) { - task_id <- cu_task_id(task_id) - .cu_put("task", task_id, - body=list(...)) -} - - -#' @export -#' @rdname api-tasks -cuf_delete_task <- function(task_id) { - task_id <- cu_task_id(task_id) - .cu_delete("task", task_id) + out <- cu_update_task(task_id, ...) + tibblify(list(out), spec_tasks) } @@ -31,23 +22,23 @@ cuf_delete_task <- function(task_id) { #' @rdname api-tasks # ... takes parameters, most importantly page (starting at 0) cuf_get_tasks <- function(list_id, archived=FALSE, ...) { - .cu_get("list", list_id, "task", - query = list("archived" = tolower(archived), ...)) + out <- cu_get_tasks(list_id, archived, ...) + tibblify(out$tasks, spec_tasks) } #' @export #' @rdname api-tasks cuf_get_task <- function(task_id) { - task_id <- cu_task_id(task_id) - .cu_get("task", task_id) + out <- cu_get_task(task_id) + tibblify(list(out), spec_tasks) } #' @export #' @rdname api-tasks cuf_get_filtered_team_tasks <- function(team_id, ...) { - .cu_get("team", team_id, "task", - query = list(...)) + out <- cu_get_filtered_team_tasks(team_id, ...) + tibblify(out$tasks, spec_tasks) } diff --git a/R/spec-tasks.R b/R/spec-tasks.R new file mode 100644 index 0000000..6038614 --- /dev/null +++ b/R/spec-tasks.R @@ -0,0 +1,112 @@ +spec_tasks <- lcols( + id = lcol_chr("id"), + custom_id = lcol_guess("custom_id", .default = NULL), + name = lcol_chr("name"), + text_content = lcol_chr("text_content", .default = NA_character_), + description = lcol_chr("description", .default = NA_character_), + status = lcol_df( + "status", + status = lcol_chr("status"), + color = lcol_chr("color"), + type = lcol_chr("type"), + orderindex = lcol_int("orderindex") + ), + orderindex = lcol_int("orderindex", .parser = as.integer), + date_created = lcol_chr("date_created"), + date_updated = lcol_chr("date_updated"), + date_closed = lcol_guess("date_closed", .default = NULL), + archived = lcol_lgl("archived"), + creator = lcol_df( + "creator", + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + color = lcol_chr("color"), + email = lcol_chr("email"), + profilePicture = lcol_chr("profilePicture") + ), + assignees = lcol_guess("assignees", .default = NULL), + watchers = lcol_guess("watchers", .default = NULL), + checklists = lcol_guess("checklists", .default = NULL), + tags = lcol_df_lst( + "tags", + name = lcol_chr("name"), + tag_fg = lcol_chr("tag_fg"), + tag_bg = lcol_chr("tag_bg"), + creator = lcol_int("creator"), + .default = NULL + ), + parent = lcol_guess("parent", .default = NULL), + priority = lcol_guess("priority", .default = NULL), + due_date = lcol_chr("due_date", .default = NA_character_), + start_date = lcol_guess("start_date", .default = NULL), + points = lcol_guess("points", .default = NULL), + time_estimate = lcol_guess("time_estimate", .default = NULL), + custom_fields = lcol_df_lst( + "custom_fields", + id = lcol_chr("id"), + name = lcol_chr("name"), + type = lcol_chr("type"), + type_config = lcol_df( + "type_config", + simple = lcol_lgl("simple", .default = NA), + formula = lcol_chr("formula", .default = NA_character_), + include_guests = lcol_lgl("include_guests", .default = NA), + include_team_members = lcol_lgl("include_team_members", .default = NA), + single_user = lcol_lgl("single_user", .default = NA), + default = lcol_int("default", .default = NA_integer_), + placeholder = lcol_guess("placeholder", .default = NULL), + new_drop_down = lcol_lgl("new_drop_down", .default = NA), + options = lcol_df_lst( + "options", + id = lcol_chr("id"), + name = lcol_chr("name"), + color = lcol_chr("color", .default = NA_character_), + orderindex = lcol_int("orderindex"), + .default = NULL + ), + tracking = lcol_df( + "tracking", + subtasks = lcol_lgl("subtasks", .default = NA), + checklists = lcol_lgl("checklists", .default = NA), + assigned_comments = lcol_lgl("assigned_comments", .default = NA), + .default = NULL + ), + complete_on = lcol_int("complete_on", .default = NA_integer_), + subtask_rollup = lcol_lgl("subtask_rollup", .default = NA), + .default = NULL + ), + date_created = lcol_chr("date_created"), + hide_from_guests = lcol_lgl("hide_from_guests"), + required = lcol_lgl("required"), + value = lcol_lst("value", .default = NULL) + ), + dependencies = lcol_guess("dependencies", .default = NULL), + linked_tasks = lcol_guess("linked_tasks", .default = NULL), + team_id = lcol_chr("team_id"), + url = lcol_chr("url"), + permission_level = lcol_chr("permission_level"), + list = lcol_df( + "list", + id = lcol_chr("id"), + name = lcol_chr("name"), + access = lcol_lgl("access") + ), + project = lcol_df( + "project", + id = lcol_chr("id"), + name = lcol_chr("name"), + hidden = lcol_lgl("hidden"), + access = lcol_lgl("access") + ), + folder = lcol_df( + "folder", + id = lcol_chr("id"), + name = lcol_chr("name"), + hidden = lcol_lgl("hidden"), + access = lcol_lgl("access") + ), + space = lcol_df( + "space", + id = lcol_chr("id") + ) +) diff --git a/man/api-tasks.Rd b/man/api-tasks.Rd index 473b606..daa3cb6 100644 --- a/man/api-tasks.Rd +++ b/man/api-tasks.Rd @@ -10,7 +10,6 @@ \alias{cu_get_filtered_team_tasks} \alias{cuf_create_task} \alias{cuf_update_task} -\alias{cuf_delete_task} \alias{cuf_get_tasks} \alias{cuf_get_task} \alias{cuf_get_filtered_team_tasks} @@ -32,8 +31,6 @@ cuf_create_task(list_id, ...) cuf_update_task(task_id, ...) -cuf_delete_task(task_id) - cuf_get_tasks(list_id, archived = FALSE, ...) cuf_get_task(task_id) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R new file mode 100644 index 0000000..1f8a22a --- /dev/null +++ b/script/tibblify-05-tasks.R @@ -0,0 +1,20 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +df_teams <- cuf_get_teams() +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) + +df_folders <- cuf_get_folders(df_spaces$id[[1]]) +df_folders + +df_lists <- cuf_get_lists(df_folders$id[[1]]) +df_lists + +tasks <- cu_get_tasks(df_lists$id[[1]]) + +df_tasks <- tibblify::tibblify(tasks$tasks) +df_tasks +df_tasks %>% get_spec() + +write_spec(df_tasks) From 0d7372ae216e68d95bcf0fae5ab413a72d54ff08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 05:55:15 +0200 Subject: [PATCH 032/137] Refine spec --- R/spec-tasks.R | 31 ++++++++++++++++++++++++++----- script/tibblify-05-tasks.R | 3 ++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 6038614..f8e32fb 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -24,7 +24,16 @@ spec_tasks <- lcols( email = lcol_chr("email"), profilePicture = lcol_chr("profilePicture") ), - assignees = lcol_guess("assignees", .default = NULL), + assignees = lcol_df_lst( + "assignees", + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + color = lcol_chr("color"), + initials = lcol_chr("initials"), + email = lcol_chr("email"), + profilePicture = lcol_chr("profilePicture"), + .default = NULL + ), watchers = lcol_guess("watchers", .default = NULL), checklists = lcol_guess("checklists", .default = NULL), tags = lcol_df_lst( @@ -40,7 +49,8 @@ spec_tasks <- lcols( due_date = lcol_chr("due_date", .default = NA_character_), start_date = lcol_guess("start_date", .default = NULL), points = lcol_guess("points", .default = NULL), - time_estimate = lcol_guess("time_estimate", .default = NULL), + time_estimate = lcol_int("time_estimate", .default = NA_integer_), + time_spent = lcol_int("time_spent", .default = NA_integer_), custom_fields = lcol_df_lst( "custom_fields", id = lcol_chr("id"), @@ -59,9 +69,10 @@ spec_tasks <- lcols( options = lcol_df_lst( "options", id = lcol_chr("id"), - name = lcol_chr("name"), + name = lcol_chr("name", .default = NA_character_), color = lcol_chr("color", .default = NA_character_), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .default = NA_integer_), + label = lcol_chr("label", .default = NA_character_), .default = NULL ), tracking = lcol_df( @@ -73,6 +84,8 @@ spec_tasks <- lcols( ), complete_on = lcol_int("complete_on", .default = NA_integer_), subtask_rollup = lcol_lgl("subtask_rollup", .default = NA), + end = lcol_int("end", .default = NA_integer_), + start = lcol_int("start", .default = NA_integer_), .default = NULL ), date_created = lcol_chr("date_created"), @@ -80,7 +93,15 @@ spec_tasks <- lcols( required = lcol_lgl("required"), value = lcol_lst("value", .default = NULL) ), - dependencies = lcol_guess("dependencies", .default = NULL), + dependencies = lcol_df_lst( + "dependencies", + task_id = lcol_chr("task_id"), + depends_on = lcol_chr("depends_on"), + type = lcol_int("type"), + date_created = lcol_chr("date_created"), + userid = lcol_chr("userid"), + .default = NULL + ), linked_tasks = lcol_guess("linked_tasks", .default = NULL), team_id = lcol_chr("team_id"), url = lcol_chr("url"), diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 1f8a22a..ecf6dd7 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -11,7 +11,8 @@ df_folders df_lists <- cuf_get_lists(df_folders$id[[1]]) df_lists -tasks <- cu_get_tasks(df_lists$id[[1]]) +# tasks <- cu_get_tasks(df_lists$id[[1]]) +tasks <- cu_get_filtered_team_tasks(df_teams$id[[1]]) df_tasks <- tibblify::tibblify(tasks$tasks) df_tasks From 912f6b2986533c0ed1b78a0a188f45d7d07d0d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 06:03:06 +0200 Subject: [PATCH 033/137] More tasks --- script/tibblify-05-tasks.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index ecf6dd7..53660fa 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -11,10 +11,11 @@ df_folders df_lists <- cuf_get_lists(df_folders$id[[1]]) df_lists -# tasks <- cu_get_tasks(df_lists$id[[1]]) -tasks <- cu_get_filtered_team_tasks(df_teams$id[[1]]) +tasks_list <- cu_get_tasks(df_lists$id[[1]]) +tasks_list_archived <- cu_get_tasks(df_lists$id[[1]], archived = TRUE) +tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) -df_tasks <- tibblify::tibblify(tasks$tasks) +df_tasks <- tibblify::tibblify(c(tasks_team$tasks, tasks_list$tasks, tasks_list_archived$tasks)) df_tasks df_tasks %>% get_spec() From 9340f600acbeb24b30e067762a3fd5ec0d1601e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 06:13:03 +0200 Subject: [PATCH 034/137] Refine spec --- DESCRIPTION | 1 + R/spec-folders.R | 4 ++-- R/tibblify.R | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8cf7932..6a21102 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,6 +20,7 @@ License: MIT + file LICENSE URL: https://github.com/psolymos/clickrup BugReports: https://github.com/psolymos/clickrup/issues Imports: + dttr2, httr, jsonlite, rlang, diff --git a/R/spec-folders.R b/R/spec-folders.R index 0fe410a..d3ee1bf 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -42,8 +42,8 @@ spec_folders <- lcols( .default = NULL ), task_count = lcol_int("task_count"), - due_date = lcol_chr("due_date", .default = NA_character_), - start_date = lcol_chr("start_date", .default = NA_character_), + due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), + start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), space = lcol_df( "space", id = lcol_chr("id"), diff --git a/R/tibblify.R b/R/tibblify.R index 7b7b913..c44c0a7 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,9 @@ write_spec <- function(x) { out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) - out <- gsub('lcol_chr[(]"(last_active|date_joined|date_invited)"', 'lcol_dtt("\\1", .parser = cu_date_from', out) + date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date" + out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')", .default = NA_character_'), 'lcol_dtt("\\1", .parser = cu_date_from, .default = dttr2::NA_POSIXct_', out) + out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')"'), 'lcol_dtt("\\1", .parser = cu_date_from', out) # Dogfood first eval(parse(text = out)) From d6b3458390c9baeabc35f009c02fa42e29e3a9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 06:22:48 +0200 Subject: [PATCH 035/137] Time entries --- NAMESPACE | 1 - R/df-timetracking-v2.R | 17 ++++------------- R/spec-time_entries.R | 22 ++++++++++++++++++++++ R/tibblify.R | 2 +- man/api-timetracking-2.Rd | 3 --- script/tibblify-06-timetracking-v2.R | 27 +++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 R/spec-time_entries.R create mode 100644 script/tibblify-06-timetracking-v2.R diff --git a/NAMESPACE b/NAMESPACE index 253677b..6b0e65e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -159,7 +159,6 @@ export(cuf_delete_dependency) export(cuf_delete_goal) export(cuf_delete_key_result) export(cuf_delete_space_tag) -export(cuf_delete_time_entry) export(cuf_delete_time_tracked) export(cuf_delete_view) export(cuf_delete_webhook) diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index e54d721..bd60686 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -6,18 +6,16 @@ NULL #' @rdname api-timetracking-2 cuf_get_time_entries_within_date_range <- function(team_id, start_date, end_date, assignee) { - .cu_get("team", team_id, "time_entries", - query = list( - "start_date"=start_date, - "end_date"=end_date, - "assignee"=assignee)) + out <- cu_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) + tibblify(out$data, spec_time_entries) } #' @export #' @rdname api-timetracking-2 cuf_get_singular_time_entry <- function(team_id, timer_id) { - .cu_get("team", team_id, "time_entries", timer_id) + out <- cu_get_singular_time_entry(team_id, timer_id) + tibblify(list(out$data), spec_time_entries) } @@ -89,13 +87,6 @@ cuf_stop_time_entry <- function(team_id) { } -#' @export -#' @rdname api-timetracking-2 -cuf_delete_time_entry <- function(team_id, timer_id) { - .cu_delete("team", team_id, "time_entries", timer_id) -} - - #' @export #' @rdname api-timetracking-2 cuf_update_time_entry <- function(team_id, timer_id, ...) { diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R new file mode 100644 index 0000000..11908c0 --- /dev/null +++ b/R/spec-time_entries.R @@ -0,0 +1,22 @@ +spec_time_entries <- lcols( + id = lcol_chr("id"), + task = lcol_lst("task", .default = NULL), + wid = lcol_chr("wid"), + user = lcol_df( + "user", + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + email = lcol_chr("email"), + color = lcol_chr("color"), + initials = lcol_chr("initials"), + profilePicture = lcol_chr("profilePicture") + ), + billable = lcol_lgl("billable"), + start = lcol_dtt("start", .parser = cu_date_from), + end = lcol_dtt("end", .parser = cu_date_from), + duration = lcol_chr("duration"), + description = lcol_chr("description"), + tags = lcol_guess("tags", .default = NULL), + source = lcol_chr("source"), + at = lcol_chr("at") +) diff --git a/R/tibblify.R b/R/tibblify.R index c44c0a7..365b883 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,7 @@ write_spec <- function(x) { out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) - date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date" + date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end" out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')", .default = NA_character_'), 'lcol_dtt("\\1", .parser = cu_date_from, .default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')"'), 'lcol_dtt("\\1", .parser = cu_date_from', out) diff --git a/man/api-timetracking-2.Rd b/man/api-timetracking-2.Rd index afadc97..8c2c24a 100644 --- a/man/api-timetracking-2.Rd +++ b/man/api-timetracking-2.Rd @@ -26,7 +26,6 @@ \alias{cuf_change_tag_names_from_time_entries} \alias{cuf_start_time_entry} \alias{cuf_stop_time_entry} -\alias{cuf_delete_time_entry} \alias{cuf_update_time_entry} \title{Time tracking 2.0} \usage{ @@ -78,8 +77,6 @@ cuf_start_time_entry(team_id, timer_id, ...) cuf_stop_time_entry(team_id) -cuf_delete_time_entry(team_id, timer_id) - cuf_update_time_entry(team_id, timer_id, ...) } \arguments{ diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R new file mode 100644 index 0000000..0d3a551 --- /dev/null +++ b/script/tibblify-06-timetracking-v2.R @@ -0,0 +1,27 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +df_teams <- cuf_get_teams() + +user_ids <- bind_rows(df_teams$members)$user$id + +time <- cu_get_time_entries_within_date_range( + df_teams$id[[1]], + start_date = cu_date_to("2021-06-01"), + end_date = cu_date_to("2021-08-01"), + assignee = paste(user_ids, collapse = ",") +) + +df_time_entries <- tibblify::tibblify(time$data) +df_time_entries +df_time_entries %>% get_spec() + +write_spec(df_time_entries) + +# Reload after updating spec +pkgload::load_all() + +df_time_entries$id +cuf_get_singular_time_entry(df_teams$id[[1]], df_time_entries$id[[1]]) +cuf_get_time_entry_history(df_teams$id[[1]], df_time_entries$id[[253]]) From 74380dfc73f84323a76bfeeee0bebcbb60e2476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 06:36:42 +0200 Subject: [PATCH 036/137] Members --- R/df-members.R | 7 ++++--- R/spec-members.R | 8 ++++++++ script/tibblify-07-members.R | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 R/spec-members.R create mode 100644 script/tibblify-07-members.R diff --git a/R/df-members.R b/R/df-members.R index 7a73c77..58455bb 100644 --- a/R/df-members.R +++ b/R/df-members.R @@ -5,13 +5,14 @@ NULL #' @export #' @rdname api-members cuf_get_task_members <- function(task_id) { - task_id <- cu_task_id(task_id) - .cu_get("task", task_id, "member") + out <- cu_get_task_members(task_id) + tibblify(out$members, spec_members) } #' @export #' @rdname api-members cuf_get_list_members <- function(list_id) { - .cu_get("list", list_id, "member") + out <- cu_get_list_members(list_id) + tibblify(out$members, spec_members) } diff --git a/R/spec-members.R b/R/spec-members.R new file mode 100644 index 0000000..d2400f1 --- /dev/null +++ b/R/spec-members.R @@ -0,0 +1,8 @@ +spec_members <- lcols( + id = lcol_chr("id", .parser = as.character), + username = lcol_chr("username"), + email = lcol_chr("email"), + color = lcol_chr("color"), + initials = lcol_chr("initials"), + profilePicture = lcol_chr("profilePicture") +) diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R new file mode 100644 index 0000000..9a6f2c5 --- /dev/null +++ b/script/tibblify-07-members.R @@ -0,0 +1,27 @@ +pkgload::load_all() +library(tibblify) +library(tidyverse) + +df_teams <- cuf_get_teams() +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) + +df_folders <- cuf_get_folders(df_spaces$id[[1]]) +df_folders + +df_lists <- cuf_get_lists(df_folders$id[[1]]) +df_lists + +members <- cu_get_list_members(df_lists$id[[1]]) + +df_members <- tibblify::tibblify(members$members) +df_members +df_members %>% get_spec() + +write_spec(df_members) + +# Reload +pkgload::load_all() + +df_tasks <- cuf_get_tasks(df_lists$id[[1]]) + +cuf_get_task_members(df_tasks$id[[1]]) From 996b72060f41ef2d48e96083e9249fa58a58ba7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 06:43:48 +0200 Subject: [PATCH 037/137] Fix due date --- R/spec-tasks.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index f8e32fb..89f6673 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -46,7 +46,7 @@ spec_tasks <- lcols( ), parent = lcol_guess("parent", .default = NULL), priority = lcol_guess("priority", .default = NULL), - due_date = lcol_chr("due_date", .default = NA_character_), + due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), start_date = lcol_guess("start_date", .default = NULL), points = lcol_guess("points", .default = NULL), time_estimate = lcol_int("time_estimate", .default = NA_integer_), From ff06b4a33ce9968dfccf2dd22877a9375f922a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 06:43:55 +0200 Subject: [PATCH 038/137] Source all --- script/tibblify-all.R | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 script/tibblify-all.R diff --git a/script/tibblify-all.R b/script/tibblify-all.R new file mode 100644 index 0000000..6022f32 --- /dev/null +++ b/script/tibblify-all.R @@ -0,0 +1,3 @@ +paths <- dir("script", pattern = "^tibblify-[0-9]", full.names = TRUE) + +purrr::walk(paths, source, echo = TRUE) From 9ec6a317d3d037252d3881e1722767fb106c2864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 07:40:57 +0200 Subject: [PATCH 039/137] Restore cuf_delete_*() --- R/df-folders.R | 7 +++++++ R/df-lists.R | 7 +++++++ R/df-spaces.R | 7 +++++++ R/df-tasks.R | 8 ++++++++ R/df-timetracking-v2.R | 7 +++++++ 5 files changed, 36 insertions(+) diff --git a/R/df-folders.R b/R/df-folders.R index 48183e6..107aa56 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -18,6 +18,13 @@ cuf_update_folder <- function(folder_id, name) { } +#' @export +#' @rdname api-folders +cuf_delete_folder <- function(folder_id, name) { + .cu_delete("folder", folder_id) +} + + #' @export #' @rdname api-folders cuf_get_folders <- function(space_id, archived=FALSE) { diff --git a/R/df-lists.R b/R/df-lists.R index 15281d2..8e73a58 100644 --- a/R/df-lists.R +++ b/R/df-lists.R @@ -26,6 +26,13 @@ cuf_update_list <- function(list_id, ...) { } +#' @export +#' @rdname api-lists +cuf_delete_list <- function(list_id, ...) { + .cu_delete("list", list_id) +} + + #' @export #' @rdname api-lists cuf_get_lists <- function(folder_id, archived=FALSE) { diff --git a/R/df-spaces.R b/R/df-spaces.R index 8434037..60302ca 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -14,6 +14,13 @@ cuf_update_space <- function(space_id, ...) { } +#' @export +#' @rdname api-spaces +cuf_delete_space <- function(space_id) { + .cu_delete("space", space_id) +} + + #' @export #' @rdname api-spaces ##GET https://api.clickup.com/api/v2/team/team_id/space?archived=false diff --git a/R/df-tasks.R b/R/df-tasks.R index f33c01c..a73f273 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -18,6 +18,14 @@ cuf_update_task <- function(task_id, ...) { } +#' @export +#' @rdname api-tasks +cuf_delete_task <- function(task_id) { + task_id <- cu_task_id(task_id) + .cu_delete("task", task_id) +} + + #' @export #' @rdname api-tasks # ... takes parameters, most importantly page (starting at 0) diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index bd60686..f80ee7f 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -87,6 +87,13 @@ cuf_stop_time_entry <- function(team_id) { } +#' @export +#' @rdname api-timetracking-2 +cuf_delete_time_entry <- function(team_id, timer_id) { + .cu_delete("team", team_id, "time_entries", timer_id) +} + + #' @export #' @rdname api-timetracking-2 cuf_update_time_entry <- function(team_id, timer_id, ...) { From 9b4b9fb568e6be740c1e7f304243a4be35698daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 07:57:02 +0200 Subject: [PATCH 040/137] Draft tests --- tests/testthat.R | 4 + tests/testthat/_snaps/api-spaces.md | 508 ++++++++++++++++++++++++++++ tests/testthat/_snaps/api-teams.md | 68 ++++ tests/testthat/setup.R | 3 + tests/testthat/test-api-spaces.R | 30 ++ tests/testthat/test-api-teams.R | 13 + 6 files changed, 626 insertions(+) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/_snaps/api-spaces.md create mode 100644 tests/testthat/_snaps/api-teams.md create mode 100644 tests/testthat/setup.R create mode 100644 tests/testthat/test-api-spaces.R create mode 100644 tests/testthat/test-api-teams.R diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..76587f0 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(clickrup) + +test_check("clickrup") diff --git a/tests/testthat/_snaps/api-spaces.md b/tests/testthat/_snaps/api-spaces.md new file mode 100644 index 0000000..eccdfe0 --- /dev/null +++ b/tests/testthat/_snaps/api-spaces.md @@ -0,0 +1,508 @@ +# output + + Code + cu_get_spaces("1234") + Output + $spaces + $spaces[[1]] + $spaces[[1]]$id + [1] "790" + + $spaces[[1]]$name + [1] "Updated Space Name" + + $spaces[[1]]$private + [1] FALSE + + $spaces[[1]]$statuses + $spaces[[1]]$statuses[[1]] + $spaces[[1]]$statuses[[1]]$status + [1] "to do" + + $spaces[[1]]$statuses[[1]]$type + [1] "open" + + $spaces[[1]]$statuses[[1]]$orderindex + [1] 0 + + $spaces[[1]]$statuses[[1]]$color + [1] "#d3d3d3" + + + $spaces[[1]]$statuses[[2]] + $spaces[[1]]$statuses[[2]]$status + [1] "complete" + + $spaces[[1]]$statuses[[2]]$type + [1] "closed" + + $spaces[[1]]$statuses[[2]]$orderindex + [1] 1 + + $spaces[[1]]$statuses[[2]]$color + [1] "#6bc950" + + + + $spaces[[1]]$multiple_assignees + [1] FALSE + + $spaces[[1]]$features + $spaces[[1]]$features$due_dates + $spaces[[1]]$features$due_dates$enabled + [1] FALSE + + $spaces[[1]]$features$due_dates$start_date + [1] FALSE + + $spaces[[1]]$features$due_dates$remap_due_dates + [1] FALSE + + $spaces[[1]]$features$due_dates$remap_closed_due_date + [1] FALSE + + + $spaces[[1]]$features$time_tracking + $spaces[[1]]$features$time_tracking$enabled + [1] FALSE + + + $spaces[[1]]$features$tags + $spaces[[1]]$features$tags$enabled + [1] FALSE + + + $spaces[[1]]$features$time_estimates + $spaces[[1]]$features$time_estimates$enabled + [1] FALSE + + + $spaces[[1]]$features$checklists + $spaces[[1]]$features$checklists$enabled + [1] TRUE + + + $spaces[[1]]$features$custom_fields + $spaces[[1]]$features$custom_fields$enabled + [1] TRUE + + + $spaces[[1]]$features$remap_dependencies + $spaces[[1]]$features$remap_dependencies$enabled + [1] FALSE + + + $spaces[[1]]$features$dependency_warning + $spaces[[1]]$features$dependency_warning$enabled + [1] FALSE + + + $spaces[[1]]$features$portfolios + $spaces[[1]]$features$portfolios$enabled + [1] FALSE + + + + + $spaces[[2]] + $spaces[[2]]$id + [1] "791" + + $spaces[[2]]$name + [1] "Second Space Name" + + $spaces[[2]]$private + [1] FALSE + + $spaces[[2]]$statuses + $spaces[[2]]$statuses[[1]] + $spaces[[2]]$statuses[[1]]$status + [1] "Open" + + $spaces[[2]]$statuses[[1]]$type + [1] "open" + + $spaces[[2]]$statuses[[1]]$orderindex + [1] 0 + + $spaces[[2]]$statuses[[1]]$color + [1] "#d3d3d3" + + + $spaces[[2]]$statuses[[2]] + $spaces[[2]]$statuses[[2]]$status + [1] "Closed" + + $spaces[[2]]$statuses[[2]]$type + [1] "closed" + + $spaces[[2]]$statuses[[2]]$orderindex + [1] 1 + + $spaces[[2]]$statuses[[2]]$color + [1] "#6bc950" + + + + $spaces[[2]]$multiple_assignees + [1] TRUE + + $spaces[[2]]$features + $spaces[[2]]$features$due_dates + $spaces[[2]]$features$due_dates$enabled + [1] TRUE + + $spaces[[2]]$features$due_dates$start_date + [1] FALSE + + $spaces[[2]]$features$due_dates$remap_due_dates + [1] FALSE + + $spaces[[2]]$features$due_dates$remap_closed_due_date + [1] FALSE + + + $spaces[[2]]$features$time_tracking + $spaces[[2]]$features$time_tracking$enabled + [1] TRUE + + + $spaces[[2]]$features$tags + $spaces[[2]]$features$tags$enabled + [1] TRUE + + + $spaces[[2]]$features$time_estimates + $spaces[[2]]$features$time_estimates$enabled + [1] TRUE + + + $spaces[[2]]$features$checklists + $spaces[[2]]$features$checklists$enabled + [1] TRUE + + + + + + +--- + + Code + cu_get_spaces("1234", archived = TRUE) + Output + $spaces + $spaces[[1]] + $spaces[[1]]$id + [1] "790" + + $spaces[[1]]$name + [1] "Updated Space Name" + + $spaces[[1]]$private + [1] FALSE + + $spaces[[1]]$statuses + $spaces[[1]]$statuses[[1]] + $spaces[[1]]$statuses[[1]]$status + [1] "to do" + + $spaces[[1]]$statuses[[1]]$type + [1] "open" + + $spaces[[1]]$statuses[[1]]$orderindex + [1] 0 + + $spaces[[1]]$statuses[[1]]$color + [1] "#d3d3d3" + + + $spaces[[1]]$statuses[[2]] + $spaces[[1]]$statuses[[2]]$status + [1] "complete" + + $spaces[[1]]$statuses[[2]]$type + [1] "closed" + + $spaces[[1]]$statuses[[2]]$orderindex + [1] 1 + + $spaces[[1]]$statuses[[2]]$color + [1] "#6bc950" + + + + $spaces[[1]]$multiple_assignees + [1] FALSE + + $spaces[[1]]$features + $spaces[[1]]$features$due_dates + $spaces[[1]]$features$due_dates$enabled + [1] FALSE + + $spaces[[1]]$features$due_dates$start_date + [1] FALSE + + $spaces[[1]]$features$due_dates$remap_due_dates + [1] FALSE + + $spaces[[1]]$features$due_dates$remap_closed_due_date + [1] FALSE + + + $spaces[[1]]$features$time_tracking + $spaces[[1]]$features$time_tracking$enabled + [1] FALSE + + + $spaces[[1]]$features$tags + $spaces[[1]]$features$tags$enabled + [1] FALSE + + + $spaces[[1]]$features$time_estimates + $spaces[[1]]$features$time_estimates$enabled + [1] FALSE + + + $spaces[[1]]$features$checklists + $spaces[[1]]$features$checklists$enabled + [1] TRUE + + + $spaces[[1]]$features$custom_fields + $spaces[[1]]$features$custom_fields$enabled + [1] TRUE + + + $spaces[[1]]$features$remap_dependencies + $spaces[[1]]$features$remap_dependencies$enabled + [1] FALSE + + + $spaces[[1]]$features$dependency_warning + $spaces[[1]]$features$dependency_warning$enabled + [1] FALSE + + + $spaces[[1]]$features$portfolios + $spaces[[1]]$features$portfolios$enabled + [1] FALSE + + + + + $spaces[[2]] + $spaces[[2]]$id + [1] "791" + + $spaces[[2]]$name + [1] "Second Space Name" + + $spaces[[2]]$private + [1] FALSE + + $spaces[[2]]$statuses + $spaces[[2]]$statuses[[1]] + $spaces[[2]]$statuses[[1]]$status + [1] "Open" + + $spaces[[2]]$statuses[[1]]$type + [1] "open" + + $spaces[[2]]$statuses[[1]]$orderindex + [1] 0 + + $spaces[[2]]$statuses[[1]]$color + [1] "#d3d3d3" + + + $spaces[[2]]$statuses[[2]] + $spaces[[2]]$statuses[[2]]$status + [1] "Closed" + + $spaces[[2]]$statuses[[2]]$type + [1] "closed" + + $spaces[[2]]$statuses[[2]]$orderindex + [1] 1 + + $spaces[[2]]$statuses[[2]]$color + [1] "#6bc950" + + + + $spaces[[2]]$multiple_assignees + [1] TRUE + + $spaces[[2]]$features + $spaces[[2]]$features$due_dates + $spaces[[2]]$features$due_dates$enabled + [1] TRUE + + $spaces[[2]]$features$due_dates$start_date + [1] FALSE + + $spaces[[2]]$features$due_dates$remap_due_dates + [1] FALSE + + $spaces[[2]]$features$due_dates$remap_closed_due_date + [1] FALSE + + + $spaces[[2]]$features$time_tracking + $spaces[[2]]$features$time_tracking$enabled + [1] TRUE + + + $spaces[[2]]$features$tags + $spaces[[2]]$features$tags$enabled + [1] TRUE + + + $spaces[[2]]$features$time_estimates + $spaces[[2]]$features$time_estimates$enabled + [1] TRUE + + + $spaces[[2]]$features$checklists + $spaces[[2]]$features$checklists$enabled + [1] TRUE + + + + + + +# data frame output + + Code + df_spaces <- cuf_get_spaces("1234") + df_spaces + Output + # A tibble: 2 x 6 + id name private statuses multiple_assign~ features$due_da~ + > + 1 790 Updated Space Name FALSE [2 x 4] FALSE FALSE + 2 791 Second Space Name FALSE [2 x 4] TRUE TRUE + Code + df_spaces$statuses + Output + + >[2]> + [[1]] + # A tibble: 2 x 4 + status type orderindex color + + 1 to do open 0 #d3d3d3 + 2 complete closed 1 #6bc950 + + [[2]] + # A tibble: 2 x 4 + status type orderindex color + + 1 Open open 0 #d3d3d3 + 2 Closed closed 1 #6bc950 + + Code + df_spaces$features + Output + # A tibble: 2 x 9 + due_dates$enabled $start_date $remap_due_dates $remap_closed_due_date + + 1 FALSE FALSE FALSE FALSE + 2 TRUE FALSE FALSE FALSE + # ... with 8 more variables: time_tracking , tags , + # time_estimates , checklists , + # custom_fields , remap_dependencies , + # dependency_warning , portfolios + Code + df_spaces$features$due_dates + Output + # A tibble: 2 x 4 + enabled start_date remap_due_dates remap_closed_due_date + + 1 FALSE FALSE FALSE FALSE + 2 TRUE FALSE FALSE FALSE + Code + df_spaces$features$time_tracking + Output + # A tibble: 2 x 1 + enabled + + 1 FALSE + 2 TRUE + Code + df_spaces$features$tags + Output + # A tibble: 2 x 1 + enabled + + 1 FALSE + 2 TRUE + Code + df_spaces$features$time_estimates + Output + # A tibble: 2 x 1 + enabled + + 1 FALSE + 2 TRUE + Code + df_spaces$features$checklists + Output + # A tibble: 2 x 1 + enabled + + 1 TRUE + 2 TRUE + Code + df_spaces$features$custom_fields + Output + # A tibble: 2 x 1 + enabled + + 1 TRUE + 2 NA + Code + df_spaces$features$remap_dependencies + Output + # A tibble: 2 x 1 + enabled + + 1 FALSE + 2 NA + Code + df_spaces$features$dependency_warning + Output + # A tibble: 2 x 1 + enabled + + 1 FALSE + 2 NA + Code + df_spaces$features$portfolios + Output + # A tibble: 2 x 1 + enabled + + 1 FALSE + 2 NA + +--- + + Code + cuf_get_spaces("1234", archived = TRUE) + Output + # A tibble: 2 x 6 + id name private statuses multiple_assign~ features$due_da~ + > + 1 790 Updated Space Name FALSE [2 x 4] FALSE FALSE + 2 791 Second Space Name FALSE [2 x 4] TRUE TRUE + diff --git a/tests/testthat/_snaps/api-teams.md b/tests/testthat/_snaps/api-teams.md new file mode 100644 index 0000000..afacfb1 --- /dev/null +++ b/tests/testthat/_snaps/api-teams.md @@ -0,0 +1,68 @@ +# output + + Code + cu_get_teams() + Output + $teams + $teams[[1]] + $teams[[1]]$id + [1] "1234" + + $teams[[1]]$name + [1] "My ClickUp Team" + + $teams[[1]]$color + [1] "#000000" + + $teams[[1]]$avatar + [1] "https://clickup.com/avatar.jpg" + + $teams[[1]]$members + $teams[[1]]$members[[1]] + $teams[[1]]$members[[1]]$user + $teams[[1]]$members[[1]]$user$id + [1] 123 + + $teams[[1]]$members[[1]]$user$username + [1] "John Doe" + + $teams[[1]]$members[[1]]$user$color + [1] "#000000" + + $teams[[1]]$members[[1]]$user$profilePicture + [1] "https://clickup.com/avatar.jpg" + + + + + + + +# data frame output + + Code + df_teams <- cuf_get_teams() + df_teams + Output + # A tibble: 1 x 5 + id name color avatar members + + 1 1234 My ClickUp Team #000000 https://clickup.com/avatar.jpg [1 x 1] + Code + df_teams$members + Output + > + >[1]> + [[1]] + # A tibble: 1 x 1 + user$id $username $color $profilePicture + + 1 123 John Doe #000000 https://clickup.com/avatar.jpg + + diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R new file mode 100644 index 0000000..2f044b5 --- /dev/null +++ b/tests/testthat/setup.R @@ -0,0 +1,3 @@ +cu_options( + baseurl = "https://private-anon-cfc2f69e11-clickup20.apiary-mock.com/api/v2" +) diff --git a/tests/testthat/test-api-spaces.R b/tests/testthat/test-api-spaces.R new file mode 100644 index 0000000..2546bdb --- /dev/null +++ b/tests/testthat/test-api-spaces.R @@ -0,0 +1,30 @@ +test_that("output", { + expect_snapshot({ + cu_get_spaces("1234") + }) + # UPSTREAM: No new data here, suggest to add? + expect_snapshot({ + cu_get_spaces("1234", archived = TRUE) + }) +}) + +test_that("data frame output", { + expect_snapshot({ + df_spaces <- cuf_get_spaces("1234") + df_spaces + df_spaces$statuses + df_spaces$features + df_spaces$features$due_dates + df_spaces$features$time_tracking + df_spaces$features$tags + df_spaces$features$time_estimates + df_spaces$features$checklists + df_spaces$features$custom_fields + df_spaces$features$remap_dependencies + df_spaces$features$dependency_warning + df_spaces$features$portfolios + }) + expect_snapshot({ + cuf_get_spaces("1234", archived = TRUE) + }) +}) diff --git a/tests/testthat/test-api-teams.R b/tests/testthat/test-api-teams.R new file mode 100644 index 0000000..5b8c681 --- /dev/null +++ b/tests/testthat/test-api-teams.R @@ -0,0 +1,13 @@ +test_that("output", { + expect_snapshot({ + cu_get_teams() + }) +}) + +test_that("data frame output", { + expect_snapshot({ + df_teams <- cuf_get_teams() + df_teams + df_teams$members + }) +}) From 9f78efcc24b701733bcbb3c0eb4f9a3061c25a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 08:00:57 +0200 Subject: [PATCH 041/137] Add documentation --- script/README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 script/README.md diff --git a/script/README.md b/script/README.md new file mode 100644 index 0000000..bfcaf50 --- /dev/null +++ b/script/README.md @@ -0,0 +1,52 @@ +# Type-stable wrappers via tibblify + +Goal: A `cuf_*()` function for each `cu_()` function that returns a tibble with a known structure. + +## Working examples + +- [x] `cu_get_folders()` +- [x] `cu_get_lists()` +- [x] `cu_get_tasks()` +- [x] `cu_get_time_entries_within_date_range()` +- [x] `cu_get_singular_time_entry()` +- [x] `cu_get_list_members()` + +## Building blocks + +- `R/df-*.R`: started as copies of `R/api-*.R`, need adaptation +- `script/tibblify-??-*.R`: scripts that access the API to generate specs from data +- `R/spec-*.R`: generated from `script/tibblify-??-*.R` +- `R/tibblify.R`: tooling + +## How to extend + +- Pick an entity type +- Make a copy of an existing `script/tibblify-??-*.R` +- Adapt to collect data matching this entity type +- Run the script +- Adapt the `cuf_*()` functions following existing examples +- Test, perhaps as part of the same script (after another `pkgload::load_all()`) + +## Test instance + +For testing, I created a throwaway ClickUp workspace that can be populatd with the `create.R` script. +The data in a live workspace is richer, but modification and deletion can only reliably be tested on a toy workspace. +The "team ID" is hard-coded in `create.R` to ensure that the code doesn't accidentally wipe the live workspace. + +## Technical debt + +- Fix warnings in `devtools::document()` -- delete first four lines in most `df-*.R` files +- Enhance `create.R` script + - Rerun `tibblify-all.R`, ensure that the generated specs are not worse than the existing specs + - Eliminate all instances of `lcol_guess()` in the specs by creating a richer example workspace in `create.R` +- Add tests against toy workspace + +## Problems + +### Deletion + +`cu_delete_*()` often returns an empty list. It feels more consistent to keep the wrappers here, even if they return an empty tibble. + +### Visible vs. invisible return + +Should `POST` and `PUT` methods return invisibly? From 9a77e8b05ebd0b6c3a02e63f90615c455a7ce60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 11:40:32 +0200 Subject: [PATCH 042/137] Better specs --- R/spec-lists.R | 20 ++++++++++++++++---- script/tibblify-04-lists.R | 10 +++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/R/spec-lists.R b/R/spec-lists.R index 4cc99b4..1914f29 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -3,12 +3,24 @@ spec_lists <- lcols( name = lcol_chr("name"), orderindex = lcol_int("orderindex"), content = lcol_chr("content", .default = NA_character_), - status = lcol_guess("status", .default = NULL), + status = lcol_df( + "status", + status = lcol_chr("status", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + .default = NULL + ), priority = lcol_guess("priority", .default = NULL), - assignee = lcol_guess("assignee", .default = NULL), + assignee = lcol_df( + "assignee", + color = lcol_chr("color", .default = NA_character_), + username = lcol_chr("username", .default = NA_character_), + initials = lcol_chr("initials", .default = NA_character_), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), + .default = NULL + ), task_count = lcol_int("task_count"), - due_date = lcol_guess("due_date", .default = NULL), - start_date = lcol_guess("start_date", .default = NULL), + due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), + start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), folder = lcol_df( "folder", id = lcol_chr("id"), diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index ce43d8f..d6770f3 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -5,12 +5,16 @@ library(tidyverse) df_teams <- cuf_get_teams() df_spaces <- cuf_get_spaces(df_teams$id[[1]]) -df_folders <- cuf_get_folders(df_spaces$id[[1]]) +df_folders <- map_dfr(df_spaces$id, cuf_get_folders) df_folders -lists <- cu_get_lists(df_folders$id[[1]]) +lists <- + df_folders$id %>% + map(cu_get_lists) %>% + map("lists") %>% + unlist(recursive = FALSE) -df_lists <- tibblify::tibblify(lists$lists) +df_lists <- tibblify::tibblify(lists) df_lists df_lists %>% get_spec() From db885a483e6400fe99f4c7ff2746c20575d2b062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 20:04:10 +0200 Subject: [PATCH 043/137] Refine tasks --- R/spec-tasks.R | 17 ++++++++++++----- script/tibblify-05-tasks.R | 16 +++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 89f6673..b81c234 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -31,7 +31,7 @@ spec_tasks <- lcols( color = lcol_chr("color"), initials = lcol_chr("initials"), email = lcol_chr("email"), - profilePicture = lcol_chr("profilePicture"), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), .default = NULL ), watchers = lcol_guess("watchers", .default = NULL), @@ -45,12 +45,18 @@ spec_tasks <- lcols( .default = NULL ), parent = lcol_guess("parent", .default = NULL), - priority = lcol_guess("priority", .default = NULL), + priority = lcol_df( + "priority", + id = lcol_chr("id", .default = NA_character_), + priority = lcol_chr("priority", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + orderindex = lcol_chr("orderindex", .default = NA_character_), + .default = NULL + ), due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - start_date = lcol_guess("start_date", .default = NULL), + start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), points = lcol_guess("points", .default = NULL), time_estimate = lcol_int("time_estimate", .default = NA_integer_), - time_spent = lcol_int("time_spent", .default = NA_integer_), custom_fields = lcol_df_lst( "custom_fields", id = lcol_chr("id"), @@ -129,5 +135,6 @@ spec_tasks <- lcols( space = lcol_df( "space", id = lcol_chr("id") - ) + ), + time_spent = lcol_int("time_spent", .default = NA_integer_) ) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 53660fa..a9da2f6 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -5,17 +5,23 @@ library(tidyverse) df_teams <- cuf_get_teams() df_spaces <- cuf_get_spaces(df_teams$id[[1]]) -df_folders <- cuf_get_folders(df_spaces$id[[1]]) +df_folders <- map_dfr(df_spaces$id, cuf_get_folders) df_folders -df_lists <- cuf_get_lists(df_folders$id[[1]]) +df_lists <- map_dfr(df_folders$id, cuf_get_lists) df_lists -tasks_list <- cu_get_tasks(df_lists$id[[1]]) -tasks_list_archived <- cu_get_tasks(df_lists$id[[1]], archived = TRUE) +tasks_list <- map(df_lists$id, cu_get_tasks) +tasks_list_archived <- map(df_lists$id, cu_get_tasks, archived = TRUE) + +tasks <- + c(tasks_list, tasks_list_archived) %>% + map("tasks") %>% + unlist(recursive = FALSE) + tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) -df_tasks <- tibblify::tibblify(c(tasks_team$tasks, tasks_list$tasks, tasks_list_archived$tasks)) +df_tasks <- tibblify::tibblify(c(tasks, tasks_list_archived$tasks)) df_tasks df_tasks %>% get_spec() From 49a540506fd882e8bcbc2a1faf58b1cdb00b5ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 20:16:03 +0200 Subject: [PATCH 044/137] Oops --- script/tibblify-05-tasks.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index a9da2f6..2c6b1a1 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -21,7 +21,7 @@ tasks <- tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) -df_tasks <- tibblify::tibblify(c(tasks, tasks_list_archived$tasks)) +df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks)) df_tasks df_tasks %>% get_spec() From da02b99e37131f0d3f94b3972e842a20f1549594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 21:06:00 +0200 Subject: [PATCH 045/137] Refine --- R/spec-tasks.R | 8 ++++---- R/tibblify.R | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index b81c234..ae08a5a 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -12,8 +12,8 @@ spec_tasks <- lcols( orderindex = lcol_int("orderindex") ), orderindex = lcol_int("orderindex", .parser = as.integer), - date_created = lcol_chr("date_created"), - date_updated = lcol_chr("date_updated"), + date_created = lcol_dtt("date_created", .parser = cu_date_from), + date_updated = lcol_dtt("date_updated", .parser = cu_date_from), date_closed = lcol_guess("date_closed", .default = NULL), archived = lcol_lgl("archived"), creator = lcol_df( @@ -94,7 +94,7 @@ spec_tasks <- lcols( start = lcol_int("start", .default = NA_integer_), .default = NULL ), - date_created = lcol_chr("date_created"), + date_created = lcol_dtt("date_created", .parser = cu_date_from), hide_from_guests = lcol_lgl("hide_from_guests"), required = lcol_lgl("required"), value = lcol_lst("value", .default = NULL) @@ -104,7 +104,7 @@ spec_tasks <- lcols( task_id = lcol_chr("task_id"), depends_on = lcol_chr("depends_on"), type = lcol_int("type"), - date_created = lcol_chr("date_created"), + date_created = lcol_dtt("date_created", .parser = cu_date_from), userid = lcol_chr("userid"), .default = NULL ), diff --git a/R/tibblify.R b/R/tibblify.R index 365b883..ce7bdc2 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,7 @@ write_spec <- function(x) { out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) - date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end" + date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed" out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')", .default = NA_character_'), 'lcol_dtt("\\1", .parser = cu_date_from, .default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')"'), 'lcol_dtt("\\1", .parser = cu_date_from', out) From 154c7f65984ec939d248ca056ed32e4b286c1b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 21:28:09 +0200 Subject: [PATCH 046/137] Refine tasks --- R/spec-tasks.R | 32 ++++++++++++++++++++++++++++---- script/tibblify-05-tasks.R | 4 ++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index ae08a5a..9779993 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -14,7 +14,7 @@ spec_tasks <- lcols( orderindex = lcol_int("orderindex", .parser = as.integer), date_created = lcol_dtt("date_created", .parser = cu_date_from), date_updated = lcol_dtt("date_updated", .parser = cu_date_from), - date_closed = lcol_guess("date_closed", .default = NULL), + date_closed = lcol_dtt("date_closed", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), archived = lcol_lgl("archived"), creator = lcol_df( "creator", @@ -22,7 +22,7 @@ spec_tasks <- lcols( username = lcol_chr("username"), color = lcol_chr("color"), email = lcol_chr("email"), - profilePicture = lcol_chr("profilePicture") + profilePicture = lcol_chr("profilePicture", .default = NA_character_) ), assignees = lcol_df_lst( "assignees", @@ -35,7 +35,31 @@ spec_tasks <- lcols( .default = NULL ), watchers = lcol_guess("watchers", .default = NULL), - checklists = lcol_guess("checklists", .default = NULL), + checklists = lcol_df_lst( + "checklists", + id = lcol_chr("id"), + task_id = lcol_chr("task_id"), + name = lcol_chr("name"), + date_created = lcol_dtt("date_created", .parser = cu_date_from), + orderindex = lcol_int("orderindex"), + creator = lcol_int("creator"), + resolved = lcol_int("resolved"), + unresolved = lcol_int("unresolved"), + items = lcol_df_lst( + "items", + id = lcol_chr("id"), + name = lcol_chr("name"), + orderindex = lcol_int("orderindex"), + assignee = lcol_guess("assignee", .default = NULL), + group_assignee = lcol_guess("group_assignee", .default = NULL), + resolved = lcol_lgl("resolved"), + parent = lcol_guess("parent", .default = NULL), + date_created = lcol_dtt("date_created", .parser = cu_date_from), + children = lcol_guess("children", .default = NULL), + .default = NULL + ), + .default = NULL + ), tags = lcol_df_lst( "tags", name = lcol_chr("name"), @@ -44,7 +68,7 @@ spec_tasks <- lcols( creator = lcol_int("creator"), .default = NULL ), - parent = lcol_guess("parent", .default = NULL), + parent = lcol_chr("parent", .default = NA_character_), priority = lcol_df( "priority", id = lcol_chr("id", .default = NA_character_), diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 2c6b1a1..37e0e37 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -11,8 +11,8 @@ df_folders df_lists <- map_dfr(df_folders$id, cuf_get_lists) df_lists -tasks_list <- map(df_lists$id, cu_get_tasks) -tasks_list_archived <- map(df_lists$id, cu_get_tasks, archived = TRUE) +tasks_list <- map(df_lists$id, cu_get_tasks, subtasks = TRUE, include_closed = TRUE) +tasks_list_archived <- map(df_lists$id, cu_get_tasks, archived = TRUE, subtasks = TRUE, include_closed = TRUE) tasks <- c(tasks_list, tasks_list_archived) %>% From 2b78fd18185010bc4471f2ed69df036ed5dbda1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 21:46:03 +0200 Subject: [PATCH 047/137] Refine --- R/spec-time_entries.R | 8 ++++---- script/tibblify-06-timetracking-v2.R | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 11908c0..a14e559 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -1,6 +1,5 @@ spec_time_entries <- lcols( id = lcol_chr("id"), - task = lcol_lst("task", .default = NULL), wid = lcol_chr("wid"), user = lcol_df( "user", @@ -13,10 +12,11 @@ spec_time_entries <- lcols( ), billable = lcol_lgl("billable"), start = lcol_dtt("start", .parser = cu_date_from), - end = lcol_dtt("end", .parser = cu_date_from), - duration = lcol_chr("duration"), description = lcol_chr("description"), tags = lcol_guess("tags", .default = NULL), source = lcol_chr("source"), - at = lcol_chr("at") + at = lcol_chr("at"), + task = lcol_lst("task", .default = NULL), + end = lcol_dtt("end", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), + duration = lcol_chr("duration", .default = NA_character_) ) diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index 0d3a551..11f9d54 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -6,10 +6,13 @@ df_teams <- cuf_get_teams() user_ids <- bind_rows(df_teams$members)$user$id +start_date <- format(as.numeric(cu_date_to(as.POSIXct("2021-04-01 00:00:00 UTC"))), scientific = FALSE) +end_date <- format(as.numeric(cu_date_to(Sys.time() + 86400)), scientific = FALSE) + time <- cu_get_time_entries_within_date_range( df_teams$id[[1]], - start_date = cu_date_to("2021-06-01"), - end_date = cu_date_to("2021-08-01"), + start_date = start_date, + end_date = end_date, assignee = paste(user_ids, collapse = ",") ) From b9599c01171b4c4cb9e7e1c141e84c1261ef62e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 21:59:47 +0200 Subject: [PATCH 048/137] Specify task --- R/spec-time_entries.R | 16 +++++++++++++++- script/tibblify-06-timetracking-v2.R | 17 +++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index a14e559..50ab2df 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -16,7 +16,21 @@ spec_time_entries <- lcols( tags = lcol_guess("tags", .default = NULL), source = lcol_chr("source"), at = lcol_chr("at"), - task = lcol_lst("task", .default = NULL), + task = lcol_df( + "task", + id = lcol_chr("id", .default = NA_character_), + name = lcol_chr("name", .default = NA_character_), + status = lcol_df( + "status", + status = lcol_chr("status", .default = NA_character_), + color = lcol_chr("color", .default = NA_character_), + type = lcol_chr("type", .default = NA_character_), + orderindex = lcol_int("orderindex", .default = NA_integer_), + .default = NULL + ), + custom_type = lcol_guess("custom_type", .default = NULL), + .default = NULL + ), end = lcol_dtt("end", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), duration = lcol_chr("duration", .default = NA_character_) ) diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index 11f9d54..b9c9f79 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -16,6 +16,16 @@ time <- cu_get_time_entries_within_date_range( assignee = paste(user_ids, collapse = ",") ) +good <- + time$data %>% + map("task") %>% + map_lgl(is.list) + +# contains garbage sometimes +for (i in which(!good)) { + time$data[[i]]$task <- list() +} + df_time_entries <- tibblify::tibblify(time$data) df_time_entries df_time_entries %>% get_spec() @@ -25,6 +35,13 @@ write_spec(df_time_entries) # Reload after updating spec pkgload::load_all() +cuf_get_time_entries_within_date_range( + df_teams$id[[1]], + start_date = start_date, + end_date = end_date, + assignee = paste(user_ids, collapse = ",") +) + df_time_entries$id cuf_get_singular_time_entry(df_teams$id[[1]], df_time_entries$id[[1]]) cuf_get_time_entry_history(df_teams$id[[1]], df_time_entries$id[[253]]) From e926ef8b2fb4be9f00f3286719fde9185c1b0825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 3 Oct 2021 22:16:13 +0200 Subject: [PATCH 049/137] Duration --- R/spec-time_entries.R | 2 +- R/tibblify.R | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 50ab2df..03b9239 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -32,5 +32,5 @@ spec_time_entries <- lcols( .default = NULL ), end = lcol_dtt("end", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - duration = lcol_chr("duration", .default = NA_character_) + duration = lcol_vec("duration", hms::new_hms(), .default = dttr2::NA_hms_, .parser = ~ hms::as_hms(as.numeric(.x) / 1000)) ) diff --git a/R/tibblify.R b/R/tibblify.R index ce7bdc2..5838a4b 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -25,6 +25,8 @@ write_spec <- function(x) { out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')", .default = NA_character_'), 'lcol_dtt("\\1", .parser = cu_date_from, .default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')"'), 'lcol_dtt("\\1", .parser = cu_date_from', out) + out <- gsub('lcol_chr("duration", .default = NA_character_)', 'lcol_vec("duration", hms::new_hms(), .default = dttr2::NA_hms_, .parser = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + # Dogfood first eval(parse(text = out)) From 57c407ff7afb0a493d86cfde50d2fd5d67283adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 4 Oct 2021 04:46:46 +0200 Subject: [PATCH 050/137] Refine task --- R/spec-time_entries.R | 2 +- R/tibblify.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 03b9239..113b8d5 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -15,7 +15,7 @@ spec_time_entries <- lcols( description = lcol_chr("description"), tags = lcol_guess("tags", .default = NULL), source = lcol_chr("source"), - at = lcol_chr("at"), + at = lcol_dtt("at", .parser = cu_date_from), task = lcol_df( "task", id = lcol_chr("id", .default = NA_character_), diff --git a/R/tibblify.R b/R/tibblify.R index 5838a4b..bcdcb91 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,7 @@ write_spec <- function(x) { out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) - date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed" + date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')", .default = NA_character_'), 'lcol_dtt("\\1", .parser = cu_date_from, .default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')"'), 'lcol_dtt("\\1", .parser = cu_date_from', out) From 6e1038c45310befa96786ef0f430dfb55c99fe13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 12 Dec 2021 19:20:32 +0100 Subject: [PATCH 051/137] Fix unstable API output --- R/spec-folders.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index d3ee1bf..c8a6635 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -41,7 +41,7 @@ spec_folders <- lcols( profilePicture = lcol_chr("profilePicture", .default = NA_character_), .default = NULL ), - task_count = lcol_int("task_count"), + task_count = lcol_int("task_count", .parser = as.integer), due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), space = lcol_df( From 75424d900368b67161002efed550df69aa43f004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 12 Dec 2021 19:23:24 +0100 Subject: [PATCH 052/137] Cast --- R/spec-folders.R | 2 +- R/spec-lists.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index c8a6635..877ae9e 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -9,7 +9,7 @@ spec_folders <- lcols( id = lcol_chr("id"), name = lcol_chr("name") ), - task_count = lcol_chr("task_count"), + task_count = lcol_chr("task_count", .parser = as.integer), archived = lcol_lgl("archived"), statuses = lcol_df_lst( "statuses", diff --git a/R/spec-lists.R b/R/spec-lists.R index 1914f29..c94caa5 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -18,7 +18,7 @@ spec_lists <- lcols( profilePicture = lcol_chr("profilePicture", .default = NA_character_), .default = NULL ), - task_count = lcol_int("task_count"), + task_count = lcol_int("task_count", .parser = as.integer), due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), folder = lcol_df( From a8dc4b99065fd7e0e915996c364a96051185aedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 12 Dec 2021 19:24:36 +0100 Subject: [PATCH 053/137] lcol_int() --- R/spec-folders.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index 877ae9e..db97f7e 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -9,7 +9,7 @@ spec_folders <- lcols( id = lcol_chr("id"), name = lcol_chr("name") ), - task_count = lcol_chr("task_count", .parser = as.integer), + task_count = lcol_int("task_count", .parser = as.integer), archived = lcol_lgl("archived"), statuses = lcol_df_lst( "statuses", From deb9ccaf7e8521991d621fc8518b135dbca58637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 28 Jan 2022 18:54:24 +0100 Subject: [PATCH 054/137] Allow missing profile picture --- R/spec-members.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/spec-members.R b/R/spec-members.R index d2400f1..2f1fe26 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -4,5 +4,5 @@ spec_members <- lcols( email = lcol_chr("email"), color = lcol_chr("color"), initials = lcol_chr("initials"), - profilePicture = lcol_chr("profilePicture") + profilePicture = lcol_chr("profilePicture", .default = NA_character_) ) From 70e13aa050362428699fca357a1ccd1ec52dd6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 28 Jan 2022 19:27:42 +0100 Subject: [PATCH 055/137] More optional --- R/spec-spaces.R | 2 +- R/spec-time_entries.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 44f1935..1b18ac0 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -111,7 +111,7 @@ spec_spaces <- lcols( id = lcol_chr("id", .parser = as.character), username = lcol_chr("username"), color = lcol_chr("color"), - profilePicture = lcol_chr("profilePicture"), + profilePicture = lcol_chr("profilePicture", .default = NA_character_), initials = lcol_chr("initials") ), .default = NULL diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 113b8d5..7fe3b07 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -8,7 +8,7 @@ spec_time_entries <- lcols( email = lcol_chr("email"), color = lcol_chr("color"), initials = lcol_chr("initials"), - profilePicture = lcol_chr("profilePicture") + profilePicture = lcol_chr("profilePicture", .default = NA_character_) ), billable = lcol_lgl("billable"), start = lcol_dtt("start", .parser = cu_date_from), From c9693db7a623ef71508edb1e94ccdf7981087b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 28 Jan 2022 19:27:53 +0100 Subject: [PATCH 056/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 05adab0..35b7ff1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5 +Version: 0.0.5.9000 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 9a4ceda6c41ee2cb6621bbb8aa1d5584ed6f7fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Apr 2022 06:28:06 +0200 Subject: [PATCH 057/137] Always enforce parsing as integer --- R/spec-folders.R | 8 ++++---- R/spec-lists.R | 2 +- R/spec-spaces.R | 2 +- R/spec-tasks.R | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index db97f7e..522d5d5 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -1,7 +1,7 @@ spec_folders <- lcols( id = lcol_chr("id"), name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), override_statuses = lcol_lgl("override_statuses"), hidden = lcol_lgl("hidden"), space = lcol_df( @@ -16,7 +16,7 @@ spec_folders <- lcols( id = lcol_chr("id"), status = lcol_chr("status"), type = lcol_chr("type"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), color = lcol_chr("color"), .default = NULL ), @@ -24,7 +24,7 @@ spec_folders <- lcols( "lists", id = lcol_chr("id"), name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), content = lcol_chr("content", .default = NA_character_), status = lcol_df( "status", @@ -56,7 +56,7 @@ spec_folders <- lcols( "statuses", id = lcol_chr("id"), status = lcol_chr("status"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), color = lcol_chr("color"), type = lcol_chr("type") ), diff --git a/R/spec-lists.R b/R/spec-lists.R index c94caa5..d1b1246 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -1,7 +1,7 @@ spec_lists <- lcols( id = lcol_chr("id"), name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), content = lcol_chr("content", .default = NA_character_), status = lcol_df( "status", diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 1b18ac0..1ec8bf0 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -7,7 +7,7 @@ spec_spaces <- lcols( id = lcol_chr("id"), status = lcol_chr("status"), type = lcol_chr("type"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), color = lcol_chr("color") ), multiple_assignees = lcol_lgl("multiple_assignees"), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 9779993..46ed188 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -9,7 +9,7 @@ spec_tasks <- lcols( status = lcol_chr("status"), color = lcol_chr("color"), type = lcol_chr("type"), - orderindex = lcol_int("orderindex") + orderindex = lcol_int("orderindex", .parser = as.integer) ), orderindex = lcol_int("orderindex", .parser = as.integer), date_created = lcol_dtt("date_created", .parser = cu_date_from), @@ -41,7 +41,7 @@ spec_tasks <- lcols( task_id = lcol_chr("task_id"), name = lcol_chr("name"), date_created = lcol_dtt("date_created", .parser = cu_date_from), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), creator = lcol_int("creator"), resolved = lcol_int("resolved"), unresolved = lcol_int("unresolved"), @@ -49,7 +49,7 @@ spec_tasks <- lcols( "items", id = lcol_chr("id"), name = lcol_chr("name"), - orderindex = lcol_int("orderindex"), + orderindex = lcol_int("orderindex", .parser = as.integer), assignee = lcol_guess("assignee", .default = NULL), group_assignee = lcol_guess("group_assignee", .default = NULL), resolved = lcol_lgl("resolved"), From 5ba94ace4b2907aca38cb14232b310623c480287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Apr 2022 06:28:37 +0200 Subject: [PATCH 058/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 35b7ff1..006bbcf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9000 +Version: 0.0.5.9001 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 0b40e451233cd14b2c7802fa0b49e9c6eaa86914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 22 May 2022 17:25:23 +0200 Subject: [PATCH 059/137] Adapt to dev version of tibblify --- DESCRIPTION | 6 +- R/spec-folders.R | 99 ++++++----- R/spec-lists.R | 60 ++++--- R/spec-members.R | 24 ++- R/spec-spaces.R | 153 +++++------------ R/spec-tasks.R | 247 ++++++++++++--------------- R/spec-teams.R | 61 +++---- R/spec-time_entries.R | 71 ++++---- R/tibblify.R | 4 +- script/tibblify-01-teams.R | 7 +- script/tibblify-02-spaces.R | 4 +- script/tibblify-03-folders.R | 4 +- script/tibblify-04-lists.R | 4 +- script/tibblify-05-tasks.R | 6 +- script/tibblify-06-timetracking-v2.R | 4 +- script/tibblify-07-members.R | 4 +- 16 files changed, 350 insertions(+), 408 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 006bbcf..6b8da7c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9001 +Version: 0.0.5.9002 Date: 2021-12-12 Authors@R: c(person(given = "Peter", @@ -25,7 +25,7 @@ Imports: jsonlite, rlang, tibble, - tibblify + tibblify (>= 0.1.0.9000) Suggests: fansi, knitr, @@ -38,3 +38,5 @@ LazyData: true LazyLoad: yes Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.2 +Remotes: + mgirlich/tibblify diff --git a/R/spec-folders.R b/R/spec-folders.R index 522d5d5..79a6c26 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -1,66 +1,63 @@ -spec_folders <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex", .parser = as.integer), - override_statuses = lcol_lgl("override_statuses"), - hidden = lcol_lgl("hidden"), - space = lcol_df( +spec_folders <- spec_df( + id = tib_chr("id"), + name = tib_chr("name"), + orderindex = tib_int("orderindex"), + override_statuses = tib_lgl("override_statuses"), + hidden = tib_lgl("hidden"), + space = tib_row( "space", - id = lcol_chr("id"), - name = lcol_chr("name") + id = tib_chr("id"), + name = tib_chr("name") ), - task_count = lcol_int("task_count", .parser = as.integer), - archived = lcol_lgl("archived"), - statuses = lcol_df_lst( + task_count = tib_chr("task_count"), + archived = tib_lgl("archived"), + statuses = tib_df( "statuses", - id = lcol_chr("id"), - status = lcol_chr("status"), - type = lcol_chr("type"), - orderindex = lcol_int("orderindex", .parser = as.integer), - color = lcol_chr("color"), - .default = NULL + id = tib_chr("id"), + status = tib_chr("status"), + type = tib_chr("type"), + orderindex = tib_int("orderindex"), + color = tib_chr("color") ), - lists = lcol_df_lst( + lists = tib_df( "lists", - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex", .parser = as.integer), - content = lcol_chr("content", .default = NA_character_), - status = lcol_df( + id = tib_chr("id"), + name = tib_chr("name"), + orderindex = tib_int("orderindex"), + content = tib_chr("content", required = FALSE), + status = tib_row( "status", - status = lcol_chr("status", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - .default = NULL + status = tib_chr("status", required = FALSE), + color = tib_chr("color", required = FALSE) ), - priority = lcol_guess("priority", .default = NULL), - assignee = lcol_df( + priority = tib_unspecified("priority"), + assignee = tib_row( "assignee", - color = lcol_chr("color", .default = NA_character_), - username = lcol_chr("username", .default = NA_character_), - initials = lcol_chr("initials", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL + color = tib_chr("color", required = FALSE), + username = tib_chr("username", required = FALSE), + initials = tib_chr("initials", required = FALSE), + profilePicture = tib_chr("profilePicture", required = FALSE) ), - task_count = lcol_int("task_count", .parser = as.integer), - due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - space = lcol_df( + task_count = tib_int("task_count"), + due_date = tib_chr("due_date"), + start_date = tib_chr("start_date"), + space = tib_row( "space", - id = lcol_chr("id"), - name = lcol_chr("name"), - access = lcol_lgl("access") + id = tib_chr("id"), + name = tib_chr("name"), + access = tib_lgl("access") ), - archived = lcol_lgl("archived"), - override_statuses = lcol_lgl("override_statuses", .default = NA), - statuses = lcol_df_lst( + archived = tib_lgl("archived"), + override_statuses = tib_lgl("override_statuses"), + statuses = tib_df( "statuses", - id = lcol_chr("id"), - status = lcol_chr("status"), - orderindex = lcol_int("orderindex", .parser = as.integer), - color = lcol_chr("color"), - type = lcol_chr("type") + id = tib_chr("id"), + status = tib_chr("status"), + orderindex = tib_int("orderindex"), + color = tib_chr("color"), + type = tib_chr("type") ), - permission_level = lcol_chr("permission_level") + permission_level = tib_chr("permission_level") ), - permission_level = lcol_chr("permission_level") + permission_level = tib_chr("permission_level") ) diff --git a/R/spec-lists.R b/R/spec-lists.R index d1b1246..7acee00 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -1,40 +1,38 @@ -spec_lists <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex", .parser = as.integer), - content = lcol_chr("content", .default = NA_character_), - status = lcol_df( +spec_lists <- spec_df( + id = tib_chr("id"), + name = tib_chr("name"), + orderindex = tib_int("orderindex"), + content = tib_chr("content", required = FALSE), + status = tib_row( "status", - status = lcol_chr("status", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - .default = NULL + status = tib_chr("status", required = FALSE), + color = tib_chr("color", required = FALSE) ), - priority = lcol_guess("priority", .default = NULL), - assignee = lcol_df( + priority = tib_unspecified("priority"), + assignee = tib_row( "assignee", - color = lcol_chr("color", .default = NA_character_), - username = lcol_chr("username", .default = NA_character_), - initials = lcol_chr("initials", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL + color = tib_chr("color", required = FALSE), + username = tib_chr("username", required = FALSE), + initials = tib_chr("initials", required = FALSE), + profilePicture = tib_chr("profilePicture", required = FALSE) ), - task_count = lcol_int("task_count", .parser = as.integer), - due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - folder = lcol_df( + task_count = tib_int("task_count"), + due_date = tib_chr("due_date"), + start_date = tib_chr("start_date"), + folder = tib_row( "folder", - id = lcol_chr("id"), - name = lcol_chr("name"), - hidden = lcol_lgl("hidden"), - access = lcol_lgl("access") + id = tib_chr("id"), + name = tib_chr("name"), + hidden = tib_lgl("hidden"), + access = tib_lgl("access") ), - space = lcol_df( + space = tib_row( "space", - id = lcol_chr("id"), - name = lcol_chr("name"), - access = lcol_lgl("access") + id = tib_chr("id"), + name = tib_chr("name"), + access = tib_lgl("access") ), - archived = lcol_lgl("archived"), - override_statuses = lcol_lgl("override_statuses", .default = NA), - permission_level = lcol_chr("permission_level") + archived = tib_lgl("archived"), + override_statuses = tib_lgl("override_statuses"), + permission_level = tib_chr("permission_level") ) diff --git a/R/spec-members.R b/R/spec-members.R index 2f1fe26..0aabf44 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -1,8 +1,18 @@ -spec_members <- lcols( - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - email = lcol_chr("email"), - color = lcol_chr("color"), - initials = lcol_chr("initials"), - profilePicture = lcol_chr("profilePicture", .default = NA_character_) +spec_members <- spec_df( + id = tib_int("id"), + username = tib_chr("username"), + email = tib_chr("email"), + color = tib_chr("color"), + initials = tib_chr("initials"), + profilePicture = tib_chr("profilePicture"), + profileInfo = tib_row( + "profileInfo", + display_profile = tib_lgl("display_profile"), + verified_ambassador = tib_unspecified("verified_ambassador"), + verified_consultant = tib_unspecified("verified_consultant"), + top_tier_user = tib_unspecified("top_tier_user"), + viewed_verified_ambassador = tib_unspecified("viewed_verified_ambassador"), + viewed_verified_consultant = tib_unspecified("viewed_verified_consultant"), + viewed_top_tier_user = tib_unspecified("viewed_top_tier_user") + ) ) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 1ec8bf0..dd50c83 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -1,119 +1,52 @@ -spec_spaces <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - private = lcol_lgl("private"), - statuses = lcol_df_lst( +spec_spaces <- spec_df( + id = tib_chr("id"), + name = tib_chr("name"), + color = tib_chr("color"), + private = tib_lgl("private"), + avatar = tib_chr("avatar"), + admin_can_manage = tib_unspecified("admin_can_manage"), + statuses = tib_df( "statuses", - id = lcol_chr("id"), - status = lcol_chr("status"), - type = lcol_chr("type"), - orderindex = lcol_int("orderindex", .parser = as.integer), - color = lcol_chr("color") + id = tib_chr("id"), + status = tib_chr("status"), + type = tib_chr("type"), + orderindex = tib_int("orderindex"), + color = tib_chr("color") ), - multiple_assignees = lcol_lgl("multiple_assignees"), - features = lcol_df( + multiple_assignees = tib_lgl("multiple_assignees"), + features = tib_df( "features", - due_dates = lcol_df( - "due_dates", - enabled = lcol_lgl("enabled"), - start_date = lcol_lgl("start_date"), - remap_due_dates = lcol_lgl("remap_due_dates"), - remap_closed_due_date = lcol_lgl("remap_closed_due_date") - ), - sprints = lcol_df( - "sprints", - enabled = lcol_lgl("enabled") - ), - time_tracking = lcol_df( - "time_tracking", - enabled = lcol_lgl("enabled"), - harvest = lcol_lgl("harvest"), - rollup = lcol_lgl("rollup") - ), - points = lcol_df( - "points", - enabled = lcol_lgl("enabled") - ), - custom_items = lcol_df( - "custom_items", - enabled = lcol_lgl("enabled") - ), - priorities = lcol_df( + .names_to = ".names", + enabled = tib_lgl("enabled"), + start_date = tib_lgl("start_date", required = FALSE), + remap_due_dates = tib_lgl("remap_due_dates", required = FALSE), + remap_closed_due_date = tib_lgl("remap_closed_due_date", required = FALSE), + harvest = tib_lgl("harvest", required = FALSE), + rollup = tib_lgl("rollup", required = FALSE), + priorities = tib_df( "priorities", - enabled = lcol_lgl("enabled"), - priorities = lcol_df_lst( - "priorities", - id = lcol_chr("id"), - priority = lcol_chr("priority"), - color = lcol_chr("color"), - orderindex = lcol_int("orderindex", .parser = as.integer) - ) - ), - tags = lcol_df( - "tags", - enabled = lcol_lgl("enabled") - ), - wip_limits = lcol_df( - "wip_limits", - enabled = lcol_lgl("enabled", .default = NA), - .default = NULL - ), - time_estimates = lcol_df( - "time_estimates", - enabled = lcol_lgl("enabled", .default = NA), - rollup = lcol_lgl("rollup", .default = NA), - per_assignee = lcol_lgl("per_assignee", .default = NA), - .default = NULL - ), - check_unresolved = lcol_df( - "check_unresolved", - enabled = lcol_lgl("enabled"), - subtasks = lcol_lgl("subtasks", .default = NA), - checklists = lcol_guess("checklists", .default = NULL), - comments = lcol_guess("comments", .default = NULL) - ), - zoom = lcol_df( - "zoom", - enabled = lcol_lgl("enabled") - ), - milestones = lcol_df( - "milestones", - enabled = lcol_lgl("enabled") - ), - custom_fields = lcol_df( - "custom_fields", - enabled = lcol_lgl("enabled") - ), - remap_dependencies = lcol_df( - "remap_dependencies", - enabled = lcol_lgl("enabled", .default = NA), - .default = NULL - ), - dependency_warning = lcol_df( - "dependency_warning", - enabled = lcol_lgl("enabled") - ), - multiple_assignees = lcol_df( - "multiple_assignees", - enabled = lcol_lgl("enabled", .default = NA), - .default = NULL - ), - emails = lcol_df( - "emails", - enabled = lcol_lgl("enabled") - ) + .required = FALSE, + id = tib_chr("id"), + priority = tib_chr("priority"), + color = tib_chr("color"), + orderindex = tib_chr("orderindex") + ), + per_assignee = tib_lgl("per_assignee", required = FALSE), + subtasks = tib_lgl("subtasks", required = FALSE), + checklists = tib_unspecified("checklists", required = FALSE), + comments = tib_unspecified("comments", required = FALSE) ), - archived = lcol_lgl("archived"), - members = lcol_df_lst( + archived = tib_lgl("archived"), + members = tib_df( "members", - user = lcol_df( + .required = FALSE, + user = tib_row( "user", - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - color = lcol_chr("color"), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - initials = lcol_chr("initials") - ), - .default = NULL + id = tib_int("id"), + username = tib_chr("username"), + color = tib_chr("color"), + profilePicture = tib_chr("profilePicture"), + initials = tib_chr("initials") + ) ) ) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 46ed188..f06e17a 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -1,164 +1,135 @@ -spec_tasks <- lcols( - id = lcol_chr("id"), - custom_id = lcol_guess("custom_id", .default = NULL), - name = lcol_chr("name"), - text_content = lcol_chr("text_content", .default = NA_character_), - description = lcol_chr("description", .default = NA_character_), - status = lcol_df( +spec_tasks <- spec_df( + id = tib_chr("id"), + custom_id = tib_unspecified("custom_id"), + name = tib_chr("name"), + text_content = tib_chr("text_content"), + description = tib_chr("description"), + status = tib_row( "status", - status = lcol_chr("status"), - color = lcol_chr("color"), - type = lcol_chr("type"), - orderindex = lcol_int("orderindex", .parser = as.integer) + status = tib_chr("status"), + color = tib_chr("color"), + type = tib_chr("type"), + orderindex = tib_int("orderindex") ), - orderindex = lcol_int("orderindex", .parser = as.integer), - date_created = lcol_dtt("date_created", .parser = cu_date_from), - date_updated = lcol_dtt("date_updated", .parser = cu_date_from), - date_closed = lcol_dtt("date_closed", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - archived = lcol_lgl("archived"), - creator = lcol_df( + orderindex = tib_chr("orderindex"), + date_created = tib_chr("date_created"), + date_updated = tib_chr("date_updated"), + date_closed = tib_chr("date_closed"), + archived = tib_lgl("archived"), + creator = tib_row( "creator", - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - color = lcol_chr("color"), - email = lcol_chr("email"), - profilePicture = lcol_chr("profilePicture", .default = NA_character_) + id = tib_int("id"), + username = tib_chr("username"), + color = tib_chr("color"), + email = tib_chr("email"), + profilePicture = tib_chr("profilePicture") ), - assignees = lcol_df_lst( + assignees = tib_df( "assignees", - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - color = lcol_chr("color"), - initials = lcol_chr("initials"), - email = lcol_chr("email"), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL + id = tib_int("id"), + username = tib_chr("username"), + color = tib_chr("color"), + initials = tib_chr("initials"), + email = tib_chr("email"), + profilePicture = tib_chr("profilePicture") ), - watchers = lcol_guess("watchers", .default = NULL), - checklists = lcol_df_lst( + watchers = tib_unspecified("watchers"), + checklists = tib_df( "checklists", - id = lcol_chr("id"), - task_id = lcol_chr("task_id"), - name = lcol_chr("name"), - date_created = lcol_dtt("date_created", .parser = cu_date_from), - orderindex = lcol_int("orderindex", .parser = as.integer), - creator = lcol_int("creator"), - resolved = lcol_int("resolved"), - unresolved = lcol_int("unresolved"), - items = lcol_df_lst( + id = tib_chr("id"), + task_id = tib_chr("task_id"), + name = tib_chr("name"), + date_created = tib_chr("date_created"), + orderindex = tib_int("orderindex"), + creator = tib_int("creator"), + resolved = tib_int("resolved"), + unresolved = tib_int("unresolved"), + items = tib_df( "items", - id = lcol_chr("id"), - name = lcol_chr("name"), - orderindex = lcol_int("orderindex", .parser = as.integer), - assignee = lcol_guess("assignee", .default = NULL), - group_assignee = lcol_guess("group_assignee", .default = NULL), - resolved = lcol_lgl("resolved"), - parent = lcol_guess("parent", .default = NULL), - date_created = lcol_dtt("date_created", .parser = cu_date_from), - children = lcol_guess("children", .default = NULL), - .default = NULL - ), - .default = NULL + id = tib_chr("id"), + name = tib_chr("name"), + orderindex = tib_dbl("orderindex"), + assignee = tib_row( + "assignee", + id = tib_int("id", required = FALSE), + username = tib_chr("username", required = FALSE), + email = tib_chr("email", required = FALSE), + color = tib_chr("color", required = FALSE), + initials = tib_chr("initials", required = FALSE), + profilePicture = tib_chr("profilePicture", required = FALSE) + ), + group_assignee = tib_unspecified("group_assignee"), + resolved = tib_lgl("resolved"), + parent = tib_unspecified("parent"), + date_created = tib_chr("date_created"), + children = tib_unspecified("children") + ) ), - tags = lcol_df_lst( + tags = tib_df( "tags", - name = lcol_chr("name"), - tag_fg = lcol_chr("tag_fg"), - tag_bg = lcol_chr("tag_bg"), - creator = lcol_int("creator"), - .default = NULL + name = tib_chr("name"), + tag_fg = tib_chr("tag_fg"), + tag_bg = tib_chr("tag_bg"), + creator = tib_int("creator") ), - parent = lcol_chr("parent", .default = NA_character_), - priority = lcol_df( + parent = tib_chr("parent"), + priority = tib_row( "priority", - id = lcol_chr("id", .default = NA_character_), - priority = lcol_chr("priority", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - orderindex = lcol_chr("orderindex", .default = NA_character_), - .default = NULL + id = tib_chr("id", required = FALSE), + priority = tib_chr("priority", required = FALSE), + color = tib_chr("color", required = FALSE), + orderindex = tib_chr("orderindex", required = FALSE) ), - due_date = lcol_dtt("due_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - start_date = lcol_dtt("start_date", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - points = lcol_guess("points", .default = NULL), - time_estimate = lcol_int("time_estimate", .default = NA_integer_), - custom_fields = lcol_df_lst( + due_date = tib_chr("due_date"), + start_date = tib_chr("start_date"), + points = tib_int("points"), + time_estimate = tib_int("time_estimate"), + custom_fields = tib_df( "custom_fields", - id = lcol_chr("id"), - name = lcol_chr("name"), - type = lcol_chr("type"), - type_config = lcol_df( - "type_config", - simple = lcol_lgl("simple", .default = NA), - formula = lcol_chr("formula", .default = NA_character_), - include_guests = lcol_lgl("include_guests", .default = NA), - include_team_members = lcol_lgl("include_team_members", .default = NA), - single_user = lcol_lgl("single_user", .default = NA), - default = lcol_int("default", .default = NA_integer_), - placeholder = lcol_guess("placeholder", .default = NULL), - new_drop_down = lcol_lgl("new_drop_down", .default = NA), - options = lcol_df_lst( - "options", - id = lcol_chr("id"), - name = lcol_chr("name", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - orderindex = lcol_int("orderindex", .default = NA_integer_), - label = lcol_chr("label", .default = NA_character_), - .default = NULL - ), - tracking = lcol_df( - "tracking", - subtasks = lcol_lgl("subtasks", .default = NA), - checklists = lcol_lgl("checklists", .default = NA), - assigned_comments = lcol_lgl("assigned_comments", .default = NA), - .default = NULL - ), - complete_on = lcol_int("complete_on", .default = NA_integer_), - subtask_rollup = lcol_lgl("subtask_rollup", .default = NA), - end = lcol_int("end", .default = NA_integer_), - start = lcol_int("start", .default = NA_integer_), - .default = NULL - ), - date_created = lcol_dtt("date_created", .parser = cu_date_from), - hide_from_guests = lcol_lgl("hide_from_guests"), - required = lcol_lgl("required"), - value = lcol_lst("value", .default = NULL) + id = tib_chr("id"), + name = tib_chr("name"), + type = tib_chr("type"), + type_config = tib_list("type_config"), + date_created = tib_chr("date_created"), + hide_from_guests = tib_lgl("hide_from_guests"), + required = tib_lgl("required"), + value = tib_list("value", required = FALSE) ), - dependencies = lcol_df_lst( + dependencies = tib_df( "dependencies", - task_id = lcol_chr("task_id"), - depends_on = lcol_chr("depends_on"), - type = lcol_int("type"), - date_created = lcol_dtt("date_created", .parser = cu_date_from), - userid = lcol_chr("userid"), - .default = NULL + task_id = tib_chr("task_id"), + depends_on = tib_chr("depends_on"), + type = tib_int("type"), + date_created = tib_chr("date_created"), + userid = tib_chr("userid") ), - linked_tasks = lcol_guess("linked_tasks", .default = NULL), - team_id = lcol_chr("team_id"), - url = lcol_chr("url"), - permission_level = lcol_chr("permission_level"), - list = lcol_df( + linked_tasks = tib_unspecified("linked_tasks"), + team_id = tib_chr("team_id"), + url = tib_chr("url"), + permission_level = tib_chr("permission_level"), + list = tib_row( "list", - id = lcol_chr("id"), - name = lcol_chr("name"), - access = lcol_lgl("access") + id = tib_chr("id"), + name = tib_chr("name"), + access = tib_lgl("access") ), - project = lcol_df( + project = tib_row( "project", - id = lcol_chr("id"), - name = lcol_chr("name"), - hidden = lcol_lgl("hidden"), - access = lcol_lgl("access") + id = tib_chr("id"), + name = tib_chr("name"), + hidden = tib_lgl("hidden"), + access = tib_lgl("access") ), - folder = lcol_df( + folder = tib_row( "folder", - id = lcol_chr("id"), - name = lcol_chr("name"), - hidden = lcol_lgl("hidden"), - access = lcol_lgl("access") + id = tib_chr("id"), + name = tib_chr("name"), + hidden = tib_lgl("hidden"), + access = tib_lgl("access") ), - space = lcol_df( + space = tib_row( "space", - id = lcol_chr("id") + id = tib_chr("id") ), - time_spent = lcol_int("time_spent", .default = NA_integer_) + time_spent = tib_int("time_spent", required = FALSE) ) diff --git a/R/spec-teams.R b/R/spec-teams.R index 5b8d5dc..365e445 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -1,37 +1,38 @@ -spec_teams <- lcols( - id = lcol_chr("id"), - name = lcol_chr("name"), - color = lcol_chr("color"), - avatar = lcol_chr("avatar"), - members = lcol_df_lst( +spec_teams <- spec_df( + id = tib_chr("id"), + name = tib_chr("name"), + color = tib_chr("color"), + avatar = tib_chr("avatar"), + members = tib_df( "members", - user = lcol_df( + user = tib_row( "user", - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - email = lcol_chr("email"), - color = lcol_chr("color", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - initials = lcol_chr("initials"), - role = lcol_int("role"), - custom_role = lcol_guess("custom_role", .default = NULL), - last_active = lcol_dtt("last_active", .parser = cu_date_from), - date_joined = lcol_dtt("date_joined", .parser = cu_date_from), - date_invited = lcol_dtt("date_invited", .parser = cu_date_from) + id = tib_int("id"), + username = tib_chr("username"), + email = tib_chr("email"), + color = tib_chr("color"), + profilePicture = tib_chr("profilePicture"), + initials = tib_chr("initials"), + role = tib_int("role"), + custom_role = tib_unspecified("custom_role"), + last_active = tib_chr("last_active"), + date_joined = tib_chr("date_joined"), + date_invited = tib_chr("date_invited") ), - invited_by = lcol_df( + invited_by = tib_row( "invited_by", - id = lcol_chr("id", .parser = as.character, .default = NA_character_), - username = lcol_chr("username", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - email = lcol_chr("email", .default = NA_character_), - initials = lcol_chr("initials", .default = NA_character_), - profilePicture = lcol_chr("profilePicture", .default = NA_character_), - .default = NULL + .required = FALSE, + id = tib_int("id", required = FALSE), + username = tib_chr("username", required = FALSE), + color = tib_chr("color", required = FALSE), + email = tib_chr("email", required = FALSE), + initials = tib_chr("initials", required = FALSE), + profilePicture = tib_chr("profilePicture", required = FALSE) ), - can_see_time_spent = lcol_lgl("can_see_time_spent", .default = NA), - can_see_time_estimated = lcol_lgl("can_see_time_estimated", .default = NA), - can_see_points_estimated = lcol_lgl("can_see_points_estimated", .default = NA), - can_edit_tags = lcol_lgl("can_edit_tags", .default = NA) + can_see_time_spent = tib_lgl("can_see_time_spent", required = FALSE), + can_see_time_estimated = tib_lgl("can_see_time_estimated", required = FALSE), + can_see_points_estimated = tib_lgl("can_see_points_estimated", required = FALSE), + can_edit_tags = tib_lgl("can_edit_tags", required = FALSE), + can_create_views = tib_lgl("can_create_views", required = FALSE) ) ) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 7fe3b07..4fe85d2 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -1,36 +1,49 @@ -spec_time_entries <- lcols( - id = lcol_chr("id"), - wid = lcol_chr("wid"), - user = lcol_df( +spec_time_entries <- spec_df( + id = tib_chr("id"), + wid = tib_chr("wid"), + user = tib_row( "user", - id = lcol_chr("id", .parser = as.character), - username = lcol_chr("username"), - email = lcol_chr("email"), - color = lcol_chr("color"), - initials = lcol_chr("initials"), - profilePicture = lcol_chr("profilePicture", .default = NA_character_) + id = tib_int("id"), + username = tib_chr("username"), + email = tib_chr("email"), + color = tib_chr("color"), + initials = tib_chr("initials"), + profilePicture = tib_chr("profilePicture") ), - billable = lcol_lgl("billable"), - start = lcol_dtt("start", .parser = cu_date_from), - description = lcol_chr("description"), - tags = lcol_guess("tags", .default = NULL), - source = lcol_chr("source"), - at = lcol_dtt("at", .parser = cu_date_from), - task = lcol_df( + billable = tib_lgl("billable"), + start = tib_chr("start"), + description = tib_chr("description"), + tags = tib_df( + "tags", + name = tib_chr("name"), + tag_bg = tib_chr("tag_bg"), + tag_fg = tib_chr("tag_fg"), + creator = tib_int("creator") + ), + source = tib_chr("source"), + at = tib_chr("at"), + task_location = tib_row( + "task_location", + .required = FALSE, + list_id = tib_chr("list_id", required = FALSE), + folder_id = tib_chr("folder_id", required = FALSE), + space_id = tib_chr("space_id", required = FALSE) + ), + task_url = tib_chr("task_url", required = FALSE), + task = tib_row( "task", - id = lcol_chr("id", .default = NA_character_), - name = lcol_chr("name", .default = NA_character_), - status = lcol_df( + id = tib_chr("id", required = FALSE), + name = tib_chr("name", required = FALSE), + status = tib_row( "status", - status = lcol_chr("status", .default = NA_character_), - color = lcol_chr("color", .default = NA_character_), - type = lcol_chr("type", .default = NA_character_), - orderindex = lcol_int("orderindex", .default = NA_integer_), - .default = NULL + .required = FALSE, + status = tib_chr("status"), + color = tib_chr("color"), + type = tib_chr("type"), + orderindex = tib_int("orderindex") ), - custom_type = lcol_guess("custom_type", .default = NULL), - .default = NULL + custom_type = tib_int("custom_type", required = FALSE) ), - end = lcol_dtt("end", .parser = cu_date_from, .default = dttr2::NA_POSIXct_), - duration = lcol_vec("duration", hms::new_hms(), .default = dttr2::NA_hms_, .parser = ~ hms::as_hms(as.numeric(.x) / 1000)) + end = tib_chr("end", required = FALSE), + duration = tib_chr("duration", required = FALSE) ) diff --git a/R/tibblify.R b/R/tibblify.R index bcdcb91..d24a2d0 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -7,11 +7,11 @@ write_spec <- function(x) { out <- x %>% - get_spec() %>% format() %>% fansi::strip_sgr() - base_name <- gsub("^df_", "", name) + base_name <- gsub("^spec_", "", name) + stopifnot(base_name != name) out <- paste0("spec_", base_name, " <- ", out) out <- gsub(" ", " ", out, fixed = TRUE) diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R index fa6e389..1281be4 100644 --- a/script/tibblify-01-teams.R +++ b/script/tibblify-01-teams.R @@ -5,11 +5,14 @@ library(tidyverse) teams <- cu_get_teams() teams -df_teams <- tibblify(teams$teams) +# Needs https://github.com/mgirlich/tibblify/pull/50 +spec_teams <- guess_spec(teams$teams) + +df_teams <- tibblify(teams$teams, spec = spec_teams) df_teams df_teams %>% get_spec() df_teams df_teams$members -write_spec(df_teams) +write_spec(spec_teams) diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R index 65af9fa..5f47e47 100644 --- a/script/tibblify-02-spaces.R +++ b/script/tibblify-02-spaces.R @@ -6,6 +6,8 @@ df_teams <- cuf_get_teams() spaces <- cu_get_spaces(df_teams$id[[1]]) spaces +spec_spaces <- guess_spec(spaces$spaces) + df_spaces <- spaces$spaces %>% tibblify() @@ -13,4 +15,4 @@ df_spaces <- df_spaces %>% get_spec() -write_spec(df_spaces) +write_spec(spec_spaces) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index 751f053..1133eee 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -12,8 +12,10 @@ folders <- unlist(recursive = FALSE) folders +spec_folders <- guess_spec(folders) + df_folders <- tibblify::tibblify(folders) df_folders df_folders %>% get_spec() -write_spec(df_folders) +write_spec(spec_folders) diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index d6770f3..fc31dca 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -14,8 +14,10 @@ lists <- map("lists") %>% unlist(recursive = FALSE) +spec_lists <- guess_spec(lists) + df_lists <- tibblify::tibblify(lists) df_lists df_lists %>% get_spec() -write_spec(df_lists) +write_spec(spec_lists) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 37e0e37..ab41158 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -21,8 +21,12 @@ tasks <- tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) +spec_tasks <- guess_spec(c(tasks, tasks_team$tasks)) + +# Error in tibblify_impl(x, spec) : +# SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL' df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks)) df_tasks df_tasks %>% get_spec() -write_spec(df_tasks) +write_spec(spec_tasks) diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index b9c9f79..cdecc31 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -26,11 +26,13 @@ for (i in which(!good)) { time$data[[i]]$task <- list() } +spec_time_entries <- guess_spec(time$data) + df_time_entries <- tibblify::tibblify(time$data) df_time_entries df_time_entries %>% get_spec() -write_spec(df_time_entries) +write_spec(spec_time_entries) # Reload after updating spec pkgload::load_all() diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R index 9a6f2c5..34d824b 100644 --- a/script/tibblify-07-members.R +++ b/script/tibblify-07-members.R @@ -13,11 +13,13 @@ df_lists members <- cu_get_list_members(df_lists$id[[1]]) +spec_members <- guess_spec(members$members) + df_members <- tibblify::tibblify(members$members) df_members df_members %>% get_spec() -write_spec(df_members) +write_spec(spec_members) # Reload pkgload::load_all() From 44ccf201675074a08a29fdcbb9c3e1f65067d69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 22 May 2022 17:47:46 +0200 Subject: [PATCH 060/137] Use new API for search + replace --- R/tibblify.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/tibblify.R b/R/tibblify.R index d24a2d0..1fa0a36 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -16,16 +16,16 @@ write_spec <- function(x) { out <- paste0("spec_", base_name, " <- ", out) out <- gsub(" ", " ", out, fixed = TRUE) - out <- gsub('lcol_int("id")', 'lcol_chr("id", .parser = as.character)', out, fixed = TRUE) - out <- gsub('lcol_int("id", .default = NA_integer_', 'lcol_chr("id", .parser = as.character, .default = NA_character_', out, fixed = TRUE) + out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character)', out, fixed = TRUE) + out <- gsub('tib_int("id", default = NA_integer_', 'tib_chr("id", transform = as.character, default = NA_character_', out, fixed = TRUE) - out <- gsub('lcol_chr("orderindex")', 'lcol_int("orderindex", .parser = as.integer)', out, fixed = TRUE) + out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer)', out, fixed = TRUE) date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" - out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')", .default = NA_character_'), 'lcol_dtt("\\1", .parser = cu_date_from, .default = dttr2::NA_POSIXct_', out) - out <- gsub(paste0('lcol_chr[(]"(', date_cols, ')"'), 'lcol_dtt("\\1", .parser = cu_date_from', out) + out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_vector("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) + out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_vector("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) - out <- gsub('lcol_chr("duration", .default = NA_character_)', 'lcol_vec("duration", hms::new_hms(), .default = dttr2::NA_hms_, .parser = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + out <- gsub('tib_chr("duration", default = NA_character_)', 'tib_vector("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From 50323110f632a71409068a4cce27193cecc27b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 05:40:58 +0200 Subject: [PATCH 061/137] Tweak time entries without task --- R/df-timetracking-v2.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index f80ee7f..4f89abd 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -7,7 +7,16 @@ NULL cuf_get_time_entries_within_date_range <- function(team_id, start_date, end_date, assignee) { out <- cu_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) - tibblify(out$data, spec_time_entries) + + # Patch time entries without associated task + entries <- lapply(out$data, function(.x) { + if (is.null(names(.x[["task"]]))) { + .x[["task"]] <- NULL + } + .x + }) + + tibblify(entries, spec_time_entries) } From 63cdfbb0350d32ce4efa90c972c34545972ab796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 05:41:22 +0200 Subject: [PATCH 062/137] Type stability --- R/spec-folders.R | 4 ++-- R/spec-lists.R | 4 ++-- R/spec-members.R | 10 +++++++--- R/spec-spaces.R | 4 ++-- R/spec-tasks.R | 24 ++++++++++++------------ R/spec-teams.R | 8 ++++---- R/spec-time_entries.R | 9 +++++---- 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index 79a6c26..84d5546 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -39,8 +39,8 @@ spec_folders <- spec_df( profilePicture = tib_chr("profilePicture", required = FALSE) ), task_count = tib_int("task_count"), - due_date = tib_chr("due_date"), - start_date = tib_chr("start_date"), + due_date = tib_vector("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + start_date = tib_vector("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), space = tib_row( "space", id = tib_chr("id"), diff --git a/R/spec-lists.R b/R/spec-lists.R index 7acee00..2785cea 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -17,8 +17,8 @@ spec_lists <- spec_df( profilePicture = tib_chr("profilePicture", required = FALSE) ), task_count = tib_int("task_count"), - due_date = tib_chr("due_date"), - start_date = tib_chr("start_date"), + due_date = tib_vector("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + start_date = tib_vector("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), folder = tib_row( "folder", id = tib_chr("id"), diff --git a/R/spec-members.R b/R/spec-members.R index 0aabf44..e3041d4 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -1,5 +1,5 @@ spec_members <- spec_df( - id = tib_int("id"), + id = tib_chr("id", transform = as.character), username = tib_chr("username"), email = tib_chr("email"), color = tib_chr("color"), @@ -11,8 +11,12 @@ spec_members <- spec_df( verified_ambassador = tib_unspecified("verified_ambassador"), verified_consultant = tib_unspecified("verified_consultant"), top_tier_user = tib_unspecified("top_tier_user"), - viewed_verified_ambassador = tib_unspecified("viewed_verified_ambassador"), - viewed_verified_consultant = tib_unspecified("viewed_verified_consultant"), + viewed_verified_ambassador = tib_unspecified( + "viewed_verified_ambassador" + ), + viewed_verified_consultant = tib_unspecified( + "viewed_verified_consultant" + ), viewed_top_tier_user = tib_unspecified("viewed_top_tier_user") ) ) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index dd50c83..03b57eb 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -29,7 +29,7 @@ spec_spaces <- spec_df( id = tib_chr("id"), priority = tib_chr("priority"), color = tib_chr("color"), - orderindex = tib_chr("orderindex") + orderindex = tib_int("orderindex", transform = as.integer) ), per_assignee = tib_lgl("per_assignee", required = FALSE), subtasks = tib_lgl("subtasks", required = FALSE), @@ -42,7 +42,7 @@ spec_spaces <- spec_df( .required = FALSE, user = tib_row( "user", - id = tib_int("id"), + id = tib_chr("id", transform = as.character), username = tib_chr("username"), color = tib_chr("color"), profilePicture = tib_chr("profilePicture"), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index f06e17a..781999f 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -11,14 +11,14 @@ spec_tasks <- spec_df( type = tib_chr("type"), orderindex = tib_int("orderindex") ), - orderindex = tib_chr("orderindex"), - date_created = tib_chr("date_created"), - date_updated = tib_chr("date_updated"), - date_closed = tib_chr("date_closed"), + orderindex = tib_int("orderindex", transform = as.integer), + date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_updated = tib_vector("date_updated", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_closed = tib_vector("date_closed", ptype = vctrs::new_datetime(), transform = cu_date_from), archived = tib_lgl("archived"), creator = tib_row( "creator", - id = tib_int("id"), + id = tib_chr("id", transform = as.character), username = tib_chr("username"), color = tib_chr("color"), email = tib_chr("email"), @@ -26,7 +26,7 @@ spec_tasks <- spec_df( ), assignees = tib_df( "assignees", - id = tib_int("id"), + id = tib_chr("id", transform = as.character), username = tib_chr("username"), color = tib_chr("color"), initials = tib_chr("initials"), @@ -39,7 +39,7 @@ spec_tasks <- spec_df( id = tib_chr("id"), task_id = tib_chr("task_id"), name = tib_chr("name"), - date_created = tib_chr("date_created"), + date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), orderindex = tib_int("orderindex"), creator = tib_int("creator"), resolved = tib_int("resolved"), @@ -61,7 +61,7 @@ spec_tasks <- spec_df( group_assignee = tib_unspecified("group_assignee"), resolved = tib_lgl("resolved"), parent = tib_unspecified("parent"), - date_created = tib_chr("date_created"), + date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), children = tib_unspecified("children") ) ), @@ -80,8 +80,8 @@ spec_tasks <- spec_df( color = tib_chr("color", required = FALSE), orderindex = tib_chr("orderindex", required = FALSE) ), - due_date = tib_chr("due_date"), - start_date = tib_chr("start_date"), + due_date = tib_vector("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + start_date = tib_vector("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), points = tib_int("points"), time_estimate = tib_int("time_estimate"), custom_fields = tib_df( @@ -90,7 +90,7 @@ spec_tasks <- spec_df( name = tib_chr("name"), type = tib_chr("type"), type_config = tib_list("type_config"), - date_created = tib_chr("date_created"), + date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), hide_from_guests = tib_lgl("hide_from_guests"), required = tib_lgl("required"), value = tib_list("value", required = FALSE) @@ -100,7 +100,7 @@ spec_tasks <- spec_df( task_id = tib_chr("task_id"), depends_on = tib_chr("depends_on"), type = tib_int("type"), - date_created = tib_chr("date_created"), + date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), userid = tib_chr("userid") ), linked_tasks = tib_unspecified("linked_tasks"), diff --git a/R/spec-teams.R b/R/spec-teams.R index 365e445..85a99b2 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -7,7 +7,7 @@ spec_teams <- spec_df( "members", user = tib_row( "user", - id = tib_int("id"), + id = tib_chr("id", transform = as.character), username = tib_chr("username"), email = tib_chr("email"), color = tib_chr("color"), @@ -15,9 +15,9 @@ spec_teams <- spec_df( initials = tib_chr("initials"), role = tib_int("role"), custom_role = tib_unspecified("custom_role"), - last_active = tib_chr("last_active"), - date_joined = tib_chr("date_joined"), - date_invited = tib_chr("date_invited") + last_active = tib_vector("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_joined = tib_vector("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_invited = tib_vector("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from) ), invited_by = tib_row( "invited_by", diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 4fe85d2..86457bb 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -3,7 +3,7 @@ spec_time_entries <- spec_df( wid = tib_chr("wid"), user = tib_row( "user", - id = tib_int("id"), + id = tib_chr("id", transform = as.character), username = tib_chr("username"), email = tib_chr("email"), color = tib_chr("color"), @@ -11,7 +11,7 @@ spec_time_entries <- spec_df( profilePicture = tib_chr("profilePicture") ), billable = tib_lgl("billable"), - start = tib_chr("start"), + start = tib_vector("start", ptype = vctrs::new_datetime(), transform = cu_date_from), description = tib_chr("description"), tags = tib_df( "tags", @@ -21,7 +21,7 @@ spec_time_entries <- spec_df( creator = tib_int("creator") ), source = tib_chr("source"), - at = tib_chr("at"), + at = tib_vector("at", ptype = vctrs::new_datetime(), transform = cu_date_from), task_location = tib_row( "task_location", .required = FALSE, @@ -32,6 +32,7 @@ spec_time_entries <- spec_df( task_url = tib_chr("task_url", required = FALSE), task = tib_row( "task", + .required = FALSE, id = tib_chr("id", required = FALSE), name = tib_chr("name", required = FALSE), status = tib_row( @@ -44,6 +45,6 @@ spec_time_entries <- spec_df( ), custom_type = tib_int("custom_type", required = FALSE) ), - end = tib_chr("end", required = FALSE), + end = tib_vector("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), duration = tib_chr("duration", required = FALSE) ) From 4633db25804a7f0b3f574d29eb4e0a04bc4dae9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 05:41:30 +0200 Subject: [PATCH 063/137] README --- script/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/README.md b/script/README.md index bfcaf50..0e3b500 100644 --- a/script/README.md +++ b/script/README.md @@ -29,7 +29,7 @@ Goal: A `cuf_*()` function for each `cu_()` function that returns a tibble with ## Test instance -For testing, I created a throwaway ClickUp workspace that can be populatd with the `create.R` script. +For testing, I created a throwaway ClickUp workspace that can be populated with the `create.R` script. The data in a live workspace is richer, but modification and deletion can only reliably be tested on a toy workspace. The "team ID" is hard-coded in `create.R` to ensure that the code doesn't accidentally wipe the live workspace. @@ -38,7 +38,6 @@ The "team ID" is hard-coded in `create.R` to ensure that the code doesn't accide - Fix warnings in `devtools::document()` -- delete first four lines in most `df-*.R` files - Enhance `create.R` script - Rerun `tibblify-all.R`, ensure that the generated specs are not worse than the existing specs - - Eliminate all instances of `lcol_guess()` in the specs by creating a richer example workspace in `create.R` - Add tests against toy workspace ## Problems From 6f9ce8dc9b4897691e57fc750c7b89609c52d5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 05:42:31 +0200 Subject: [PATCH 064/137] Cleanup --- script/tibblify-01-teams.R | 1 - script/tibblify-02-spaces.R | 8 ++------ script/tibblify-03-folders.R | 3 +-- script/tibblify-04-lists.R | 3 +-- script/tibblify-05-tasks.R | 3 +-- script/tibblify-06-timetracking-v2.R | 3 +-- script/tibblify-07-members.R | 3 +-- 7 files changed, 7 insertions(+), 17 deletions(-) diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R index 1281be4..38169cc 100644 --- a/script/tibblify-01-teams.R +++ b/script/tibblify-01-teams.R @@ -10,7 +10,6 @@ spec_teams <- guess_spec(teams$teams) df_teams <- tibblify(teams$teams, spec = spec_teams) df_teams -df_teams %>% get_spec() df_teams df_teams$members diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R index 5f47e47..302fbac 100644 --- a/script/tibblify-02-spaces.R +++ b/script/tibblify-02-spaces.R @@ -8,11 +8,7 @@ spaces spec_spaces <- guess_spec(spaces$spaces) -df_spaces <- - spaces$spaces %>% - tibblify() - -df_spaces %>% - get_spec() +spaces$spaces %>% + tibblify(spec = spec_spaces) write_spec(spec_spaces) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index 1133eee..dda4cb6 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -14,8 +14,7 @@ folders spec_folders <- guess_spec(folders) -df_folders <- tibblify::tibblify(folders) +df_folders <- tibblify::tibblify(folders, spec = spec_folders) df_folders -df_folders %>% get_spec() write_spec(spec_folders) diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index fc31dca..046d15f 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -16,8 +16,7 @@ lists <- spec_lists <- guess_spec(lists) -df_lists <- tibblify::tibblify(lists) +df_lists <- tibblify::tibblify(lists, spec = spec_lists) df_lists -df_lists %>% get_spec() write_spec(spec_lists) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index ab41158..76743dd 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -25,8 +25,7 @@ spec_tasks <- guess_spec(c(tasks, tasks_team$tasks)) # Error in tibblify_impl(x, spec) : # SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL' -df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks)) +df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks), spec = spec_tasks) df_tasks -df_tasks %>% get_spec() write_spec(spec_tasks) diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index cdecc31..587433c 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -28,9 +28,8 @@ for (i in which(!good)) { spec_time_entries <- guess_spec(time$data) -df_time_entries <- tibblify::tibblify(time$data) +df_time_entries <- tibblify::tibblify(time$data, spec_time_entries) df_time_entries -df_time_entries %>% get_spec() write_spec(spec_time_entries) diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R index 34d824b..42d19cb 100644 --- a/script/tibblify-07-members.R +++ b/script/tibblify-07-members.R @@ -15,9 +15,8 @@ members <- cu_get_list_members(df_lists$id[[1]]) spec_members <- guess_spec(members$members) -df_members <- tibblify::tibblify(members$members) +df_members <- tibblify::tibblify(members$members, spec_members) df_members -df_members %>% get_spec() write_spec(spec_members) From 7de2f80537584419f10d23b859717242055ae11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 05:43:04 +0200 Subject: [PATCH 065/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6b8da7c..90b06fd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9002 +Version: 0.0.5.9003 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 48b3701e9eb360ed5d25ec4b9a1b3bd59b6096e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 06:20:38 +0200 Subject: [PATCH 066/137] Need tib_scalar() --- R/spec-folders.R | 4 ++-- R/spec-lists.R | 4 ++-- R/spec-tasks.R | 18 +++++++++--------- R/spec-teams.R | 6 +++--- R/spec-time_entries.R | 6 +++--- R/tibblify.R | 6 +++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index 84d5546..24a9892 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -39,8 +39,8 @@ spec_folders <- spec_df( profilePicture = tib_chr("profilePicture", required = FALSE) ), task_count = tib_int("task_count"), - due_date = tib_vector("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - start_date = tib_vector("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + due_date = tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + start_date = tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), space = tib_row( "space", id = tib_chr("id"), diff --git a/R/spec-lists.R b/R/spec-lists.R index 2785cea..91a50a3 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -17,8 +17,8 @@ spec_lists <- spec_df( profilePicture = tib_chr("profilePicture", required = FALSE) ), task_count = tib_int("task_count"), - due_date = tib_vector("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - start_date = tib_vector("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + due_date = tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + start_date = tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), folder = tib_row( "folder", id = tib_chr("id"), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 781999f..51038b5 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -12,9 +12,9 @@ spec_tasks <- spec_df( orderindex = tib_int("orderindex") ), orderindex = tib_int("orderindex", transform = as.integer), - date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_updated = tib_vector("date_updated", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_closed = tib_vector("date_closed", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_updated = tib_scalar("date_updated", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_closed = tib_scalar("date_closed", ptype = vctrs::new_datetime(), transform = cu_date_from), archived = tib_lgl("archived"), creator = tib_row( "creator", @@ -39,7 +39,7 @@ spec_tasks <- spec_df( id = tib_chr("id"), task_id = tib_chr("task_id"), name = tib_chr("name"), - date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), orderindex = tib_int("orderindex"), creator = tib_int("creator"), resolved = tib_int("resolved"), @@ -61,7 +61,7 @@ spec_tasks <- spec_df( group_assignee = tib_unspecified("group_assignee"), resolved = tib_lgl("resolved"), parent = tib_unspecified("parent"), - date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), children = tib_unspecified("children") ) ), @@ -80,8 +80,8 @@ spec_tasks <- spec_df( color = tib_chr("color", required = FALSE), orderindex = tib_chr("orderindex", required = FALSE) ), - due_date = tib_vector("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - start_date = tib_vector("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + due_date = tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + start_date = tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), points = tib_int("points"), time_estimate = tib_int("time_estimate"), custom_fields = tib_df( @@ -90,7 +90,7 @@ spec_tasks <- spec_df( name = tib_chr("name"), type = tib_chr("type"), type_config = tib_list("type_config"), - date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), hide_from_guests = tib_lgl("hide_from_guests"), required = tib_lgl("required"), value = tib_list("value", required = FALSE) @@ -100,7 +100,7 @@ spec_tasks <- spec_df( task_id = tib_chr("task_id"), depends_on = tib_chr("depends_on"), type = tib_int("type"), - date_created = tib_vector("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), userid = tib_chr("userid") ), linked_tasks = tib_unspecified("linked_tasks"), diff --git a/R/spec-teams.R b/R/spec-teams.R index 85a99b2..a6bd207 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -15,9 +15,9 @@ spec_teams <- spec_df( initials = tib_chr("initials"), role = tib_int("role"), custom_role = tib_unspecified("custom_role"), - last_active = tib_vector("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_joined = tib_vector("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_invited = tib_vector("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from) + last_active = tib_scalar("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_joined = tib_scalar("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), + date_invited = tib_scalar("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from) ), invited_by = tib_row( "invited_by", diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 86457bb..df68282 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -11,7 +11,7 @@ spec_time_entries <- spec_df( profilePicture = tib_chr("profilePicture") ), billable = tib_lgl("billable"), - start = tib_vector("start", ptype = vctrs::new_datetime(), transform = cu_date_from), + start = tib_scalar("start", ptype = vctrs::new_datetime(), transform = cu_date_from), description = tib_chr("description"), tags = tib_df( "tags", @@ -21,7 +21,7 @@ spec_time_entries <- spec_df( creator = tib_int("creator") ), source = tib_chr("source"), - at = tib_vector("at", ptype = vctrs::new_datetime(), transform = cu_date_from), + at = tib_scalar("at", ptype = vctrs::new_datetime(), transform = cu_date_from), task_location = tib_row( "task_location", .required = FALSE, @@ -45,6 +45,6 @@ spec_time_entries <- spec_df( ), custom_type = tib_int("custom_type", required = FALSE) ), - end = tib_vector("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), + end = tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), duration = tib_chr("duration", required = FALSE) ) diff --git a/R/tibblify.R b/R/tibblify.R index 1fa0a36..4d939d3 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -22,10 +22,10 @@ write_spec <- function(x) { out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer)', out, fixed = TRUE) date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" - out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_vector("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) - out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_vector("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) + out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) + out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) - out <- gsub('tib_chr("duration", default = NA_character_)', 'tib_vector("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + out <- gsub('tib_chr("duration", default = NA_character_)', 'tib_scalar("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From 033f194b2af64cebb8e1e1cf1f836e13bacfff6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 06:20:44 +0200 Subject: [PATCH 067/137] Test-drive --- script/tibblify-04-lists.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index 046d15f..b5f3f0d 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -20,3 +20,7 @@ df_lists <- tibblify::tibblify(lists, spec = spec_lists) df_lists write_spec(spec_lists) + +pkgload::load_all() + +cuf_get_lists(df_folders$id[[1]]) From aa11fba9fec3ba45d3ebcb4f7ead19f67fcbdfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 06:20:52 +0200 Subject: [PATCH 068/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 90b06fd..f57be65 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9003 +Version: 0.0.5.9004 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 6ef89e21c96153a75b3734dd7b39c29411b9ed3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 07:59:14 +0200 Subject: [PATCH 069/137] Fix type for duration --- DESCRIPTION | 2 +- R/spec-time_entries.R | 2 +- R/tibblify.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f57be65..a2ce06d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9004 +Version: 0.0.5.9005 Date: 2021-12-12 Authors@R: c(person(given = "Peter", diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index df68282..6f61670 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -46,5 +46,5 @@ spec_time_entries <- spec_df( custom_type = tib_int("custom_type", required = FALSE) ), end = tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), - duration = tib_chr("duration", required = FALSE) + duration = tib_scalar("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), ) diff --git a/R/tibblify.R b/R/tibblify.R index 4d939d3..b006d66 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -25,7 +25,7 @@ write_spec <- function(x) { out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) - out <- gsub('tib_chr("duration", default = NA_character_)', 'tib_scalar("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + out <- gsub('tib_chr("duration", required = FALSE)', 'tib_scalar("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From 05955a7af2d38d83ee288d89fe33373511723852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 23 May 2022 08:04:24 +0200 Subject: [PATCH 070/137] Allow missing --- DESCRIPTION | 2 +- R/spec-time_entries.R | 2 +- R/tibblify.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a2ce06d..c850329 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9005 +Version: 0.0.5.9006 Date: 2021-12-12 Authors@R: c(person(given = "Peter", diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 6f61670..6267d1a 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -46,5 +46,5 @@ spec_time_entries <- spec_df( custom_type = tib_int("custom_type", required = FALSE) ), end = tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), - duration = tib_scalar("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), + duration = tib_scalar("duration", hms::new_hms(), required = FALSE, default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), ) diff --git a/R/tibblify.R b/R/tibblify.R index b006d66..1d1f5e8 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -25,7 +25,7 @@ write_spec <- function(x) { out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) - out <- gsub('tib_chr("duration", required = FALSE)', 'tib_scalar("duration", hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + out <- gsub('tib_chr("duration", required = FALSE)', 'tib_scalar("duration", required = FALSE, hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From a11078f416b5cd943c8cbd09ec0e27ea85deab91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:46:41 +0200 Subject: [PATCH 071/137] Make loadable again --- R/spec-tasks.R | 4 ++-- R/spec-time_entries.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 51038b5..997411d 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -89,11 +89,11 @@ spec_tasks <- spec_df( id = tib_chr("id"), name = tib_chr("name"), type = tib_chr("type"), - type_config = tib_list("type_config"), + type_config = tib_variant("type_config"), date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), hide_from_guests = tib_lgl("hide_from_guests"), required = tib_lgl("required"), - value = tib_list("value", required = FALSE) + value = tib_variant("value", required = FALSE) ), dependencies = tib_df( "dependencies", diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 6267d1a..791de6c 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -46,5 +46,5 @@ spec_time_entries <- spec_df( custom_type = tib_int("custom_type", required = FALSE) ), end = tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), - duration = tib_scalar("duration", hms::new_hms(), required = FALSE, default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), + duration = tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), ) From 1a7824aba7d3082bcf59485dd10de479582b2c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:48:25 +0200 Subject: [PATCH 072/137] Document --- DESCRIPTION | 2 +- NAMESPACE | 5 +++++ man/api-folders.Rd | 3 +++ man/api-lists.Rd | 3 +++ man/api-spaces.Rd | 3 +++ man/api-tasks.Rd | 3 +++ man/api-timetracking-2.Rd | 3 +++ 7 files changed, 21 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index c850329..73bc642 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,6 +37,6 @@ Encoding: UTF-8 LazyData: true LazyLoad: yes Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.0 Remotes: mgirlich/tibblify diff --git a/NAMESPACE b/NAMESPACE index 6b0e65e..a33245b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -156,9 +156,14 @@ export(cuf_delete_checklist) export(cuf_delete_checklist_item) export(cuf_delete_comment) export(cuf_delete_dependency) +export(cuf_delete_folder) export(cuf_delete_goal) export(cuf_delete_key_result) +export(cuf_delete_list) +export(cuf_delete_space) export(cuf_delete_space_tag) +export(cuf_delete_task) +export(cuf_delete_time_entry) export(cuf_delete_time_tracked) export(cuf_delete_view) export(cuf_delete_webhook) diff --git a/man/api-folders.Rd b/man/api-folders.Rd index 026bf58..2ec5b2c 100644 --- a/man/api-folders.Rd +++ b/man/api-folders.Rd @@ -9,6 +9,7 @@ \alias{cu_get_folder} \alias{cuf_create_folder} \alias{cuf_update_folder} +\alias{cuf_delete_folder} \alias{cuf_get_folders} \alias{cuf_get_folder} \title{Folders} @@ -27,6 +28,8 @@ cuf_create_folder(space_id, name) cuf_update_folder(folder_id, name) +cuf_delete_folder(folder_id, name) + cuf_get_folders(space_id, archived = FALSE) cuf_get_folder(folder_id) diff --git a/man/api-lists.Rd b/man/api-lists.Rd index b6ebdc4..7160c4c 100644 --- a/man/api-lists.Rd +++ b/man/api-lists.Rd @@ -12,6 +12,7 @@ \alias{cuf_create_list} \alias{cuf_create_folderless_list} \alias{cuf_update_list} +\alias{cuf_delete_list} \alias{cuf_get_lists} \alias{cuf_get_lists_folderless} \alias{cuf_get_list} @@ -37,6 +38,8 @@ cuf_create_folderless_list(space_id, ...) cuf_update_list(list_id, ...) +cuf_delete_list(list_id, ...) + cuf_get_lists(folder_id, archived = FALSE) cuf_get_lists_folderless(space_id, archived = FALSE) diff --git a/man/api-spaces.Rd b/man/api-spaces.Rd index c7ee28d..c2b8151 100644 --- a/man/api-spaces.Rd +++ b/man/api-spaces.Rd @@ -9,6 +9,7 @@ \alias{cu_get_space} \alias{cuf_create_space} \alias{cuf_update_space} +\alias{cuf_delete_space} \alias{cuf_get_spaces} \alias{cuf_get_space} \title{Spaces} @@ -27,6 +28,8 @@ cuf_create_space(team_id, name, ...) cuf_update_space(space_id, ...) +cuf_delete_space(space_id) + cuf_get_spaces(team_id, archived = FALSE) cuf_get_space(space_id) diff --git a/man/api-tasks.Rd b/man/api-tasks.Rd index daa3cb6..473b606 100644 --- a/man/api-tasks.Rd +++ b/man/api-tasks.Rd @@ -10,6 +10,7 @@ \alias{cu_get_filtered_team_tasks} \alias{cuf_create_task} \alias{cuf_update_task} +\alias{cuf_delete_task} \alias{cuf_get_tasks} \alias{cuf_get_task} \alias{cuf_get_filtered_team_tasks} @@ -31,6 +32,8 @@ cuf_create_task(list_id, ...) cuf_update_task(task_id, ...) +cuf_delete_task(task_id) + cuf_get_tasks(list_id, archived = FALSE, ...) cuf_get_task(task_id) diff --git a/man/api-timetracking-2.Rd b/man/api-timetracking-2.Rd index 8c2c24a..afadc97 100644 --- a/man/api-timetracking-2.Rd +++ b/man/api-timetracking-2.Rd @@ -26,6 +26,7 @@ \alias{cuf_change_tag_names_from_time_entries} \alias{cuf_start_time_entry} \alias{cuf_stop_time_entry} +\alias{cuf_delete_time_entry} \alias{cuf_update_time_entry} \title{Time tracking 2.0} \usage{ @@ -77,6 +78,8 @@ cuf_start_time_entry(team_id, timer_id, ...) cuf_stop_time_entry(team_id) +cuf_delete_time_entry(team_id, timer_id) + cuf_update_time_entry(team_id, timer_id, ...) } \arguments{ From 64ca83265d759efbaaf20d30baa30cebe233dfc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:49:05 +0200 Subject: [PATCH 073/137] cu_date_to() gets tz argument --- R/cu-date.R | 5 ++++- man/cu-date.Rd | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/cu-date.R b/R/cu-date.R index e9a8598..92ed031 100644 --- a/R/cu-date.R +++ b/R/cu-date.R @@ -51,6 +51,9 @@ cu_date_from <- function(ms, tz = NULL, ...) { #' @export #' @rdname cu-date ## turning POSIXct to unix time -cu_date_to <- function(dt) { +cu_date_to <- function(dt, tz = NULL) { + if (is.null(tz)) + tz <- getOption("cu_options")$tz + as.character(round(unclass(as.POSIXct(dt))*1000)) } diff --git a/man/cu-date.Rd b/man/cu-date.Rd index 2cf97df..ce68d5b 100644 --- a/man/cu-date.Rd +++ b/man/cu-date.Rd @@ -8,7 +8,7 @@ \usage{ cu_date_from(ms, tz = NULL, ...) -cu_date_to(dt) +cu_date_to(dt, tz = NULL) } \arguments{ \item{ms}{ClickUp date/time format, Unix time in milliseconds.} From 3b1e7c76b775d2caa897c3b93488a2230bb75319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:49:33 +0200 Subject: [PATCH 074/137] Rename API --- script/tibblify-01-teams.R | 2 +- script/tibblify-02-spaces.R | 2 +- script/tibblify-03-folders.R | 2 +- script/tibblify-04-lists.R | 2 +- script/tibblify-05-tasks.R | 2 +- script/tibblify-06-timetracking-v2.R | 2 +- script/tibblify-07-members.R | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R index 38169cc..55844cb 100644 --- a/script/tibblify-01-teams.R +++ b/script/tibblify-01-teams.R @@ -6,7 +6,7 @@ teams <- cu_get_teams() teams # Needs https://github.com/mgirlich/tibblify/pull/50 -spec_teams <- guess_spec(teams$teams) +spec_teams <- spec_guess(teams$teams) df_teams <- tibblify(teams$teams, spec = spec_teams) df_teams diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R index 302fbac..8c437f5 100644 --- a/script/tibblify-02-spaces.R +++ b/script/tibblify-02-spaces.R @@ -6,7 +6,7 @@ df_teams <- cuf_get_teams() spaces <- cu_get_spaces(df_teams$id[[1]]) spaces -spec_spaces <- guess_spec(spaces$spaces) +spec_spaces <- spec_guess(spaces$spaces) spaces$spaces %>% tibblify(spec = spec_spaces) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index dda4cb6..0a380da 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -12,7 +12,7 @@ folders <- unlist(recursive = FALSE) folders -spec_folders <- guess_spec(folders) +spec_folders <- spec_guess(folders) df_folders <- tibblify::tibblify(folders, spec = spec_folders) df_folders diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index b5f3f0d..41001ac 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -14,7 +14,7 @@ lists <- map("lists") %>% unlist(recursive = FALSE) -spec_lists <- guess_spec(lists) +spec_lists <- spec_guess(lists) df_lists <- tibblify::tibblify(lists, spec = spec_lists) df_lists diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 76743dd..554d1d1 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -21,7 +21,7 @@ tasks <- tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) -spec_tasks <- guess_spec(c(tasks, tasks_team$tasks)) +spec_tasks <- spec_guess(c(tasks, tasks_team$tasks)) # Error in tibblify_impl(x, spec) : # SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL' diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index 587433c..dd9c222 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -26,7 +26,7 @@ for (i in which(!good)) { time$data[[i]]$task <- list() } -spec_time_entries <- guess_spec(time$data) +spec_time_entries <- spec_guess(time$data) df_time_entries <- tibblify::tibblify(time$data, spec_time_entries) df_time_entries diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R index 42d19cb..f25643b 100644 --- a/script/tibblify-07-members.R +++ b/script/tibblify-07-members.R @@ -13,7 +13,7 @@ df_lists members <- cu_get_list_members(df_lists$id[[1]]) -spec_members <- guess_spec(members$members) +spec_members <- spec_guess(members$members) df_members <- tibblify::tibblify(members$members, spec_members) df_members From 7c2e64fc50781d1286c630e30074ca426b260bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:51:41 +0200 Subject: [PATCH 075/137] Remove names --- R/spec-folders.R | 94 +++++++++---------- R/spec-lists.R | 56 +++++------ R/spec-members.R | 28 +++--- R/spec-spaces.R | 74 +++++++-------- R/spec-tasks.R | 210 +++++++++++++++++++++--------------------- R/spec-teams.R | 58 ++++++------ R/spec-time_entries.R | 70 +++++++------- 7 files changed, 295 insertions(+), 295 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index 24a9892..54f4ae4 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -1,63 +1,63 @@ spec_folders <- spec_df( - id = tib_chr("id"), - name = tib_chr("name"), - orderindex = tib_int("orderindex"), - override_statuses = tib_lgl("override_statuses"), - hidden = tib_lgl("hidden"), - space = tib_row( + tib_chr("id"), + tib_chr("name"), + tib_int("orderindex"), + tib_lgl("override_statuses"), + tib_lgl("hidden"), + tib_row( "space", - id = tib_chr("id"), - name = tib_chr("name") + tib_chr("id"), + tib_chr("name") ), - task_count = tib_chr("task_count"), - archived = tib_lgl("archived"), - statuses = tib_df( + tib_chr("task_count"), + tib_lgl("archived"), + tib_df( "statuses", - id = tib_chr("id"), - status = tib_chr("status"), - type = tib_chr("type"), - orderindex = tib_int("orderindex"), - color = tib_chr("color") + tib_chr("id"), + tib_chr("status"), + tib_chr("type"), + tib_int("orderindex"), + tib_chr("color") ), - lists = tib_df( + tib_df( "lists", - id = tib_chr("id"), - name = tib_chr("name"), - orderindex = tib_int("orderindex"), - content = tib_chr("content", required = FALSE), - status = tib_row( + tib_chr("id"), + tib_chr("name"), + tib_int("orderindex"), + tib_chr("content", required = FALSE), + tib_row( "status", - status = tib_chr("status", required = FALSE), - color = tib_chr("color", required = FALSE) + tib_chr("status", required = FALSE), + tib_chr("color", required = FALSE) ), - priority = tib_unspecified("priority"), - assignee = tib_row( + tib_unspecified("priority"), + tib_row( "assignee", - color = tib_chr("color", required = FALSE), - username = tib_chr("username", required = FALSE), - initials = tib_chr("initials", required = FALSE), - profilePicture = tib_chr("profilePicture", required = FALSE) + tib_chr("color", required = FALSE), + tib_chr("username", required = FALSE), + tib_chr("initials", required = FALSE), + tib_chr("profilePicture", required = FALSE) ), - task_count = tib_int("task_count"), - due_date = tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - start_date = tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - space = tib_row( + tib_int("task_count"), + tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_row( "space", - id = tib_chr("id"), - name = tib_chr("name"), - access = tib_lgl("access") + tib_chr("id"), + tib_chr("name"), + tib_lgl("access") ), - archived = tib_lgl("archived"), - override_statuses = tib_lgl("override_statuses"), - statuses = tib_df( + tib_lgl("archived"), + tib_lgl("override_statuses"), + tib_df( "statuses", - id = tib_chr("id"), - status = tib_chr("status"), - orderindex = tib_int("orderindex"), - color = tib_chr("color"), - type = tib_chr("type") + tib_chr("id"), + tib_chr("status"), + tib_int("orderindex"), + tib_chr("color"), + tib_chr("type") ), - permission_level = tib_chr("permission_level") + tib_chr("permission_level") ), - permission_level = tib_chr("permission_level") + tib_chr("permission_level") ) diff --git a/R/spec-lists.R b/R/spec-lists.R index 91a50a3..ae1bc90 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -1,38 +1,38 @@ spec_lists <- spec_df( - id = tib_chr("id"), - name = tib_chr("name"), - orderindex = tib_int("orderindex"), - content = tib_chr("content", required = FALSE), - status = tib_row( + tib_chr("id"), + tib_chr("name"), + tib_int("orderindex"), + tib_chr("content", required = FALSE), + tib_row( "status", - status = tib_chr("status", required = FALSE), - color = tib_chr("color", required = FALSE) + tib_chr("status", required = FALSE), + tib_chr("color", required = FALSE) ), - priority = tib_unspecified("priority"), - assignee = tib_row( + tib_unspecified("priority"), + tib_row( "assignee", - color = tib_chr("color", required = FALSE), - username = tib_chr("username", required = FALSE), - initials = tib_chr("initials", required = FALSE), - profilePicture = tib_chr("profilePicture", required = FALSE) + tib_chr("color", required = FALSE), + tib_chr("username", required = FALSE), + tib_chr("initials", required = FALSE), + tib_chr("profilePicture", required = FALSE) ), - task_count = tib_int("task_count"), - due_date = tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - start_date = tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - folder = tib_row( + tib_int("task_count"), + tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_row( "folder", - id = tib_chr("id"), - name = tib_chr("name"), - hidden = tib_lgl("hidden"), - access = tib_lgl("access") + tib_chr("id"), + tib_chr("name"), + tib_lgl("hidden"), + tib_lgl("access") ), - space = tib_row( + tib_row( "space", - id = tib_chr("id"), - name = tib_chr("name"), - access = tib_lgl("access") + tib_chr("id"), + tib_chr("name"), + tib_lgl("access") ), - archived = tib_lgl("archived"), - override_statuses = tib_lgl("override_statuses"), - permission_level = tib_chr("permission_level") + tib_lgl("archived"), + tib_lgl("override_statuses"), + tib_chr("permission_level") ) diff --git a/R/spec-members.R b/R/spec-members.R index e3041d4..af1d8f5 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -1,22 +1,22 @@ spec_members <- spec_df( - id = tib_chr("id", transform = as.character), - username = tib_chr("username"), - email = tib_chr("email"), - color = tib_chr("color"), - initials = tib_chr("initials"), - profilePicture = tib_chr("profilePicture"), - profileInfo = tib_row( + tib_chr("id", transform = as.character), + tib_chr("username"), + tib_chr("email"), + tib_chr("color"), + tib_chr("initials"), + tib_chr("profilePicture"), + tib_row( "profileInfo", - display_profile = tib_lgl("display_profile"), - verified_ambassador = tib_unspecified("verified_ambassador"), - verified_consultant = tib_unspecified("verified_consultant"), - top_tier_user = tib_unspecified("top_tier_user"), - viewed_verified_ambassador = tib_unspecified( + tib_lgl("display_profile"), + tib_unspecified("verified_ambassador"), + tib_unspecified("verified_consultant"), + tib_unspecified("top_tier_user"), + tib_unspecified( "viewed_verified_ambassador" ), - viewed_verified_consultant = tib_unspecified( + tib_unspecified( "viewed_verified_consultant" ), - viewed_top_tier_user = tib_unspecified("viewed_top_tier_user") + tib_unspecified("viewed_top_tier_user") ) ) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 03b57eb..f52d7a9 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -1,52 +1,52 @@ spec_spaces <- spec_df( - id = tib_chr("id"), - name = tib_chr("name"), - color = tib_chr("color"), - private = tib_lgl("private"), - avatar = tib_chr("avatar"), - admin_can_manage = tib_unspecified("admin_can_manage"), - statuses = tib_df( + tib_chr("id"), + tib_chr("name"), + tib_chr("color"), + tib_lgl("private"), + tib_chr("avatar"), + tib_unspecified("admin_can_manage"), + tib_df( "statuses", - id = tib_chr("id"), - status = tib_chr("status"), - type = tib_chr("type"), - orderindex = tib_int("orderindex"), - color = tib_chr("color") + tib_chr("id"), + tib_chr("status"), + tib_chr("type"), + tib_int("orderindex"), + tib_chr("color") ), - multiple_assignees = tib_lgl("multiple_assignees"), - features = tib_df( + tib_lgl("multiple_assignees"), + tib_df( "features", .names_to = ".names", - enabled = tib_lgl("enabled"), - start_date = tib_lgl("start_date", required = FALSE), - remap_due_dates = tib_lgl("remap_due_dates", required = FALSE), - remap_closed_due_date = tib_lgl("remap_closed_due_date", required = FALSE), - harvest = tib_lgl("harvest", required = FALSE), - rollup = tib_lgl("rollup", required = FALSE), - priorities = tib_df( + tib_lgl("enabled"), + tib_lgl("start_date", required = FALSE), + tib_lgl("remap_due_dates", required = FALSE), + tib_lgl("remap_closed_due_date", required = FALSE), + tib_lgl("harvest", required = FALSE), + tib_lgl("rollup", required = FALSE), + tib_df( "priorities", .required = FALSE, - id = tib_chr("id"), - priority = tib_chr("priority"), - color = tib_chr("color"), - orderindex = tib_int("orderindex", transform = as.integer) + tib_chr("id"), + tib_chr("priority"), + tib_chr("color"), + tib_int("orderindex", transform = as.integer) ), - per_assignee = tib_lgl("per_assignee", required = FALSE), - subtasks = tib_lgl("subtasks", required = FALSE), - checklists = tib_unspecified("checklists", required = FALSE), - comments = tib_unspecified("comments", required = FALSE) + tib_lgl("per_assignee", required = FALSE), + tib_lgl("subtasks", required = FALSE), + tib_unspecified("checklists", required = FALSE), + tib_unspecified("comments", required = FALSE) ), - archived = tib_lgl("archived"), - members = tib_df( + tib_lgl("archived"), + tib_df( "members", .required = FALSE, - user = tib_row( + tib_row( "user", - id = tib_chr("id", transform = as.character), - username = tib_chr("username"), - color = tib_chr("color"), - profilePicture = tib_chr("profilePicture"), - initials = tib_chr("initials") + tib_chr("id", transform = as.character), + tib_chr("username"), + tib_chr("color"), + tib_chr("profilePicture"), + tib_chr("initials") ) ) ) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 997411d..e3087dd 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -1,135 +1,135 @@ spec_tasks <- spec_df( - id = tib_chr("id"), - custom_id = tib_unspecified("custom_id"), - name = tib_chr("name"), - text_content = tib_chr("text_content"), - description = tib_chr("description"), - status = tib_row( + tib_chr("id"), + tib_unspecified("custom_id"), + tib_chr("name"), + tib_chr("text_content"), + tib_chr("description"), + tib_row( "status", - status = tib_chr("status"), - color = tib_chr("color"), - type = tib_chr("type"), - orderindex = tib_int("orderindex") + tib_chr("status"), + tib_chr("color"), + tib_chr("type"), + tib_int("orderindex") ), - orderindex = tib_int("orderindex", transform = as.integer), - date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_updated = tib_scalar("date_updated", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_closed = tib_scalar("date_closed", ptype = vctrs::new_datetime(), transform = cu_date_from), - archived = tib_lgl("archived"), - creator = tib_row( + tib_int("orderindex", transform = as.integer), + tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("date_updated", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("date_closed", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_lgl("archived"), + tib_row( "creator", - id = tib_chr("id", transform = as.character), - username = tib_chr("username"), - color = tib_chr("color"), - email = tib_chr("email"), - profilePicture = tib_chr("profilePicture") + tib_chr("id", transform = as.character), + tib_chr("username"), + tib_chr("color"), + tib_chr("email"), + tib_chr("profilePicture") ), - assignees = tib_df( + tib_df( "assignees", - id = tib_chr("id", transform = as.character), - username = tib_chr("username"), - color = tib_chr("color"), - initials = tib_chr("initials"), - email = tib_chr("email"), - profilePicture = tib_chr("profilePicture") + tib_chr("id", transform = as.character), + tib_chr("username"), + tib_chr("color"), + tib_chr("initials"), + tib_chr("email"), + tib_chr("profilePicture") ), - watchers = tib_unspecified("watchers"), - checklists = tib_df( + tib_unspecified("watchers"), + tib_df( "checklists", - id = tib_chr("id"), - task_id = tib_chr("task_id"), - name = tib_chr("name"), - date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - orderindex = tib_int("orderindex"), - creator = tib_int("creator"), - resolved = tib_int("resolved"), - unresolved = tib_int("unresolved"), - items = tib_df( + tib_chr("id"), + tib_chr("task_id"), + tib_chr("name"), + tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_int("orderindex"), + tib_int("creator"), + tib_int("resolved"), + tib_int("unresolved"), + tib_df( "items", - id = tib_chr("id"), - name = tib_chr("name"), - orderindex = tib_dbl("orderindex"), - assignee = tib_row( + tib_chr("id"), + tib_chr("name"), + tib_dbl("orderindex"), + tib_row( "assignee", - id = tib_int("id", required = FALSE), - username = tib_chr("username", required = FALSE), - email = tib_chr("email", required = FALSE), - color = tib_chr("color", required = FALSE), - initials = tib_chr("initials", required = FALSE), - profilePicture = tib_chr("profilePicture", required = FALSE) + tib_int("id", required = FALSE), + tib_chr("username", required = FALSE), + tib_chr("email", required = FALSE), + tib_chr("color", required = FALSE), + tib_chr("initials", required = FALSE), + tib_chr("profilePicture", required = FALSE) ), - group_assignee = tib_unspecified("group_assignee"), - resolved = tib_lgl("resolved"), - parent = tib_unspecified("parent"), - date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - children = tib_unspecified("children") + tib_unspecified("group_assignee"), + tib_lgl("resolved"), + tib_unspecified("parent"), + tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_unspecified("children") ) ), - tags = tib_df( + tib_df( "tags", - name = tib_chr("name"), - tag_fg = tib_chr("tag_fg"), - tag_bg = tib_chr("tag_bg"), - creator = tib_int("creator") + tib_chr("name"), + tib_chr("tag_fg"), + tib_chr("tag_bg"), + tib_int("creator") ), - parent = tib_chr("parent"), - priority = tib_row( + tib_chr("parent"), + tib_row( "priority", - id = tib_chr("id", required = FALSE), - priority = tib_chr("priority", required = FALSE), - color = tib_chr("color", required = FALSE), - orderindex = tib_chr("orderindex", required = FALSE) + tib_chr("id", required = FALSE), + tib_chr("priority", required = FALSE), + tib_chr("color", required = FALSE), + tib_chr("orderindex", required = FALSE) ), - due_date = tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - start_date = tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - points = tib_int("points"), - time_estimate = tib_int("time_estimate"), - custom_fields = tib_df( + tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_int("points"), + tib_int("time_estimate"), + tib_df( "custom_fields", - id = tib_chr("id"), - name = tib_chr("name"), - type = tib_chr("type"), - type_config = tib_variant("type_config"), - date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - hide_from_guests = tib_lgl("hide_from_guests"), - required = tib_lgl("required"), - value = tib_variant("value", required = FALSE) + tib_chr("id"), + tib_chr("name"), + tib_chr("type"), + tib_variant("type_config"), + tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_lgl("hide_from_guests"), + tib_lgl("required"), + tib_variant("value", required = FALSE) ), - dependencies = tib_df( + tib_df( "dependencies", - task_id = tib_chr("task_id"), - depends_on = tib_chr("depends_on"), - type = tib_int("type"), - date_created = tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - userid = tib_chr("userid") + tib_chr("task_id"), + tib_chr("depends_on"), + tib_int("type"), + tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_chr("userid") ), - linked_tasks = tib_unspecified("linked_tasks"), - team_id = tib_chr("team_id"), - url = tib_chr("url"), - permission_level = tib_chr("permission_level"), - list = tib_row( + tib_unspecified("linked_tasks"), + tib_chr("team_id"), + tib_chr("url"), + tib_chr("permission_level"), + tib_row( "list", - id = tib_chr("id"), - name = tib_chr("name"), - access = tib_lgl("access") + tib_chr("id"), + tib_chr("name"), + tib_lgl("access") ), - project = tib_row( + tib_row( "project", - id = tib_chr("id"), - name = tib_chr("name"), - hidden = tib_lgl("hidden"), - access = tib_lgl("access") + tib_chr("id"), + tib_chr("name"), + tib_lgl("hidden"), + tib_lgl("access") ), - folder = tib_row( + tib_row( "folder", - id = tib_chr("id"), - name = tib_chr("name"), - hidden = tib_lgl("hidden"), - access = tib_lgl("access") + tib_chr("id"), + tib_chr("name"), + tib_lgl("hidden"), + tib_lgl("access") ), - space = tib_row( + tib_row( "space", - id = tib_chr("id") + tib_chr("id") ), - time_spent = tib_int("time_spent", required = FALSE) + tib_int("time_spent", required = FALSE) ) diff --git a/R/spec-teams.R b/R/spec-teams.R index a6bd207..208af97 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -1,38 +1,38 @@ spec_teams <- spec_df( - id = tib_chr("id"), - name = tib_chr("name"), - color = tib_chr("color"), - avatar = tib_chr("avatar"), - members = tib_df( + tib_chr("id"), + tib_chr("name"), + tib_chr("color"), + tib_chr("avatar"), + tib_df( "members", - user = tib_row( + tib_row( "user", - id = tib_chr("id", transform = as.character), - username = tib_chr("username"), - email = tib_chr("email"), - color = tib_chr("color"), - profilePicture = tib_chr("profilePicture"), - initials = tib_chr("initials"), - role = tib_int("role"), - custom_role = tib_unspecified("custom_role"), - last_active = tib_scalar("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_joined = tib_scalar("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), - date_invited = tib_scalar("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from) + tib_chr("id", transform = as.character), + tib_chr("username"), + tib_chr("email"), + tib_chr("color"), + tib_chr("profilePicture"), + tib_chr("initials"), + tib_int("role"), + tib_unspecified("custom_role"), + tib_scalar("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_scalar("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from) ), - invited_by = tib_row( + tib_row( "invited_by", .required = FALSE, - id = tib_int("id", required = FALSE), - username = tib_chr("username", required = FALSE), - color = tib_chr("color", required = FALSE), - email = tib_chr("email", required = FALSE), - initials = tib_chr("initials", required = FALSE), - profilePicture = tib_chr("profilePicture", required = FALSE) + tib_int("id", required = FALSE), + tib_chr("username", required = FALSE), + tib_chr("color", required = FALSE), + tib_chr("email", required = FALSE), + tib_chr("initials", required = FALSE), + tib_chr("profilePicture", required = FALSE) ), - can_see_time_spent = tib_lgl("can_see_time_spent", required = FALSE), - can_see_time_estimated = tib_lgl("can_see_time_estimated", required = FALSE), - can_see_points_estimated = tib_lgl("can_see_points_estimated", required = FALSE), - can_edit_tags = tib_lgl("can_edit_tags", required = FALSE), - can_create_views = tib_lgl("can_create_views", required = FALSE) + tib_lgl("can_see_time_spent", required = FALSE), + tib_lgl("can_see_time_estimated", required = FALSE), + tib_lgl("can_see_points_estimated", required = FALSE), + tib_lgl("can_edit_tags", required = FALSE), + tib_lgl("can_create_views", required = FALSE) ) ) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 791de6c..7f4ab34 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -1,50 +1,50 @@ spec_time_entries <- spec_df( - id = tib_chr("id"), - wid = tib_chr("wid"), - user = tib_row( + tib_chr("id"), + tib_chr("wid"), + tib_row( "user", - id = tib_chr("id", transform = as.character), - username = tib_chr("username"), - email = tib_chr("email"), - color = tib_chr("color"), - initials = tib_chr("initials"), - profilePicture = tib_chr("profilePicture") + tib_chr("id", transform = as.character), + tib_chr("username"), + tib_chr("email"), + tib_chr("color"), + tib_chr("initials"), + tib_chr("profilePicture") ), - billable = tib_lgl("billable"), - start = tib_scalar("start", ptype = vctrs::new_datetime(), transform = cu_date_from), - description = tib_chr("description"), - tags = tib_df( + tib_lgl("billable"), + tib_scalar("start", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_chr("description"), + tib_df( "tags", - name = tib_chr("name"), - tag_bg = tib_chr("tag_bg"), - tag_fg = tib_chr("tag_fg"), - creator = tib_int("creator") + tib_chr("name"), + tib_chr("tag_bg"), + tib_chr("tag_fg"), + tib_int("creator") ), - source = tib_chr("source"), - at = tib_scalar("at", ptype = vctrs::new_datetime(), transform = cu_date_from), - task_location = tib_row( + tib_chr("source"), + tib_scalar("at", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_row( "task_location", .required = FALSE, - list_id = tib_chr("list_id", required = FALSE), - folder_id = tib_chr("folder_id", required = FALSE), - space_id = tib_chr("space_id", required = FALSE) + tib_chr("list_id", required = FALSE), + tib_chr("folder_id", required = FALSE), + tib_chr("space_id", required = FALSE) ), - task_url = tib_chr("task_url", required = FALSE), - task = tib_row( + tib_chr("task_url", required = FALSE), + tib_row( "task", .required = FALSE, - id = tib_chr("id", required = FALSE), - name = tib_chr("name", required = FALSE), - status = tib_row( + tib_chr("id", required = FALSE), + tib_chr("name", required = FALSE), + tib_row( "status", .required = FALSE, - status = tib_chr("status"), - color = tib_chr("color"), - type = tib_chr("type"), - orderindex = tib_int("orderindex") + tib_chr("status"), + tib_chr("color"), + tib_chr("type"), + tib_int("orderindex") ), - custom_type = tib_int("custom_type", required = FALSE) + tib_int("custom_type", required = FALSE) ), - end = tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), - duration = tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), + tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), + tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), ) From fa2b2d39fb5371d5295b9dae19f4330d85e7f8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:53:29 +0200 Subject: [PATCH 076/137] Teams --- R/spec-teams.R | 10 +++++----- R/tibblify.R | 2 ++ script/tibblify-01-teams.R | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/R/spec-teams.R b/R/spec-teams.R index 208af97..b2ba49c 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -14,10 +14,10 @@ spec_teams <- spec_df( tib_chr("profilePicture"), tib_chr("initials"), tib_int("role"), - tib_unspecified("custom_role"), + # tib_unspecified("custom_role"), tib_scalar("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), tib_scalar("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from) + tib_scalar("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from), ), tib_row( "invited_by", @@ -27,12 +27,12 @@ spec_teams <- spec_df( tib_chr("color", required = FALSE), tib_chr("email", required = FALSE), tib_chr("initials", required = FALSE), - tib_chr("profilePicture", required = FALSE) + tib_chr("profilePicture", required = FALSE), ), tib_lgl("can_see_time_spent", required = FALSE), tib_lgl("can_see_time_estimated", required = FALSE), tib_lgl("can_see_points_estimated", required = FALSE), tib_lgl("can_edit_tags", required = FALSE), - tib_lgl("can_create_views", required = FALSE) - ) + tib_lgl("can_create_views", required = FALSE), + ), ) diff --git a/R/tibblify.R b/R/tibblify.R index 1d1f5e8..22a1ad8 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -16,6 +16,8 @@ write_spec <- function(x) { out <- paste0("spec_", base_name, " <- ", out) out <- gsub(" ", " ", out, fixed = TRUE) + out <- gsub('tib_unspecified(', '# tib_unspecified(', out, fixed = TRUE) + out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character)', out, fixed = TRUE) out <- gsub('tib_int("id", default = NA_integer_', 'tib_chr("id", transform = as.character, default = NA_character_', out, fixed = TRUE) diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R index 55844cb..a48b7da 100644 --- a/script/tibblify-01-teams.R +++ b/script/tibblify-01-teams.R @@ -8,7 +8,7 @@ teams # Needs https://github.com/mgirlich/tibblify/pull/50 spec_teams <- spec_guess(teams$teams) -df_teams <- tibblify(teams$teams, spec = spec_teams) +df_teams <- tibblify(teams$teams, spec = spec_teams, unspecified = "inform") df_teams df_teams From e245537848f5d17b5fe461eda490858eb04ba605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:54:15 +0200 Subject: [PATCH 077/137] Spaces --- R/spec-spaces.R | 16 ++++++++-------- script/tibblify-02-spaces.R | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index f52d7a9..565ce4c 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -4,14 +4,14 @@ spec_spaces <- spec_df( tib_chr("color"), tib_lgl("private"), tib_chr("avatar"), - tib_unspecified("admin_can_manage"), + # tib_unspecified("admin_can_manage"), tib_df( "statuses", tib_chr("id"), tib_chr("status"), tib_chr("type"), tib_int("orderindex"), - tib_chr("color") + tib_chr("color"), ), tib_lgl("multiple_assignees"), tib_df( @@ -29,12 +29,12 @@ spec_spaces <- spec_df( tib_chr("id"), tib_chr("priority"), tib_chr("color"), - tib_int("orderindex", transform = as.integer) + tib_int("orderindex", transform = as.integer), ), tib_lgl("per_assignee", required = FALSE), tib_lgl("subtasks", required = FALSE), - tib_unspecified("checklists", required = FALSE), - tib_unspecified("comments", required = FALSE) + # tib_unspecified("checklists", required = FALSE), + # tib_unspecified("comments", required = FALSE), ), tib_lgl("archived"), tib_df( @@ -46,7 +46,7 @@ spec_spaces <- spec_df( tib_chr("username"), tib_chr("color"), tib_chr("profilePicture"), - tib_chr("initials") - ) - ) + tib_chr("initials"), + ), + ), ) diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R index 8c437f5..be3913f 100644 --- a/script/tibblify-02-spaces.R +++ b/script/tibblify-02-spaces.R @@ -9,6 +9,6 @@ spaces spec_spaces <- spec_guess(spaces$spaces) spaces$spaces %>% - tibblify(spec = spec_spaces) + tibblify(spec = spec_spaces, unspecified = "inform") write_spec(spec_spaces) From 9caa5dd600f193661036178576b00a7186474418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:54:39 +0200 Subject: [PATCH 078/137] Folders --- R/spec-folders.R | 18 +++++++++--------- script/tibblify-03-folders.R | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index 54f4ae4..30f60a9 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -7,7 +7,7 @@ spec_folders <- spec_df( tib_row( "space", tib_chr("id"), - tib_chr("name") + tib_chr("name"), ), tib_chr("task_count"), tib_lgl("archived"), @@ -17,7 +17,7 @@ spec_folders <- spec_df( tib_chr("status"), tib_chr("type"), tib_int("orderindex"), - tib_chr("color") + tib_chr("color"), ), tib_df( "lists", @@ -28,15 +28,15 @@ spec_folders <- spec_df( tib_row( "status", tib_chr("status", required = FALSE), - tib_chr("color", required = FALSE) + tib_chr("color", required = FALSE), ), - tib_unspecified("priority"), + # tib_unspecified("priority"), tib_row( "assignee", tib_chr("color", required = FALSE), tib_chr("username", required = FALSE), tib_chr("initials", required = FALSE), - tib_chr("profilePicture", required = FALSE) + tib_chr("profilePicture", required = FALSE), ), tib_int("task_count"), tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), @@ -45,7 +45,7 @@ spec_folders <- spec_df( "space", tib_chr("id"), tib_chr("name"), - tib_lgl("access") + tib_lgl("access"), ), tib_lgl("archived"), tib_lgl("override_statuses"), @@ -55,9 +55,9 @@ spec_folders <- spec_df( tib_chr("status"), tib_int("orderindex"), tib_chr("color"), - tib_chr("type") + tib_chr("type"), ), - tib_chr("permission_level") + tib_chr("permission_level"), ), - tib_chr("permission_level") + tib_chr("permission_level"), ) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index 0a380da..8d88cca 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -14,7 +14,7 @@ folders spec_folders <- spec_guess(folders) -df_folders <- tibblify::tibblify(folders, spec = spec_folders) +df_folders <- tibblify::tibblify(folders, spec = spec_folders, unspecified = "inform") df_folders write_spec(spec_folders) From 499b642284e8778a596b40e8691b7d4f210ddaa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 16:55:40 +0200 Subject: [PATCH 079/137] Lists --- R/spec-lists.R | 12 ++++++------ script/tibblify-04-lists.R | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/spec-lists.R b/R/spec-lists.R index ae1bc90..8e4033a 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -6,15 +6,15 @@ spec_lists <- spec_df( tib_row( "status", tib_chr("status", required = FALSE), - tib_chr("color", required = FALSE) + tib_chr("color", required = FALSE), ), - tib_unspecified("priority"), + # tib_unspecified("priority"), tib_row( "assignee", tib_chr("color", required = FALSE), tib_chr("username", required = FALSE), tib_chr("initials", required = FALSE), - tib_chr("profilePicture", required = FALSE) + tib_chr("profilePicture", required = FALSE), ), tib_int("task_count"), tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), @@ -24,15 +24,15 @@ spec_lists <- spec_df( tib_chr("id"), tib_chr("name"), tib_lgl("hidden"), - tib_lgl("access") + tib_lgl("access"), ), tib_row( "space", tib_chr("id"), tib_chr("name"), - tib_lgl("access") + tib_lgl("access"), ), tib_lgl("archived"), tib_lgl("override_statuses"), - tib_chr("permission_level") + tib_chr("permission_level"), ) diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index 41001ac..9085f0a 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -16,7 +16,7 @@ lists <- spec_lists <- spec_guess(lists) -df_lists <- tibblify::tibblify(lists, spec = spec_lists) +df_lists <- tibblify::tibblify(lists, spec = spec_lists, unspecified = "inform") df_lists write_spec(spec_lists) From 3c3595963a201109947e1c88bebe6e723c51377a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 17:00:00 +0200 Subject: [PATCH 080/137] Tasks --- R/spec-tasks.R | 41 +++++++++++++++++++------------------- script/tibblify-05-tasks.R | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index e3087dd..053631d 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -1,6 +1,6 @@ spec_tasks <- spec_df( tib_chr("id"), - tib_unspecified("custom_id"), + # tib_unspecified("custom_id"), tib_chr("name"), tib_chr("text_content"), tib_chr("description"), @@ -9,7 +9,7 @@ spec_tasks <- spec_df( tib_chr("status"), tib_chr("color"), tib_chr("type"), - tib_int("orderindex") + tib_int("orderindex"), ), tib_int("orderindex", transform = as.integer), tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), @@ -22,7 +22,7 @@ spec_tasks <- spec_df( tib_chr("username"), tib_chr("color"), tib_chr("email"), - tib_chr("profilePicture") + tib_chr("profilePicture"), ), tib_df( "assignees", @@ -31,9 +31,9 @@ spec_tasks <- spec_df( tib_chr("color"), tib_chr("initials"), tib_chr("email"), - tib_chr("profilePicture") + tib_chr("profilePicture"), ), - tib_unspecified("watchers"), + # tib_unspecified("watchers"), tib_df( "checklists", tib_chr("id"), @@ -56,21 +56,21 @@ spec_tasks <- spec_df( tib_chr("email", required = FALSE), tib_chr("color", required = FALSE), tib_chr("initials", required = FALSE), - tib_chr("profilePicture", required = FALSE) + tib_chr("profilePicture", required = FALSE), ), - tib_unspecified("group_assignee"), + # tib_unspecified("group_assignee"), tib_lgl("resolved"), - tib_unspecified("parent"), + # tib_unspecified("parent"), tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_unspecified("children") - ) + # tib_unspecified("children"), + ), ), tib_df( "tags", tib_chr("name"), tib_chr("tag_fg"), tib_chr("tag_bg"), - tib_int("creator") + tib_int("creator"), ), tib_chr("parent"), tib_row( @@ -78,12 +78,13 @@ spec_tasks <- spec_df( tib_chr("id", required = FALSE), tib_chr("priority", required = FALSE), tib_chr("color", required = FALSE), - tib_chr("orderindex", required = FALSE) + tib_chr("orderindex", required = FALSE), ), tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), tib_int("points"), tib_int("time_estimate"), + tib_int("time_spent", required = FALSE), tib_df( "custom_fields", tib_chr("id"), @@ -93,7 +94,7 @@ spec_tasks <- spec_df( tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), tib_lgl("hide_from_guests"), tib_lgl("required"), - tib_variant("value", required = FALSE) + tib_variant("value", required = FALSE), ), tib_df( "dependencies", @@ -101,9 +102,10 @@ spec_tasks <- spec_df( tib_chr("depends_on"), tib_int("type"), tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_chr("userid") + tib_chr("userid"), + # tib_unspecified("workspace_id"), ), - tib_unspecified("linked_tasks"), + # tib_unspecified("linked_tasks"), tib_chr("team_id"), tib_chr("url"), tib_chr("permission_level"), @@ -111,25 +113,24 @@ spec_tasks <- spec_df( "list", tib_chr("id"), tib_chr("name"), - tib_lgl("access") + tib_lgl("access"), ), tib_row( "project", tib_chr("id"), tib_chr("name"), tib_lgl("hidden"), - tib_lgl("access") + tib_lgl("access"), ), tib_row( "folder", tib_chr("id"), tib_chr("name"), tib_lgl("hidden"), - tib_lgl("access") + tib_lgl("access"), ), tib_row( "space", - tib_chr("id") + tib_chr("id"), ), - tib_int("time_spent", required = FALSE) ) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 554d1d1..5419e94 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -25,7 +25,7 @@ spec_tasks <- spec_guess(c(tasks, tasks_team$tasks)) # Error in tibblify_impl(x, spec) : # SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL' -df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks), spec = spec_tasks) +df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks), spec = spec_tasks, unspecified = "inform") df_tasks write_spec(spec_tasks) From d5518e5d0048ed387ee69f6407122f9c8010cd9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 17:01:32 +0200 Subject: [PATCH 081/137] Time entries --- R/spec-time_entries.R | 10 +++++----- R/tibblify.R | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 7f4ab34..3e59c56 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -8,7 +8,7 @@ spec_time_entries <- spec_df( tib_chr("email"), tib_chr("color"), tib_chr("initials"), - tib_chr("profilePicture") + tib_chr("profilePicture"), ), tib_lgl("billable"), tib_scalar("start", ptype = vctrs::new_datetime(), transform = cu_date_from), @@ -18,7 +18,7 @@ spec_time_entries <- spec_df( tib_chr("name"), tib_chr("tag_bg"), tib_chr("tag_fg"), - tib_int("creator") + tib_int("creator"), ), tib_chr("source"), tib_scalar("at", ptype = vctrs::new_datetime(), transform = cu_date_from), @@ -27,7 +27,7 @@ spec_time_entries <- spec_df( .required = FALSE, tib_chr("list_id", required = FALSE), tib_chr("folder_id", required = FALSE), - tib_chr("space_id", required = FALSE) + tib_chr("space_id", required = FALSE), ), tib_chr("task_url", required = FALSE), tib_row( @@ -41,9 +41,9 @@ spec_time_entries <- spec_df( tib_chr("status"), tib_chr("color"), tib_chr("type"), - tib_int("orderindex") + tib_int("orderindex"), ), - tib_int("custom_type", required = FALSE) + tib_int("custom_type", required = FALSE), ), tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), diff --git a/R/tibblify.R b/R/tibblify.R index 22a1ad8..5e8239a 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -27,7 +27,7 @@ write_spec <- function(x) { out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) - out <- gsub('tib_chr("duration", required = FALSE)', 'tib_scalar("duration", required = FALSE, hms::new_hms(), default = dttr2::NA_hms_, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + out <- gsub('tib_chr("duration", required = FALSE)', 'tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From 34414d711ce5d755bd40e1935bf6896ad5b3dab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 17:04:08 +0200 Subject: [PATCH 082/137] Members --- R/spec-members.R | 18 +++++++----------- script/tibblify-07-members.R | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/R/spec-members.R b/R/spec-members.R index af1d8f5..c89d77f 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -8,15 +8,11 @@ spec_members <- spec_df( tib_row( "profileInfo", tib_lgl("display_profile"), - tib_unspecified("verified_ambassador"), - tib_unspecified("verified_consultant"), - tib_unspecified("top_tier_user"), - tib_unspecified( - "viewed_verified_ambassador" - ), - tib_unspecified( - "viewed_verified_consultant" - ), - tib_unspecified("viewed_top_tier_user") - ) + # tib_unspecified("verified_ambassador"), + # tib_unspecified("verified_consultant"), + # tib_unspecified("top_tier_user"), + # tib_unspecified("viewed_verified_ambassador"), + # tib_unspecified("viewed_verified_consultant"), + # tib_unspecified("viewed_top_tier_user"), + ), ) diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R index f25643b..523793c 100644 --- a/script/tibblify-07-members.R +++ b/script/tibblify-07-members.R @@ -15,7 +15,7 @@ members <- cu_get_list_members(df_lists$id[[1]]) spec_members <- spec_guess(members$members) -df_members <- tibblify::tibblify(members$members, spec_members) +df_members <- tibblify::tibblify(members$members, spec_members, unspecified = "inform") df_members write_spec(spec_members) From e631a1b335426a1b24fdae2ead9b87ccbd189629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 2 Jul 2022 17:04:29 +0200 Subject: [PATCH 083/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 73bc642..b1863a4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9006 +Version: 0.0.5.9007 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 0cf171379b85f600fc9440369f498f18e10a027f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 14:34:13 +0200 Subject: [PATCH 084/137] Up e-mail --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index b1863a4..c5ac4eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,7 +12,7 @@ Authors@R: person(given = "Kirill", family = "M\u00fcller", role = "aut", - email = "krlmlr+r@mailbox.org")) + email = "kirill@cynkra.com")) Maintainer: Peter Solymos Description: Work with the ClickUp productivity app from R to manage tasks, goals, time tracking, and more. From 34848f3214bc215598b547ab250c72093eeff105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 14:34:34 +0200 Subject: [PATCH 085/137] Bump tibblify version --- DESCRIPTION | 2 +- R/spec-folders.R | 2 +- R/spec-lists.R | 2 +- R/spec-members.R | 2 +- R/spec-spaces.R | 2 +- R/spec-tasks.R | 2 +- R/spec-teams.R | 2 +- R/spec-time_entries.R | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c5ac4eb..198cf98 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,7 @@ Imports: jsonlite, rlang, tibble, - tibblify (>= 0.1.0.9000) + tibblify (>= 0.3.0) Suggests: fansi, knitr, diff --git a/R/spec-folders.R b/R/spec-folders.R index 30f60a9..30632c8 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -1,4 +1,4 @@ -spec_folders <- spec_df( +spec_folders <- tspec_df( tib_chr("id"), tib_chr("name"), tib_int("orderindex"), diff --git a/R/spec-lists.R b/R/spec-lists.R index 8e4033a..67c503c 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -1,4 +1,4 @@ -spec_lists <- spec_df( +spec_lists <- tspec_df( tib_chr("id"), tib_chr("name"), tib_int("orderindex"), diff --git a/R/spec-members.R b/R/spec-members.R index c89d77f..2d231a8 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -1,4 +1,4 @@ -spec_members <- spec_df( +spec_members <- tspec_df( tib_chr("id", transform = as.character), tib_chr("username"), tib_chr("email"), diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 565ce4c..01d0b5e 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -1,4 +1,4 @@ -spec_spaces <- spec_df( +spec_spaces <- tspec_df( tib_chr("id"), tib_chr("name"), tib_chr("color"), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 053631d..638d593 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -1,4 +1,4 @@ -spec_tasks <- spec_df( +spec_tasks <- tspec_df( tib_chr("id"), # tib_unspecified("custom_id"), tib_chr("name"), diff --git a/R/spec-teams.R b/R/spec-teams.R index b2ba49c..5da6818 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -1,4 +1,4 @@ -spec_teams <- spec_df( +spec_teams <- tspec_df( tib_chr("id"), tib_chr("name"), tib_chr("color"), diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 3e59c56..245ae43 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -1,4 +1,4 @@ -spec_time_entries <- spec_df( +spec_time_entries <- tspec_df( tib_chr("id"), tib_chr("wid"), tib_row( From d2535ae2ae7da14efb7d833eb42beed3c36e79dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 14:35:13 +0200 Subject: [PATCH 086/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 198cf98..1f4ce07 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9007 +Version: 0.0.5.9008 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From db924b0a28931e7854a057de22ef663eb3b1d525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:03:26 +0200 Subject: [PATCH 087/137] tib_custom() --- R/aaa.R | 14 ++++++++++++++ R/spec-folders.R | 4 ++-- R/spec-lists.R | 4 ++-- R/spec-tasks.R | 18 +++++++++--------- R/spec-teams.R | 6 +++--- R/spec-time_entries.R | 8 ++++---- R/tibblify.R | 6 +++--- 7 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 R/aaa.R diff --git a/R/aaa.R b/R/aaa.R new file mode 100644 index 0000000..ce431b9 --- /dev/null +++ b/R/aaa.R @@ -0,0 +1,14 @@ +tib_custom <- function(key, transform, required = TRUE) { + # https://github.com/mgirlich/tibblify/issues/183 + + transform <- rlang::as_function(transform) + ptype <- transform(character()) + + tib_scalar( + key, + ptype, + ptype_inner = character(), + transform = transform, + required = required + ) +} diff --git a/R/spec-folders.R b/R/spec-folders.R index 30632c8..2844a15 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -39,8 +39,8 @@ spec_folders <- tspec_df( tib_chr("profilePicture", required = FALSE), ), tib_int("task_count"), - tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("due_date", cu_date_from), + tib_custom("start_date", cu_date_from), tib_row( "space", tib_chr("id"), diff --git a/R/spec-lists.R b/R/spec-lists.R index 67c503c..f4af6b4 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -17,8 +17,8 @@ spec_lists <- tspec_df( tib_chr("profilePicture", required = FALSE), ), tib_int("task_count"), - tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("due_date", cu_date_from), + tib_custom("start_date", cu_date_from), tib_row( "folder", tib_chr("id"), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 638d593..1a96e3e 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -12,9 +12,9 @@ spec_tasks <- tspec_df( tib_int("orderindex"), ), tib_int("orderindex", transform = as.integer), - tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("date_updated", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("date_closed", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("date_created", cu_date_from), + tib_custom("date_updated", cu_date_from), + tib_custom("date_closed", cu_date_from), tib_lgl("archived"), tib_row( "creator", @@ -39,7 +39,7 @@ spec_tasks <- tspec_df( tib_chr("id"), tib_chr("task_id"), tib_chr("name"), - tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("date_created", cu_date_from), tib_int("orderindex"), tib_int("creator"), tib_int("resolved"), @@ -61,7 +61,7 @@ spec_tasks <- tspec_df( # tib_unspecified("group_assignee"), tib_lgl("resolved"), # tib_unspecified("parent"), - tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("date_created", cu_date_from), # tib_unspecified("children"), ), ), @@ -80,8 +80,8 @@ spec_tasks <- tspec_df( tib_chr("color", required = FALSE), tib_chr("orderindex", required = FALSE), ), - tib_scalar("due_date", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("start_date", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("due_date", cu_date_from), + tib_custom("start_date", cu_date_from), tib_int("points"), tib_int("time_estimate"), tib_int("time_spent", required = FALSE), @@ -91,7 +91,7 @@ spec_tasks <- tspec_df( tib_chr("name"), tib_chr("type"), tib_variant("type_config"), - tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("date_created", cu_date_from), tib_lgl("hide_from_guests"), tib_lgl("required"), tib_variant("value", required = FALSE), @@ -101,7 +101,7 @@ spec_tasks <- tspec_df( tib_chr("task_id"), tib_chr("depends_on"), tib_int("type"), - tib_scalar("date_created", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("date_created", cu_date_from), tib_chr("userid"), # tib_unspecified("workspace_id"), ), diff --git a/R/spec-teams.R b/R/spec-teams.R index 5da6818..65987c6 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -15,9 +15,9 @@ spec_teams <- tspec_df( tib_chr("initials"), tib_int("role"), # tib_unspecified("custom_role"), - tib_scalar("last_active", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("date_joined", ptype = vctrs::new_datetime(), transform = cu_date_from), - tib_scalar("date_invited", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("last_active", cu_date_from), + tib_custom("date_joined", cu_date_from), + tib_custom("date_invited", cu_date_from), ), tib_row( "invited_by", diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 245ae43..49f9993 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -11,7 +11,7 @@ spec_time_entries <- tspec_df( tib_chr("profilePicture"), ), tib_lgl("billable"), - tib_scalar("start", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("start", cu_date_from), tib_chr("description"), tib_df( "tags", @@ -21,7 +21,7 @@ spec_time_entries <- tspec_df( tib_int("creator"), ), tib_chr("source"), - tib_scalar("at", ptype = vctrs::new_datetime(), transform = cu_date_from), + tib_custom("at", cu_date_from), tib_row( "task_location", .required = FALSE, @@ -45,6 +45,6 @@ spec_time_entries <- tspec_df( ), tib_int("custom_type", required = FALSE), ), - tib_scalar("end", ptype = vctrs::new_datetime(), transform = cu_date_from, required = FALSE), - tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), + tib_custom("end", cu_date_from, required = FALSE), + tib_custom("duration", required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), ) diff --git a/R/tibblify.R b/R/tibblify.R index 5e8239a..908b609 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -24,10 +24,10 @@ write_spec <- function(x) { out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer)', out, fixed = TRUE) date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" - out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from, default = dttr2::NA_POSIXct_', out) - out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_scalar("\\1", ptype = vctrs::new_datetime(), transform = cu_date_from', out) + out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_custom("\\1", transform = cu_date_from, default = dttr2::NA_POSIXct_', out) + out <- gsub(paste0('tib_chr[(]"(', date_cols, ')"'), 'tib_custom("\\1", cu_date_from', out) - out <- gsub('tib_chr("duration", required = FALSE)', 'tib_scalar("duration", hms::new_hms(), required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) + out <- gsub('tib_chr("duration", required = FALSE)', 'tib_custom("duration", required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000))', out, fixed = TRUE) # Dogfood first eval(parse(text = out)) From 9bcbf4eddfae1ee7f38db81729a8b29244add4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:14:39 +0200 Subject: [PATCH 088/137] ptype_inner --- R/spec-teams.R | 2 +- R/tibblify.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/spec-teams.R b/R/spec-teams.R index 65987c6..002ec52 100644 --- a/R/spec-teams.R +++ b/R/spec-teams.R @@ -7,7 +7,7 @@ spec_teams <- tspec_df( "members", tib_row( "user", - tib_chr("id", transform = as.character), + tib_chr("id", transform = as.character, ptype_inner = integer()), tib_chr("username"), tib_chr("email"), tib_chr("color"), diff --git a/R/tibblify.R b/R/tibblify.R index 908b609..62968b6 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -18,7 +18,7 @@ write_spec <- function(x) { out <- gsub('tib_unspecified(', '# tib_unspecified(', out, fixed = TRUE) - out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character)', out, fixed = TRUE) + out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character, ptype_inner = integer())', out, fixed = TRUE) out <- gsub('tib_int("id", default = NA_integer_', 'tib_chr("id", transform = as.character, default = NA_character_', out, fixed = TRUE) out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer)', out, fixed = TRUE) From 41f32f2f948c1ade4805c05e0e4f3dd1dcfd0d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:16:41 +0200 Subject: [PATCH 089/137] teams --- script/tibblify-01-teams.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R index a48b7da..6996b26 100644 --- a/script/tibblify-01-teams.R +++ b/script/tibblify-01-teams.R @@ -6,12 +6,14 @@ teams <- cu_get_teams() teams # Needs https://github.com/mgirlich/tibblify/pull/50 -spec_teams <- spec_guess(teams$teams) +spec_teams <- tibblify::guess_tspec(teams$teams) +write_spec(spec_teams) +rm(spec_teams) + +pkgload::load_all() df_teams <- tibblify(teams$teams, spec = spec_teams, unspecified = "inform") df_teams df_teams df_teams$members - -write_spec(spec_teams) From ba50983f23c88eca221f1985bd3f83a21f2e7904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:18:35 +0200 Subject: [PATCH 090/137] spaces --- R/spec-spaces.R | 6 +++--- R/tibblify.R | 2 +- script/tibblify-02-spaces.R | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 01d0b5e..b473930 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -26,10 +26,10 @@ spec_spaces <- tspec_df( tib_df( "priorities", .required = FALSE, + tib_chr("color"), tib_chr("id"), + tib_int("orderindex", transform = as.integer, ptype_inner = character()), tib_chr("priority"), - tib_chr("color"), - tib_int("orderindex", transform = as.integer), ), tib_lgl("per_assignee", required = FALSE), tib_lgl("subtasks", required = FALSE), @@ -42,7 +42,7 @@ spec_spaces <- tspec_df( .required = FALSE, tib_row( "user", - tib_chr("id", transform = as.character), + tib_chr("id", transform = as.character, ptype_inner = integer()), tib_chr("username"), tib_chr("color"), tib_chr("profilePicture"), diff --git a/R/tibblify.R b/R/tibblify.R index 62968b6..fa2a013 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,7 @@ write_spec <- function(x) { out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character, ptype_inner = integer())', out, fixed = TRUE) out <- gsub('tib_int("id", default = NA_integer_', 'tib_chr("id", transform = as.character, default = NA_character_', out, fixed = TRUE) - out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer)', out, fixed = TRUE) + out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer, ptype_inner = character())', out, fixed = TRUE) date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_custom("\\1", transform = cu_date_from, default = dttr2::NA_POSIXct_', out) diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R index be3913f..48de876 100644 --- a/script/tibblify-02-spaces.R +++ b/script/tibblify-02-spaces.R @@ -6,9 +6,12 @@ df_teams <- cuf_get_teams() spaces <- cu_get_spaces(df_teams$id[[1]]) spaces -spec_spaces <- spec_guess(spaces$spaces) +spec_spaces <- guess_tspec(spaces$spaces) +write_spec(spec_spaces) +rm(spec_spaces) + +pkgload::load_all() spaces$spaces %>% tibblify(spec = spec_spaces, unspecified = "inform") -write_spec(spec_spaces) From 8afdeaa979c23fe9736a30c77f23165799e56bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:19:16 +0200 Subject: [PATCH 091/137] folders --- script/tibblify-03-folders.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index 8d88cca..48ee3e7 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -12,9 +12,11 @@ folders <- unlist(recursive = FALSE) folders -spec_folders <- spec_guess(folders) +spec_folders <- guess_tspec(folders) +write_spec(spec_folders) +rm(spec_folders) + +pkgload::load_all() df_folders <- tibblify::tibblify(folders, spec = spec_folders, unspecified = "inform") df_folders - -write_spec(spec_folders) From 13179eb703f612b731ab528a36db74043289ef3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:20:04 +0200 Subject: [PATCH 092/137] lists --- script/tibblify-04-lists.R | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index 9085f0a..9da3738 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -14,12 +14,9 @@ lists <- map("lists") %>% unlist(recursive = FALSE) -spec_lists <- spec_guess(lists) - -df_lists <- tibblify::tibblify(lists, spec = spec_lists, unspecified = "inform") -df_lists - +spec_lists <- guess_tspec(lists) write_spec(spec_lists) +rm(spec_lists) pkgload::load_all() From 4c06a1a76d32f39e854d0be84e0fe8b752e503b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:28:56 +0200 Subject: [PATCH 093/137] tasks --- R/spec-tasks.R | 37 ++++++++++++++++++++++++++++++------- script/tibblify-05-tasks.R | 17 ++++++++--------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 1a96e3e..78cd6ff 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -11,14 +11,15 @@ spec_tasks <- tspec_df( tib_chr("type"), tib_int("orderindex"), ), - tib_int("orderindex", transform = as.integer), + tib_int("orderindex", transform = as.integer, ptype_inner = character()), tib_custom("date_created", cu_date_from), tib_custom("date_updated", cu_date_from), tib_custom("date_closed", cu_date_from), + tib_chr("date_done"), tib_lgl("archived"), tib_row( "creator", - tib_chr("id", transform = as.character), + tib_chr("id", transform = as.character, ptype_inner = integer()), tib_chr("username"), tib_chr("color"), tib_chr("email"), @@ -26,7 +27,7 @@ spec_tasks <- tspec_df( ), tib_df( "assignees", - tib_chr("id", transform = as.character), + tib_chr("id", transform = as.character, ptype_inner = integer()), tib_chr("username"), tib_chr("color"), tib_chr("initials"), @@ -75,10 +76,10 @@ spec_tasks <- tspec_df( tib_chr("parent"), tib_row( "priority", - tib_chr("id", required = FALSE), - tib_chr("priority", required = FALSE), tib_chr("color", required = FALSE), + tib_chr("id", required = FALSE), tib_chr("orderindex", required = FALSE), + tib_chr("priority", required = FALSE), ), tib_custom("due_date", cu_date_from), tib_custom("start_date", cu_date_from), @@ -103,11 +104,33 @@ spec_tasks <- tspec_df( tib_int("type"), tib_custom("date_created", cu_date_from), tib_chr("userid"), - # tib_unspecified("workspace_id"), + tib_chr("workspace_id"), + ), + tib_df( + "linked_tasks", + tib_chr("task_id"), + tib_chr("link_id"), + tib_custom("date_created", cu_date_from), + tib_chr("userid"), + tib_chr("workspace_id"), ), - # tib_unspecified("linked_tasks"), tib_chr("team_id"), tib_chr("url"), + tib_row( + "sharing", + tib_lgl("public"), + # tib_unspecified("public_share_expires_on"), + tib_variant("public_fields"), + tib_chr("token"), + tib_lgl("seo_optimized"), + tib_int("permission_level", required = FALSE), + tib_row( + "permissions", + .required = FALSE, + tib_lgl("can_comment", required = FALSE), + tib_chr("name", required = FALSE), + ), + ), tib_chr("permission_level"), tib_row( "list", diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 5419e94..1b2bff1 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -8,11 +8,11 @@ df_spaces <- cuf_get_spaces(df_teams$id[[1]]) df_folders <- map_dfr(df_spaces$id, cuf_get_folders) df_folders -df_lists <- map_dfr(df_folders$id, cuf_get_lists) +df_lists <- map_dfr(df_folders$id, cuf_get_lists, .progress = TRUE) df_lists -tasks_list <- map(df_lists$id, cu_get_tasks, subtasks = TRUE, include_closed = TRUE) -tasks_list_archived <- map(df_lists$id, cu_get_tasks, archived = TRUE, subtasks = TRUE, include_closed = TRUE) +tasks_list <- map(df_lists$id, cu_get_tasks, subtasks = TRUE, include_closed = TRUE, .progress = TRUE) +tasks_list_archived <- map(df_lists$id, cu_get_tasks, archived = TRUE, subtasks = TRUE, include_closed = TRUE, .progress = TRUE) tasks <- c(tasks_list, tasks_list_archived) %>% @@ -21,11 +21,10 @@ tasks <- tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) -spec_tasks <- spec_guess(c(tasks, tasks_team$tasks)) +spec_tasks <- guess_tspec(c(tasks, tasks_team$tasks)) +write_spec(spec_tasks) +rm(spec_tasks) -# Error in tibblify_impl(x, spec) : -# SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL' -df_tasks <- tibblify::tibblify(c(tasks, tasks_team$tasks), spec = spec_tasks, unspecified = "inform") -df_tasks +pkgload::load_all() -write_spec(spec_tasks) +cuf_get_tasks(df_lists$id[[1]]) From 7d208caf05f0a6470a17d998cc00c7b2507d480f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:36:30 +0200 Subject: [PATCH 094/137] timetracking --- R/spec-time_entries.R | 36 ++++++++++++++-------------- script/tibblify-06-timetracking-v2.R | 10 ++++---- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index 49f9993..eeb3f09 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -1,9 +1,24 @@ spec_time_entries <- tspec_df( tib_chr("id"), + tib_row( + "task", + .required = FALSE, + tib_chr("id", required = FALSE), + tib_chr("name", required = FALSE), + tib_row( + "status", + .required = FALSE, + tib_chr("status"), + tib_chr("color"), + tib_chr("type"), + tib_int("orderindex"), + ), + tib_int("custom_type", required = FALSE), + ), tib_chr("wid"), tib_row( "user", - tib_chr("id", transform = as.character), + tib_chr("id", transform = as.character, ptype_inner = integer()), tib_chr("username"), tib_chr("email"), tib_chr("color"), @@ -12,6 +27,8 @@ spec_time_entries <- tspec_df( ), tib_lgl("billable"), tib_custom("start", cu_date_from), + tib_custom("end", cu_date_from, required = FALSE), + tib_custom("duration", required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), tib_chr("description"), tib_df( "tags", @@ -30,21 +47,4 @@ spec_time_entries <- tspec_df( tib_chr("space_id", required = FALSE), ), tib_chr("task_url", required = FALSE), - tib_row( - "task", - .required = FALSE, - tib_chr("id", required = FALSE), - tib_chr("name", required = FALSE), - tib_row( - "status", - .required = FALSE, - tib_chr("status"), - tib_chr("color"), - tib_chr("type"), - tib_int("orderindex"), - ), - tib_int("custom_type", required = FALSE), - ), - tib_custom("end", cu_date_from, required = FALSE), - tib_custom("duration", required = FALSE, transform = ~ hms::as_hms(as.numeric(.x) / 1000)), ) diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index dd9c222..e412233 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -26,22 +26,20 @@ for (i in which(!good)) { time$data[[i]]$task <- list() } -spec_time_entries <- spec_guess(time$data) - -df_time_entries <- tibblify::tibblify(time$data, spec_time_entries) -df_time_entries - +spec_time_entries <- guess_tspec(time$data) write_spec(spec_time_entries) +rm(spec_time_entries) # Reload after updating spec pkgload::load_all() -cuf_get_time_entries_within_date_range( +df_time_entries <- cuf_get_time_entries_within_date_range( df_teams$id[[1]], start_date = start_date, end_date = end_date, assignee = paste(user_ids, collapse = ",") ) +df_time_entries df_time_entries$id cuf_get_singular_time_entry(df_teams$id[[1]], df_time_entries$id[[1]]) From d5dc052b04e26ee6c0c4cffb4113596aed79d61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 26 May 2023 15:37:23 +0200 Subject: [PATCH 095/137] members --- R/spec-members.R | 6 +++--- script/tibblify-07-members.R | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/R/spec-members.R b/R/spec-members.R index 2d231a8..8782a2f 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -1,5 +1,5 @@ spec_members <- tspec_df( - tib_chr("id", transform = as.character), + tib_chr("id", transform = as.character, ptype_inner = integer()), tib_chr("username"), tib_chr("email"), tib_chr("color"), @@ -8,10 +8,10 @@ spec_members <- tspec_df( tib_row( "profileInfo", tib_lgl("display_profile"), - # tib_unspecified("verified_ambassador"), + tib_lgl("verified_ambassador"), # tib_unspecified("verified_consultant"), # tib_unspecified("top_tier_user"), - # tib_unspecified("viewed_verified_ambassador"), + tib_lgl("viewed_verified_ambassador"), # tib_unspecified("viewed_verified_consultant"), # tib_unspecified("viewed_top_tier_user"), ), diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R index 523793c..38dd6f4 100644 --- a/script/tibblify-07-members.R +++ b/script/tibblify-07-members.R @@ -13,16 +13,14 @@ df_lists members <- cu_get_list_members(df_lists$id[[1]]) -spec_members <- spec_guess(members$members) - -df_members <- tibblify::tibblify(members$members, spec_members, unspecified = "inform") -df_members +spec_members <- guess_tspec(members$members) write_spec(spec_members) +rm(spec_members) # Reload pkgload::load_all() -df_tasks <- cuf_get_tasks(df_lists$id[[1]]) +df_tasks <- cuf_get_tasks(df_lists$id[[2]]) cuf_get_task_members(df_tasks$id[[1]]) From c53951e5f3762ef7c41780db6aa487fa7e464b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 1 Jan 2024 20:33:16 +0100 Subject: [PATCH 096/137] Un-remote --- DESCRIPTION | 2 -- 1 file changed, 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1f4ce07..3137b2f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -38,5 +38,3 @@ LazyData: true LazyLoad: yes Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.0 -Remotes: - mgirlich/tibblify From 91a3675717a7445cb9518ecd489537eaba1697ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 6 Jan 2024 20:56:04 +0100 Subject: [PATCH 097/137] Fix type --- R/spec-tasks.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 78cd6ff..e130750 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -85,7 +85,7 @@ spec_tasks <- tspec_df( tib_custom("start_date", cu_date_from), tib_int("points"), tib_int("time_estimate"), - tib_int("time_spent", required = FALSE), + tib_dbl("time_spent", required = FALSE), tib_df( "custom_fields", tib_chr("id"), From 5d62c7b16c4f2e96481643574321dd3a6e54284a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 6 Jan 2024 20:57:40 +0100 Subject: [PATCH 098/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3137b2f..41316c9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9008 +Version: 0.0.5.9009 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From e0a73cee31aa220b6bffa703d69aaa94026b1829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 17:55:11 +0100 Subject: [PATCH 099/137] New optional field --- R/spec-folders.R | 1 + R/spec-lists.R | 1 + 2 files changed, 2 insertions(+) diff --git a/R/spec-folders.R b/R/spec-folders.R index 2844a15..5bec5d3 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -29,6 +29,7 @@ spec_folders <- tspec_df( "status", tib_chr("status", required = FALSE), tib_chr("color", required = FALSE), + tib_lgl("hide_label", required = FALSE), ), # tib_unspecified("priority"), tib_row( diff --git a/R/spec-lists.R b/R/spec-lists.R index f4af6b4..bf4fef1 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -7,6 +7,7 @@ spec_lists <- tspec_df( "status", tib_chr("status", required = FALSE), tib_chr("color", required = FALSE), + tib_lgl("hide_label", required = FALSE), ), # tib_unspecified("priority"), tib_row( From 5d5124ae870f389bc04c15abad4b3d88210aab08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 17:55:37 +0100 Subject: [PATCH 100/137] New sub-record with all-optional values --- R/spec-tasks.R | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index e130750..8b66bc7 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -85,13 +85,56 @@ spec_tasks <- tspec_df( tib_custom("start_date", cu_date_from), tib_int("points"), tib_int("time_estimate"), - tib_dbl("time_spent", required = FALSE), + tib_int("time_spent", required = FALSE), tib_df( "custom_fields", tib_chr("id"), tib_chr("name"), tib_chr("type"), - tib_variant("type_config"), + tib_row( + "type_config", + tib_int("default", required = FALSE), + # tib_unspecified("placeholder", required = FALSE), + tib_df( + "options", + .required = FALSE, + tib_chr("id"), + tib_chr("name", required = FALSE), + tib_chr("color"), + tib_int("orderindex", required = FALSE), + tib_chr("label", required = FALSE), + ), + tib_lgl("simple", required = FALSE), + tib_chr("formula", required = FALSE), + tib_chr("version", required = FALSE), + tib_lgl("is_dynamic", required = FALSE), + tib_variant("return_types", required = FALSE), + tib_chr("calculation_state", required = FALSE), + tib_lgl("new_drop_down", required = FALSE), + tib_lgl("single_user", required = FALSE), + # tib_unspecified("include_groups", required = FALSE), + tib_lgl("include_guests", required = FALSE), + tib_lgl("include_team_members", required = FALSE), + tib_int("precision", required = FALSE), + tib_chr("currency_type", required = FALSE), + tib_int("end", required = FALSE), + tib_int("start", required = FALSE), + tib_int("count", required = FALSE), + tib_chr("code_point", required = FALSE), + tib_row( + "tracking", + .required = FALSE, + tib_lgl("subtasks", required = FALSE), + tib_lgl("checklists", required = FALSE), + tib_lgl("assigned_comments", required = FALSE), + ), + tib_int("complete_on", required = FALSE), + # tib_unspecified("fields", required = FALSE), + tib_chr("subcategory_id", required = FALSE), + tib_lgl("linked_subcategory_access", required = FALSE), + tib_chr("subcategory_inverted_name", required = FALSE), + tib_dbl("reset_at", required = FALSE), + ), tib_custom("date_created", cu_date_from), tib_lgl("hide_from_guests"), tib_lgl("required"), From b8ba966f18d7d2d031e350842cf0af5546061a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 17:57:09 +0100 Subject: [PATCH 101/137] unspecified -> typed --- R/spec-members.R | 4 ++-- R/spec-spaces.R | 2 +- R/spec-tasks.R | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/spec-members.R b/R/spec-members.R index 8782a2f..51ae595 100644 --- a/R/spec-members.R +++ b/R/spec-members.R @@ -8,10 +8,10 @@ spec_members <- tspec_df( tib_row( "profileInfo", tib_lgl("display_profile"), - tib_lgl("verified_ambassador"), + # tib_unspecified("verified_ambassador"), # tib_unspecified("verified_consultant"), # tib_unspecified("top_tier_user"), - tib_lgl("viewed_verified_ambassador"), + # tib_unspecified("viewed_verified_ambassador"), # tib_unspecified("viewed_verified_consultant"), # tib_unspecified("viewed_top_tier_user"), ), diff --git a/R/spec-spaces.R b/R/spec-spaces.R index b473930..30ab1aa 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -4,7 +4,7 @@ spec_spaces <- tspec_df( tib_chr("color"), tib_lgl("private"), tib_chr("avatar"), - # tib_unspecified("admin_can_manage"), + tib_lgl("admin_can_manage"), tib_df( "statuses", tib_chr("id"), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 8b66bc7..43f87c5 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -1,6 +1,7 @@ spec_tasks <- tspec_df( tib_chr("id"), # tib_unspecified("custom_id"), + tib_int("custom_item_id"), tib_chr("name"), tib_chr("text_content"), tib_chr("description"), From 0cf7af6d7742c0acfdea3d6c14f863f8c29afc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 17:57:20 +0100 Subject: [PATCH 102/137] Task locations --- R/spec-tasks.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 43f87c5..a8cc736 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -158,6 +158,11 @@ spec_tasks <- tspec_df( tib_chr("userid"), tib_chr("workspace_id"), ), + tib_df( + "locations", + tib_chr("id"), + tib_chr("name"), + ), tib_chr("team_id"), tib_chr("url"), tib_row( From 27882e7c57fd5ee2ff624a300d5016c18d472b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 18:42:16 +0100 Subject: [PATCH 103/137] Align --- script/tibblify-01-teams.R | 4 +--- script/tibblify-02-spaces.R | 6 +++--- script/tibblify-03-folders.R | 3 ++- script/tibblify-04-lists.R | 4 +++- script/tibblify-05-tasks.R | 9 ++++++++- script/tibblify-06-timetracking-v2.R | 9 ++++++--- script/tibblify-07-members.R | 4 +++- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/script/tibblify-01-teams.R b/script/tibblify-01-teams.R index 6996b26..f5b8a36 100644 --- a/script/tibblify-01-teams.R +++ b/script/tibblify-01-teams.R @@ -12,8 +12,6 @@ rm(spec_teams) pkgload::load_all() -df_teams <- tibblify(teams$teams, spec = spec_teams, unspecified = "inform") -df_teams - +df_teams <- cuf_get_teams() df_teams df_teams$members diff --git a/script/tibblify-02-spaces.R b/script/tibblify-02-spaces.R index 48de876..e0c573d 100644 --- a/script/tibblify-02-spaces.R +++ b/script/tibblify-02-spaces.R @@ -12,6 +12,6 @@ rm(spec_spaces) pkgload::load_all() -spaces$spaces %>% - tibblify(spec = spec_spaces, unspecified = "inform") - +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) +df_spaces +df_spaces$statuses[[1]] diff --git a/script/tibblify-03-folders.R b/script/tibblify-03-folders.R index 48ee3e7..08f2389 100644 --- a/script/tibblify-03-folders.R +++ b/script/tibblify-03-folders.R @@ -18,5 +18,6 @@ rm(spec_folders) pkgload::load_all() -df_folders <- tibblify::tibblify(folders, spec = spec_folders, unspecified = "inform") +df_folders <- cuf_get_folders(df_spaces$id[[1]]) df_folders +df_folders$lists[[1]] diff --git a/script/tibblify-04-lists.R b/script/tibblify-04-lists.R index 9da3738..092df16 100644 --- a/script/tibblify-04-lists.R +++ b/script/tibblify-04-lists.R @@ -20,4 +20,6 @@ rm(spec_lists) pkgload::load_all() -cuf_get_lists(df_folders$id[[1]]) +df_lists <- cuf_get_lists(df_folders$id[[1]]) +df_lists +df_lists$folder diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 1b2bff1..91c9708 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -27,4 +27,11 @@ rm(spec_tasks) pkgload::load_all() -cuf_get_tasks(df_lists$id[[1]]) +df_tasks <- cuf_get_tasks(df_lists$id[[1]]) +df_tasks +df_tasks$priority +df_tasks$custom_fields[[1]] +df_tasks$dependencies[[1]] +df_tasks$sharing +df_tasks$sharing$public_fields[[1]] + diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index e412233..a76f39e 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -40,7 +40,10 @@ df_time_entries <- cuf_get_time_entries_within_date_range( assignee = paste(user_ids, collapse = ",") ) df_time_entries +df_time_entries$task -df_time_entries$id -cuf_get_singular_time_entry(df_teams$id[[1]], df_time_entries$id[[1]]) -cuf_get_time_entry_history(df_teams$id[[1]], df_time_entries$id[[253]]) +df_time_entry <- cuf_get_singular_time_entry(df_teams$id[[1]], df_time_entries$id[[1]]) +df_time_entry + +# Doesn't work yet: +# cuf_get_time_entry_history(df_teams$id[[1]], df_time_entries$id[[260]]) diff --git a/script/tibblify-07-members.R b/script/tibblify-07-members.R index 38dd6f4..031434a 100644 --- a/script/tibblify-07-members.R +++ b/script/tibblify-07-members.R @@ -22,5 +22,7 @@ rm(spec_members) pkgload::load_all() df_tasks <- cuf_get_tasks(df_lists$id[[2]]) +df_tasks$assignees[[1]] -cuf_get_task_members(df_tasks$id[[1]]) +df_task_members <- cuf_get_task_members(df_tasks$id[[1]]) +df_task_members From 97b92a3268cfc769ab9768a38e84a95d5440dbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 18:42:20 +0100 Subject: [PATCH 104/137] Fix drift --- script/tibblify-06-timetracking-v2.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/tibblify-06-timetracking-v2.R b/script/tibblify-06-timetracking-v2.R index a76f39e..3b1becb 100644 --- a/script/tibblify-06-timetracking-v2.R +++ b/script/tibblify-06-timetracking-v2.R @@ -23,10 +23,12 @@ good <- # contains garbage sometimes for (i in which(!good)) { + # Handled below with spec_time_entries$fields$task$required <- FALSE time$data[[i]]$task <- list() } spec_time_entries <- guess_tspec(time$data) +spec_time_entries$fields$task$required <- FALSE write_spec(spec_time_entries) rm(spec_time_entries) From 2ab0e38284eddb8d1807f7f19359e1f38161e446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 20:07:34 +0100 Subject: [PATCH 105/137] Support paging for cu_get_filtered_team_tasks() --- R/cu-get-all-team-tasks.R | 4 ++++ R/internals.R | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/R/cu-get-all-team-tasks.R b/R/cu-get-all-team-tasks.R index fee1663..19c0167 100644 --- a/R/cu-get-all-team-tasks.R +++ b/R/cu-get-all-team-tasks.R @@ -2,6 +2,8 @@ #' #' The wrapper function uses [cu_get_filtered_team_tasks()] #' but takes care of paging. +#' No longer needed because paging is now handled automatically for all functions, +#' including [cu_get_filtered_team_tasks()]. #' #' @param team_id Team ID of tasks. #' @param ... All query parameters for [cu_get_filtered_team_tasks()] @@ -20,6 +22,8 @@ ## include_closed = FALSE by default cu_get_all_team_tasks <- function(team_id, ...) { + .Deprecated("cu_get_filtered_team_tasks") + p <- 0 done <- FALSE out <- list(tasks=NULL) diff --git a/R/internals.R b/R/internals.R index 1ff59dd..6b65bc5 100644 --- a/R/internals.R +++ b/R/internals.R @@ -40,11 +40,28 @@ chunk <- .cu_get_page(..., query = query) out <- chunk page <- 0 - while (paging && length(chunk) == 1 && length(chunk[[1]]) == 100) { + repeat { + if (length(chunk) == 1) { + if (length(chunk[[1]]) < 100) { + break + } + } else if (length(chunk) == 2) { + if (names(chunk)[[2]] != "last_page") { + break + } + # Clear output + out[["last_page"]] <- NULL + if (chunk[["last_page"]]) { + break + } + } else { + break + } + page <- page + 1 query$page <- page chunk <- .cu_get_page(..., query = query) - stopifnot(length(chunk) == 1) + stopifnot(length(chunk) %in% 1:2) out[[1]] <- c(out[[1]], chunk[[1]]) } From 4cf8bf86ebba6818944b1144974cf7a34414e984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 20:07:48 +0100 Subject: [PATCH 106/137] Derive specs from cu_get_filtered_team_tasks() --- R/spec-tasks.R | 27 ++++++++++++++------------- script/tibblify-05-tasks.R | 32 +++++++++++++------------------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index a8cc736..9d8b4f4 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -77,6 +77,7 @@ spec_tasks <- tspec_df( tib_chr("parent"), tib_row( "priority", + .required = FALSE, tib_chr("color", required = FALSE), tib_chr("id", required = FALSE), tib_chr("orderindex", required = FALSE), @@ -86,7 +87,7 @@ spec_tasks <- tspec_df( tib_custom("start_date", cu_date_from), tib_int("points"), tib_int("time_estimate"), - tib_int("time_spent", required = FALSE), + tib_dbl("time_spent", required = FALSE), tib_df( "custom_fields", tib_chr("id"), @@ -94,30 +95,35 @@ spec_tasks <- tspec_df( tib_chr("type"), tib_row( "type_config", - tib_int("default", required = FALSE), - # tib_unspecified("placeholder", required = FALSE), tib_df( "options", .required = FALSE, tib_chr("id"), - tib_chr("name", required = FALSE), + tib_chr("label", required = FALSE), tib_chr("color"), + tib_chr("name", required = FALSE), tib_int("orderindex", required = FALSE), - tib_chr("label", required = FALSE), ), + tib_int("default", required = FALSE), + # tib_unspecified("placeholder", required = FALSE), + tib_lgl("new_drop_down", required = FALSE), tib_lgl("simple", required = FALSE), tib_chr("formula", required = FALSE), tib_chr("version", required = FALSE), tib_lgl("is_dynamic", required = FALSE), tib_variant("return_types", required = FALSE), tib_chr("calculation_state", required = FALSE), - tib_lgl("new_drop_down", required = FALSE), - tib_lgl("single_user", required = FALSE), - # tib_unspecified("include_groups", required = FALSE), tib_lgl("include_guests", required = FALSE), tib_lgl("include_team_members", required = FALSE), + tib_lgl("single_user", required = FALSE), + # tib_unspecified("include_groups", required = FALSE), tib_int("precision", required = FALSE), tib_chr("currency_type", required = FALSE), + # tib_unspecified("fields", required = FALSE), + tib_chr("subcategory_id", required = FALSE), + tib_lgl("linked_subcategory_access", required = FALSE), + tib_chr("subcategory_inverted_name", required = FALSE), + tib_dbl("reset_at", required = FALSE), tib_int("end", required = FALSE), tib_int("start", required = FALSE), tib_int("count", required = FALSE), @@ -130,11 +136,6 @@ spec_tasks <- tspec_df( tib_lgl("assigned_comments", required = FALSE), ), tib_int("complete_on", required = FALSE), - # tib_unspecified("fields", required = FALSE), - tib_chr("subcategory_id", required = FALSE), - tib_lgl("linked_subcategory_access", required = FALSE), - tib_chr("subcategory_inverted_name", required = FALSE), - tib_dbl("reset_at", required = FALSE), ), tib_custom("date_created", cu_date_from), tib_lgl("hide_from_guests"), diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 91c9708..504f5ee 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -3,31 +3,23 @@ library(tibblify) library(tidyverse) df_teams <- cuf_get_teams() -df_spaces <- cuf_get_spaces(df_teams$id[[1]]) - -df_folders <- map_dfr(df_spaces$id, cuf_get_folders) -df_folders - -df_lists <- map_dfr(df_folders$id, cuf_get_lists, .progress = TRUE) -df_lists - -tasks_list <- map(df_lists$id, cu_get_tasks, subtasks = TRUE, include_closed = TRUE, .progress = TRUE) -tasks_list_archived <- map(df_lists$id, cu_get_tasks, archived = TRUE, subtasks = TRUE, include_closed = TRUE, .progress = TRUE) - -tasks <- - c(tasks_list, tasks_list_archived) %>% - map("tasks") %>% - unlist(recursive = FALSE) +tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]], include_closed = TRUE, subtasks = TRUE) -tasks_team <- cu_get_filtered_team_tasks(df_teams$id[[1]]) - -spec_tasks <- guess_tspec(c(tasks, tasks_team$tasks)) +spec_tasks <- guess_tspec(tasks_team$tasks) write_spec(spec_tasks) rm(spec_tasks) pkgload::load_all() -df_tasks <- cuf_get_tasks(df_lists$id[[1]]) +df_spaces <- cuf_get_spaces(df_teams$id[[1]]) + +df_folder <- cuf_get_folders(df_spaces$id[[1]]) +df_folder + +df_list <- cuf_get_lists(df_folder$id[[1]]) +df_list + +df_tasks <- cuf_get_tasks(df_list$id[[1]]) df_tasks df_tasks$priority df_tasks$custom_fields[[1]] @@ -35,3 +27,5 @@ df_tasks$dependencies[[1]] df_tasks$sharing df_tasks$sharing$public_fields[[1]] +df_all_tasks <- cuf_get_filtered_team_tasks(df_teams$id[[1]], include_closed = TRUE, subtasks = TRUE) +df_all_tasks From cee9c248be443e50628828d5456edfad8d6e469d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 17:58:36 +0100 Subject: [PATCH 107/137] Done --- script/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/script/README.md b/script/README.md index 0e3b500..171520d 100644 --- a/script/README.md +++ b/script/README.md @@ -7,6 +7,7 @@ Goal: A `cuf_*()` function for each `cu_()` function that returns a tibble with - [x] `cu_get_folders()` - [x] `cu_get_lists()` - [x] `cu_get_tasks()` +- [x] `cu_get_filtered_team_tasks()` - [x] `cu_get_time_entries_within_date_range()` - [x] `cu_get_singular_time_entry()` - [x] `cu_get_list_members()` From 40f798a105765f33251529d63bf4babe8aa10acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 20:14:55 +0100 Subject: [PATCH 108/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 41316c9..d9ec4e1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9009 +Version: 0.0.5.9010 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From e569c0df8b2113428f6f1f20521a71e187cd2e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 21:50:09 +0100 Subject: [PATCH 109/137] Don't page with paging = FALSE --- R/internals.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/internals.R b/R/internals.R index 6b65bc5..95fcdc5 100644 --- a/R/internals.R +++ b/R/internals.R @@ -41,6 +41,9 @@ out <- chunk page <- 0 repeat { + if (!paging) { + break + } if (length(chunk) == 1) { if (length(chunk[[1]]) < 100) { break From da8e15e673ebb62b405801691dd4e038d1697e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 19 Jan 2024 21:50:20 +0100 Subject: [PATCH 110/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d9ec4e1..99cdd02 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9010 +Version: 0.0.5.9011 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From c4ba219adc98a854cc258537773c563db6228e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 21 Jan 2024 06:45:57 +0100 Subject: [PATCH 111/137] orderindex is a double --- R/spec-folders.R | 8 ++++---- R/spec-lists.R | 2 +- R/spec-spaces.R | 4 ++-- R/spec-tasks.R | 8 ++++---- R/spec-time_entries.R | 2 +- R/tibblify.R | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/R/spec-folders.R b/R/spec-folders.R index 5bec5d3..04375c7 100644 --- a/R/spec-folders.R +++ b/R/spec-folders.R @@ -1,7 +1,7 @@ spec_folders <- tspec_df( tib_chr("id"), tib_chr("name"), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_lgl("override_statuses"), tib_lgl("hidden"), tib_row( @@ -16,14 +16,14 @@ spec_folders <- tspec_df( tib_chr("id"), tib_chr("status"), tib_chr("type"), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_chr("color"), ), tib_df( "lists", tib_chr("id"), tib_chr("name"), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_chr("content", required = FALSE), tib_row( "status", @@ -54,7 +54,7 @@ spec_folders <- tspec_df( "statuses", tib_chr("id"), tib_chr("status"), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_chr("color"), tib_chr("type"), ), diff --git a/R/spec-lists.R b/R/spec-lists.R index bf4fef1..d56c1b1 100644 --- a/R/spec-lists.R +++ b/R/spec-lists.R @@ -1,7 +1,7 @@ spec_lists <- tspec_df( tib_chr("id"), tib_chr("name"), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_chr("content", required = FALSE), tib_row( "status", diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 30ab1aa..4e106b5 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -10,7 +10,7 @@ spec_spaces <- tspec_df( tib_chr("id"), tib_chr("status"), tib_chr("type"), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_chr("color"), ), tib_lgl("multiple_assignees"), @@ -28,7 +28,7 @@ spec_spaces <- tspec_df( .required = FALSE, tib_chr("color"), tib_chr("id"), - tib_int("orderindex", transform = as.integer, ptype_inner = character()), + tib_dbl("orderindex", transform = as.integer, ptype_inner = character()), tib_chr("priority"), ), tib_lgl("per_assignee", required = FALSE), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 9d8b4f4..fddfa3d 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -10,9 +10,9 @@ spec_tasks <- tspec_df( tib_chr("status"), tib_chr("color"), tib_chr("type"), - tib_int("orderindex"), + tib_dbl("orderindex"), ), - tib_int("orderindex", transform = as.integer, ptype_inner = character()), + tib_dbl("orderindex", transform = as.integer, ptype_inner = character()), tib_custom("date_created", cu_date_from), tib_custom("date_updated", cu_date_from), tib_custom("date_closed", cu_date_from), @@ -42,7 +42,7 @@ spec_tasks <- tspec_df( tib_chr("task_id"), tib_chr("name"), tib_custom("date_created", cu_date_from), - tib_int("orderindex"), + tib_dbl("orderindex"), tib_int("creator"), tib_int("resolved"), tib_int("unresolved"), @@ -102,7 +102,7 @@ spec_tasks <- tspec_df( tib_chr("label", required = FALSE), tib_chr("color"), tib_chr("name", required = FALSE), - tib_int("orderindex", required = FALSE), + tib_dbl("orderindex", required = FALSE), ), tib_int("default", required = FALSE), # tib_unspecified("placeholder", required = FALSE), diff --git a/R/spec-time_entries.R b/R/spec-time_entries.R index eeb3f09..7bb2921 100644 --- a/R/spec-time_entries.R +++ b/R/spec-time_entries.R @@ -11,7 +11,7 @@ spec_time_entries <- tspec_df( tib_chr("status"), tib_chr("color"), tib_chr("type"), - tib_int("orderindex"), + tib_dbl("orderindex"), ), tib_int("custom_type", required = FALSE), ), diff --git a/R/tibblify.R b/R/tibblify.R index fa2a013..3f9f316 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,7 @@ write_spec <- function(x) { out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character, ptype_inner = integer())', out, fixed = TRUE) out <- gsub('tib_int("id", default = NA_integer_', 'tib_chr("id", transform = as.character, default = NA_character_', out, fixed = TRUE) - out <- gsub('tib_chr("orderindex")', 'tib_int("orderindex", transform = as.integer, ptype_inner = character())', out, fixed = TRUE) + out <- gsub('tib_chr("orderindex")', 'tib_dbl("orderindex", transform = as.integer, ptype_inner = character())', out, fixed = TRUE) date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_custom("\\1", transform = cu_date_from, default = dttr2::NA_POSIXct_', out) From ba9d64fa36b9abc5854c2f9a88c4035b5b8a5ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 21 Jan 2024 06:46:12 +0100 Subject: [PATCH 112/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 99cdd02..e81ddd9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9011 +Version: 0.0.5.9012 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 9cc34b2b501395dc4085747f912685b3f172bf5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 21 Jan 2024 11:35:28 +0100 Subject: [PATCH 113/137] orderindex --- R/spec-spaces.R | 2 +- R/spec-tasks.R | 2 +- R/tibblify.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 4e106b5..8009c6c 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -28,7 +28,7 @@ spec_spaces <- tspec_df( .required = FALSE, tib_chr("color"), tib_chr("id"), - tib_dbl("orderindex", transform = as.integer, ptype_inner = character()), + tib_dbl("orderindex", transform = as.numeric, ptype_inner = character()), tib_chr("priority"), ), tib_lgl("per_assignee", required = FALSE), diff --git a/R/spec-tasks.R b/R/spec-tasks.R index fddfa3d..25c9435 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -12,7 +12,7 @@ spec_tasks <- tspec_df( tib_chr("type"), tib_dbl("orderindex"), ), - tib_dbl("orderindex", transform = as.integer, ptype_inner = character()), + tib_dbl("orderindex", transform = as.numeric, ptype_inner = character()), tib_custom("date_created", cu_date_from), tib_custom("date_updated", cu_date_from), tib_custom("date_closed", cu_date_from), diff --git a/R/tibblify.R b/R/tibblify.R index 3f9f316..a63c5ab 100644 --- a/R/tibblify.R +++ b/R/tibblify.R @@ -21,7 +21,7 @@ write_spec <- function(x) { out <- gsub('tib_int("id")', 'tib_chr("id", transform = as.character, ptype_inner = integer())', out, fixed = TRUE) out <- gsub('tib_int("id", default = NA_integer_', 'tib_chr("id", transform = as.character, default = NA_character_', out, fixed = TRUE) - out <- gsub('tib_chr("orderindex")', 'tib_dbl("orderindex", transform = as.integer, ptype_inner = character())', out, fixed = TRUE) + out <- gsub('tib_chr("orderindex")', 'tib_dbl("orderindex", transform = as.numeric, ptype_inner = character())', out, fixed = TRUE) date_cols <- "last_active|date_joined|date_invited|start_date|end_date|due_date|start|end|date_created|date_updated|date_closed|at" out <- gsub(paste0('tib_chr[(]"(', date_cols, ')", default = NA_character_'), 'tib_custom("\\1", transform = cu_date_from, default = dttr2::NA_POSIXct_', out) From f375bceeed7e0866265a4ae677c7f0951f901ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 21 Jan 2024 11:35:44 +0100 Subject: [PATCH 114/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e81ddd9..1baea7e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.5.9012 +Version: 0.0.5.9013 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From ccdb4c2a7543448318248ea5d8d1db2371201a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 1 Feb 2024 08:30:38 +0100 Subject: [PATCH 115/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4dbafaa..00ad77b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9013 +Version: 0.0.6.9014 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 0063f78e6b75f4dfb68920559249666aebf1ec76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 3 Feb 2024 18:49:08 +0100 Subject: [PATCH 116/137] cu_token --- R/df-folders.R | 16 ++++++++-------- R/df-lists.R | 24 ++++++++++++------------ R/df-members.R | 8 ++++---- R/df-spaces.R | 16 ++++++++-------- R/df-tasks.R | 20 ++++++++++---------- R/df-teams.R | 4 ++-- R/df-timetracking-v2.R | 9 ++++----- 7 files changed, 48 insertions(+), 49 deletions(-) diff --git a/R/df-folders.R b/R/df-folders.R index 107aa56..3dd8423 100644 --- a/R/df-folders.R +++ b/R/df-folders.R @@ -4,16 +4,16 @@ NULL #' @export #' @rdname api-folders -cuf_create_folder <- function(space_id, name) { - out <- cu_create_folder(space_id, name) +cuf_create_folder <- function(space_id, name, cu_token = NULL) { + out <- cu_create_folder(space_id, name, cu_token = cu_token) tibblify(list(out), spec_folders) } #' @export #' @rdname api-folders -cuf_update_folder <- function(folder_id, name) { - out <- cu_update_folder(folder_id, name) +cuf_update_folder <- function(folder_id, name, cu_token = NULL) { + out <- cu_update_folder(folder_id, name, cu_token = cu_token) tibblify(list(out), spec_folders) } @@ -27,8 +27,8 @@ cuf_delete_folder <- function(folder_id, name) { #' @export #' @rdname api-folders -cuf_get_folders <- function(space_id, archived=FALSE) { - out <- cu_get_folders(space_id, archived) +cuf_get_folders <- function(space_id, archived=FALSE, cu_token = NULL) { + out <- cu_get_folders(space_id, archived, cu_token = cu_token) tibblify(out$folders, spec_folders) } @@ -36,7 +36,7 @@ cuf_get_folders <- function(space_id, archived=FALSE) { #' @export #' @rdname api-folders -cuf_get_folder <- function(folder_id) { - out <- cu_get_folder(folder_id) +cuf_get_folder <- function(folder_id, cu_token = NULL) { + out <- cu_get_folder(folder_id, cu_token = cu_token) tibblify(list(out), spec_folders) } diff --git a/R/df-lists.R b/R/df-lists.R index 8e73a58..177d6d8 100644 --- a/R/df-lists.R +++ b/R/df-lists.R @@ -4,24 +4,24 @@ NULL #' @export #' @rdname api-lists -cuf_create_list <- function(folder_id, ...) { - out <- cu_create_list(folder_id, ...) +cuf_create_list <- function(folder_id, ..., cu_token = NULL) { + out <- cu_create_list(folder_id, ..., cu_token = cu_token) tibblify(list(out), spec_lists) } #' @export #' @rdname api-lists -cuf_create_folderless_list <- function(space_id, ...) { - out <- cu_create_folderless_list(space_id, ...) +cuf_create_folderless_list <- function(space_id, ..., cu_token = NULL) { + out <- cu_create_folderless_list(space_id, ..., cu_token = cu_token) tibblify(list(out), spec_lists) } #' @export #' @rdname api-lists -cuf_update_list <- function(list_id, ...) { - out <- cu_update_list(folder_id, ...) +cuf_update_list <- function(list_id, ..., cu_token = NULL) { + out <- cu_update_list(folder_id, ..., cu_token = cu_token) tibblify(list(out), spec_lists) } @@ -35,23 +35,23 @@ cuf_delete_list <- function(list_id, ...) { #' @export #' @rdname api-lists -cuf_get_lists <- function(folder_id, archived=FALSE) { - out <- cu_get_lists(folder_id, archived) +cuf_get_lists <- function(folder_id, archived=FALSE, cu_token = NULL) { + out <- cu_get_lists(folder_id, archived, cu_token = cu_token) tibblify(out$lists, spec_lists) } #' @export #' @rdname api-lists -cuf_get_lists_folderless <- function(space_id, archived=FALSE) { - out <- cu_get_lists_folderless(folder_id, archived) +cuf_get_lists_folderless <- function(space_id, archived=FALSE, cu_token = NULL) { + out <- cu_get_lists_folderless(folder_id, archived, cu_token = cu_token) tibblify(out$lists, spec_lists) } #' @export #' @rdname api-lists -cuf_get_list <- function(list_id) { - out <- cu_get_list(list_id) +cuf_get_list <- function(list_id, cu_token = NULL) { + out <- cu_get_list(list_id, cu_token = cu_token) tibblify(list(out), spec_lists) } diff --git a/R/df-members.R b/R/df-members.R index 58455bb..f16259e 100644 --- a/R/df-members.R +++ b/R/df-members.R @@ -4,15 +4,15 @@ NULL #' @export #' @rdname api-members -cuf_get_task_members <- function(task_id) { - out <- cu_get_task_members(task_id) +cuf_get_task_members <- function(task_id, cu_token = NULL) { + out <- cu_get_task_members(task_id, cu_token = cu_token) tibblify(out$members, spec_members) } #' @export #' @rdname api-members -cuf_get_list_members <- function(list_id) { - out <- cu_get_list_members(list_id) +cuf_get_list_members <- function(list_id, cu_token = NULL) { + out <- cu_get_list_members(list_id, cu_token = cu_token) tibblify(out$members, spec_members) } diff --git a/R/df-spaces.R b/R/df-spaces.R index 60302ca..5710a27 100644 --- a/R/df-spaces.R +++ b/R/df-spaces.R @@ -1,15 +1,15 @@ #' @export #' @rdname api-spaces -cuf_create_space <- function(team_id, name, ...) { - out <- cu_create_space(team_id, name, ...) +cuf_create_space <- function(team_id, name, ..., cu_token = NULL) { + out <- cu_create_space(team_id, name, ..., cu_token = cu_token) tibblify(list(out), spec_spaces) } #' @export #' @rdname api-spaces -cuf_update_space <- function(space_id, ...) { - out <- cu_update_space(team_id, name, ...) +cuf_update_space <- function(space_id, ..., cu_token = NULL) { + out <- cu_update_space(team_id, name, ..., cu_token = cu_token) tibblify(list(out), spec_spaces) } @@ -24,14 +24,14 @@ cuf_delete_space <- function(space_id) { #' @export #' @rdname api-spaces ##GET https://api.clickup.com/api/v2/team/team_id/space?archived=false -cuf_get_spaces <- function(team_id, archived=FALSE) { - out <- cu_get_spaces(team_id, archived) +cuf_get_spaces <- function(team_id, archived=FALSE, cu_token = NULL) { + out <- cu_get_spaces(team_id, archived, cu_token = cu_token) tibblify(out$spaces, spec_spaces) } #' @export #' @rdname api-spaces -cuf_get_space <- function(space_id) { - out <- cu_get_space(space_id) +cuf_get_space <- function(space_id, cu_token = NULL) { + out <- cu_get_space(space_id, cu_token = cu_token) tibblify(list(out), spec_spaces) } diff --git a/R/df-tasks.R b/R/df-tasks.R index a73f273..7d7b04b 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -4,16 +4,16 @@ NULL #' @export #' @rdname api-tasks -cuf_create_task <- function(list_id, ...) { - out <- cu_create_task(list_id, ...) +cuf_create_task <- function(list_id, ..., cu_token = NULL) { + out <- cu_create_task(list_id, ..., cu_token = cu_token) tibblify(list(out), spec_tasks) } #' @export #' @rdname api-tasks -cuf_update_task <- function(task_id, ...) { - out <- cu_update_task(task_id, ...) +cuf_update_task <- function(task_id, ..., cu_token = NULL) { + out <- cu_update_task(task_id, ..., cu_token = cu_token) tibblify(list(out), spec_tasks) } @@ -29,24 +29,24 @@ cuf_delete_task <- function(task_id) { #' @export #' @rdname api-tasks # ... takes parameters, most importantly page (starting at 0) -cuf_get_tasks <- function(list_id, archived=FALSE, ...) { - out <- cu_get_tasks(list_id, archived, ...) +cuf_get_tasks <- function(list_id, archived=FALSE, ..., cu_token = NULL) { + out <- cu_get_tasks(list_id, archived, ..., cu_token = cu_token) tibblify(out$tasks, spec_tasks) } #' @export #' @rdname api-tasks -cuf_get_task <- function(task_id) { - out <- cu_get_task(task_id) +cuf_get_task <- function(task_id, cu_token = NULL) { + out <- cu_get_task(task_id, cu_token = cu_token) tibblify(list(out), spec_tasks) } #' @export #' @rdname api-tasks -cuf_get_filtered_team_tasks <- function(team_id, ...) { - out <- cu_get_filtered_team_tasks(team_id, ...) +cuf_get_filtered_team_tasks <- function(team_id, ..., cu_token = NULL) { + out <- cu_get_filtered_team_tasks(team_id, ..., cu_token = cu_token) tibblify(out$tasks, spec_tasks) } diff --git a/R/df-teams.R b/R/df-teams.R index e2e987c..128f7e2 100644 --- a/R/df-teams.R +++ b/R/df-teams.R @@ -1,8 +1,8 @@ #' @export #' @rdname api-teams -cuf_get_teams <- function() { - out <- cu_get_teams() +cuf_get_teams <- function(cu_token = NULL) { + out <- cu_get_teams(cu_token = cu_token) tibblify(out$teams, spec_teams) } #cuf_get_workspaces <- cu_get_teams diff --git a/R/df-timetracking-v2.R b/R/df-timetracking-v2.R index 4f89abd..c8bc460 100644 --- a/R/df-timetracking-v2.R +++ b/R/df-timetracking-v2.R @@ -4,9 +4,8 @@ NULL #' @export #' @rdname api-timetracking-2 -cuf_get_time_entries_within_date_range <- function(team_id, -start_date, end_date, assignee) { - out <- cu_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) +cuf_get_time_entries_within_date_range <- function(team_id, start_date, end_date, assignee, cu_token = NULL) { + out <- cu_get_time_entries_within_date_range(team_id, start_date, end_date, assignee, cu_token = cu_token) # Patch time entries without associated task entries <- lapply(out$data, function(.x) { @@ -22,8 +21,8 @@ start_date, end_date, assignee) { #' @export #' @rdname api-timetracking-2 -cuf_get_singular_time_entry <- function(team_id, timer_id) { - out <- cu_get_singular_time_entry(team_id, timer_id) +cuf_get_singular_time_entry <- function(team_id, timer_id, cu_token = NULL) { + out <- cu_get_singular_time_entry(team_id, timer_id, cu_token = cu_token) tibblify(list(out$data), spec_time_entries) } From 007d56bd3471bad6237a854c60976043ca12bcc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 3 Feb 2024 18:49:18 +0100 Subject: [PATCH 117/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 00ad77b..68e6fc5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9014 +Version: 0.0.6.9015 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 2dc9198736313d34d9e975c0641664a4e27f93b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 11 Mar 2024 05:46:40 +0100 Subject: [PATCH 118/137] Update schema definition --- R/spec-spaces.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 8009c6c..63f5a3a 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -17,12 +17,13 @@ spec_spaces <- tspec_df( tib_df( "features", .names_to = ".names", - tib_lgl("enabled"), + tib_lgl("enabled", required = FALSE), tib_lgl("start_date", required = FALSE), tib_lgl("remap_due_dates", required = FALSE), tib_lgl("remap_closed_due_date", required = FALSE), tib_lgl("harvest", required = FALSE), tib_lgl("rollup", required = FALSE), + tib_int("default_to_billable", required = FALSE), tib_df( "priorities", .required = FALSE, From 9a5ff65e8470f3120c30293a6dc5d90e5c5fd590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 11 Mar 2024 05:48:28 +0100 Subject: [PATCH 119/137] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 68e6fc5..5db3870 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9015 +Version: 0.0.6.9016 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From e4f3519892916120372565c4c6f86d9d83c691ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:00:11 +0200 Subject: [PATCH 120/137] Document --- DESCRIPTION | 2 +- man/api-folders.Rd | 8 ++++---- man/api-lists.Rd | 12 ++++++------ man/api-members.Rd | 4 ++-- man/api-spaces.Rd | 8 ++++---- man/api-tasks.Rd | 10 +++++----- man/api-teams.Rd | 2 +- man/api-timetracking-2.Rd | 10 ++++++++-- 8 files changed, 31 insertions(+), 25 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5db3870..923af17 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,4 +37,4 @@ Encoding: UTF-8 LazyData: true LazyLoad: yes Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0.9000 +RoxygenNote: 7.3.1 diff --git a/man/api-folders.Rd b/man/api-folders.Rd index 3c259bd..ccf10cc 100644 --- a/man/api-folders.Rd +++ b/man/api-folders.Rd @@ -24,15 +24,15 @@ cu_get_folders(space_id, archived = FALSE, cu_token = NULL) cu_get_folder(folder_id, cu_token = NULL) -cuf_create_folder(space_id, name) +cuf_create_folder(space_id, name, cu_token = NULL) -cuf_update_folder(folder_id, name) +cuf_update_folder(folder_id, name, cu_token = NULL) cuf_delete_folder(folder_id, name) -cuf_get_folders(space_id, archived = FALSE) +cuf_get_folders(space_id, archived = FALSE, cu_token = NULL) -cuf_get_folder(folder_id) +cuf_get_folder(folder_id, cu_token = NULL) } \arguments{ \item{space_id}{Space ID.} diff --git a/man/api-lists.Rd b/man/api-lists.Rd index 64c0fe3..e354aed 100644 --- a/man/api-lists.Rd +++ b/man/api-lists.Rd @@ -32,19 +32,19 @@ cu_get_lists_folderless(space_id, archived = FALSE, cu_token = NULL) cu_get_list(list_id, cu_token = NULL) -cuf_create_list(folder_id, ...) +cuf_create_list(folder_id, ..., cu_token = NULL) -cuf_create_folderless_list(space_id, ...) +cuf_create_folderless_list(space_id, ..., cu_token = NULL) -cuf_update_list(list_id, ...) +cuf_update_list(list_id, ..., cu_token = NULL) cuf_delete_list(list_id, ...) -cuf_get_lists(folder_id, archived = FALSE) +cuf_get_lists(folder_id, archived = FALSE, cu_token = NULL) -cuf_get_lists_folderless(space_id, archived = FALSE) +cuf_get_lists_folderless(space_id, archived = FALSE, cu_token = NULL) -cuf_get_list(list_id) +cuf_get_list(list_id, cu_token = NULL) } \arguments{ \item{folder_id}{Folder ID.} diff --git a/man/api-members.Rd b/man/api-members.Rd index 8cdd7b1..3f2912e 100644 --- a/man/api-members.Rd +++ b/man/api-members.Rd @@ -12,9 +12,9 @@ cu_get_task_members(task_id, cu_token = NULL) cu_get_list_members(list_id, cu_token = NULL) -cuf_get_task_members(task_id) +cuf_get_task_members(task_id, cu_token = NULL) -cuf_get_list_members(list_id) +cuf_get_list_members(list_id, cu_token = NULL) } \arguments{ \item{task_id}{Task ID.} diff --git a/man/api-spaces.Rd b/man/api-spaces.Rd index d5537bc..6100931 100644 --- a/man/api-spaces.Rd +++ b/man/api-spaces.Rd @@ -24,15 +24,15 @@ cu_get_spaces(team_id, archived = FALSE, cu_token = NULL) cu_get_space(space_id, cu_token = NULL) -cuf_create_space(team_id, name, ...) +cuf_create_space(team_id, name, ..., cu_token = NULL) -cuf_update_space(space_id, ...) +cuf_update_space(space_id, ..., cu_token = NULL) cuf_delete_space(space_id) -cuf_get_spaces(team_id, archived = FALSE) +cuf_get_spaces(team_id, archived = FALSE, cu_token = NULL) -cuf_get_space(space_id) +cuf_get_space(space_id, cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} diff --git a/man/api-tasks.Rd b/man/api-tasks.Rd index 7321252..0541d2d 100644 --- a/man/api-tasks.Rd +++ b/man/api-tasks.Rd @@ -28,17 +28,17 @@ cu_get_task(task_id, cu_token = NULL) cu_get_filtered_team_tasks(team_id, ..., cu_token = NULL) -cuf_create_task(list_id, ...) +cuf_create_task(list_id, ..., cu_token = NULL) -cuf_update_task(task_id, ...) +cuf_update_task(task_id, ..., cu_token = NULL) cuf_delete_task(task_id) -cuf_get_tasks(list_id, archived = FALSE, ...) +cuf_get_tasks(list_id, archived = FALSE, ..., cu_token = NULL) -cuf_get_task(task_id) +cuf_get_task(task_id, cu_token = NULL) -cuf_get_filtered_team_tasks(team_id, ...) +cuf_get_filtered_team_tasks(team_id, ..., cu_token = NULL) } \arguments{ \item{list_id}{List ID.} diff --git a/man/api-teams.Rd b/man/api-teams.Rd index 4f3dad9..2f65e23 100644 --- a/man/api-teams.Rd +++ b/man/api-teams.Rd @@ -8,7 +8,7 @@ \usage{ cu_get_teams(cu_token = NULL) -cuf_get_teams() +cuf_get_teams(cu_token = NULL) } \arguments{ \item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. diff --git a/man/api-timetracking-2.Rd b/man/api-timetracking-2.Rd index e5a30b3..0a72a40 100644 --- a/man/api-timetracking-2.Rd +++ b/man/api-timetracking-2.Rd @@ -62,9 +62,15 @@ cu_delete_time_entry(team_id, timer_id, cu_token = NULL) cu_update_time_entry(team_id, timer_id, ..., cu_token = NULL) -cuf_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) +cuf_get_time_entries_within_date_range( + team_id, + start_date, + end_date, + assignee, + cu_token = NULL +) -cuf_get_singular_time_entry(team_id, timer_id) +cuf_get_singular_time_entry(team_id, timer_id, cu_token = NULL) cuf_get_time_entry_history(team_id, timer_id) From 442211c71efeb751968bbda2c73da81791db466f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:00:33 +0200 Subject: [PATCH 121/137] Add ... to cu_get_task() and cuf_get_task() --- R/api-tasks.R | 4 ++-- R/df-tasks.R | 4 ++-- man/api-tasks.Rd | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/api-tasks.R b/R/api-tasks.R index 6f29988..1750b82 100644 --- a/R/api-tasks.R +++ b/R/api-tasks.R @@ -294,9 +294,9 @@ cu_get_tasks <- function(list_id, archived=FALSE, ..., cu_token = NULL) { ## task_id ## Example: 9hz. ## String -cu_get_task <- function(task_id, cu_token = NULL) { +cu_get_task <- function(task_id, ..., cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_get("task", task_id, cu_token = cu_token) + .cu_get("task", task_id, ..., cu_token = cu_token) } diff --git a/R/df-tasks.R b/R/df-tasks.R index 7d7b04b..90b2433 100644 --- a/R/df-tasks.R +++ b/R/df-tasks.R @@ -37,8 +37,8 @@ cuf_get_tasks <- function(list_id, archived=FALSE, ..., cu_token = NULL) { #' @export #' @rdname api-tasks -cuf_get_task <- function(task_id, cu_token = NULL) { - out <- cu_get_task(task_id, cu_token = cu_token) +cuf_get_task <- function(task_id, ..., cu_token = NULL) { + out <- cu_get_task(task_id, ..., cu_token = cu_token) tibblify(list(out), spec_tasks) } diff --git a/man/api-tasks.Rd b/man/api-tasks.Rd index 0541d2d..1f5f52a 100644 --- a/man/api-tasks.Rd +++ b/man/api-tasks.Rd @@ -24,7 +24,7 @@ cu_delete_task(task_id, cu_token = NULL) cu_get_tasks(list_id, archived = FALSE, ..., cu_token = NULL) -cu_get_task(task_id, cu_token = NULL) +cu_get_task(task_id, ..., cu_token = NULL) cu_get_filtered_team_tasks(team_id, ..., cu_token = NULL) @@ -36,7 +36,7 @@ cuf_delete_task(task_id) cuf_get_tasks(list_id, archived = FALSE, ..., cu_token = NULL) -cuf_get_task(task_id, cu_token = NULL) +cuf_get_task(task_id, ..., cu_token = NULL) cuf_get_filtered_team_tasks(team_id, ..., cu_token = NULL) } From b73b3e7d9dd34d23cde2beba36d21feddf041a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:00:45 +0200 Subject: [PATCH 122/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 923af17..fc575c2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9016 +Version: 0.0.6.9017 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 6c57d61cd4e59512b77e14e6efdcbdef44ee8a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:22:31 +0200 Subject: [PATCH 123/137] Fix --- R/api-tasks.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/api-tasks.R b/R/api-tasks.R index 1750b82..d21ea49 100644 --- a/R/api-tasks.R +++ b/R/api-tasks.R @@ -296,7 +296,7 @@ cu_get_tasks <- function(list_id, archived=FALSE, ..., cu_token = NULL) { ## String cu_get_task <- function(task_id, ..., cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_get("task", task_id, ..., cu_token = cu_token) + .cu_get("task", task_id, query = list(...), cu_token = cu_token) } From ac4720966c30ac846d765d79da5ea5f8d7650ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:22:38 +0200 Subject: [PATCH 124/137] Refine spec --- R/spec-tasks.R | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 25c9435..164ee67 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -7,6 +7,7 @@ spec_tasks <- tspec_df( tib_chr("description"), tib_row( "status", + tib_chr("id"), tib_chr("status"), tib_chr("color"), tib_chr("type"), @@ -35,7 +36,16 @@ spec_tasks <- tspec_df( tib_chr("email"), tib_chr("profilePicture"), ), - # tib_unspecified("watchers"), + # tib_unspecified("group_assignees"), + tib_df( + "watchers", + tib_chr("id", transform = as.character, ptype_inner = integer()), + tib_chr("username"), + tib_chr("color"), + tib_chr("initials"), + tib_chr("email"), + tib_chr("profilePicture"), + ), tib_df( "checklists", tib_chr("id"), @@ -206,4 +216,5 @@ spec_tasks <- tspec_df( "space", tib_chr("id"), ), + # tib_unspecified("attachments"), ) From df2e327c5f15cf73fe78bb0ae2dd1e67387c86d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:24:37 +0200 Subject: [PATCH 125/137] Coerce logicals --- R/internals.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/internals.R b/R/internals.R index d58e05e..b533d36 100644 --- a/R/internals.R +++ b/R/internals.R @@ -74,6 +74,13 @@ ## convenience function for GET requests .cu_get_page <- function(..., query=list(), cu_token = NULL) { + query <- lapply(query, function(.x) { + if (is.logical(.x)) { + .x <- if (.x) "true" else "false" + } + .x + }) + resp <- .rate_insist(httr::GET( httr::modify_url(getOption("cu_options")$baseurl, path = .cu_path(...), From dfd038033681bb0feb1c4181f64a35db264e9309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:25:48 +0200 Subject: [PATCH 126/137] Include subtasks in spec --- R/spec-tasks.R | 52 ++++++++++++++++++++++++++++++++++++++ script/tibblify-05-tasks.R | 3 ++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 164ee67..937cc3b 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -216,5 +216,57 @@ spec_tasks <- tspec_df( "space", tib_chr("id"), ), + tib_df( + "subtasks", + .required = FALSE, + tib_chr("id"), + tib_int("custom_item_id"), + tib_chr("name"), + tib_row( + "status", + tib_chr("status"), + tib_int("orderindex"), + tib_chr("color"), + tib_chr("type"), + ), + tib_dbl("orderindex", transform = as.numeric, ptype_inner = character()), + tib_custom("date_created", cu_date_from), + tib_custom("date_updated", cu_date_from), + # tib_unspecified("date_closed"), + # tib_unspecified("date_done"), + tib_lgl("archived"), + tib_row( + "creator", + tib_chr("id", transform = as.character, ptype_inner = integer()), + tib_chr("username"), + tib_chr("color"), + tib_chr("email"), + tib_chr("profilePicture"), + ), + tib_df( + "assignees", + tib_chr("id", transform = as.character, ptype_inner = integer()), + tib_chr("username"), + tib_chr("color"), + tib_chr("initials"), + tib_chr("email"), + tib_chr("profilePicture"), + ), + # tib_unspecified("group_assignees"), + # tib_unspecified("watchers"), + # tib_unspecified("checklists"), + # tib_unspecified("tags"), + tib_chr("parent"), + tib_custom("due_date", cu_date_from), + tib_custom("start_date", cu_date_from), + # tib_unspecified("points"), + # tib_unspecified("time_estimate"), + tib_int("time_spent"), + # tib_unspecified("custom_fields"), + # tib_unspecified("dependencies"), + # tib_unspecified("linked_tasks"), + # tib_unspecified("locations"), + tib_chr("url"), + ), # tib_unspecified("attachments"), ) diff --git a/script/tibblify-05-tasks.R b/script/tibblify-05-tasks.R index 504f5ee..2262997 100644 --- a/script/tibblify-05-tasks.R +++ b/script/tibblify-05-tasks.R @@ -19,13 +19,14 @@ df_folder df_list <- cuf_get_lists(df_folder$id[[1]]) df_list -df_tasks <- cuf_get_tasks(df_list$id[[1]]) +df_tasks <- cuf_get_tasks(df_list$id[[1]], include_subtasks = TRUE) df_tasks df_tasks$priority df_tasks$custom_fields[[1]] df_tasks$dependencies[[1]] df_tasks$sharing df_tasks$sharing$public_fields[[1]] +df_tasks$subtasks df_all_tasks <- cuf_get_filtered_team_tasks(df_teams$id[[1]], include_closed = TRUE, subtasks = TRUE) df_all_tasks From 061d7a0fda5070323ed10026a8b2ff24dbc41cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 08:30:32 +0200 Subject: [PATCH 127/137] Avoid LazyData --- DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index fc575c2..3103e63 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,7 +34,6 @@ VignetteBuilder: knitr Config/testthat/edition: 3 Encoding: UTF-8 -LazyData: true LazyLoad: yes Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 From 23229e35cdfbd1c8edb68372dad08a0384b816cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 9 May 2024 08:59:36 +0200 Subject: [PATCH 128/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3103e63..9a64924 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9017 +Version: 0.0.6.9018 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From c63246afb467511988a83abd752994f6272571ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 9 May 2024 08:59:58 +0200 Subject: [PATCH 129/137] Tweak schema --- R/spec-tasks.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/spec-tasks.R b/R/spec-tasks.R index 937cc3b..a3ff878 100644 --- a/R/spec-tasks.R +++ b/R/spec-tasks.R @@ -261,7 +261,9 @@ spec_tasks <- tspec_df( tib_custom("start_date", cu_date_from), # tib_unspecified("points"), # tib_unspecified("time_estimate"), - tib_int("time_spent"), + # FIXME: Seen this field as string and integer in two subtasks of the same task + # How to handle in tibblify? + # tib_dbl("time_spent", transform = as.numeric, ptype_inner = list(), required = FALSE), # tib_unspecified("custom_fields"), # tib_unspecified("dependencies"), # tib_unspecified("linked_tasks"), From 47b6f631d2c9121091d902894d1a2048c71633db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 9 May 2024 09:13:10 +0200 Subject: [PATCH 130/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9a64924..110968d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9018 +Version: 0.0.6.9019 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From b20d049a5ad8558337c27fdfc5a36f753135968f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 7 Aug 2024 15:28:54 +0200 Subject: [PATCH 131/137] New structure for spaces --- R/spec-spaces.R | 116 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 20 deletions(-) diff --git a/R/spec-spaces.R b/R/spec-spaces.R index 63f5a3a..d96702e 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -10,32 +10,108 @@ spec_spaces <- tspec_df( tib_chr("id"), tib_chr("status"), tib_chr("type"), - tib_dbl("orderindex"), + tib_int("orderindex"), tib_chr("color"), ), tib_lgl("multiple_assignees"), - tib_df( + tib_row( "features", - .names_to = ".names", - tib_lgl("enabled", required = FALSE), - tib_lgl("start_date", required = FALSE), - tib_lgl("remap_due_dates", required = FALSE), - tib_lgl("remap_closed_due_date", required = FALSE), - tib_lgl("harvest", required = FALSE), - tib_lgl("rollup", required = FALSE), - tib_int("default_to_billable", required = FALSE), - tib_df( + tib_row( + "due_dates", + tib_lgl("enabled"), + tib_lgl("start_date"), + tib_lgl("remap_due_dates"), + tib_lgl("remap_closed_due_date"), + ), + tib_row( + "sprints", + tib_lgl("enabled"), + ), + tib_row( + "time_tracking", + tib_lgl("enabled", required = FALSE), + tib_lgl("harvest", required = FALSE), + tib_lgl("rollup", required = FALSE), + tib_int("default_to_billable"), + ), + tib_row( + "points", + tib_lgl("enabled"), + ), + tib_row( + "custom_items", + tib_lgl("enabled"), + ), + tib_row( "priorities", + tib_lgl("enabled"), + tib_df( + "priorities", + tib_chr("color"), + tib_chr("id"), + tib_dbl("orderindex", transform = as.numeric, ptype_inner = character()), + tib_chr("priority"), + ), + ), + tib_row( + "tags", + tib_lgl("enabled"), + ), + tib_row( + "wip_limits", .required = FALSE, - tib_chr("color"), - tib_chr("id"), - tib_dbl("orderindex", transform = as.numeric, ptype_inner = character()), - tib_chr("priority"), - ), - tib_lgl("per_assignee", required = FALSE), - tib_lgl("subtasks", required = FALSE), - # tib_unspecified("checklists", required = FALSE), - # tib_unspecified("comments", required = FALSE), + tib_lgl("enabled", required = FALSE), + ), + tib_row( + "time_estimates", + .required = FALSE, + tib_lgl("enabled", required = FALSE), + tib_lgl("rollup", required = FALSE), + tib_lgl("per_assignee", required = FALSE), + ), + tib_row( + "check_unresolved", + tib_lgl("enabled"), + tib_lgl("subtasks"), + # tib_unspecified("checklists"), + # tib_unspecified("comments"), + ), + tib_row( + "zoom", + tib_lgl("enabled"), + ), + tib_row( + "milestones", + tib_lgl("enabled"), + ), + tib_row( + "custom_fields", + tib_lgl("enabled"), + ), + tib_row( + "remap_dependencies", + .required = FALSE, + tib_lgl("enabled", required = FALSE), + ), + tib_row( + "dependency_warning", + tib_lgl("enabled"), + ), + tib_row( + "status_pies", + tib_lgl("enabled"), + ), + tib_row( + "multiple_assignees", + .required = FALSE, + tib_lgl("enabled", required = FALSE), + ), + tib_row( + "emails", + .required = FALSE, + tib_lgl("enabled", required = FALSE), + ), + tib_lgl("scheduler_enabled"), ), tib_lgl("archived"), tib_df( From c0318e4e011da0fae54a655edbf47edc2f2cc929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 7 Aug 2024 15:56:32 +0200 Subject: [PATCH 132/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 110968d..f350bee 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9019 +Version: 0.0.6.9020 Date: 2021-12-12 Authors@R: c(person(given = "Peter", From 395f1fbf96a584526a138fb79bc313a371d1e53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 25 Mar 2025 21:38:48 +0100 Subject: [PATCH 133/137] Upstream change --- DESCRIPTION | 2 +- R/spec-spaces.R | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f350bee..7ddb679 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9020 +Version: 0.0.6.9021 Date: 2021-12-12 Authors@R: c(person(given = "Peter", diff --git a/R/spec-spaces.R b/R/spec-spaces.R index d96702e..3a7d663 100644 --- a/R/spec-spaces.R +++ b/R/spec-spaces.R @@ -79,6 +79,7 @@ spec_spaces <- tspec_df( tib_row( "zoom", tib_lgl("enabled"), + .required = FALSE, ), tib_row( "milestones", From 8764bd09ffdccd2d00078183a0281e2617a8e13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 25 Mar 2025 21:38:53 +0100 Subject: [PATCH 134/137] IDE --- clickrup.Rproj | 1 + 1 file changed, 1 insertion(+) diff --git a/clickrup.Rproj b/clickrup.Rproj index f342560..f25ef24 100644 --- a/clickrup.Rproj +++ b/clickrup.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 1ac0f9b4-30f5-48a4-ad29-e4869b4f05be RestoreWorkspace: No SaveWorkspace: No From a141bb024d2a6040d51d4f35af2f96384d5dcf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 29 May 2025 11:22:56 +0200 Subject: [PATCH 135/137] Revert "cu_date_to() gets tz argument" This reverts commit 64ca83265d759efbaaf20d30baa30cebe233dfc9. --- R/cu-date.R | 5 +---- man/cu-date.Rd | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/R/cu-date.R b/R/cu-date.R index 92ed031..e9a8598 100644 --- a/R/cu-date.R +++ b/R/cu-date.R @@ -51,9 +51,6 @@ cu_date_from <- function(ms, tz = NULL, ...) { #' @export #' @rdname cu-date ## turning POSIXct to unix time -cu_date_to <- function(dt, tz = NULL) { - if (is.null(tz)) - tz <- getOption("cu_options")$tz - +cu_date_to <- function(dt) { as.character(round(unclass(as.POSIXct(dt))*1000)) } diff --git a/man/cu-date.Rd b/man/cu-date.Rd index ce68d5b..2cf97df 100644 --- a/man/cu-date.Rd +++ b/man/cu-date.Rd @@ -8,7 +8,7 @@ \usage{ cu_date_from(ms, tz = NULL, ...) -cu_date_to(dt, tz = NULL) +cu_date_to(dt) } \arguments{ \item{ms}{ClickUp date/time format, Unix time in milliseconds.} From a444863c4779c0c6313100ab3ac0e8a5c2b45fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 29 May 2025 11:25:42 +0200 Subject: [PATCH 136/137] Avoid exponential notation --- R/cu-date.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cu-date.R b/R/cu-date.R index e9a8598..d67f4ba 100644 --- a/R/cu-date.R +++ b/R/cu-date.R @@ -52,5 +52,5 @@ cu_date_from <- function(ms, tz = NULL, ...) { #' @rdname cu-date ## turning POSIXct to unix time cu_date_to <- function(dt) { - as.character(round(unclass(as.POSIXct(dt))*1000)) + sprintf("%.0f", round(unclass(as.POSIXct(dt))*1000)) } From 9dcf5fc13b40d63e62376d397234a6cc97960cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 29 May 2025 11:25:53 +0200 Subject: [PATCH 137/137] Bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7ddb679..64a693a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: clickrup Title: Interacting with the ClickUp v2 API from R -Version: 0.0.6.9021 +Version: 0.0.6.9022 Date: 2021-12-12 Authors@R: c(person(given = "Peter",