add subclasses to endpoint object

This commit is contained in:
Hong Ooi 2019-09-30 16:47:01 +10:00
Родитель d7055d2c40
Коммит 4aa1674351
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -18,7 +18,7 @@
#' - `TextTranslate`: text translation
#'
#' @return
#' An object of from class `cognitive_endpoint`, that can be used to communicate with the REST endpoint.
#' An object inheriting from class `cognitive_endpoint`, that can be used to communicate with the REST endpoint. The subclass of the object indicates the type of service provided.
#'
#' @seealso
#' [call_cognitive_endpoint], [create_cognitive_service], [get_cognitive_service]
@ -46,7 +46,7 @@ cognitive_endpoint <- function(url, service_type, key=NULL, aad_token=NULL, cogn
url$path <- get_api_path(service_type)
object <- list(url=url, key=unname(key), aad_token=aad_token, cognitive_token=cognitive_token)
class(object) <- "cognitive_endpoint"
class(object) <- c(paste0(service_type, "_endpoint"), "cognitive_endpoint")
object
}

Просмотреть файл

@ -19,7 +19,7 @@ cognitive_endpoint(url, service_type, key = NULL, aad_token = NULL,
\item{cognitive_token}{A Cognitive Service token, as another alternative to a key for the services that accept it.}
}
\value{
An object of from class \code{cognitive_endpoint}, that can be used to communicate with the REST endpoint.
An object inheriting from class \code{cognitive_endpoint}, that can be used to communicate with the REST endpoint. The subclass of the object indicates the type of service provided.
}
\description{
Object representing an Azure Cognitive Service endpoint