Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 1 | % Generated by roxygen2: do not edit by hand |
| 2 | % Please edit documentation in R/KorAPConnection.R |
| 3 | \docType{class} |
| 4 | \name{KorAPConnection-class} |
| 5 | \alias{KorAPConnection-class} |
| 6 | \alias{KorAPConnection} |
| 7 | \alias{initialize,KorAPConnection-method} |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 8 | \alias{persistApiToken,KorAPConnection-method} |
| 9 | \alias{persistApiToken} |
| 10 | \alias{clearApiToken,KorAPConnection-method} |
| 11 | \alias{clearApiToken} |
Marc Kupietz | d0d3e9b | 2019-09-24 17:36:03 +0200 | [diff] [blame] | 12 | \alias{apiCall,KorAPConnection-method} |
| 13 | \alias{apiCall} |
Marc Kupietz | 0a96b28 | 2019-10-01 11:05:31 +0200 | [diff] [blame] | 14 | \alias{clearCache,KorAPConnection-method} |
| 15 | \alias{clearCache} |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 16 | \alias{show,KorAPConnection-method} |
| 17 | \title{Class KorAPConnection} |
| 18 | \usage{ |
| 19 | \S4method{initialize}{KorAPConnection}(.Object, |
Marc Kupietz | f94a6c8 | 2019-09-19 11:32:07 +0200 | [diff] [blame] | 20 | KorAPUrl = "https://korap.ids-mannheim.de/", apiVersion = "v1.0", |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 21 | apiUrl, apiToken = getApiToken(KorAPUrl), |
| 22 | userAgent = "R-KorAP-Client", timeout = 10, verbose = FALSE, |
| 23 | cache = TRUE) |
| 24 | |
| 25 | \S4method{persistApiToken}{KorAPConnection}(kco, apiToken = kco@apiToken) |
| 26 | |
| 27 | \S4method{clearApiToken}{KorAPConnection}(kco) |
Marc Kupietz | d0d3e9b | 2019-09-24 17:36:03 +0200 | [diff] [blame] | 28 | |
| 29 | \S4method{apiCall}{KorAPConnection}(kco, url) |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 30 | |
Marc Kupietz | 0a96b28 | 2019-10-01 11:05:31 +0200 | [diff] [blame] | 31 | \S4method{clearCache}{KorAPConnection}(kco) |
| 32 | |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 33 | \S4method{show}{KorAPConnection}(object) |
| 34 | } |
| 35 | \arguments{ |
| 36 | \item{.Object}{KorAPConnection object} |
| 37 | |
| 38 | \item{KorAPUrl}{the URL of the KorAP server instance you want to access.} |
| 39 | |
| 40 | \item{apiVersion}{which version of KorAP's API you want to connect to.} |
| 41 | |
| 42 | \item{apiUrl}{URL of the KorAP web service.} |
| 43 | |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 44 | \item{apiToken}{OAuth2 API token. To use authorization based on an API token |
| 45 | in subsequent queries, intialize your KorAP connection with |
| 46 | \code{kco <- new("KorAPConnection", apiToken="<API Token>")}. |
| 47 | In order to make the API |
| 48 | token persistent for the currently used \code{KorAPUrl} (you can have one |
| 49 | token per KorAPUrl / KorAP server instance), use |
| 50 | \code{persistApiToken(kco)}. This will store it in your keyring using the |
| 51 | \code{\link{keyring}} package. Subsequent new("KorAPConnection") calls will |
| 52 | then automatically retrieve the token from your keying. To stop using a |
| 53 | persisted token, call \code{clearApiToken(kco)}. Please note that for |
| 54 | DeReKo, authorized queries will behave differently inside and outside the |
| 55 | IDS, because of the special license situation. This concerns also cached |
| 56 | results which do not take into account from where a request was issued. If |
| 57 | you experience problems or unexpected results, please try \code{kco <- |
| 58 | new("KorAPConnection", cache=FALSE)} or use |
| 59 | \code{\link{clearCache}} to clear the cache completely.} |
| 60 | |
Marc Kupietz | d0d3e9b | 2019-09-24 17:36:03 +0200 | [diff] [blame] | 61 | \item{userAgent}{user agent string.} |
| 62 | |
| 63 | \item{timeout}{time out in seconds.} |
| 64 | |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 65 | \item{verbose}{logical. Decides whether following operations will default to |
| 66 | be verbose.} |
Marc Kupietz | 5a51982 | 2019-09-20 21:43:52 +0200 | [diff] [blame] | 67 | |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 68 | \item{cache}{logical. Decides if API calls are cached locally. You can clear |
| 69 | the cache with \code{\link{clearCache}()}.} |
Marc Kupietz | 0a96b28 | 2019-10-01 11:05:31 +0200 | [diff] [blame] | 70 | |
Marc Kupietz | d0d3e9b | 2019-09-24 17:36:03 +0200 | [diff] [blame] | 71 | \item{kco}{KorAPConnection object} |
| 72 | |
| 73 | \item{url}{request url} |
| 74 | |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 75 | \item{object}{KorAPConnection object} |
| 76 | } |
| 77 | \value{ |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 78 | \code{\link{KorAPConnection}} object that can be used e.g. with |
| 79 | \code{\link{corpusQuery}} |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 80 | } |
| 81 | \description{ |
Marc Kupietz | 7776dec | 2019-09-27 16:59:02 +0200 | [diff] [blame] | 82 | \code{KorAPConnection} objects represent the connection to a KorAP server. |
| 83 | New \code{KorAPConnection} objects can be created by \code{KorAPConnection()}. |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 84 | } |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 85 | \examples{ |
Marc Kupietz | 5a51982 | 2019-09-20 21:43:52 +0200 | [diff] [blame] | 86 | kcon <- new("KorAPConnection", verbose = TRUE) |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 87 | kq <- corpusQuery(kcon, "Ameisenplage") |
Marc Kupietz | 5a51982 | 2019-09-20 21:43:52 +0200 | [diff] [blame] | 88 | kq <- fetchAll(kq) |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 89 | |
Marc Kupietz | 4862b86 | 2019-11-07 10:13:53 +0100 | [diff] [blame] | 90 | \dontrun{ |
| 91 | kcon <- new("KorAPConnection", verbose = TRUE, apiToken="e739u6eOzkwADQPdVChxFg") |
| 92 | kq <- corpusQuery(kcon, "Ameisenplage", metadataOnly=FALSE) |
| 93 | kq <- fetchAll(kq) |
| 94 | kq@collectedMatches$snippet |
| 95 | } |
| 96 | |
| 97 | \dontrun{ |
| 98 | kco <- new("KorAPConnection", apiToken="e739u6eOzkwADQPdVChxFg") |
| 99 | persistApiToken(kco) |
| 100 | } |
| 101 | |
| 102 | \dontrun{ |
| 103 | kco <- new("KorAPConnection") |
| 104 | clearApiToken(kco) |
| 105 | } |
| 106 | |
Marc Kupietz | e95108e | 2019-09-18 13:23:58 +0200 | [diff] [blame] | 107 | } |