# 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.0
# Contact: contact@ikna.io
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title Neighbor
#'
#' @description Neighbor Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field labels list( character ) [optional]
#'
#' @field no_txs integer
#'
#' @field value \link{Values}
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Neighbor <- R6::R6Class(
'Neighbor',
public = list(
`labels` = NULL,
`no_txs` = NULL,
`value` = NULL,
initialize = function(
`no_txs`, `value`, `labels`=NULL, ...
) {
local.optional.var <- list(...)
if (!missing(`no_txs`)) {
stopifnot(is.numeric(`no_txs`), length(`no_txs`) == 1)
self$`no_txs` <- `no_txs`
}
if (!missing(`value`)) {
stopifnot(R6::is.R6(`value`))
self$`value` <- `value`
}
if (!is.null(`labels`)) {
stopifnot(is.vector(`labels`), length(`labels`) != 0)
sapply(`labels`, function(x) stopifnot(is.character(x)))
self$`labels` <- `labels`
}
},
toJSON = function() {
NeighborObject <- list()
if (!is.null(self$`labels`)) {
NeighborObject[['labels']] <-
self$`labels`
}
if (!is.null(self$`no_txs`)) {
NeighborObject[['no_txs']] <-
self$`no_txs`
}
if (!is.null(self$`value`)) {
NeighborObject[['value']] <-
self$`value`$toJSON()
}
NeighborObject
},
fromJSON = function(NeighborJson) {
NeighborObject <- jsonlite::fromJSON(NeighborJson)
if (!is.null(NeighborObject$`labels`)) {
self$`labels` <- ApiClient$new()$deserializeObj(NeighborObject$`labels`, "array[character]", loadNamespace("graphsense"))
}
if (!is.null(NeighborObject$`no_txs`)) {
self$`no_txs` <- NeighborObject$`no_txs`
}
if (!is.null(NeighborObject$`value`)) {
valueObject <- Values$new()
valueObject$fromJSON(jsonlite::toJSON(NeighborObject$value, auto_unbox = TRUE, digits = NA))
self$`value` <- valueObject
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`labels`)) {
sprintf(
'"labels":
[%s]
',
paste(unlist(lapply(self$`labels`, function(x) paste0('"', x, '"'))), collapse=",")
)},
if (!is.null(self$`no_txs`)) {
sprintf(
'"no_txs":
%d
',
self$`no_txs`
)},
if (!is.null(self$`value`)) {
sprintf(
'"value":
%s
',
jsonlite::toJSON(self$`value`$toJSON(), auto_unbox=TRUE, digits = NA)
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(NeighborJson) {
NeighborObject <- jsonlite::fromJSON(NeighborJson)
self$`labels` <- ApiClient$new()$deserializeObj(NeighborObject$`labels`, "array[character]", loadNamespace("graphsense"))
self$`no_txs` <- NeighborObject$`no_txs`
self$`value` <- Values$new()$fromJSON(jsonlite::toJSON(NeighborObject$value, auto_unbox = TRUE, digits = NA))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.