#' Create a room under group
#'
#' @param groupId A character of groupId
#' @param name A character determing the prefix of room name attached by its sha1 10-digit code
#' @param topic A character, default=""
#' @param securityType A character, default="PRIVATE". The other option is "PUBLIC"
#'
#' @return
#' @export
#'
#' @examples none.
create_aPrivateRoomUnderGroup <- function(groupId, name,topic="", securityType="PRIVATE")
{
postingMessage <- glue::glue(
'POST /v1/groups/{groupId}/rooms'
)
create_aRoomUnderGroupFun <- gitter_apiFunctional(postingMessage)
name <- paste0(name,"_",digest::sha1(name,10))
security <-
list(
security=securityType #'PRIVATE'
)
bodyContent <-
list(
name=name,
topic=topic,
security=security
)
create_aRoomUnderGroupFun(
body=bodyContent,
encode="json"
) -> response
invisible(response)
}
#' Post message to a room
#'
#' @param text one character value of text to post
#' @param roomId a character of room ID
#'
#' @return
#' @export
#'
#' @examples
#' roomId <- gitter$roomIds$`110-1-r4ds/main`
#' text <- '
#' (程式測試,請忽略)
#' ```{r}
#' list("1", 1)
#' ```
#' '
postMessageToARoom <- function(text, roomId)
{
postingMessage <- glue::glue(
"POST /v1/rooms/{roomId}/chatMessages"
)
postMessageToARoomFun <- gitter_apiFunctional(postingMessage)
bodyContent <-
list(
text=text
)
postMessageToARoomFun(
body=bodyContent,
encode="json"
) -> response
invisible(response)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.