# Altana Atlas API
#
# Altana Atlas for Regulatory Risk and Trade Compliance
#
# OpenAPI spec version: {{ version or \"v0.0.1\" }}
# Contact: engineering@altanatech.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' InterFacilityEdge Class
#'
#' @field edge_type
#' @field edge_canon_id
#' @field facility_canon_ids
#' @field trade_relationships
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InterFacilityEdge <- R6::R6Class(
'InterFacilityEdge',
public = list(
`edge_type` = NULL,
`edge_canon_id` = NULL,
`facility_canon_ids` = NULL,
`trade_relationships` = NULL,
initialize = function(`edge_type`, `edge_canon_id`, `facility_canon_ids`, `trade_relationships`){
if (!missing(`edge_type`)) {
stopifnot(is.character(`edge_type`), length(`edge_type`) == 1)
self$`edge_type` <- `edge_type`
}
if (!missing(`edge_canon_id`)) {
stopifnot(is.character(`edge_canon_id`), length(`edge_canon_id`) == 1)
self$`edge_canon_id` <- `edge_canon_id`
}
if (!missing(`facility_canon_ids`)) {
stopifnot(is.list(`facility_canon_ids`), length(`facility_canon_ids`) != 0)
lapply(`facility_canon_ids`, function(x) stopifnot(is.character(x)))
self$`facility_canon_ids` <- `facility_canon_ids`
}
if (!missing(`trade_relationships`)) {
stopifnot(is.list(`trade_relationships`), length(`trade_relationships`) != 0)
lapply(`trade_relationships`, function(x) stopifnot(R6::is.R6(x)))
self$`trade_relationships` <- `trade_relationships`
}
},
toJSON = function() {
InterFacilityEdgeObject <- list()
if (!is.null(self$`edge_type`)) {
InterFacilityEdgeObject[['edge_type']] <- self$`edge_type`
}
if (!is.null(self$`edge_canon_id`)) {
InterFacilityEdgeObject[['edge_canon_id']] <- self$`edge_canon_id`
}
if (!is.null(self$`facility_canon_ids`)) {
InterFacilityEdgeObject[['facility_canon_ids']] <- self$`facility_canon_ids`
}
if (!is.null(self$`trade_relationships`)) {
InterFacilityEdgeObject[['trade_relationships']] <- lapply(self$`trade_relationships`, function(x) x$toJSON())
}
InterFacilityEdgeObject
},
fromJSON = function(InterFacilityEdgeJson) {
InterFacilityEdgeObject <- jsonlite::fromJSON(InterFacilityEdgeJson)
if (!is.null(InterFacilityEdgeObject$`edge_type`)) {
self$`edge_type` <- InterFacilityEdgeObject$`edge_type`
}
if (!is.null(InterFacilityEdgeObject$`edge_canon_id`)) {
self$`edge_canon_id` <- InterFacilityEdgeObject$`edge_canon_id`
}
if (!is.null(InterFacilityEdgeObject$`facility_canon_ids`)) {
self$`facility_canon_ids` <- InterFacilityEdgeObject$`facility_canon_ids`
}
if (!is.null(InterFacilityEdgeObject$`trade_relationships`)) {
self$`trade_relationships` <- lapply(InterFacilityEdgeObject$`trade_relationships`, function(x) {
trade_relationshipsObject <- TradeRelationship$new()
trade_relationshipsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
trade_relationshipsObject
})
}
},
toJSONString = function() {
sprintf(
'{
"edge_type": %s,
"edge_canon_id": %s,
"facility_canon_ids": [%s],
"trade_relationships": [%s]
}',
self$`edge_type`,
self$`edge_canon_id`,
lapply(self$`facility_canon_ids`, function(x) paste(paste0('"', x, '"'), sep=",")),
lapply(self$`trade_relationships`, function(x) paste(x$toJSON(), sep=","))
)
},
fromJSONString = function(InterFacilityEdgeJson) {
InterFacilityEdgeObject <- jsonlite::fromJSON(InterFacilityEdgeJson)
self$`edge_type` <- InterFacilityEdgeObject$`edge_type`
self$`edge_canon_id` <- InterFacilityEdgeObject$`edge_canon_id`
self$`facility_canon_ids` <- InterFacilityEdgeObject$`facility_canon_ids`
self$`trade_relationships` <- lapply(InterFacilityEdgeObject$`trade_relationships`, function(x) TradeRelationship$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.