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