Skip to content

Commit 5ff2189

Browse files
authored
Merge pull request #195 from rstudio/aron-issue-194
Content$delete_tag removes that tag from a content item
2 parents ee7873f + 50c92c8 commit 5ff2189

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
- BREAKING: The functions `Connect$download_bundle()` and
44
`Connect$bundle_delete()` have been removed. Use `Content$bundle_download()`
55
and `Content$bundle_delete()` instead.
6+
- `Content$tag_delete()` removes the tag from the target content item rather
7+
than removing the tag entirely. (#194)
68

79
# connectapi 0.1.3.1
810

R/connect.R

+10-1
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,20 @@ Connect <- R6::R6Class(
538538
self$POST(
539539
path = glue::glue("v1/content/{content_id}/tags"),
540540
body = list(
541-
tag_id = tag_id
541+
tag_id = as.character(tag_id)
542542
)
543543
)
544544
},
545545

546+
#' @description Remove a tag from a content item.
547+
#' @param content_id The content identifier.
548+
#' @param tag_id The tag identifier.
549+
remove_content_tag = function(content_id, tag_id) {
550+
invisible(self$DELETE(
551+
path = glue::glue("v1/content/{content_id}/tags/{tag_id}")
552+
))
553+
},
554+
546555
# users -----------------------------------------------
547556

548557
#' @description Get user details.

R/content.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ Content <- R6::R6Class(
141141
},
142142
#' @description Remove a tag for this content.
143143
#' @param id The tag identifier.
144-
tag_delete = function(id) {
144+
tag_delete = function(tag_id) {
145145
# note that deleting the parent tag deletes all children
146-
self$get_connect()$tag_delete(id)
146+
self$get_connect()$remove_content_tag(self$get_content()$guid, tag_id = tag_id)
147147
},
148148
#' @description The tags for this content.
149149
tags = function() {

0 commit comments

Comments
 (0)