Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export(BuildHeader)
export(BuildInnerBreakdownsRecursively)
export(BuildLineItemSegment)
export(BuildRealTimeReportStructure)
export(CalculatedMetrics_Get)
export(CancelReport)
export(GetActivation)
export(GetAxleStartDate)
Expand Down Expand Up @@ -77,9 +78,12 @@ export(QueueSummary)
export(QueueTrended)
export(SCAuth)
export(SaveRealTimeSettings)
export(Segments_Get)
export(SubmitJsonQueueReport)
export(ValidateReport)
export(ViewProcessingRules)
export(parse_segment_defn)
export(parse_shares)
importFrom(base64enc,base64encode)
importFrom(digest,digest)
importFrom(httr,POST)
Expand Down
77 changes: 77 additions & 0 deletions R/CalculatedMetrics_Get.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#' Get Calculated Metrics via the 1.4 API CalculatedMetrics.Get method
#'
#' Get calculated metrics information with different search criteria and return options
#'
#' @importFrom jsonlite unbox toJSON
#'
#' @export
#'
#' @inherit call.Get_base params return details
#' @inheritSection call.Get_base Access Privileges
#'
#' @section Definition Parsing:
#' This is not yet ready for Calculated Metrics.
#'
#' @section API Method Info:
#' This function calls the Adobe Analytics 1.4
#' \href{https://marketing.adobe.com/developer/documentation/segments-1-4/calculated-metrics}{CalculatedMetrics.Get}
#' method, which supercedes the deprecated \emph{ReportSuite.GetCalculatedMetrics} method.
#' The \emph{CalculatedMetrics_Get} method, and therefore this function,
#' allows essentially all available information about one or more calculated metrics to be returned.
#'
#' As such, it is now possible to download one or more complete calculated metric definitions, which
#' may be useful for batch auditing, back-up, and much more. Note, though, that \emph{CalculatedMetrics.Get}
#' operates at the calculated metrics ownership level, as opposed to the reportsuite ID level,
#' which means this is not a strict replacement for the (deprecated) \emph{ReportSuite.GetCalculatedMetrics} method.
#'
#' If this function is called with \code{accessLevel = "all"} by a non-admin, the following error message is
#' returned:
#'
#' \code{ERROR: Bad Request - invalid accessLevel, only an admin user can request "all" Calculated Metrics}
#'
#' @examples
#' \dontrun{
#' # Get all calculated metrics you own
#' CalculatedMetrics_Get()
#'
#' # Get all calculated metrics that are shared with you
#' CalculatedMetrics_Get(accessLevel = "shared")
#'
#' # Get all calculated metrics, period
#' # Note this requires admin privileges
#' CalculatedMetrics_Get(accessLevel = "all")
#'
#' # To constrain at report suite level
#' CalculatedMetrics_Get(filters = list(reportSuiteID = "your_rsid"))
#'
#' # Parsing is needed for certain fields, in particular 'definition'
#' # This returns some nested fields, but tags and compatibility are collapsed automatically...
#' needs_parsing_1 <- CalculatedMetrics_Get(fields = c("tags", "shares", "compatibility"))
#' # ...unless you request otherwise
#' needs_parsing_1_alt <- CalculatedMetrics_Get(fields = c("tags", "shares", "compatibility"),
#' collapse_simple = FALSE
#' )
#'
#' # `definition` is the most complex
#' needs_parsing_2 <- CalculatedMetrics_Get(fields = c("definition"))
#'
#' # Here's what it looks like if we ask for all fields
#' needs_parsing_3 <- CalculatedMetrics_Get(fields = c("compatibility", "definition",
#' "favorite", "modified",
#' "owner", "reportSuiteID",
#' "shares", "tags")
#' )
#'
#' }
CalculatedMetrics_Get <- function(accessLevel = NULL, fields = NULL,
selected = NULL, sort = NULL,
filters = NULL,
collapse_simple = TRUE) {

call.Get_base(accessLevel = accessLevel, fields = fields,
selected = selected, sort = sort,
filters = filters,
collapse_simple = collapse_simple,
func.name = "CalculatedMetrics.Get")

}
78 changes: 78 additions & 0 deletions R/Segments_Get.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#' Get Segments via the 1.4 API Segments.Get method
#'
#' Get segments information with different search criteria and return options
#'
#' @importFrom jsonlite unbox toJSON
#'
#' @export
#'
#' @inherit call.Get_base params return details
#' @inheritSection call.Get_base Access Privileges
#'
#' @section Definition Parsing:
#' This is still experimental: \code{\link{parse_segment_defn}}
#'
#' @section API Method Info:
#' This function calls the Adobe Analytics 1.4
#' \href{https://marketing.adobe.com/developer/documentation/segments-1-4/r-get-1}{Segments.Get}
#' method, which supercedes the deprecated \emph{ReportSuite.GetSegments} method.
#' The \emph{Segments_Get} method, and therefore this function,
#' allows essentially all available information about one or more segments to be returned.
#'
#' As such, it is now possible to download one or more complete segment definitions, which
#' may be useful for batch auditing, back-up, and much more. Note, though, that \emph{Segments.Get}
#' operates at the segment ownership level, as opposed to the reportsuite ID level,
#' which means this is not a strict replacement for the (deprecated) \emph{ReportSuite.GetSegments} method.
#'
#' If this function is called with \code{accessLevel = "all"} by a non-admin, the following error message is
#' returned:
#'
#' \code{ERROR: Bad Request - invalid accessLevel, only an admin user can request "all" segments}
#'
#'
#' @examples
#' \dontrun{
#' # Get all segments you own
#' Segments_Get()
#'
#' # Get all segments that are shared with you
#' Segments_Get(accessLevel = "shared")
#'
#' # Get all segments, period
#' # Note this requires admin privileges
#' Segments_Get(accessLevel = "all")
#'
#' # To constrain at report suite level
#' Segments_Get(filters = list(reportSuiteID = "your_rsid"))
#'
#' # Parsing is needed for certain fields, in particular 'definition'
#' # This returns some nested fields, but tags and compatibility are collapsed automatically...
#' needs_parsing_1 <- Segments_Get(fields = c("tags", "shares", "compatibility"))
#' # ...unless you request otherwise
#' needs_parsing_1_alt <- Segments_Get(fields = c("tags", "shares", "compatibility"),
#' collapse_simple = FALSE
#' )
#'
#' # `definition` is the most complex
#' needs_parsing_2 <- Segments_Get(fields = c("definition"))
#'
#' # Here's what it looks like if we ask for all fields
#' needs_parsing_3 <- Segments_Get(fields = c("compatibility", "definition",
#' "favorite", "modified",
#' "owner", "reportSuiteID",
#' "shares", "tags")
#' )
#'
#' }
Segments_Get <- function(accessLevel = NULL, fields = NULL,
selected = NULL, sort = NULL,
filters = NULL,
collapse_simple = TRUE) {

call.Get_base(accessLevel = accessLevel, fields = fields,
selected = selected, sort = sort,
filters = filters,
collapse_simple = collapse_simple,
func.name = "Segments.Get")

}
Loading