KorAPConnection-class {RKorAPClient} | R Documentation |
Class KorAPConnection
Description
KorAPConnection
objects represent the connection to a KorAP server.
New KorAPConnection
objects can be created by new("KorAPConnection")
.
Usage
## S4 method for signature 'KorAPConnection'
initialize(
.Object,
KorAPUrl = "https://korap.ids-mannheim.de/",
apiVersion = "v1.0",
apiUrl,
accessToken = getAccessToken(KorAPUrl),
userAgent = "R-KorAP-Client",
timeout = 240,
verbose = FALSE,
cache = TRUE
)
## S4 method for signature 'KorAPConnection'
persistAccessToken(kco, accessToken = kco@accessToken)
## S4 method for signature 'KorAPConnection'
clearAccessToken(kco)
## S4 method for signature 'KorAPConnection'
apiCall(
kco,
url,
json = TRUE,
getHeaders = FALSE,
cache = kco@cache,
timeout = kco@timeout
)
## S4 method for signature 'KorAPConnection'
clearCache(kco)
## S4 method for signature 'KorAPConnection'
show(object)
Arguments
.Object |
KorAPConnection object |
KorAPUrl |
URL of the web user interface of the KorAP server instance you want to access. |
apiVersion |
which version of KorAP's API you want to connect to. |
apiUrl |
URL of the KorAP web service. |
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. How to obtain an access token for the DeReKo KorAP instance is explained in the authorization section of the RKorAPClient Readme on GitHub. To use authorization based on an access token in subsequent queries, initialize your KorAP connection with: kco <- new("KorAPConnection", accessToken="<access token>") In order to make the API
token persistent for the currently used persistAccessToken(kco) This will store it in your keyring using the
|
userAgent |
user agent string. |
timeout |
tineout in seconds for API requests (this does not influence server internal timeouts). |
verbose |
logical that decides whether following operations will default to be verbose. |
cache |
logical that decides if API calls are cached locally. You can clear
the cache with |
kco |
KorAPConnection object |
url |
request url |
json |
logical that determines if json result is expected |
getHeaders |
logical that determines if headers and content should be returned (as a list) |
object |
KorAPConnection object |
Value
KorAPConnection()
object that can be used e.g. with
corpusQuery()
Slots
KorAPUrl
URL of the web user interface of the KorAP server used in the connection.
apiVersion
requested KorAP API version.
indexRevision
indexRevision code as reported from API via
X-Index-Revision
HTTP header.apiUrl
full URL of API including version.
accessToken
OAuth2 access token.
userAgent
user agent string used for connection the API.
timeout
tineout in seconds for API requests (this does not influence server internal timeouts)
verbose
logical that decides whether operations will default to be verbose.
cache
logical that decides if API calls are cached locally.
welcome
list containing HTTP response received from KorAP server welcome function.
Examples
## Not run:
kcon <- new("KorAPConnection", verbose = TRUE)
kq <- corpusQuery(kcon, "Ameisenplage")
kq <- fetchAll(kq)
## End(Not run)
## Not run:
kcon <- new("KorAPConnection", verbose = TRUE, accessToken="e739u6eOzkwADQPdVChxFg")
kq <- corpusQuery(kcon, "Ameisenplage", metadataOnly=FALSE)
kq <- fetchAll(kq)
kq@collectedMatches$snippet
## End(Not run)
## Not run:
kco <- new("KorAPConnection", accessToken="e739u6eOzkwADQPdVChxFg")
persistAccessToken(kco)
## End(Not run)
## Not run:
kco <- new("KorAPConnection")
clearAccessToken(kco)
## End(Not run)