Add support for API token authorization
To use authorization based on an API token in subsequent queries,
initialize your KorAP connection with
kco <- new("KorAPConnection", apiToken="<API Token>").
In order to make the API token persistent for the currently
used KorAPUrl (you can have one token per KorAPUrl / KorAP server
instance), use persistApiToken(kco). This will store it in your keyring
using the keyring package.
Subsequent new("KorAPConnection") calls will then automatically
retrieve the token from your keying.
To stop using a persisted token, call clearApiToken(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 kco <- new("KorAPConnection", cache=FALSE) or use
clearCache to clear the cache completely.
Change-Id: Ic956b0dcf03574e63b62d5036622f30a6cf27f8a
diff --git a/NAMESPACE b/NAMESPACE
index 4ba2e60..5c5f350 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -20,6 +20,7 @@
exportClasses(KorAPCorpusStats)
exportClasses(KorAPQuery)
exportMethods(apiCall)
+exportMethods(clearApiToken)
exportMethods(clearCache)
exportMethods(corpusQuery)
exportMethods(corpusStats)
@@ -28,9 +29,11 @@
exportMethods(fetchRest)
exportMethods(frequencyQuery)
exportMethods(initialize)
+exportMethods(persistApiToken)
exportMethods(show)
import(R.cache)
import(httr)
+import(keyring)
import(methods)
import(utils)
importFrom(broom,tidy)