# 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 Block
#'
#' @description Block Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field block_hash character
#'
#' @field currency character
#'
#' @field height integer
#'
#' @field no_txs integer
#'
#' @field timestamp integer
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Block <- R6::R6Class(
'Block',
public = list(
`block_hash` = NULL,
`currency` = NULL,
`height` = NULL,
`no_txs` = NULL,
`timestamp` = NULL,
initialize = function(
`block_hash`, `currency`, `height`, `no_txs`, `timestamp`, ...
) {
local.optional.var <- list(...)
if (!missing(`block_hash`)) {
stopifnot(is.character(`block_hash`), length(`block_hash`) == 1)
self$`block_hash` <- `block_hash`
}
if (!missing(`currency`)) {
stopifnot(is.character(`currency`), length(`currency`) == 1)
self$`currency` <- `currency`
}
if (!missing(`height`)) {
stopifnot(is.numeric(`height`), length(`height`) == 1)
self$`height` <- `height`
}
if (!missing(`no_txs`)) {
stopifnot(is.numeric(`no_txs`), length(`no_txs`) == 1)
self$`no_txs` <- `no_txs`
}
if (!missing(`timestamp`)) {
stopifnot(is.numeric(`timestamp`), length(`timestamp`) == 1)
self$`timestamp` <- `timestamp`
}
},
toJSON = function() {
BlockObject <- list()
if (!is.null(self$`block_hash`)) {
BlockObject[['block_hash']] <-
self$`block_hash`
}
if (!is.null(self$`currency`)) {
BlockObject[['currency']] <-
self$`currency`
}
if (!is.null(self$`height`)) {
BlockObject[['height']] <-
self$`height`
}
if (!is.null(self$`no_txs`)) {
BlockObject[['no_txs']] <-
self$`no_txs`
}
if (!is.null(self$`timestamp`)) {
BlockObject[['timestamp']] <-
self$`timestamp`
}
BlockObject
},
fromJSON = function(BlockJson) {
BlockObject <- jsonlite::fromJSON(BlockJson)
if (!is.null(BlockObject$`block_hash`)) {
self$`block_hash` <- BlockObject$`block_hash`
}
if (!is.null(BlockObject$`currency`)) {
self$`currency` <- BlockObject$`currency`
}
if (!is.null(BlockObject$`height`)) {
self$`height` <- BlockObject$`height`
}
if (!is.null(BlockObject$`no_txs`)) {
self$`no_txs` <- BlockObject$`no_txs`
}
if (!is.null(BlockObject$`timestamp`)) {
self$`timestamp` <- BlockObject$`timestamp`
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`block_hash`)) {
sprintf(
'"block_hash":
"%s"
',
self$`block_hash`
)},
if (!is.null(self$`currency`)) {
sprintf(
'"currency":
"%s"
',
self$`currency`
)},
if (!is.null(self$`height`)) {
sprintf(
'"height":
%d
',
self$`height`
)},
if (!is.null(self$`no_txs`)) {
sprintf(
'"no_txs":
%d
',
self$`no_txs`
)},
if (!is.null(self$`timestamp`)) {
sprintf(
'"timestamp":
%d
',
self$`timestamp`
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(BlockJson) {
BlockObject <- jsonlite::fromJSON(BlockJson)
self$`block_hash` <- BlockObject$`block_hash`
self$`currency` <- BlockObject$`currency`
self$`height` <- BlockObject$`height`
self$`no_txs` <- BlockObject$`no_txs`
self$`timestamp` <- BlockObject$`timestamp`
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.