Add new man sections
Change-Id: I7280cb2cf8a939722c4a8c187694e36a0ce216ea
diff --git a/man/initialize-KorAPConnection-method.Rd b/man/initialize-KorAPConnection-method.Rd
new file mode 100644
index 0000000..83b05ff
--- /dev/null
+++ b/man/initialize-KorAPConnection-method.Rd
@@ -0,0 +1,113 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/KorAPConnection.R
+\name{initialize,KorAPConnection-method}
+\alias{initialize,KorAPConnection-method}
+\title{Initialize KorAPConnection object}
+\usage{
+\S4method{initialize}{KorAPConnection}(
+ .Object,
+ KorAPUrl = if (is.null(Sys.getenv("KORAP_URL")) | Sys.getenv("KORAP_URL") == "") {
+
+ "https://korap.ids-mannheim.de/"
+ } else {
+ Sys.getenv("KORAP_URL")
+ },
+ apiVersion = "v1.0",
+ apiUrl,
+ accessToken = getAccessToken(KorAPUrl),
+ oauthClient = NULL,
+ oauthScope = "search match_info",
+ authorizationSupported = TRUE,
+ userAgent = "R-KorAP-Client",
+ timeout = 240,
+ verbose = FALSE,
+ cache = TRUE
+)
+}
+\arguments{
+\item{.Object}{KorAPConnection object}
+
+\item{KorAPUrl}{URL of the web user interface of the KorAP server instance you want to access.
+Defaults to the environment variable \code{KORAP_URL} if set and to the IDS Mannheim KorAP main instance
+to query DeReKo, otherwise.}
+
+\item{apiVersion}{which version of KorAP's API you want to connect to.}
+
+\item{apiUrl}{URL of the KorAP web service.}
+
+\item{accessToken}{OAuth2 access token. For queries on corpus parts with restricted
+access (e.g. textual queries on IPR protected data), you need to authorize
+your application with an access token.
+You can obtain an access token in the OAuth settings of your KorAP web interface.
+
+More details are explained in the
+\href{https://github.com/KorAP/RKorAPClient#authorization}{authorization section}
+of the RKorAPClient Readme on GitHub.
+
+To use authorization based on an access token
+in subsequent queries, initialize your KorAP connection with:
+
+\if{html}{\out{<div class="sourceCode">}}\preformatted{kco <- KorAPConnection(accessToken="<access token>")
+}\if{html}{\out{</div>}}
+
+In order to make the API
+token persistent for the currently used \code{KorAPUrl} (you can have one
+token per KorAPUrl / KorAP server instance), use:
+
+\if{html}{\out{<div class="sourceCode">}}\preformatted{persistAccessToken(kco)
+}\if{html}{\out{</div>}}
+
+This will store it in your keyring using the
+\link[keyring:keyring-package]{keyring::keyring-package}. Subsequent KorAPConnection() calls will
+then automatically retrieve the token from your keying. To stop using a
+persisted token, call \code{clearAccessToken(kco)}. Please note that for
+DeReKo, authorized queries will behave differently inside and outside the
+IDS, because of the special license situation. This concerns also cached
+results which do not take into account from where a request was issued. If
+you experience problems or unexpected results, please try \code{kco <- KorAPConnection(cache=FALSE)} or use
+\code{\link[=clearCache]{clearCache()}} to clear the cache completely.
+
+An alternative to using an access token is to use a browser-based oauth2 workflow
+to obtain an access token. This can be done with the \code{\link[=auth]{auth()}} method.}
+
+\item{oauthClient}{OAuth2 client object.}
+
+\item{oauthScope}{OAuth2 scope.}
+
+\item{authorizationSupported}{logical that indicates if authorization is supported/necessary for the current KorAP instance. Automatically set during initialization.}
+
+\item{userAgent}{user agent string.}
+
+\item{timeout}{tineout in seconds for API requests (this does not influence server internal timeouts).}
+
+\item{verbose}{logical that decides whether following operations will default to
+be verbose.}
+
+\item{cache}{logical that decides if API calls are cached locally. You can clear
+the cache with \code{\link[=clearCache]{clearCache()}}.}
+}
+\value{
+\code{\link[=KorAPConnection]{KorAPConnection()}} object that can be used e.g. with
+\code{\link[=corpusQuery]{corpusQuery()}}
+}
+\description{
+Initialize KorAPConnection object
+}
+\examples{
+\dontrun{
+
+kcon <- KorAPConnection(verbose = TRUE)
+kq <- corpusQuery(kcon, "Ameisenplage")
+kq <- fetchAll(kq)
+}
+
+\dontrun{
+
+kcon <- KorAPConnection(verbose = TRUE, accessToken = "e739u6eOzkwADQPdVChxFg")
+kq <- corpusQuery(kcon, "Ameisenplage", metadataOnly = FALSE)
+kq <- fetchAll(kq)
+kq@collectedMatches$snippet
+}
+
+}
+\keyword{internal}