R/personal_name_geo_in.R

# NamSor API v2
#
# NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 1000 names at a time). Need something you can't find here? We have many more features coming soon. Let us know, we'll do our best to add it! 
#
# OpenAPI spec version: 2.0.2-beta
# Contact: contact@namsor.com
# Generated by: https://openapi-generator.tech


#' PersonalNameGeoIn Class
#'
#' @field id 
#' @field name 
#' @field countryIso2 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PersonalNameGeoIn <- R6::R6Class(
  'PersonalNameGeoIn',
  public = list(
    `id` = NULL,
    `name` = NULL,
    `countryIso2` = NULL,
    initialize = function(`id`, `name`, `countryIso2`){
      if (!missing(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`countryIso2`)) {
        stopifnot(is.character(`countryIso2`), length(`countryIso2`) == 1)
        self$`countryIso2` <- `countryIso2`
      }
    },
    toJSON = function() {
      PersonalNameGeoInObject <- list()
      if (!is.null(self$`id`)) {
        PersonalNameGeoInObject[['id']] <-
          self$`id`
      }
      if (!is.null(self$`name`)) {
        PersonalNameGeoInObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`countryIso2`)) {
        PersonalNameGeoInObject[['countryIso2']] <-
          self$`countryIso2`
      }

      PersonalNameGeoInObject
    },
    fromJSON = function(PersonalNameGeoInJson) {
      PersonalNameGeoInObject <- jsonlite::fromJSON(PersonalNameGeoInJson)
      if (!is.null(PersonalNameGeoInObject$`id`)) {
        self$`id` <- PersonalNameGeoInObject$`id`
      }
      if (!is.null(PersonalNameGeoInObject$`name`)) {
        self$`name` <- PersonalNameGeoInObject$`name`
      }
      if (!is.null(PersonalNameGeoInObject$`countryIso2`)) {
        self$`countryIso2` <- PersonalNameGeoInObject$`countryIso2`
      }
    },
    toJSONString = function() {
      sprintf(
        '{
           "id":
             "%s",
           "name":
             "%s",
           "countryIso2":
             "%s"
        }',
        self$`id`,
        self$`name`,
        self$`countryIso2`
      )
    },
    fromJSONString = function(PersonalNameGeoInJson) {
      PersonalNameGeoInObject <- jsonlite::fromJSON(PersonalNameGeoInJson)
      self$`id` <- PersonalNameGeoInObject$`id`
      self$`name` <- PersonalNameGeoInObject$`name`
      self$`countryIso2` <- PersonalNameGeoInObject$`countryIso2`
      self
    }
  )
)
wing328/namsor-r-client documentation built on May 26, 2019, 7:01 p.m.