-
Notifications
You must be signed in to change notification settings - Fork 2
/
qcri_get_language_pairs.R
36 lines (32 loc) · 979 Bytes
/
qcri_get_language_pairs.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#' QCRI Get Language Pairs
#'
#' This function retrieves the supported language pairs from the QCRI Multiterm API.
#'
#' @param api_key The API key associated with the user account being used. If not provided, the function will attempt to retrieve it from the QCRI_API_KEY environment variable. You can register for an API key at https://mt.qcri.org/api/register
#'
#' @return Language pairs.
#'
#' @export
#'
#' @examples
#' \dontrun{
#' qcri_get_language_pairs(api_key = "YourApiKey")
#' qcri_get_language_pairs()
#' }
qcri_get_language_pairs <- function(api_key = qcri_api_key()) {
# Get the API key
if (is.null(api_key)) {
api_key <- qcri_api_key()
}
# Set up the URL parameters
url_params <- list(key = api_key)
# Make the request
response <- httr::GET(
url = "https://mt.qcri.org/api/v1/getLanguagePairs",
query = url_params
)
# Parse the response
content <- httr::content(response, "parsed")
# Return the response
return(content)
}