-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrt_ticket_history_reply.R
46 lines (40 loc) · 1.41 KB
/
rt_ticket_history_reply.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#' Add ticket history reply
#'
#' Add a response to an existing ticket
#'
#' @inheritParams rt_ticket_attachment
#' @param text (character) Text that to add as a comment
#' @param cc (character) Email for cc
#' @param bcc (character) Email for bcc
#' @param time_worked (character)
#' @param attachment_path (character) Path to a file to upload
#'
#' @export
#'
#' @examples
#' \dontrun{
#' rt_ticket_history_reply(11,
#' "Thank you.
#'
#' Have a great day!")
#' }
rt_ticket_history_reply <- function(ticket_id,
text,
cc = NULL,
bcc = NULL,
time_worked = NULL, #unsure what the inputs are...
attachment_path = NULL,
rt_base_url = Sys.getenv("RT_BASE_URL")) {
url <- rt_url(rt_base_url, "ticket", ticket_id, "comment")
#account for NULLs
params <- compact(list(id = ticket_id,
Action = "correspond",
Text = text,
CC = cc,
Bcc = bcc,
TimeWorked = time_worked,
Attachment = attachment_path))
reply <- paste(names(params), params, sep = ": ", collapse = "\n")
httr::POST(url, body = list(content = reply))
#not tested
}