diff --git a/R/api-attachments.R b/R/api-attachments.R index 264231c..31ff3ad 100644 --- a/R/api-attachments.R +++ b/R/api-attachments.R @@ -9,6 +9,8 @@ #' 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. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @examples #' \dontrun{ diff --git a/R/api-authorization.R b/R/api-authorization.R index 36f03f0..d065d6d 100644 --- a/R/api-authorization.R +++ b/R/api-authorization.R @@ -7,6 +7,8 @@ #' @param client_id Oauth app client id. #' @param client_secret Oauth app client secret. #' @param code Code given in redirect URL. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -32,11 +34,12 @@ NULL ## code ## Code given in redirect url ## String -cu_get_access_token <- function(client_id, client_secret, code) { +cu_get_access_token <- function(client_id, client_secret, code, cu_token = NULL) { .cu_post("oauth", "token", query=list(client_id=client_id, client_secret=client_secret, - code=code)) + code=code), + cu_token = cu_token) } @@ -44,8 +47,8 @@ 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() { - .cu_get("user") +cu_get_authorized_user <- function(cu_token = NULL) { + .cu_get("user", cu_token = cu_token) } @@ -56,6 +59,6 @@ cu_get_authorized_user <- function() { ## ## Note: this is the same endpoint as for cu_get_teams ## -cu_get_authorized_teams <- function() { - .cu_get("team") +cu_get_authorized_teams <- function(cu_token = NULL) { + .cu_get("team", cu_token = cu_token) } diff --git a/R/api-checklists.R b/R/api-checklists.R index f05d686..37fade2 100644 --- a/R/api-checklists.R +++ b/R/api-checklists.R @@ -11,6 +11,8 @@ #' @param checklist_item_id Checklist item ID. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @examples #' \dontrun{ @@ -49,10 +51,11 @@ 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) { +cu_create_checklist <- function(task_id, name, cu_token = NULL) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "checklist", - body=list(name = name)) + body=list(name = name), + cu_token = cu_token) } #cu_create_checklist("8ach57", "New checklist") @@ -68,9 +71,10 @@ 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) { +cu_edit_checklist <- function(checklist_id, position, cu_token = NULL) { .cu_put("checklist", checklist_id, - body=list(position = position)) + body=list(position = position), + cu_token = cu_token) } #cu_edit_checklist("4bc57892-a1a6-44f4-894d-d98de71f4054", 0) @@ -82,8 +86,8 @@ cu_edit_checklist <- function(checklist_id, position) { ## checklist_id ## b8a8-48d8-a0c6-b4200788a683 (uuid) ## Example: b955c4dc. String -cu_delete_checklist <- function(checklist_id) { - .cu_delete("checklist", checklist_id) +cu_delete_checklist <- function(checklist_id, cu_token = NULL) { + .cu_delete("checklist", checklist_id, cu_token = cu_token) } #cu_delete_checklist("4bc57892-a1a6-44f4-894d-d98de71f4054") @@ -104,9 +108,10 @@ cu_delete_checklist <- function(checklist_id) { ## "resolved": true, ## "parent": null ## } -cu_create_checklist_item <- function(checklist_id, name, ...) { +cu_create_checklist_item <- function(checklist_id, name, ..., cu_token = NULL) { .cu_post("checklist", checklist_id, "checklist_item", - body=list(name = name, ...)) + body=list(name = name, ...), + cu_token = cu_token) } #cu_create_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", # name="New item 1") @@ -133,9 +138,10 @@ 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, ...) { +cu_edit_checklist_item <- function(checklist_id, checklist_item_id, ..., cu_token = NULL) { .cu_put("checklist", checklist_id, "checklist_item", checklist_item_id, - body=list(...)) + body=list(...), + cu_token = cu_token) } #cu_put_edit_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", # "8849fcba-9db4-4400-a78e-cfced2ae6ce0", @@ -155,8 +161,8 @@ 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) { - .cu_delete("checklist", checklist_id, "checklist_item", checklist_item_id) +cu_delete_checklist_item <- function(checklist_id, checklist_item_id, cu_token = NULL) { + .cu_delete("checklist", checklist_id, "checklist_item", checklist_item_id, cu_token = cu_token) } #cu_delete_checklist_item("40146d1e-efe5-4140-a0ba-ad39c9dec18c", # "8849fcba-9db4-4400-a78e-cfced2ae6ce0") diff --git a/R/api-comments.R b/R/api-comments.R index 0239064..6cb6fae 100644 --- a/R/api-comments.R +++ b/R/api-comments.R @@ -8,6 +8,8 @@ #' @param comment_id Comment ID. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -35,10 +37,11 @@ NULL ## "assignee": 183, ## "notify_all": true ## } -cu_post_task_comment <- function(task_id, ...) { +cu_post_task_comment <- function(task_id, ..., cu_token = NULL) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "comment", - body=list(...)) + body=list(...), + cu_token = cu_token) } @@ -60,9 +63,10 @@ cu_post_task_comment <- function(task_id, ...) { ## "comment_text": "View comment content", ## "notify_all": true ## } -cu_post_view_comment <- function(view_id, ...) { +cu_post_view_comment <- function(view_id, ..., cu_token = NULL) { .cu_post("view", view_id, "comment", - body=list(...)) + body=list(...), + cu_token = cu_token) } @@ -84,9 +88,10 @@ cu_post_view_comment <- function(view_id, ...) { ## "assignee": 183, ## "notify_all": true ## } -cu_post_list_comment <- function(list_id, ...) { +cu_post_list_comment <- function(list_id, ..., cu_token = NULL) { .cu_post("list", list_id, "comment", - body=list(...)) + body=list(...), + cu_token = cu_token) } @@ -97,9 +102,9 @@ cu_post_list_comment <- function(list_id, ...) { ## task_id ## Example: 9hz. ## String -cu_get_task_comments <- function(task_id) { +cu_get_task_comments <- function(task_id, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_get("task", task_id, "comment") + .cu_get("task", task_id, "comment", cu_token = cu_token) } @@ -111,8 +116,8 @@ cu_get_task_comments <- function(task_id) { ## 105 (string) ## Example: 3c. ## String -cu_get_view_comments <- function(view_id) { - .cu_get("view", view_id, "comment") +cu_get_view_comments <- function(view_id, cu_token = NULL) { + .cu_get("view", view_id, "comment", cu_token = cu_token) } @@ -123,8 +128,8 @@ cu_get_view_comments <- function(view_id) { ## list_id ## Example: 124. ## Number -cu_get_list_comments <- function(list_id) { - .cu_get("list", list_id, "comment") +cu_get_list_comments <- function(list_id, cu_token = NULL) { + .cu_get("list", list_id, "comment", cu_token = cu_token) } @@ -143,9 +148,10 @@ cu_get_list_comments <- function(list_id) { ## "assignee": 183, ## "resolved": true ## } -cu_put_update_comment <- function(comment_id, ...) { +cu_put_update_comment <- function(comment_id, ..., cu_token = NULL) { .cu_put("comment", comment_id, - body=list(...)) + body=list(...), + cu_token = cu_token) } @@ -156,6 +162,6 @@ cu_put_update_comment <- function(comment_id, ...) { ## comment_id ## Example: 456. ## Number -cu_delete_comment <- function(comment_id) { - .cu_delete("comment", comment_id) +cu_delete_comment <- function(comment_id, cu_token = NULL) { + .cu_delete("comment", comment_id, cu_token = cu_token) } diff --git a/R/api-customfields.R b/R/api-customfields.R index 07ceb00..6133c07 100644 --- a/R/api-customfields.R +++ b/R/api-customfields.R @@ -9,6 +9,8 @@ #' 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 (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -26,8 +28,8 @@ NULL ## list_id ## Example: 123. ## Number -cu_get_accessible_custom_fields <- function(list_id) { - .cu_get("list", list_id, "field") +cu_get_accessible_custom_fields <- function(list_id, cu_token = NULL) { + .cu_get("list", list_id, "field", cu_token = cu_token) } @@ -54,10 +56,11 @@ 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, ...) { +cu_set_custom_field_value <- function(task_id, field_id, ..., cu_token = NULL) { task_id <- cu_task_id(task_id) .cu_post("task", task_id, "field", field_id, - body=list(...)) + body=list(...), + cu_token = cu_token) } @@ -77,7 +80,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) { +cu_remove_field_value <- function(task_id, field_id, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_delete("task", task_id, "field", field_id) + .cu_delete("task", task_id, "field", field_id, cu_token = cu_token) } diff --git a/R/api-dependencies.R b/R/api-dependencies.R index 27e27f5..47941c9 100644 --- a/R/api-dependencies.R +++ b/R/api-dependencies.R @@ -8,6 +8,8 @@ #' @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. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -34,7 +36,7 @@ NULL ## { ## "depends_on": "9hw" ## } -cu_add_dependency <- function(task_id, depends_on, dependency_of) { +cu_add_dependency <- function(task_id, depends_on, dependency_of, cu_token = NULL) { 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) @@ -45,7 +47,7 @@ cu_add_dependency <- function(task_id, depends_on, dependency_of) { if (missing(depends_on) && !missing(dependency_of)) body <- list(dependency_of=dependency_of) .cu_post("task", task_id, "dependency", - body=body) + body=body, cu_token = cu_token) } @@ -68,7 +70,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) { +cu_delete_dependency <- function(task_id, depends_on, dependency_of, cu_token = NULL) { 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) @@ -79,7 +81,7 @@ cu_delete_dependency <- function(task_id, depends_on, dependency_of) { if (missing(depends_on) && !missing(dependency_of)) query <- list(dependency_of=dependency_of) .cu_delete("task", task_id, "dependency", - query=query) + query=query, cu_token = cu_token) } @@ -95,9 +97,9 @@ cu_delete_dependency <- function(task_id, depends_on, dependency_of) { ## links_to ## Example: 9hz. ## String -cu_add_task_link <- function(task_id, links_to) { +cu_add_task_link <- function(task_id, links_to, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_post("task", task_id, "link", links_to) + .cu_post("task", task_id, "link", links_to, cu_token = cu_token) } @@ -113,7 +115,7 @@ cu_add_task_link <- function(task_id, links_to) { ## links_to ## Example: 9hz. ## String -cu_delete_task_link <- function(task_id, links_to) { +cu_delete_task_link <- function(task_id, links_to, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_delete("task", task_id, "link", links_to) + .cu_delete("task", task_id, "link", links_to, cu_token = cu_token) } diff --git a/R/api-folders.R b/R/api-folders.R index dc66c31..24125f1 100644 --- a/R/api-folders.R +++ b/R/api-folders.R @@ -6,6 +6,8 @@ #' @param name Name of the folder. #' @param folder_id Folder ID. #' @param archived Logical, to return archived (`TRUE`) folders. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -30,9 +32,9 @@ NULL ## { ## "name": "New Folder Name" ## } -cu_create_folder <- function(space_id, name) { +cu_create_folder <- function(space_id, name, cu_token = NULL) { .cu_post("space", space_id, "folder", - body=list(name=name)) + body=list(name=name), cu_token = cu_token) } @@ -50,9 +52,9 @@ cu_create_folder <- function(space_id, name) { ## { ## "name": "Updated Folder Name" ## } -cu_update_folder <- function(folder_id, name) { +cu_update_folder <- function(folder_id, name, cu_token = NULL) { .cu_put("folder", folder_id, - body=list(name=name)) + body=list(name=name), cu_token = cu_token) } @@ -64,8 +66,8 @@ cu_update_folder <- function(folder_id, name) { ## folder_id ## Example: 457. ## Number -cu_delete_folder <- function(folder_id, name) { - .cu_delete("folder", folder_id) +cu_delete_folder <- function(folder_id, name, cu_token = NULL) { + .cu_delete("folder", folder_id, cu_token = cu_token) } @@ -81,9 +83,10 @@ cu_delete_folder <- function(folder_id, name) { ## archived ## Example: false. ## Boolean -cu_get_folders <- function(space_id, archived=FALSE) { +cu_get_folders <- function(space_id, archived=FALSE, cu_token = NULL) { .cu_get("space", space_id, "folder", - query = list("archived" = tolower(archived))) + query = list("archived" = tolower(archived)), + cu_token = cu_token) } @@ -95,6 +98,6 @@ cu_get_folders <- function(space_id, archived=FALSE) { ## folder_id ## Example: 457. ## Number -cu_get_folder <- function(folder_id) { - .cu_get("folder", folder_id) +cu_get_folder <- function(folder_id, cu_token = NULL) { + .cu_get("folder", folder_id, cu_token = cu_token) } diff --git a/R/api-goals.R b/R/api-goals.R index 44bf314..11bf923 100644 --- a/R/api-goals.R +++ b/R/api-goals.R @@ -7,6 +7,8 @@ #' @param key_result_id Key result ID. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -38,9 +40,9 @@ NULL ## ], ## "color": "#32a852" ## } -cu_create_goal <- function(team_id, ...) { +cu_create_goal <- function(team_id, ..., cu_token = NULL) { .cu_post("team", team_id, "goal", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -64,9 +66,9 @@ cu_create_goal <- function(team_id, ...) { ## "add_owners": [182] ## "color": "#32a852" ## } -cu_update_goal <- function(goal_id, ...) { +cu_update_goal <- function(goal_id, ..., cu_token = NULL) { .cu_put("goal", goal_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -79,8 +81,8 @@ cu_update_goal <- function(goal_id, ...) { ## 900e-462d-a849-4a216b06d930 (uuid) ## Example: e53a033c. ## String -cu_delete_goal <- function(goal_id) { - .cu_delete("goal", goal_id) +cu_delete_goal <- function(goal_id, cu_token = NULL) { + .cu_delete("goal", goal_id, cu_token = cu_token) } @@ -92,8 +94,8 @@ cu_delete_goal <- function(goal_id) { ## team_id ## Example: 512. ## Number -cu_get_goals <- function(team_id) { - .cu_get("team", team_id, "goal") +cu_get_goals <- function(team_id, cu_token = NULL) { + .cu_get("team", team_id, "goal", cu_token = cu_token) } @@ -106,8 +108,8 @@ cu_get_goals <- function(team_id) { ## 900e-462d-a849-4a216b06d930 (uuid) ## Example: e53a033c. ## String -cu_get_goal <- function(goal_id) { - .cu_get("goal", goal_id) +cu_get_goal <- function(goal_id, cu_token = NULL) { + .cu_get("goal", goal_id, cu_token = cu_token) } @@ -139,9 +141,9 @@ cu_get_goal <- function(goal_id) { ## "task_ids": [], ## "list_ids": [] ## } -cu_create_key_result <- function(goal_id, ...) { +cu_create_key_result <- function(goal_id, ..., cu_token = NULL) { .cu_post("goal", goal_id, "key_result", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -164,9 +166,9 @@ cu_create_key_result <- function(goal_id, ...) { ## "steps_current": 5, ## "note": "Target achieved" ## } -cu_edit_key_result <- function(key_result_id, ...) { +cu_edit_key_result <- function(key_result_id, ..., cu_token = NULL) { .cu_put("key_result", key_result_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -179,8 +181,8 @@ cu_edit_key_result <- function(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) +cu_delete_key_result <- function(key_result_id, cu_token = NULL) { + .cu_delete("key_result", key_result_id, cu_token = cu_token) } diff --git a/R/api-guests.R b/R/api-guests.R index b92e293..8b84f9d 100644 --- a/R/api-guests.R +++ b/R/api-guests.R @@ -11,6 +11,8 @@ #' @param task_id Task ID. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -33,8 +35,8 @@ 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) { - .cu_post("team", team_id, "guest") +cu_invite_guest_to_workspace <- function(team_id, cu_token = NULL) { + .cu_post("team", team_id, "guest", cu_token = cu_token) } @@ -59,9 +61,9 @@ 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, ...) { +cu_edit_guest_on_workspace <- function(team_id, guest_id, ..., cu_token = NULL) { .cu_put("team", team_id, "guest", guest_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -76,8 +78,8 @@ 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) { - .cu_delete("team", team_id, "guest", guest_id) +cu_remove_guest_from_workspace <- function(team_id, guest_id, cu_token = NULL) { + .cu_delete("team", team_id, "guest", guest_id, cu_token = cu_token) } @@ -93,8 +95,8 @@ cu_remove_guest_from_workspace <- function(team_id, guest_id) { ## guest_id ## Example: 403. ## Number -cu_get_guest <- function(team_id, guest_id) { - .cu_get("team", team_id, "guest", guest_id) +cu_get_guest <- function(team_id, guest_id, cu_token = NULL) { + .cu_get("team", team_id, "guest", guest_id, cu_token = cu_token) } @@ -118,12 +120,13 @@ cu_get_guest <- function(team_id, guest_id) { ## { ## "permission_level": "read" ## } -cu_add_guest_to_task <- function(task_id, guest_id, permission_level="read") { +cu_add_guest_to_task <- function(task_id, guest_id, permission_level="read", cu_token = NULL) { 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)) + body=list(permission_level=permission_level), + cu_token = cu_token) } @@ -139,9 +142,9 @@ 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) { +cu_remove_guest_from_task <- function(task_id, guest_id, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_delete("task", task_id, "guest", guest_id) + .cu_delete("task", task_id, "guest", guest_id, cu_token = cu_token) } @@ -165,11 +168,12 @@ 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") { +cu_add_guest_to_list <- function(list_id, guest_id, permission_level="read", cu_token = NULL) { 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)) + body=list(permission_level=permission_level), + cu_token = cu_token) } @@ -185,8 +189,8 @@ 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) { - .cu_delete("list", list_id, "guest", guest_id) +cu_remove_guest_from_list <- function(list_id, guest_id, cu_token = NULL) { + .cu_delete("list", list_id, "guest", guest_id, cu_token = cu_token) } @@ -211,11 +215,12 @@ cu_remove_guest_from_list <- function(list_id, guest_id) { ## "permission_level": "read" ## } cu_add_guest_to_folder <- function(folder_id, guest_id, - permission_level="read") { + permission_level="read", cu_token = NULL) { 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)) + body=list(permission_level=permission_level), + cu_token = cu_token) } @@ -233,6 +238,6 @@ cu_add_guest_to_folder <- function(folder_id, guest_id, ## Number ## ## -cu_remove_guest_from_folder <- function(folder_id, guest_id) { - .cu_delete("folder", folder_id, "guest", guest_id) +cu_remove_guest_from_folder <- function(folder_id, guest_id, cu_token = NULL) { + .cu_delete("folder", folder_id, "guest", guest_id, cu_token = cu_token) } diff --git a/R/api-lists.R b/R/api-lists.R index e400c81..53999cd 100644 --- a/R/api-lists.R +++ b/R/api-lists.R @@ -8,6 +8,8 @@ #' @param archived Logical, to return archived (`TRUE`) lists. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -41,9 +43,9 @@ NULL ## "assignee": 183, ## "status": "red" ## } -cu_create_list <- function(folder_id, ...) { +cu_create_list <- function(folder_id, ..., cu_token = NULL) { .cu_post("folder", folder_id, "list", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -70,9 +72,9 @@ cu_create_list <- function(folder_id, ...) { ## "assignee": 183, ## "status": "red" ## } -cu_create_folderless_list <- function(space_id, ...) { +cu_create_folderless_list <- function(space_id, ..., cu_token = NULL) { .cu_post("space", space_id, "list", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -101,9 +103,9 @@ cu_create_folderless_list <- function(space_id, ...) { ## "assignee": "none", ## "unset_status": true ## } -cu_update_list <- function(list_id, ...) { +cu_update_list <- function(list_id, ..., cu_token = NULL) { .cu_put("list", list_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -115,8 +117,8 @@ cu_update_list <- function(list_id, ...) { ## list_id ## Example: 124. ## Number -cu_delete_list <- function(list_id, ...) { - .cu_delete("list", list_id) +cu_delete_list <- function(list_id, ..., cu_token = NULL) { + .cu_delete("list", list_id, cu_token = cu_token) } @@ -132,9 +134,10 @@ cu_delete_list <- function(list_id, ...) { ## archived ## Example: false. ## Boolean -cu_get_lists <- function(folder_id, archived=FALSE) { +cu_get_lists <- function(folder_id, archived=FALSE, cu_token = NULL) { .cu_get("folder", folder_id, "list", - query = list("archived" = tolower(archived))) + query = list("archived" = tolower(archived)), + cu_token = cu_token) } @@ -150,9 +153,10 @@ cu_get_lists <- function(folder_id, archived=FALSE) { ## archived ## Example: false. ## Boolean -cu_get_lists_folderless <- function(space_id, archived=FALSE) { +cu_get_lists_folderless <- function(space_id, archived=FALSE, cu_token = NULL) { .cu_get("space", space_id, "list", - query = list("archived" = tolower(archived))) + query = list("archived" = tolower(archived)), + cu_token = cu_token) } @@ -164,6 +168,6 @@ cu_get_lists_folderless <- function(space_id, archived=FALSE) { ## list_id ## Example: 124. ## Number -cu_get_list <- function(list_id) { - .cu_get("list", list_id) +cu_get_list <- function(list_id, cu_token = NULL) { + .cu_get("list", list_id, cu_token = cu_token) } diff --git a/R/api-members.R b/R/api-members.R index e84b51a..ae3d2f7 100644 --- a/R/api-members.R +++ b/R/api-members.R @@ -4,6 +4,8 @@ #' @param task_id Task ID. #' @param list_id List ID. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -22,9 +24,9 @@ NULL ## task_id ## Example: 9hz. ## String -cu_get_task_members <- function(task_id) { +cu_get_task_members <- function(task_id, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_get("task", task_id, "member") + .cu_get("task", task_id, "member", cu_token = cu_token) } @@ -36,6 +38,6 @@ cu_get_task_members <- function(task_id) { ## list_id ## Example: 123. ## Number -cu_get_list_members <- function(list_id) { - .cu_get("list", list_id, "member") +cu_get_list_members <- function(list_id, cu_token = NULL) { + .cu_get("list", list_id, "member", cu_token = cu_token) } diff --git a/R/api-sharedhierarchy.R b/R/api-sharedhierarchy.R index 6a950f9..326d663 100644 --- a/R/api-sharedhierarchy.R +++ b/R/api-sharedhierarchy.R @@ -7,6 +7,8 @@ #' come back in this request. #' @param team_id Team ID. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -27,6 +29,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) { - .cu_get("team", team_id, "shared") +cu_get_shared <- function(team_id, cu_token = NULL) { + .cu_get("team", team_id, "shared", cu_token = cu_token) } diff --git a/R/api-spaces.R b/R/api-spaces.R index 41b9a22..85c06d6 100644 --- a/R/api-spaces.R +++ b/R/api-spaces.R @@ -8,6 +8,8 @@ #' @param archived Logical, to return archived (`TRUE`) spaces. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -65,9 +67,9 @@ NULL ## } ## } ## } -cu_create_space <- function(team_id, name, ...) { +cu_create_space <- function(team_id, name, ..., cu_token = NULL) { .cu_post("team", team_id, "space", - body=list(name=name, ...)) + body=list(name=name, ...), cu_token = cu_token) } @@ -81,9 +83,9 @@ cu_create_space <- function(team_id, name, ...) { ## Number ## ## Same body as for cu_create_space -cu_update_space <- function(space_id, ...) { +cu_update_space <- function(space_id, ..., cu_token = NULL) { .cu_put("space", space_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -95,8 +97,8 @@ cu_update_space <- function(space_id, ...) { ## space_id ## Example: 790. ## Number -cu_delete_space <- function(space_id) { - .cu_delete("space", space_id) +cu_delete_space <- function(space_id, cu_token = NULL) { + .cu_delete("space", space_id, cu_token = cu_token) } @@ -112,9 +114,10 @@ cu_delete_space <- function(space_id) { ## archived ## Example: false. ## Boolean -cu_get_spaces <- function(team_id, archived=FALSE) { +cu_get_spaces <- function(team_id, archived=FALSE, cu_token = NULL) { .cu_get("team", team_id, "space", - query = list("archived" = tolower(archived))) + query = list("archived" = tolower(archived)), + cu_token = cu_token) } @@ -126,6 +129,6 @@ cu_get_spaces <- function(team_id, archived=FALSE) { ## space_id ## Example: 790. ## Number -cu_get_space <- function(space_id) { - .cu_get("space", space_id) +cu_get_space <- function(space_id, cu_token = NULL) { + .cu_get("space", space_id, cu_token = cu_token) } diff --git a/R/api-tags.R b/R/api-tags.R index 17acec0..c5d8e03 100644 --- a/R/api-tags.R +++ b/R/api-tags.R @@ -8,6 +8,8 @@ #' @param name Tag name. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -26,8 +28,8 @@ NULL ## space_id ## Example: 512. ## Number -cu_get_space_tags <- function(space_id) { - .cu_get("space", space_id, "tag") +cu_get_space_tags <- function(space_id, cu_token = NULL) { + .cu_get("space", space_id, "tag", cu_token = cu_token) } @@ -49,10 +51,11 @@ cu_get_space_tags <- function(space_id) { ## "tag_bg": "#000000" ## } ## } -cu_create_space_tag <- function(space_id, name, ...) { +cu_create_space_tag <- function(space_id, name, ..., cu_token = NULL) { .cu_post("space", space_id, "tag", body=list( - tag=list(name=name, ...))) + tag=list(name=name, ...)), + cu_token = cu_token) } @@ -68,8 +71,8 @@ cu_create_space_tag <- function(space_id, name, ...) { ## tag_name ## Example: name. ## String -cu_edit_space_tag <- function(space_id, tag_name) { - .cu_put("space", space_id, "tag", tag_name) +cu_edit_space_tag <- function(space_id, tag_name, cu_token = NULL) { + .cu_put("space", space_id, "tag", tag_name, cu_token = cu_token) } @@ -85,8 +88,8 @@ cu_edit_space_tag <- function(space_id, tag_name) { ## tag_name ## Example: name. ## String -cu_delete_space_tag <- function(space_id) { - .cu_delete("space", space_id, "tag", tag_name) +cu_delete_space_tag <- function(space_id, cu_token = NULL) { + .cu_delete("space", space_id, "tag", tag_name, cu_token = cu_token) } @@ -102,9 +105,9 @@ cu_delete_space_tag <- function(space_id) { ## tag_name ## Example: name. ## String -cu_add_tag_to_task <- function(task_id, tag_name) { +cu_add_tag_to_task <- function(task_id, tag_name, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_post("task", task_id, "tag", tag_name) + .cu_post("task", task_id, "tag", tag_name, cu_token = cu_token) } @@ -120,8 +123,8 @@ cu_add_tag_to_task <- function(task_id, tag_name) { ## tag_name ## Example: name. ## String -cu_delete_space_tag <- function(task_id, tag_name) { +cu_delete_space_tag <- function(task_id, tag_name, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_delete("task", task_id, "tag", tag_name) + .cu_delete("task", task_id, "tag", tag_name, cu_token = cu_token) } diff --git a/R/api-tasks.R b/R/api-tasks.R index c42c2e4..6f29988 100644 --- a/R/api-tasks.R +++ b/R/api-tasks.R @@ -68,6 +68,8 @@ #' @param ... Named arguments to be passed to API request body, #' of as query parameters, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -137,9 +139,9 @@ 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, ...) { +cu_create_task <- function(list_id, ..., cu_token = NULL) { .cu_post("list", list_id, "task", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -172,10 +174,10 @@ cu_create_task <- function(list_id, ...) { ## }, ## "archived": false, ## } -cu_update_task <- function(task_id, ...) { +cu_update_task <- function(task_id, ..., cu_token = NULL) { task_id <- cu_task_id(task_id) .cu_put("task", task_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -187,9 +189,9 @@ cu_update_task <- function(task_id, ...) { ## task_id ## Example: 9xh. ## String -cu_delete_task <- function(task_id) { +cu_delete_task <- function(task_id, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_delete("task", task_id) + .cu_delete("task", task_id, cu_token = cu_token) } @@ -278,9 +280,9 @@ 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, ...) { +cu_get_tasks <- function(list_id, archived=FALSE, ..., cu_token = NULL) { .cu_get("list", list_id, "task", - query = list("archived" = tolower(archived), ...)) + query = list("archived" = tolower(archived), ...), cu_token = cu_token) } @@ -292,9 +294,9 @@ cu_get_tasks <- function(list_id, archived=FALSE, ...) { ## task_id ## Example: 9hz. ## String -cu_get_task <- function(task_id) { +cu_get_task <- function(task_id, cu_token = NULL) { task_id <- cu_task_id(task_id) - .cu_get("task", task_id) + .cu_get("task", task_id, cu_token = cu_token) } @@ -385,8 +387,8 @@ 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, ...) { +cu_get_filtered_team_tasks <- function(team_id, ..., cu_token = NULL) { .cu_get("team", team_id, "task", - query = list(...)) + query = list(...), cu_token = cu_token) } diff --git a/R/api-tasktemplates.R b/R/api-tasktemplates.R index c215774..3898ce3 100644 --- a/R/api-tasktemplates.R +++ b/R/api-tasktemplates.R @@ -10,6 +10,8 @@ #' @param name Name of the task. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -34,9 +36,9 @@ NULL ## Integer ## ## To page task templates, pass the page number you wish to fetch. -cu_get_task_templates <- function(team_id, page) { +cu_get_task_templates <- function(team_id, page, cu_token = NULL) { .cu_get("team", team_id, "taskTemplate", - query = list(page = page)) + query = list(page = page), cu_token = cu_token) } @@ -58,7 +60,7 @@ cu_get_task_templates <- function(team_id, page) { ## { ## "name": "New task name" ## } -cu_create_task_from_template <- function(list_id, template_id, name, ...) { +cu_create_task_from_template <- function(list_id, template_id, name, ..., cu_token = NULL) { .cu_post("list", list_id, "taskTemplate", template_id, - body=list(name=name, ...)) + body=list(name=name, ...), cu_token = cu_token) } diff --git a/R/api-teams.R b/R/api-teams.R index 8af722b..ffe9dc8 100644 --- a/R/api-teams.R +++ b/R/api-teams.R @@ -5,6 +5,8 @@ #' 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. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' @examples #' \dontrun{ #' cu_get_teams() @@ -24,7 +26,7 @@ ## 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_teams <- function(cu_token = NULL) { + .cu_get("team", cu_token = cu_token) } #cu_get_workspaces <- cu_get_teams diff --git a/R/api-timetracking-legacy.R b/R/api-timetracking-legacy.R index 17c05f7..ca98b9a 100644 --- a/R/api-timetracking-legacy.R +++ b/R/api-timetracking-legacy.R @@ -12,6 +12,8 @@ #' @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. +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -45,11 +47,11 @@ 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, ...) { +cu_track_time <- function(task_id, ..., cu_token = NULL) { .Deprecated("cu_create_time_entry") task_id <- cu_task_id(task_id) .cu_post("task", task_id, "time", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -63,10 +65,10 @@ cu_track_time <- function(task_id, ...) { ## String ## ## Get time tracked for a task. -cu_get_tracked_time <- function(task_id) { +cu_get_tracked_time <- function(task_id, cu_token = NULL) { .Deprecated("cu_get_time_entries_within_date_range") task_id <- cu_task_id(task_id) - .cu_get("task", task_id, "time") + .cu_get("task", task_id, "time", cu_token = cu_token) } @@ -93,11 +95,11 @@ 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, ...) { +cu_edit_time_tracked <- function(task_id, interval_id, ..., cu_token = NULL) { .Deprecated("cu_update_time_entry") task_id <- cu_task_id(task_id) .cu_put("task", task_id, "time", interval_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -115,8 +117,8 @@ cu_edit_time_tracked <- function(task_id, interval_id, ...) { ## String ## ## Delete a time tracked entry -cu_delete_time_tracked <- function(task_id, interval_id) { +cu_delete_time_tracked <- function(task_id, interval_id, cu_token = NULL) { .Deprecated("cu_delete_time_entry") task_id <- cu_task_id(task_id) - .cu_delete("task", task_id, "time", interval_id) + .cu_delete("task", task_id, "time", interval_id, cu_token = cu_token) } diff --git a/R/api-timetracking-v2.R b/R/api-timetracking-v2.R index 0111690..af2ae45 100644 --- a/R/api-timetracking-v2.R +++ b/R/api-timetracking-v2.R @@ -12,6 +12,8 @@ #' 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 (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -46,12 +48,13 @@ NULL ## 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) { +start_date, end_date, assignee, cu_token = NULL) { .cu_get("team", team_id, "time_entries", paging = FALSE, query = list( "start_date"=start_date, "end_date"=end_date, - "assignee"=assignee)) + "assignee"=assignee), + cu_token = cu_token) } @@ -67,8 +70,8 @@ start_date, end_date, assignee) { ## timer_id ## Example: 1963465985517105840. ## String -cu_get_singular_time_entry <- function(team_id, timer_id) { - .cu_get("team", team_id, "time_entries", timer_id) +cu_get_singular_time_entry <- function(team_id, timer_id, cu_token = NULL) { + .cu_get("team", team_id, "time_entries", timer_id, cu_token = cu_token) } @@ -84,8 +87,8 @@ 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) { - .cu_get("team", team_id, "time_entries", timer_id, "history") +cu_get_time_entry_history <- function(team_id, timer_id, cu_token = NULL) { + .cu_get("team", team_id, "time_entries", timer_id, "history", cu_token = cu_token) } @@ -97,8 +100,8 @@ 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) { - .cu_get("team", team_id, "time_entries", "current") +cu_get_running_time_entry <- function(team_id, timer_id, cu_token = NULL) { + .cu_get("team", team_id, "time_entries", "current", cu_token = cu_token) } @@ -125,9 +128,9 @@ cu_get_running_time_entry <- function(team_id, timer_id) { ## "duration": 50000, ## "assignee": 1 ## } -cu_create_time_entry <- function(team_id, ...) { +cu_create_time_entry <- function(team_id, ..., cu_token = NULL) { .cu_post("team", team_id, "time_entries", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -148,9 +151,9 @@ cu_create_time_entry <- function(team_id, ...) { ## "name of tag" ## ] ## } -cu_remove_tags_from_time_entries <- function(team_id, ...) { +cu_remove_tags_from_time_entries <- function(team_id, ..., cu_token = NULL) { .cu_delete("team", team_id, "time_entries", "tags", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -162,8 +165,8 @@ cu_remove_tags_from_time_entries <- function(team_id, ...) { ## team_id ## Example: 512. ## Number -cu_get_all_tags_from_time_entries <- function(team_id) { - .cu_get("team", team_id, "time_entries", "tags") +cu_get_all_tags_from_time_entries <- function(team_id, cu_token = NULL) { + .cu_get("team", team_id, "time_entries", "tags", cu_token = cu_token) } @@ -184,9 +187,9 @@ cu_get_all_tags_from_time_entries <- function(team_id) { ## "name of tags" ## ] ## } -cu_add_tags_from_time_entries <- function(team_id, ...) { +cu_add_tags_from_time_entries <- function(team_id, ..., cu_token = NULL) { .cu_post("team", team_id, "time_entries", "tags", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -205,9 +208,9 @@ 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, ...) { +cu_change_tag_names_from_time_entries <- function(team_id, ..., cu_token = NULL) { .cu_put("team", team_id, "time_entries", "tags", - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -232,9 +235,9 @@ cu_change_tag_names_from_time_entries <- function(team_id, ...) { ## "tid": "task_id", ## "billable": false ## } -cu_start_time_entry <- function(team_id, timer_id, ...) { +cu_start_time_entry <- function(team_id, timer_id, ..., cu_token = NULL) { .cu_post("team", team_id, "time_entries", "start", timer_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -246,8 +249,8 @@ cu_start_time_entry <- function(team_id, timer_id, ...) { ## team_id ## Example: 512. ## Number -cu_stop_time_entry <- function(team_id) { - .cu_post("team", team_id, "time_entries", "stop") +cu_stop_time_entry <- function(team_id, cu_token = NULL) { + .cu_post("team", team_id, "time_entries", "stop", cu_token = cu_token) } @@ -263,8 +266,8 @@ 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) { - .cu_delete("team", team_id, "time_entries", timer_id) +cu_delete_time_entry <- function(team_id, timer_id, cu_token = NULL) { + .cu_delete("team", team_id, "time_entries", timer_id, cu_token = cu_token) } @@ -294,7 +297,7 @@ cu_delete_time_entry <- function(team_id, timer_id) { ## "billable": true, ## "duration": 100000 ## } -cu_update_time_entry <- function(team_id, timer_id, ...) { +cu_update_time_entry <- function(team_id, timer_id, ..., cu_token = NULL) { .cu_put("team", team_id, "time_entries", timer_id, - body=list(...)) + body=list(...), cu_token = cu_token) } diff --git a/R/api-users.R b/R/api-users.R index e7ef0c5..1ace0d5 100644 --- a/R/api-users.R +++ b/R/api-users.R @@ -9,6 +9,8 @@ #' @param username User name. #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -34,9 +36,9 @@ NULL ## "email": "user@example.com", ## "admin": true ## } -cu_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { +cu_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ..., cu_token = NULL) { .cu_post("team", team_id, "user", - body=list(email=email, admin=tolower(admin), ...)) + body=list(email=email, admin=tolower(admin), ...), cu_token = cu_token) } @@ -60,9 +62,9 @@ cu_invite_user_to_workspace <- function(team_id, email, admin=FALSE, ...) { ## "admin": false ## } cu_edit_user_on_workspace <- function(team_id, user_id, - username, admin=FALSE, ...) { + username, admin=FALSE, ..., cu_token = NULL) { .cu_put("team", team_id, "user", user_id, - body=list(username=username, admin=tolower(admin), ...)) + body=list(username=username, admin=tolower(admin), ...), cu_token = cu_token) } @@ -78,8 +80,8 @@ 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) { - .cu_delete("team", team_id, "user", user_id) +cu_remove_user_from_workspace <- function(team_id, user_id, cu_token = NULL) { + .cu_delete("team", team_id, "user", user_id, cu_token = cu_token) } @@ -95,6 +97,6 @@ cu_remove_user_from_workspace <- function(team_id, user_id) { ## user_id ## Example: 403. ## Number -cu_get_user <- function(team_id, user_id) { - .cu_get("team", team_id, "user", user_id) +cu_get_user <- function(team_id, user_id, cu_token = NULL) { + .cu_get("team", team_id, "user", user_id, cu_token = cu_token) } diff --git a/R/api-views.R b/R/api-views.R index 2b2a48f..cbade5c 100644 --- a/R/api-views.R +++ b/R/api-views.R @@ -11,6 +11,8 @@ #' @param page Page to fetch (starts at 0). #' @param ... Named arguments to be passed to API request body, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -76,9 +78,9 @@ NULL ## "me_checklists": true ## } ## } -cu_create_team_view <- function(team_id, name, ...) { +cu_create_team_view <- function(team_id, name, ..., cu_token = NULL) { .cu_post("team", team_id, "view", - body=list(name=name, ...)) + body=list(name=name, ...), cu_token = cu_token) } @@ -137,9 +139,9 @@ cu_create_team_view <- function(team_id, name, ...) { ## "me_checklists": true ## } ## } -cu_create_space_view <- function(space_id, name, ...) { +cu_create_space_view <- function(space_id, name, ..., cu_token = NULL) { .cu_post("space", space_id, "view", - body=list(name=name, ...)) + body=list(name=name, ...), cu_token = cu_token) } @@ -198,9 +200,9 @@ cu_create_space_view <- function(space_id, name, ...) { ## "me_checklists": true ## } ## } -cu_create_folder_view <- function(folder_id, name, ...) { +cu_create_folder_view <- function(folder_id, name, ..., cu_token = NULL) { .cu_post("folder", folder_id, "view", - body=list(name=name, ...)) + body=list(name=name, ...), cu_token = cu_token) } @@ -259,9 +261,9 @@ cu_create_folder_view <- function(folder_id, name, ...) { ## "me_checklists": true ## } ## } -cu_create_list_view <- function(list_id, name, ...) { +cu_create_list_view <- function(list_id, name, ..., cu_token = NULL) { .cu_post("list", list_id, "view", - body=list(name=name, ...)) + body=list(name=name, ...), cu_token = cu_token) } @@ -273,8 +275,8 @@ cu_create_list_view <- function(list_id, name, ...) { ## team_id ## Example: 512. ## Number -cu_get_team_views <- function(team_id) { - .cu_get("team", team_id, "view") +cu_get_team_views <- function(team_id, cu_token = NULL) { + .cu_get("team", team_id, "view", cu_token = cu_token) } @@ -286,8 +288,8 @@ cu_get_team_views <- function(team_id) { ## space_id ## Example: 790. ## Number -cu_get_space_views <- function(space_id) { - .cu_get("space", space_id, "view") +cu_get_space_views <- function(space_id, cu_token = NULL) { + .cu_get("space", space_id, "view", cu_token = cu_token) } @@ -299,8 +301,8 @@ cu_get_space_views <- function(space_id) { ## folder_id ## Example: 457. ## Number -cu_get_folder_views <- function(folder_id) { - .cu_get("folder", folder_id, "view") +cu_get_folder_views <- function(folder_id, cu_token = NULL) { + .cu_get("folder", folder_id, "view", cu_token = cu_token) } @@ -312,8 +314,8 @@ cu_get_folder_views <- function(folder_id) { ## list_id ## Example: 124. ## Number -cu_get_list_views <- function(list_id) { - .cu_get("list", list_id, "view") +cu_get_list_views <- function(list_id, cu_token = NULL) { + .cu_get("list", list_id, "view", cu_token = cu_token) } @@ -326,8 +328,8 @@ cu_get_list_views <- function(list_id) { ## 105 (string) ## Example: 3c. ## String -cu_get_view <- function(view_id) { - .cu_get("view", view_id) +cu_get_view <- function(view_id, cu_token = NULL) { + .cu_get("view", view_id, cu_token = cu_token) } @@ -346,9 +348,9 @@ cu_get_view <- function(view_id) { ## Integer ## ## To page the tasks returned, include the page param -cu_get_view_tasks <- function(view_id, page) { +cu_get_view_tasks <- function(view_id, page, cu_token = NULL) { .cu_get("view", view_id, "task", - query = list(page = page)) + query = list(page = page), cu_token = cu_token) } @@ -414,9 +416,9 @@ 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, ...) { +cu_update_view <- function(view_id, ..., cu_token = NULL) { .cu_put("view", view_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -429,6 +431,6 @@ cu_update_view <- function(view_id, ...) { ## 105 (string) ## Example: 3c. ## String -cu_delete_view <- function(view_id) { - .cu_delete("view", view_id) +cu_delete_view <- function(view_id, cu_token = NULL) { + .cu_delete("view", view_id, cu_token = cu_token) } diff --git a/R/api-webhooks.R b/R/api-webhooks.R index cb6d5c7..24e34ca 100644 --- a/R/api-webhooks.R +++ b/R/api-webhooks.R @@ -38,6 +38,8 @@ #' @param ... Named arguments to be passed to API request body, #' e.g. `"endpoint"`, `"events"`, or `"status"`, #' see the ClickUp API documentation (). +#' @param cu_token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' @@ -93,10 +95,10 @@ 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="*", ...) { +cu_create_webhook <- function(team_id, endpoint, events="*", ..., cu_token = NULL) { .cu_post("team", team_id, "webhook", body=list(endpoint=endpoint, events=events), - query=list(...)) + query=list(...), cu_token = cu_token) } @@ -121,9 +123,9 @@ cu_create_webhook <- function(team_id, endpoint, events="*", ...) { ## "status": "active" ## } ## ... passes props to body -cu_update_webhook <- function(webhook_id, ...) { +cu_update_webhook <- function(webhook_id, ..., cu_token = NULL) { .cu_put("webhook", webhook_id, - body=list(...)) + body=list(...), cu_token = cu_token) } @@ -136,8 +138,8 @@ cu_update_webhook <- function(webhook_id, ...) { ## e506-4a29-9d42-26e504e3435e (uuid) ## Example: 4b67ac88. ## String -cu_delete_webhook <- function(webhook_id) { - .cu_delete("webhook", webhook_id) +cu_delete_webhook <- function(webhook_id, cu_token = NULL) { + .cu_delete("webhook", webhook_id, cu_token = cu_token) } @@ -149,6 +151,6 @@ cu_delete_webhook <- function(webhook_id) { ## team_id ## Example: 512. ## Number -cu_get_webhooks <- function(team_id) { - .cu_get("team", team_id, "webhook") +cu_get_webhooks <- function(team_id, cu_token = NULL) { + .cu_get("team", team_id, "webhook", cu_token = cu_token) } diff --git a/R/cu-pat.R b/R/cu-pat.R index c315199..6f0ad51 100644 --- a/R/cu-pat.R +++ b/R/cu-pat.R @@ -25,6 +25,7 @@ #' * check with `Sys.getenv("CU_PAT")`, it should return the token. #' #' @param token ClickUp personal access token or an access token from the OAuth flow. +#' The `CU_PAT` environment variable is used when `NULL`. #' #' @return #' diff --git a/R/cu-priority.R b/R/cu-priority.R index 77f7e97..e331951 100644 --- a/R/cu-priority.R +++ b/R/cu-priority.R @@ -1,6 +1,6 @@ #' Turn ClickUp API priority scores to labels #' -#' The ClickUp API returns prority values as integer scores. +#' The ClickUp API returns priority values as integer scores. #' The `cu_priority` function maps these scores to the priority labels #' Urgent (1), High (2), Normal (3), Low (4). diff --git a/man/api-attachment.Rd b/man/api-attachment.Rd index 091fb2f..10d963f 100644 --- a/man/api-attachment.Rd +++ b/man/api-attachment.Rd @@ -5,7 +5,13 @@ \alias{cu_post_task_attachment} \title{Attachments} \usage{ -cu_post_task_attachment(task_id, attachment, filename = NULL, ...) +cu_post_task_attachment( + task_id, + attachment, + filename = NULL, + ..., + cu_token = NULL +) } \arguments{ \item{task_id}{Task ID.} @@ -17,6 +23,9 @@ deduced from \code{attachment} when not provided (\code{NULL}).} \item{...}{Can be used to pass mime \code{type} argument to \code{\link[httr:upload_file]{httr::upload_file()}}, mime type is guessed otherwise.} + +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} } \value{ A cu object. diff --git a/man/api-authorization.Rd b/man/api-authorization.Rd index e970187..293daf6 100644 --- a/man/api-authorization.Rd +++ b/man/api-authorization.Rd @@ -7,11 +7,11 @@ \alias{cu_get_authorized_teams} \title{Authorization} \usage{ -cu_get_access_token(client_id, client_secret, code) +cu_get_access_token(client_id, client_secret, code, cu_token = NULL) -cu_get_authorized_user() +cu_get_authorized_user(cu_token = NULL) -cu_get_authorized_teams() +cu_get_authorized_teams(cu_token = NULL) } \arguments{ \item{client_id}{Oauth app client id.} @@ -19,6 +19,9 @@ cu_get_authorized_teams() \item{client_secret}{Oauth app client secret.} \item{code}{Code given in redirect URL.} + +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} } \value{ A cu object. diff --git a/man/api-checklists.Rd b/man/api-checklists.Rd index 156d8cc..c48de19 100644 --- a/man/api-checklists.Rd +++ b/man/api-checklists.Rd @@ -10,23 +10,26 @@ \alias{cu_delete_checklist_item} \title{Task checklists} \usage{ -cu_create_checklist(task_id, name) +cu_create_checklist(task_id, name, cu_token = NULL) -cu_edit_checklist(checklist_id, position) +cu_edit_checklist(checklist_id, position, cu_token = NULL) -cu_delete_checklist(checklist_id) +cu_delete_checklist(checklist_id, cu_token = NULL) -cu_create_checklist_item(checklist_id, name, ...) +cu_create_checklist_item(checklist_id, name, ..., cu_token = NULL) -cu_edit_checklist_item(checklist_id, checklist_item_id, ...) +cu_edit_checklist_item(checklist_id, checklist_item_id, ..., cu_token = NULL) -cu_delete_checklist_item(checklist_id, checklist_item_id) +cu_delete_checklist_item(checklist_id, checklist_item_id, cu_token = NULL) } \arguments{ \item{task_id}{Task ID.} \item{name}{Checklist or checlist item name.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{checklist_id}{Checklist ID.} \item{position}{Position is the zero-based index of the order you want diff --git a/man/api-comments.Rd b/man/api-comments.Rd index fc013d5..6ebd7d2 100644 --- a/man/api-comments.Rd +++ b/man/api-comments.Rd @@ -12,21 +12,21 @@ \alias{cu_delete_comment} \title{Comments} \usage{ -cu_post_task_comment(task_id, ...) +cu_post_task_comment(task_id, ..., cu_token = NULL) -cu_post_view_comment(view_id, ...) +cu_post_view_comment(view_id, ..., cu_token = NULL) -cu_post_list_comment(list_id, ...) +cu_post_list_comment(list_id, ..., cu_token = NULL) -cu_get_task_comments(task_id) +cu_get_task_comments(task_id, cu_token = NULL) -cu_get_view_comments(view_id) +cu_get_view_comments(view_id, cu_token = NULL) -cu_get_list_comments(list_id) +cu_get_list_comments(list_id, cu_token = NULL) -cu_put_update_comment(comment_id, ...) +cu_put_update_comment(comment_id, ..., cu_token = NULL) -cu_delete_comment(comment_id) +cu_delete_comment(comment_id, cu_token = NULL) } \arguments{ \item{task_id}{Task ID.} @@ -34,6 +34,9 @@ cu_delete_comment(comment_id) \item{...}{Named arguments to be passed to API request body, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{view_id}{View ID.} \item{list_id}{List ID.} diff --git a/man/api-customfields.Rd b/man/api-customfields.Rd index 3a5e203..39e011e 100644 --- a/man/api-customfields.Rd +++ b/man/api-customfields.Rd @@ -7,15 +7,18 @@ \alias{cu_remove_field_value} \title{Custom fields} \usage{ -cu_get_accessible_custom_fields(list_id) +cu_get_accessible_custom_fields(list_id, cu_token = NULL) -cu_set_custom_field_value(task_id, field_id, ...) +cu_set_custom_field_value(task_id, field_id, ..., cu_token = NULL) -cu_remove_field_value(task_id, field_id) +cu_remove_field_value(task_id, field_id, cu_token = NULL) } \arguments{ \item{list_id}{List ID.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{task_id}{Task ID.} \item{field_id}{Field ID.} diff --git a/man/api-dependencies.Rd b/man/api-dependencies.Rd index 467b0ea..97853c0 100644 --- a/man/api-dependencies.Rd +++ b/man/api-dependencies.Rd @@ -8,13 +8,13 @@ \alias{cu_delete_task_link} \title{Task relationships} \usage{ -cu_add_dependency(task_id, depends_on, dependency_of) +cu_add_dependency(task_id, depends_on, dependency_of, cu_token = NULL) -cu_delete_dependency(task_id, depends_on, dependency_of) +cu_delete_dependency(task_id, depends_on, dependency_of, cu_token = NULL) -cu_add_task_link(task_id, links_to) +cu_add_task_link(task_id, links_to, cu_token = NULL) -cu_delete_task_link(task_id, links_to) +cu_delete_task_link(task_id, links_to, cu_token = NULL) } \arguments{ \item{task_id}{Task ID.} @@ -25,6 +25,9 @@ One and only one of \code{depends_on} or \code{dependency_of} must be passed.} \item{dependency_of}{A blocking dependency of the task. One and only one of \code{depends_on} or \code{dependency_of} must be passed.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{links_to}{Link to another task.} } \value{ diff --git a/man/api-folders.Rd b/man/api-folders.Rd index d9c15c3..cce3349 100644 --- a/man/api-folders.Rd +++ b/man/api-folders.Rd @@ -9,21 +9,24 @@ \alias{cu_get_folder} \title{Folders} \usage{ -cu_create_folder(space_id, name) +cu_create_folder(space_id, name, cu_token = NULL) -cu_update_folder(folder_id, name) +cu_update_folder(folder_id, name, cu_token = NULL) -cu_delete_folder(folder_id, name) +cu_delete_folder(folder_id, name, cu_token = NULL) -cu_get_folders(space_id, archived = FALSE) +cu_get_folders(space_id, archived = FALSE, cu_token = NULL) -cu_get_folder(folder_id) +cu_get_folder(folder_id, cu_token = NULL) } \arguments{ \item{space_id}{Space ID.} \item{name}{Name of the folder.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{folder_id}{Folder ID.} \item{archived}{Logical, to return archived (\code{TRUE}) folders.} diff --git a/man/api-goals.Rd b/man/api-goals.Rd index dc07440..a75eb1e 100644 --- a/man/api-goals.Rd +++ b/man/api-goals.Rd @@ -12,21 +12,21 @@ \alias{cu_delete_key_result} \title{Goals} \usage{ -cu_create_goal(team_id, ...) +cu_create_goal(team_id, ..., cu_token = NULL) -cu_update_goal(goal_id, ...) +cu_update_goal(goal_id, ..., cu_token = NULL) -cu_delete_goal(goal_id) +cu_delete_goal(goal_id, cu_token = NULL) -cu_get_goals(team_id) +cu_get_goals(team_id, cu_token = NULL) -cu_get_goal(goal_id) +cu_get_goal(goal_id, cu_token = NULL) -cu_create_key_result(goal_id, ...) +cu_create_key_result(goal_id, ..., cu_token = NULL) -cu_edit_key_result(key_result_id, ...) +cu_edit_key_result(key_result_id, ..., cu_token = NULL) -cu_delete_key_result(key_result_id) +cu_delete_key_result(key_result_id, cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} @@ -34,6 +34,9 @@ cu_delete_key_result(key_result_id) \item{...}{Named arguments to be passed to API request body, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{goal_id}{Goal ID.} \item{key_result_id}{Key result ID.} diff --git a/man/api-guests.Rd b/man/api-guests.Rd index e9f2f5a..e17db3a 100644 --- a/man/api-guests.Rd +++ b/man/api-guests.Rd @@ -14,29 +14,47 @@ \alias{cu_remove_guest_from_folder} \title{Guests} \usage{ -cu_invite_guest_to_workspace(team_id) +cu_invite_guest_to_workspace(team_id, cu_token = NULL) -cu_edit_guest_on_workspace(team_id, guest_id, ...) +cu_edit_guest_on_workspace(team_id, guest_id, ..., cu_token = NULL) -cu_remove_guest_from_workspace(team_id, guest_id) +cu_remove_guest_from_workspace(team_id, guest_id, cu_token = NULL) -cu_get_guest(team_id, guest_id) +cu_get_guest(team_id, guest_id, cu_token = NULL) -cu_add_guest_to_task(task_id, guest_id, permission_level = "read") +cu_add_guest_to_task( + task_id, + guest_id, + permission_level = "read", + cu_token = NULL +) -cu_remove_guest_from_task(task_id, guest_id) +cu_remove_guest_from_task(task_id, guest_id, cu_token = NULL) -cu_add_guest_to_list(list_id, guest_id, permission_level = "read") +cu_add_guest_to_list( + list_id, + guest_id, + permission_level = "read", + cu_token = NULL +) -cu_remove_guest_from_list(list_id, guest_id) +cu_remove_guest_from_list(list_id, guest_id, cu_token = NULL) -cu_add_guest_to_folder(folder_id, guest_id, permission_level = "read") +cu_add_guest_to_folder( + folder_id, + guest_id, + permission_level = "read", + cu_token = NULL +) -cu_remove_guest_from_folder(folder_id, guest_id) +cu_remove_guest_from_folder(folder_id, guest_id, cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{guest_id}{Guest ID.} \item{...}{Named arguments to be passed to API request body, diff --git a/man/api-lists.Rd b/man/api-lists.Rd index 80655d0..b3d2c71 100644 --- a/man/api-lists.Rd +++ b/man/api-lists.Rd @@ -11,19 +11,19 @@ \alias{cu_get_list} \title{Lists} \usage{ -cu_create_list(folder_id, ...) +cu_create_list(folder_id, ..., cu_token = NULL) -cu_create_folderless_list(space_id, ...) +cu_create_folderless_list(space_id, ..., cu_token = NULL) -cu_update_list(list_id, ...) +cu_update_list(list_id, ..., cu_token = NULL) -cu_delete_list(list_id, ...) +cu_delete_list(list_id, ..., cu_token = NULL) -cu_get_lists(folder_id, archived = FALSE) +cu_get_lists(folder_id, archived = FALSE, cu_token = NULL) -cu_get_lists_folderless(space_id, archived = FALSE) +cu_get_lists_folderless(space_id, archived = FALSE, cu_token = NULL) -cu_get_list(list_id) +cu_get_list(list_id, cu_token = NULL) } \arguments{ \item{folder_id}{Folder ID.} @@ -31,6 +31,9 @@ cu_get_list(list_id) \item{...}{Named arguments to be passed to API request body, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{space_id}{SPace ID.} \item{list_id}{List ID.} diff --git a/man/api-members.Rd b/man/api-members.Rd index 62ce6c8..6fce06f 100644 --- a/man/api-members.Rd +++ b/man/api-members.Rd @@ -6,13 +6,16 @@ \alias{cu_get_list_members} \title{Members} \usage{ -cu_get_task_members(task_id) +cu_get_task_members(task_id, cu_token = NULL) -cu_get_list_members(list_id) +cu_get_list_members(list_id, cu_token = NULL) } \arguments{ \item{task_id}{Task ID.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{list_id}{List ID.} } \value{ diff --git a/man/api-sharedhierarchy.Rd b/man/api-sharedhierarchy.Rd index 12c4466..08a262d 100644 --- a/man/api-sharedhierarchy.Rd +++ b/man/api-sharedhierarchy.Rd @@ -5,10 +5,13 @@ \alias{cu_get_shared} \title{Shared hierarchy} \usage{ -cu_get_shared(team_id) +cu_get_shared(team_id, cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} + +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} } \value{ A cu object. diff --git a/man/api-spaces.Rd b/man/api-spaces.Rd index 139c423..fd16ac3 100644 --- a/man/api-spaces.Rd +++ b/man/api-spaces.Rd @@ -9,15 +9,15 @@ \alias{cu_get_space} \title{Spaces} \usage{ -cu_create_space(team_id, name, ...) +cu_create_space(team_id, name, ..., cu_token = NULL) -cu_update_space(space_id, ...) +cu_update_space(space_id, ..., cu_token = NULL) -cu_delete_space(space_id) +cu_delete_space(space_id, cu_token = NULL) -cu_get_spaces(team_id, archived = FALSE) +cu_get_spaces(team_id, archived = FALSE, cu_token = NULL) -cu_get_space(space_id) +cu_get_space(space_id, cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} @@ -27,6 +27,9 @@ cu_get_space(space_id) \item{...}{Named arguments to be passed to API request body, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{space_id}{Space ID.} \item{archived}{Logical, to return archived (\code{TRUE}) spaces.} diff --git a/man/api-tags.Rd b/man/api-tags.Rd index 1185856..15eff5d 100644 --- a/man/api-tags.Rd +++ b/man/api-tags.Rd @@ -9,21 +9,24 @@ \alias{cu_add_tag_to_task} \title{Tags} \usage{ -cu_get_space_tags(space_id) +cu_get_space_tags(space_id, cu_token = NULL) -cu_create_space_tag(space_id, name, ...) +cu_create_space_tag(space_id, name, ..., cu_token = NULL) -cu_edit_space_tag(space_id, tag_name) +cu_edit_space_tag(space_id, tag_name, cu_token = NULL) -cu_delete_space_tag(task_id, tag_name) +cu_delete_space_tag(task_id, tag_name, cu_token = NULL) -cu_add_tag_to_task(task_id, tag_name) +cu_add_tag_to_task(task_id, tag_name, cu_token = NULL) -cu_delete_space_tag(task_id, tag_name) +cu_delete_space_tag(task_id, tag_name, cu_token = NULL) } \arguments{ \item{space_id}{Space ID.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{name}{Tag name.} \item{...}{Named arguments to be passed to API request body, diff --git a/man/api-tasks.Rd b/man/api-tasks.Rd index 51a1e09..c5c76fe 100644 --- a/man/api-tasks.Rd +++ b/man/api-tasks.Rd @@ -10,17 +10,17 @@ \alias{cu_get_filtered_team_tasks} \title{Tasks} \usage{ -cu_create_task(list_id, ...) +cu_create_task(list_id, ..., cu_token = NULL) -cu_update_task(task_id, ...) +cu_update_task(task_id, ..., cu_token = NULL) -cu_delete_task(task_id) +cu_delete_task(task_id, cu_token = NULL) -cu_get_tasks(list_id, archived = FALSE, ...) +cu_get_tasks(list_id, archived = FALSE, ..., cu_token = NULL) -cu_get_task(task_id) +cu_get_task(task_id, cu_token = NULL) -cu_get_filtered_team_tasks(team_id, ...) +cu_get_filtered_team_tasks(team_id, ..., cu_token = NULL) } \arguments{ \item{list_id}{List ID.} @@ -29,6 +29,9 @@ cu_get_filtered_team_tasks(team_id, ...) of as query parameters, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{task_id}{Task ID. The ClickUp GUI prepends task IDs with a leading hash, \code{\link[=cu_task_id]{cu_task_id()}} is used internally to normalize task IDs.} \item{archived}{Logical, to return archived (\code{TRUE}) lists.} @@ -90,8 +93,8 @@ updated, due_date. \item project_ids: projects to query, array. \item statuses: statuses to query, array. \item 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. -\item assignees: ssignees to query, array. +Set this to true and don't send a status filter to include closed tasks. +\item assignees: assignees to query, array. \item due_date_gt: filter due date greater than posix time. \item due_date_lt: filter due date less than posix time. \item date_created_gt: filter date created greater than posix time. diff --git a/man/api-tasktemplates.Rd b/man/api-tasktemplates.Rd index 5145b61..1c5554f 100644 --- a/man/api-tasktemplates.Rd +++ b/man/api-tasktemplates.Rd @@ -6,9 +6,9 @@ \alias{cu_create_task_from_template} \title{Task templates} \usage{ -cu_get_task_templates(team_id, page) +cu_get_task_templates(team_id, page, cu_token = NULL) -cu_create_task_from_template(list_id, template_id, name, ...) +cu_create_task_from_template(list_id, template_id, name, ..., cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} @@ -16,6 +16,9 @@ cu_create_task_from_template(list_id, template_id, name, ...) \item{page}{Page to fetch (starts at 0). To page task templates, pass the page number you wish to fetch.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{list_id}{List ID.} \item{template_id}{Template ID.} diff --git a/man/api-teams.Rd b/man/api-teams.Rd index 8a48afd..0cf432d 100644 --- a/man/api-teams.Rd +++ b/man/api-teams.Rd @@ -5,7 +5,11 @@ \alias{cu_get_teams} \title{Teams (workspaces)} \usage{ -cu_get_teams() +cu_get_teams(cu_token = NULL) +} +\arguments{ +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} } \value{ A cu object. diff --git a/man/api-timetracking-2.Rd b/man/api-timetracking-2.Rd index 4c20a45..8cc5362 100644 --- a/man/api-timetracking-2.Rd +++ b/man/api-timetracking-2.Rd @@ -17,31 +17,37 @@ \alias{cu_update_time_entry} \title{Time tracking 2.0} \usage{ -cu_get_time_entries_within_date_range(team_id, start_date, end_date, assignee) +cu_get_time_entries_within_date_range( + team_id, + start_date, + end_date, + assignee, + cu_token = NULL +) -cu_get_singular_time_entry(team_id, timer_id) +cu_get_singular_time_entry(team_id, timer_id, cu_token = NULL) -cu_get_time_entry_history(team_id, timer_id) +cu_get_time_entry_history(team_id, timer_id, cu_token = NULL) -cu_get_running_time_entry(team_id, timer_id) +cu_get_running_time_entry(team_id, timer_id, cu_token = NULL) -cu_create_time_entry(team_id, ...) +cu_create_time_entry(team_id, ..., cu_token = NULL) -cu_remove_tags_from_time_entries(team_id, ...) +cu_remove_tags_from_time_entries(team_id, ..., cu_token = NULL) -cu_get_all_tags_from_time_entries(team_id) +cu_get_all_tags_from_time_entries(team_id, cu_token = NULL) -cu_add_tags_from_time_entries(team_id, ...) +cu_add_tags_from_time_entries(team_id, ..., cu_token = NULL) -cu_change_tag_names_from_time_entries(team_id, ...) +cu_change_tag_names_from_time_entries(team_id, ..., cu_token = NULL) -cu_start_time_entry(team_id, timer_id, ...) +cu_start_time_entry(team_id, timer_id, ..., cu_token = NULL) -cu_stop_time_entry(team_id) +cu_stop_time_entry(team_id, cu_token = NULL) -cu_delete_time_entry(team_id, timer_id) +cu_delete_time_entry(team_id, timer_id, cu_token = NULL) -cu_update_time_entry(team_id, timer_id, ...) +cu_update_time_entry(team_id, timer_id, ..., cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} @@ -53,6 +59,9 @@ cu_update_time_entry(team_id, timer_id, ...) \item{assignee}{User ids to filter by separated by commas. Note: Only Workspace Owners/Admins have access to do this.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{timer_id}{Timer ID.} \item{...}{Named arguments to be passed to API request body, diff --git a/man/api-timetracking-legacy.Rd b/man/api-timetracking-legacy.Rd index 85a0bcb..b233950 100644 --- a/man/api-timetracking-legacy.Rd +++ b/man/api-timetracking-legacy.Rd @@ -8,13 +8,13 @@ \alias{cu_delete_time_tracked} \title{Time tracking legacy} \usage{ -cu_track_time(task_id, ...) +cu_track_time(task_id, ..., cu_token = NULL) -cu_get_tracked_time(task_id) +cu_get_tracked_time(task_id, cu_token = NULL) -cu_edit_time_tracked(task_id, interval_id, ...) +cu_edit_time_tracked(task_id, interval_id, ..., cu_token = NULL) -cu_delete_time_tracked(task_id, interval_id) +cu_delete_time_tracked(task_id, interval_id, cu_token = NULL) } \arguments{ \item{task_id}{Task ID.} @@ -23,6 +23,9 @@ cu_delete_time_tracked(task_id, interval_id) see the ClickUp API documentation (\url{https://clickup.com/api}). Edit the \code{start}, \code{end}, or total \code{time} of a time tracked entry.} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{interval_id}{Interval ID.} } \value{ diff --git a/man/api-users.Rd b/man/api-users.Rd index 7e28e67..d12db38 100644 --- a/man/api-users.Rd +++ b/man/api-users.Rd @@ -8,13 +8,26 @@ \alias{cu_get_user} \title{Users} \usage{ -cu_invite_user_to_workspace(team_id, email, admin = FALSE, ...) - -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) +cu_invite_user_to_workspace( + team_id, + email, + admin = FALSE, + ..., + cu_token = NULL +) + +cu_edit_user_on_workspace( + team_id, + user_id, + username, + admin = FALSE, + ..., + cu_token = NULL +) + +cu_remove_user_from_workspace(team_id, user_id, cu_token = NULL) + +cu_get_user(team_id, user_id, cu_token = NULL) } \arguments{ \item{team_id}{Team (workspace) ID.} @@ -26,6 +39,9 @@ cu_get_user(team_id, user_id) \item{...}{Named arguments to be passed to API request body, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{user_id}{User ID.} \item{username}{User name.} diff --git a/man/api-views.Rd b/man/api-views.Rd index 0693f7a..66af8aa 100644 --- a/man/api-views.Rd +++ b/man/api-views.Rd @@ -16,29 +16,29 @@ \alias{cu_delete_view} \title{Views} \usage{ -cu_create_team_view(team_id, name, ...) +cu_create_team_view(team_id, name, ..., cu_token = NULL) -cu_create_space_view(space_id, name, ...) +cu_create_space_view(space_id, name, ..., cu_token = NULL) -cu_create_folder_view(folder_id, name, ...) +cu_create_folder_view(folder_id, name, ..., cu_token = NULL) -cu_create_list_view(list_id, name, ...) +cu_create_list_view(list_id, name, ..., cu_token = NULL) -cu_get_team_views(team_id) +cu_get_team_views(team_id, cu_token = NULL) -cu_get_space_views(space_id) +cu_get_space_views(space_id, cu_token = NULL) -cu_get_folder_views(folder_id) +cu_get_folder_views(folder_id, cu_token = NULL) -cu_get_list_views(list_id) +cu_get_list_views(list_id, cu_token = NULL) -cu_get_view(view_id) +cu_get_view(view_id, cu_token = NULL) -cu_get_view_tasks(view_id, page) +cu_get_view_tasks(view_id, page, cu_token = NULL) -cu_update_view(view_id, ...) +cu_update_view(view_id, ..., cu_token = NULL) -cu_delete_view(view_id) +cu_delete_view(view_id, cu_token = NULL) } \arguments{ \item{team_id}{Team (workspace) ID.} @@ -48,6 +48,9 @@ cu_delete_view(view_id) \item{...}{Named arguments to be passed to API request body, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{space_id}{Space ID.} \item{folder_id}{Folder ID.} diff --git a/man/api-webhooks.Rd b/man/api-webhooks.Rd index 8e65285..b18f933 100644 --- a/man/api-webhooks.Rd +++ b/man/api-webhooks.Rd @@ -8,13 +8,13 @@ \alias{cu_get_webhooks} \title{Webhooks} \usage{ -cu_create_webhook(team_id, endpoint, events = "*", ...) +cu_create_webhook(team_id, endpoint, events = "*", ..., cu_token = NULL) -cu_update_webhook(webhook_id, ...) +cu_update_webhook(webhook_id, ..., cu_token = NULL) -cu_delete_webhook(webhook_id) +cu_delete_webhook(webhook_id, cu_token = NULL) -cu_get_webhooks(team_id) +cu_get_webhooks(team_id, cu_token = NULL) } \arguments{ \item{team_id}{Team ID.} @@ -27,6 +27,9 @@ cu_get_webhooks(team_id) e.g. \code{"endpoint"}, \code{"events"}, or \code{"status"}, see the ClickUp API documentation (\url{https://clickup.com/api}).} +\item{cu_token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} + \item{webhook_id}{Webhook ID.} } \value{ diff --git a/man/cu-pat.Rd b/man/cu-pat.Rd index 78802a0..c66a3bb 100644 --- a/man/cu-pat.Rd +++ b/man/cu-pat.Rd @@ -6,18 +6,21 @@ \alias{cu_set_pat} \title{Managing ClickUp personal access token} \usage{ -cu_get_pat() +cu_get_pat(token = NULL) cu_set_pat(token) } \arguments{ -\item{token}{ClickUp personal access token.} +\item{token}{ClickUp personal access token or an access token from the OAuth flow. +The \code{CU_PAT} environment variable is used when \code{NULL}.} } \value{ \code{cu_set_pat} returns logical similarly to \code{\link[=Sys.setenv]{Sys.setenv()}}. -\code{cu_get_pat} returns the ClickUp PAT will look something like +\code{cu_get_pat} returns the ClickUp PAT that will look something like \code{pk_4753994_EXP7MPOJ7XQM5UJDV2M45MPF0YHH5YHO}. +When \code{token} is not \code{NULL} it will simply pass through the token value +and not look for the \code{CU_PAT} environment variable. } \description{ The ClickUp API requires a personal access token (PAT) diff --git a/man/cu-priority.Rd b/man/cu-priority.Rd index bb88155..8a0bbb9 100644 --- a/man/cu-priority.Rd +++ b/man/cu-priority.Rd @@ -14,7 +14,7 @@ cu_priority(score) Returns a character vector with the labels. } \description{ -The ClickUp API returns prority values as integer scores. +The ClickUp API returns priority values as integer scores. The \code{cu_priority} function maps these scores to the priority labels Urgent (1), High (2), Normal (3), Low (4). }