R/action.R

# DaDaPush Public API
#
# DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
#
# The version of the OpenAPI document: v1
# Contact: contacts@dadapush.com
# Generated by: https://openapi-generator.tech


#' Action Class
#'
#' @field name 
#' @field type 
#' @field url 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Action <- R6::R6Class(
  'Action',
  public = list(
    `name` = NULL,
    `type` = NULL,
    `url` = NULL,
    initialize = function(`name`, `type`, `url`, ...){
      local.optional.var <- list(...)
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!missing(`url`)) {
        stopifnot(is.character(`url`), length(`url`) == 1)
        self$`url` <- `url`
      }
    },
    toJSON = function() {
      ActionObject <- list()
      if (!is.null(self$`name`)) {
        ActionObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`type`)) {
        ActionObject[['type']] <-
          self$`type`
      }
      if (!is.null(self$`url`)) {
        ActionObject[['url']] <-
          self$`url`
      }

      ActionObject
    },
    fromJSON = function(ActionJson) {
      ActionObject <- jsonlite::fromJSON(ActionJson)
      if (!is.null(ActionObject$`name`)) {
        self$`name` <- ActionObject$`name`
      }
      if (!is.null(ActionObject$`type`)) {
        self$`type` <- ActionObject$`type`
      }
      if (!is.null(ActionObject$`url`)) {
        self$`url` <- ActionObject$`url`
      }
    },
    toJSONString = function() {
      sprintf(
        '{
           "name":
             "%s",
           "type":
             "%s",
           "url":
             "%s"
        }',
        self$`name`,
        self$`type`,
        self$`url`
      )
    },
    fromJSONString = function(ActionJson) {
      ActionObject <- jsonlite::fromJSON(ActionJson)
      self$`name` <- ActionObject$`name`
      self$`type` <- ActionObject$`type`
      self$`url` <- ActionObject$`url`
      self
    }
  )
)
dadapush/dadapush-r-client documentation built on Nov. 4, 2019, 9:36 a.m.