Carry a a verbosity default already in the connection object
Change-Id: I8b0b0cb3ebbf5d92be8442366b5aaf6643e9431c
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index 84aec06..a890d3f 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -10,25 +10,26 @@
#'
#' @export
-KorAPConnection <- setClass("KorAPConnection", slots=c(KorAPUrl="character", apiVersion="character", apiUrl="character"))
+KorAPConnection <- setClass("KorAPConnection", slots=c(KorAPUrl="character", apiVersion="character", apiUrl="character", verbose="logical"))
#' @param .Object KorAPConnection object
#' @param KorAPUrl the URL of the KorAP server instance you want to access.
#' @param apiVersion which version of KorAP's API you want to connect to.
#' @param apiUrl URL of the KorAP web service.
+#' @param verbose logical decides wether following operations will default to be verbose
#' @return \code{\link{KorAPConnection}} object that can be used e.g. with \code{\link{corpusQuery}}
#'
#' @examples
-#' kcon <- new("KorAPConnection")
+#' kcon <- new("KorAPConnection", verbose = TRUE)
#' kq <- corpusQuery(kcon, "Ameisenplage")
-#' kq <- fetchAll(kq, verbose=TRUE)
+#' kq <- fetchAll(kq)
#'
#' @note Currently it is not possible to authenticate the client
#'
#' @rdname KorAPConnection-class
#' @export
setMethod("initialize", "KorAPConnection",
- function(.Object, KorAPUrl = "https://korap.ids-mannheim.de/", apiVersion = 'v1.0', apiUrl) {
+ function(.Object, KorAPUrl = "https://korap.ids-mannheim.de/", apiVersion = 'v1.0', apiUrl, verbose = FALSE) {
.Object <- callNextMethod()
m <- regexpr("https?://[^?]+", KorAPUrl, perl = TRUE)
.Object@KorAPUrl <- regmatches(KorAPUrl, m)
@@ -41,6 +42,7 @@
.Object@apiUrl = apiUrl
}
.Object@apiVersion = apiVersion
+ .Object@verbose = verbose
.Object
})