# GraphSense API
#
# GraphSense API provides programmatic access to various ledgers' addresses, entities, blocks, transactions and tags for automated and highly efficient forensics tasks.
#
# The version of the OpenAPI document: 1.0.1
# Contact: contact@ikna.io
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title Entity
#'
#' @description Entity Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field balance \link{Values}
#'
#' @field best_address_tag \link{AddressTag} [optional]
#'
#' @field currency character
#'
#' @field entity integer
#'
#' @field first_tx \link{TxSummary}
#'
#' @field in_degree integer
#'
#' @field last_tx \link{TxSummary}
#'
#' @field no_address_tags integer
#'
#' @field no_addresses integer
#'
#' @field no_incoming_txs integer
#'
#' @field no_outgoing_txs integer
#'
#' @field out_degree integer
#'
#' @field root_address character
#'
#' @field total_received \link{Values}
#'
#' @field total_spent \link{Values}
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Entity <- R6::R6Class(
'Entity',
public = list(
`balance` = NULL,
`best_address_tag` = NULL,
`currency` = NULL,
`entity` = NULL,
`first_tx` = NULL,
`in_degree` = NULL,
`last_tx` = NULL,
`no_address_tags` = NULL,
`no_addresses` = NULL,
`no_incoming_txs` = NULL,
`no_outgoing_txs` = NULL,
`out_degree` = NULL,
`root_address` = NULL,
`total_received` = NULL,
`total_spent` = NULL,
initialize = function(
`balance`, `currency`, `entity`, `first_tx`, `in_degree`, `last_tx`, `no_address_tags`, `no_addresses`, `no_incoming_txs`, `no_outgoing_txs`, `out_degree`, `root_address`, `total_received`, `total_spent`, `best_address_tag`=NULL, ...
) {
local.optional.var <- list(...)
if (!missing(`balance`)) {
stopifnot(R6::is.R6(`balance`))
self$`balance` <- `balance`
}
if (!missing(`currency`)) {
stopifnot(is.character(`currency`), length(`currency`) == 1)
self$`currency` <- `currency`
}
if (!missing(`entity`)) {
stopifnot(is.numeric(`entity`), length(`entity`) == 1)
self$`entity` <- `entity`
}
if (!missing(`first_tx`)) {
stopifnot(R6::is.R6(`first_tx`))
self$`first_tx` <- `first_tx`
}
if (!missing(`in_degree`)) {
stopifnot(is.numeric(`in_degree`), length(`in_degree`) == 1)
self$`in_degree` <- `in_degree`
}
if (!missing(`last_tx`)) {
stopifnot(R6::is.R6(`last_tx`))
self$`last_tx` <- `last_tx`
}
if (!missing(`no_address_tags`)) {
stopifnot(is.numeric(`no_address_tags`), length(`no_address_tags`) == 1)
self$`no_address_tags` <- `no_address_tags`
}
if (!missing(`no_addresses`)) {
stopifnot(is.numeric(`no_addresses`), length(`no_addresses`) == 1)
self$`no_addresses` <- `no_addresses`
}
if (!missing(`no_incoming_txs`)) {
stopifnot(is.numeric(`no_incoming_txs`), length(`no_incoming_txs`) == 1)
self$`no_incoming_txs` <- `no_incoming_txs`
}
if (!missing(`no_outgoing_txs`)) {
stopifnot(is.numeric(`no_outgoing_txs`), length(`no_outgoing_txs`) == 1)
self$`no_outgoing_txs` <- `no_outgoing_txs`
}
if (!missing(`out_degree`)) {
stopifnot(is.numeric(`out_degree`), length(`out_degree`) == 1)
self$`out_degree` <- `out_degree`
}
if (!missing(`root_address`)) {
stopifnot(is.character(`root_address`), length(`root_address`) == 1)
self$`root_address` <- `root_address`
}
if (!missing(`total_received`)) {
stopifnot(R6::is.R6(`total_received`))
self$`total_received` <- `total_received`
}
if (!missing(`total_spent`)) {
stopifnot(R6::is.R6(`total_spent`))
self$`total_spent` <- `total_spent`
}
if (!is.null(`best_address_tag`)) {
stopifnot(R6::is.R6(`best_address_tag`))
self$`best_address_tag` <- `best_address_tag`
}
},
toJSON = function() {
EntityObject <- list()
if (!is.null(self$`balance`)) {
EntityObject[['balance']] <-
self$`balance`$toJSON()
}
if (!is.null(self$`best_address_tag`)) {
EntityObject[['best_address_tag']] <-
self$`best_address_tag`$toJSON()
}
if (!is.null(self$`currency`)) {
EntityObject[['currency']] <-
self$`currency`
}
if (!is.null(self$`entity`)) {
EntityObject[['entity']] <-
self$`entity`
}
if (!is.null(self$`first_tx`)) {
EntityObject[['first_tx']] <-
self$`first_tx`$toJSON()
}
if (!is.null(self$`in_degree`)) {
EntityObject[['in_degree']] <-
self$`in_degree`
}
if (!is.null(self$`last_tx`)) {
EntityObject[['last_tx']] <-
self$`last_tx`$toJSON()
}
if (!is.null(self$`no_address_tags`)) {
EntityObject[['no_address_tags']] <-
self$`no_address_tags`
}
if (!is.null(self$`no_addresses`)) {
EntityObject[['no_addresses']] <-
self$`no_addresses`
}
if (!is.null(self$`no_incoming_txs`)) {
EntityObject[['no_incoming_txs']] <-
self$`no_incoming_txs`
}
if (!is.null(self$`no_outgoing_txs`)) {
EntityObject[['no_outgoing_txs']] <-
self$`no_outgoing_txs`
}
if (!is.null(self$`out_degree`)) {
EntityObject[['out_degree']] <-
self$`out_degree`
}
if (!is.null(self$`root_address`)) {
EntityObject[['root_address']] <-
self$`root_address`
}
if (!is.null(self$`total_received`)) {
EntityObject[['total_received']] <-
self$`total_received`$toJSON()
}
if (!is.null(self$`total_spent`)) {
EntityObject[['total_spent']] <-
self$`total_spent`$toJSON()
}
EntityObject
},
fromJSON = function(EntityJson) {
EntityObject <- jsonlite::fromJSON(EntityJson)
if (!is.null(EntityObject$`balance`)) {
balanceObject <- Values$new()
balanceObject$fromJSON(jsonlite::toJSON(EntityObject$balance, auto_unbox = TRUE, digits = NA))
self$`balance` <- balanceObject
}
if (!is.null(EntityObject$`best_address_tag`)) {
best_address_tagObject <- AddressTag$new()
best_address_tagObject$fromJSON(jsonlite::toJSON(EntityObject$best_address_tag, auto_unbox = TRUE, digits = NA))
self$`best_address_tag` <- best_address_tagObject
}
if (!is.null(EntityObject$`currency`)) {
self$`currency` <- EntityObject$`currency`
}
if (!is.null(EntityObject$`entity`)) {
self$`entity` <- EntityObject$`entity`
}
if (!is.null(EntityObject$`first_tx`)) {
first_txObject <- TxSummary$new()
first_txObject$fromJSON(jsonlite::toJSON(EntityObject$first_tx, auto_unbox = TRUE, digits = NA))
self$`first_tx` <- first_txObject
}
if (!is.null(EntityObject$`in_degree`)) {
self$`in_degree` <- EntityObject$`in_degree`
}
if (!is.null(EntityObject$`last_tx`)) {
last_txObject <- TxSummary$new()
last_txObject$fromJSON(jsonlite::toJSON(EntityObject$last_tx, auto_unbox = TRUE, digits = NA))
self$`last_tx` <- last_txObject
}
if (!is.null(EntityObject$`no_address_tags`)) {
self$`no_address_tags` <- EntityObject$`no_address_tags`
}
if (!is.null(EntityObject$`no_addresses`)) {
self$`no_addresses` <- EntityObject$`no_addresses`
}
if (!is.null(EntityObject$`no_incoming_txs`)) {
self$`no_incoming_txs` <- EntityObject$`no_incoming_txs`
}
if (!is.null(EntityObject$`no_outgoing_txs`)) {
self$`no_outgoing_txs` <- EntityObject$`no_outgoing_txs`
}
if (!is.null(EntityObject$`out_degree`)) {
self$`out_degree` <- EntityObject$`out_degree`
}
if (!is.null(EntityObject$`root_address`)) {
self$`root_address` <- EntityObject$`root_address`
}
if (!is.null(EntityObject$`total_received`)) {
total_receivedObject <- Values$new()
total_receivedObject$fromJSON(jsonlite::toJSON(EntityObject$total_received, auto_unbox = TRUE, digits = NA))
self$`total_received` <- total_receivedObject
}
if (!is.null(EntityObject$`total_spent`)) {
total_spentObject <- Values$new()
total_spentObject$fromJSON(jsonlite::toJSON(EntityObject$total_spent, auto_unbox = TRUE, digits = NA))
self$`total_spent` <- total_spentObject
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`balance`)) {
sprintf(
'"balance":
%s
',
jsonlite::toJSON(self$`balance`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`best_address_tag`)) {
sprintf(
'"best_address_tag":
%s
',
jsonlite::toJSON(self$`best_address_tag`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`currency`)) {
sprintf(
'"currency":
"%s"
',
self$`currency`
)},
if (!is.null(self$`entity`)) {
sprintf(
'"entity":
%d
',
self$`entity`
)},
if (!is.null(self$`first_tx`)) {
sprintf(
'"first_tx":
%s
',
jsonlite::toJSON(self$`first_tx`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`in_degree`)) {
sprintf(
'"in_degree":
%d
',
self$`in_degree`
)},
if (!is.null(self$`last_tx`)) {
sprintf(
'"last_tx":
%s
',
jsonlite::toJSON(self$`last_tx`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`no_address_tags`)) {
sprintf(
'"no_address_tags":
%d
',
self$`no_address_tags`
)},
if (!is.null(self$`no_addresses`)) {
sprintf(
'"no_addresses":
%d
',
self$`no_addresses`
)},
if (!is.null(self$`no_incoming_txs`)) {
sprintf(
'"no_incoming_txs":
%d
',
self$`no_incoming_txs`
)},
if (!is.null(self$`no_outgoing_txs`)) {
sprintf(
'"no_outgoing_txs":
%d
',
self$`no_outgoing_txs`
)},
if (!is.null(self$`out_degree`)) {
sprintf(
'"out_degree":
%d
',
self$`out_degree`
)},
if (!is.null(self$`root_address`)) {
sprintf(
'"root_address":
"%s"
',
self$`root_address`
)},
if (!is.null(self$`total_received`)) {
sprintf(
'"total_received":
%s
',
jsonlite::toJSON(self$`total_received`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`total_spent`)) {
sprintf(
'"total_spent":
%s
',
jsonlite::toJSON(self$`total_spent`$toJSON(), auto_unbox=TRUE, digits = NA)
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(EntityJson) {
EntityObject <- jsonlite::fromJSON(EntityJson)
self$`balance` <- Values$new()$fromJSON(jsonlite::toJSON(EntityObject$balance, auto_unbox = TRUE, digits = NA))
self$`best_address_tag` <- AddressTag$new()$fromJSON(jsonlite::toJSON(EntityObject$best_address_tag, auto_unbox = TRUE, digits = NA))
self$`currency` <- EntityObject$`currency`
self$`entity` <- EntityObject$`entity`
self$`first_tx` <- TxSummary$new()$fromJSON(jsonlite::toJSON(EntityObject$first_tx, auto_unbox = TRUE, digits = NA))
self$`in_degree` <- EntityObject$`in_degree`
self$`last_tx` <- TxSummary$new()$fromJSON(jsonlite::toJSON(EntityObject$last_tx, auto_unbox = TRUE, digits = NA))
self$`no_address_tags` <- EntityObject$`no_address_tags`
self$`no_addresses` <- EntityObject$`no_addresses`
self$`no_incoming_txs` <- EntityObject$`no_incoming_txs`
self$`no_outgoing_txs` <- EntityObject$`no_outgoing_txs`
self$`out_degree` <- EntityObject$`out_degree`
self$`root_address` <- EntityObject$`root_address`
self$`total_received` <- Values$new()$fromJSON(jsonlite::toJSON(EntityObject$total_received, auto_unbox = TRUE, digits = NA))
self$`total_spent` <- Values$new()$fromJSON(jsonlite::toJSON(EntityObject$total_spent, auto_unbox = TRUE, digits = NA))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.