Add getUserCountry and general API query function matomoQuery

Change-Id: Iedea1fcacf7329144e71f1412fc41238efc30bb2
diff --git a/man/getAccessToken.Rd b/man/getAccessToken.Rd
index b50b328..830b414 100644
--- a/man/getAccessToken.Rd
+++ b/man/getAccessToken.Rd
@@ -1,5 +1,5 @@
 % Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/visitssummary.R
+% Please edit documentation in R/matomoquery.R
 \name{getAccessToken}
 \alias{getAccessToken}
 \title{get access token for matomo from keyring}
diff --git a/man/getUserCountry.Rd b/man/getUserCountry.Rd
new file mode 100644
index 0000000..d9fa90d
--- /dev/null
+++ b/man/getUserCountry.Rd
@@ -0,0 +1,42 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/usercountry.R
+\name{getUserCountry}
+\alias{getUserCountry}
+\title{Get user country report from matomo API server}
+\usage{
+getUserCountry(
+  matomoUrl,
+  siteId,
+  period = "month",
+  date = "last36",
+  filter_limit = 100,
+  accessToken = getAccessToken(matomoUrl)
+)
+}
+\arguments{
+\item{matomoUrl}{base URL of your matomo instance}
+
+\item{siteId}{matomo site id or vector of site ids}
+
+\item{period}{\code{day}, \code{week}, \code{month} or \code{year}}
+
+\item{date}{date range (see \url{https://developer.matomo.org/api-reference/reporting-api})}
+
+\item{filter_limit}{defines the maximum number of rows to be returned}
+
+\item{accessToken}{API Authentication Token - you can get this in your
+matomo interface under Settings -> Personal -> Settings -> API Authentication Token
+and pass it here, or you can make it persistent with \code{\link{persistAccessToken}}.}
+}
+\description{
+See matomo Reporting API Reference (\url{https://developer.matomo.org/api-reference/reporting-api}) for details.
+}
+\examples{
+\dontrun{
+df <- getUserCountry("https://demo.matomo.org/", siteId=3, period="day", date="last60")
+}
+
+}
+\references{
+\url{https://developer.matomo.org/api-reference/reporting-api}
+}
diff --git a/man/getVisitsSummary.Rd b/man/getVisitsSummary.Rd
index 7ce6eea..2ec475a 100644
--- a/man/getVisitsSummary.Rd
+++ b/man/getVisitsSummary.Rd
@@ -34,9 +34,6 @@
 matomo interface under Settings -> Personal -> Settings -> API Authentication Token
 and pass it here, or you can make it persistent with \code{\link{persistAccessToken}}.}
 }
-\value{
-Data frame with visits summary as returned by matomo. Note that the \code{date} column in the returned data frame refers to the first day of the respective period.
-}
 \description{
 See matomo Reporting API Reference (\url{https://developer.matomo.org/api-reference/reporting-api}) for details.
 }
diff --git a/man/matomoQuery.Rd b/man/matomoQuery.Rd
new file mode 100644
index 0000000..87501c1
--- /dev/null
+++ b/man/matomoQuery.Rd
@@ -0,0 +1,54 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/matomoquery.R
+\name{matomoQuery}
+\alias{matomoQuery}
+\title{Get reports from a matomo API server}
+\usage{
+matomoQuery(
+  matomoUrl,
+  siteId,
+  period = "month",
+  date = "last16",
+  filter_limit = 100,
+  removeFirst = FALSE,
+  removeLast = FALSE,
+  accessToken = getAccessToken(matomoUrl),
+  getMethod = "VisitsSummary.get"
+)
+}
+\arguments{
+\item{matomoUrl}{base URL of your matomo instance}
+
+\item{siteId}{matomo site id or vector of site ids}
+
+\item{period}{\code{day}, \code{week}, \code{month} or \code{year}}
+
+\item{date}{date range (see \url{https://developer.matomo.org/api-reference/reporting-api})}
+
+\item{filter_limit}{defines the maximum number of rows to be returned}
+
+\item{removeFirst}{logical that determines whether the first row of each site should be removed (to account for incomplete periods)}
+
+\item{removeLast}{logical that determines whether the last row of each site should be removed (to account for incomplete periods)}
+
+\item{accessToken}{API Authentication Token - you can get this in your
+matomo interface under Settings -> Personal -> Settings -> API Authentication Token
+and pass it here, or you can make it persistent with \code{\link{persistAccessToken}}.}
+
+\item{getMethod}{API method to call – default: VisitsSummary.get}
+}
+\value{
+Data frame with visits summary as returned by matomo. Note that the \code{date} column in the returned data frame refers to the first day of the respective period.
+}
+\description{
+See matomo Reporting API Reference (\url{https://developer.matomo.org/api-reference/reporting-api}) for details.
+}
+\examples{
+\dontrun{
+df <- matomoQuery("https://demo.matomo.org/", getMethod = "UserCountry.getCountry")
+}
+
+}
+\references{
+\url{https://developer.matomo.org/api-reference/reporting-api}
+}
diff --git a/man/persistAccessToken.Rd b/man/persistAccessToken.Rd
index 9d27b51..8386c0b 100644
--- a/man/persistAccessToken.Rd
+++ b/man/persistAccessToken.Rd
@@ -1,5 +1,5 @@
 % Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/visitssummary.R
+% Please edit documentation in R/matomoquery.R
 \name{persistAccessToken}
 \alias{persistAccessToken}
 \title{Save access token persistently to your keyring}