R/taxonomy.R

# 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 Taxonomy
#'
#' @description Taxonomy Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field taxonomy  character 
#'
#' @field uri  character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Taxonomy <- R6::R6Class(
  'Taxonomy',
  public = list(
    `taxonomy` = NULL,
    `uri` = NULL,
    initialize = function(
        `taxonomy`, `uri`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`taxonomy`)) {
        stopifnot(is.character(`taxonomy`), length(`taxonomy`) == 1)
        self$`taxonomy` <- `taxonomy`
      }
      if (!missing(`uri`)) {
        stopifnot(is.character(`uri`), length(`uri`) == 1)
        self$`uri` <- `uri`
      }
    },
    toJSON = function() {
      TaxonomyObject <- list()
      if (!is.null(self$`taxonomy`)) {
        TaxonomyObject[['taxonomy']] <-
          self$`taxonomy`
      }
      if (!is.null(self$`uri`)) {
        TaxonomyObject[['uri']] <-
          self$`uri`
      }

      TaxonomyObject
    },
    fromJSON = function(TaxonomyJson) {
      TaxonomyObject <- jsonlite::fromJSON(TaxonomyJson)
      if (!is.null(TaxonomyObject$`taxonomy`)) {
        self$`taxonomy` <- TaxonomyObject$`taxonomy`
      }
      if (!is.null(TaxonomyObject$`uri`)) {
        self$`uri` <- TaxonomyObject$`uri`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`taxonomy`)) {
        sprintf(
        '"taxonomy":
          "%s"
                ',
        self$`taxonomy`
        )},
        if (!is.null(self$`uri`)) {
        sprintf(
        '"uri":
          "%s"
                ',
        self$`uri`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(TaxonomyJson) {
      TaxonomyObject <- jsonlite::fromJSON(TaxonomyJson)
      self$`taxonomy` <- TaxonomyObject$`taxonomy`
      self$`uri` <- TaxonomyObject$`uri`
      self
    }
  )
)
graphsense/rgraphsense documentation built on Sept. 2, 2022, 1:45 p.m.