# 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
#' MessagePushRequest Class
#'
#' @field actions
#' @field content
#' @field needPush
#' @field title
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
MessagePushRequest <- R6::R6Class(
'MessagePushRequest',
public = list(
`actions` = NULL,
`content` = NULL,
`needPush` = NULL,
`title` = NULL,
initialize = function(`content`, `needPush`, `title`, `actions`=NULL, ...){
local.optional.var <- list(...)
if (!missing(`content`)) {
stopifnot(is.character(`content`), length(`content`) == 1)
self$`content` <- `content`
}
if (!missing(`needPush`)) {
self$`needPush` <- `needPush`
}
if (!missing(`title`)) {
stopifnot(is.character(`title`), length(`title`) == 1)
self$`title` <- `title`
}
if (!is.null(`actions`)) {
stopifnot(is.vector(`actions`), length(`actions`) != 0)
sapply(`actions`, function(x) stopifnot(R6::is.R6(x)))
self$`actions` <- `actions`
}
},
toJSON = function() {
MessagePushRequestObject <- list()
if (!is.null(self$`actions`)) {
MessagePushRequestObject[['actions']] <-
sapply(self$`actions`, function(x) x$toJSON())
}
if (!is.null(self$`content`)) {
MessagePushRequestObject[['content']] <-
self$`content`
}
if (!is.null(self$`needPush`)) {
MessagePushRequestObject[['needPush']] <-
self$`needPush`
}
if (!is.null(self$`title`)) {
MessagePushRequestObject[['title']] <-
self$`title`
}
MessagePushRequestObject
},
fromJSON = function(MessagePushRequestJson) {
MessagePushRequestObject <- jsonlite::fromJSON(MessagePushRequestJson)
if (!is.null(MessagePushRequestObject$`actions`)) {
self$`actions` <- sapply(MessagePushRequestObject$`actions`, function(x) {
actionsObject <- Action$new()
actionsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
actionsObject
})
}
if (!is.null(MessagePushRequestObject$`content`)) {
self$`content` <- MessagePushRequestObject$`content`
}
if (!is.null(MessagePushRequestObject$`needPush`)) {
self$`needPush` <- MessagePushRequestObject$`needPush`
}
if (!is.null(MessagePushRequestObject$`title`)) {
self$`title` <- MessagePushRequestObject$`title`
}
},
toJSONString = function() {
sprintf(
'{
"actions":
[%s],
"content":
"%s",
"needPush":
"%s",
"title":
"%s"
}',
paste(unlist(lapply(self$`actions`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE))), collapse=","),
self$`content`,
self$`needPush`,
self$`title`
)
},
fromJSONString = function(MessagePushRequestJson) {
MessagePushRequestObject <- jsonlite::fromJSON(MessagePushRequestJson)
data.frame <- MessagePushRequestObject$`actions`
self$`actions` <- vector("list", length = nrow(data.frame))
for (row in 1:nrow(data.frame)) {
actions.node <- Action$new()
actions.node$fromJSON(jsonlite::toJSON(data.frame[row,,drop = TRUE], auto_unbox = TRUE))
self$`actions`[[row]] <- actions.node
}
self$`content` <- MessagePushRequestObject$`content`
self$`needPush` <- MessagePushRequestObject$`needPush`
self$`title` <- MessagePushRequestObject$`title`
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.