diff --git a/R/r-mip-adaptor.R b/R/r-mip-adaptor.R index 423f892..db0f40b 100644 --- a/R/r-mip-adaptor.R +++ b/R/r-mip-adaptor.R @@ -5,4 +5,20 @@ #' @aliases r-mip-adaptor package-r-mip-adaptor #' @title HBP - Database connections #' @name rmipadaptor -NULL + +SHAPES <- list( + ERROR = "text/plain+error", + PFA = "application/pfa+json", + PFA_YAML = "application/pfa+yaml", + TABULAR_DATA_RESOURCE = "application/vnd.dataresource+json", + HTML = "text/html", + SVG = "image/svg+xml", + PNG = "image/png;base64", + HIGHCHARTS = "application/vnd.highcharts+json", + VISJS = "application/vnd.visjs+javascript", + PLOTLY = "application/vnd.plotly.v1+json", + VEGA = "application/vnd.vega+json", + VEGALITE = "application/vnd.vegalite+json", + JSON = "application/json", + TEXT = "text/plain" +) diff --git a/R/saveError.R b/R/saveError.R index 7c20277..6f12552 100644 --- a/R/saveError.R +++ b/R/saveError.R @@ -41,7 +41,7 @@ saveError <- function( conn <- out_conn; } } - shape <- "error"; + shape <- "text/plain+error"; data <- ""; if (file.exists(outputFile)) { diff --git a/R/saveResults.R b/R/saveResults.R index abdfb3e..94cc1db 100644 --- a/R/saveResults.R +++ b/R/saveResults.R @@ -63,12 +63,25 @@ saveResults <- function( serialized_results <- switch(shape, string = results, + "text/plain" = results, pfa_json = results, + "application/pfa+json" = results, pfa_yaml = results, + "application/pfa+yaml" = results, + "application/vnd.dataresource+json" = results, svg = results, + "image/svg+xml" = results, + "image/png;base64" = results, plotly = results, + "application/vnd.plotly.v1+json" = results, highcharts = results, + "application/vnd.highcharts+json" = results, + "application/vnd.visjs+javascript" = results, + "application/vnd.vega+json" = results, + "application/vnd.vegalite+json" = results, html = results, + "text/html" = results, + "application/json" = results, r_dataframe_intermediate = toJSON(results, auto_unbox=TRUE, digits=8, Date = "ISO8601"), r_dataframe_columns = toJSON(results, dataframe="columns", digits=8, Date = "ISO8601"), r_matrix = toJSON(results, matrix="rowmajor", digits=8, Date = "ISO8601"),