# 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
#' TradingPartnersEdge Class
#'
#' @field edge_type
#' @field edge_canon_id
#' @field company_canon_ids
#' @field trade_relationships
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TradingPartnersEdge <- R6::R6Class(
'TradingPartnersEdge',
public = list(
`edge_type` = NULL,
`edge_canon_id` = NULL,
`company_canon_ids` = NULL,
`trade_relationships` = NULL,
initialize = function(`edge_type`, `edge_canon_id`, `company_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(`company_canon_ids`)) {
stopifnot(is.list(`company_canon_ids`), length(`company_canon_ids`) != 0)
lapply(`company_canon_ids`, function(x) stopifnot(is.character(x)))
self$`company_canon_ids` <- `company_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() {
TradingPartnersEdgeObject <- list()
if (!is.null(self$`edge_type`)) {
TradingPartnersEdgeObject[['edge_type']] <- self$`edge_type`
}
if (!is.null(self$`edge_canon_id`)) {
TradingPartnersEdgeObject[['edge_canon_id']] <- self$`edge_canon_id`
}
if (!is.null(self$`company_canon_ids`)) {
TradingPartnersEdgeObject[['company_canon_ids']] <- self$`company_canon_ids`
}
if (!is.null(self$`trade_relationships`)) {
TradingPartnersEdgeObject[['trade_relationships']] <- lapply(self$`trade_relationships`, function(x) x$toJSON())
}
TradingPartnersEdgeObject
},
fromJSON = function(TradingPartnersEdgeJson) {
TradingPartnersEdgeObject <- jsonlite::fromJSON(TradingPartnersEdgeJson)
if (!is.null(TradingPartnersEdgeObject$`edge_type`)) {
self$`edge_type` <- TradingPartnersEdgeObject$`edge_type`
}
if (!is.null(TradingPartnersEdgeObject$`edge_canon_id`)) {
self$`edge_canon_id` <- TradingPartnersEdgeObject$`edge_canon_id`
}
if (!is.null(TradingPartnersEdgeObject$`company_canon_ids`)) {
self$`company_canon_ids` <- TradingPartnersEdgeObject$`company_canon_ids`
}
if (!is.null(TradingPartnersEdgeObject$`trade_relationships`)) {
self$`trade_relationships` <- lapply(TradingPartnersEdgeObject$`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,
"company_canon_ids": [%s],
"trade_relationships": [%s]
}',
self$`edge_type`,
self$`edge_canon_id`,
lapply(self$`company_canon_ids`, function(x) paste(paste0('"', x, '"'), sep=",")),
lapply(self$`trade_relationships`, function(x) paste(x$toJSON(), sep=","))
)
},
fromJSONString = function(TradingPartnersEdgeJson) {
TradingPartnersEdgeObject <- jsonlite::fromJSON(TradingPartnersEdgeJson)
self$`edge_type` <- TradingPartnersEdgeObject$`edge_type`
self$`edge_canon_id` <- TradingPartnersEdgeObject$`edge_canon_id`
self$`company_canon_ids` <- TradingPartnersEdgeObject$`company_canon_ids`
self$`trade_relationships` <- lapply(TradingPartnersEdgeObject$`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.