# 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
#' @title DaDaPushMessage operations
#' @description DaDaPushClient.DaDaPushMessage
#'
#' @field path Stores url path of the request.
#' @field apiClient Handles the client-server communication.
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' CreateMessage push Message to a Channel
#'
#'
#' DeleteMessage delete a Channel Message
#'
#'
#' GetMessage get a Channel Message
#'
#'
#' GetMessages get Message List
#'
#' }
#'
#' @importFrom caTools base64encode
#' @export
DaDaPushMessageApi <- R6::R6Class(
'DaDaPushMessageApi',
public = list(
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
CreateMessage = function(body, x.channel.token=NULL, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`body`)) {
stop("Missing required parameter `body`.")
}
headerParams['x-channel-token'] <- `x.channel.token`
if (!missing(`body`)) {
body <- `body`$toJSONString()
} else {
body <- NULL
}
urlPath <- "/api/v1/message"
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ResultOfMessagePushResponse$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8"))
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
ApiResponse$new("API server error", resp)
}
},
DeleteMessage = function(message.id, x.channel.token=NULL, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`message.id`)) {
stop("Missing required parameter `message.id`.")
}
headerParams['x-channel-token'] <- `x.channel.token`
urlPath <- "/api/v1/message/{messageId}"
if (!missing(`message.id`)) {
urlPath <- gsub(paste0("\\{", "messageId", "\\}"), URLencode(as.character(`message.id`), reserved = TRUE), urlPath)
}
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
Result$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8"))
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
ApiResponse$new("API server error", resp)
}
},
GetMessage = function(message.id, x.channel.token=NULL, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`message.id`)) {
stop("Missing required parameter `message.id`.")
}
headerParams['x-channel-token'] <- `x.channel.token`
urlPath <- "/api/v1/message/{messageId}"
if (!missing(`message.id`)) {
urlPath <- gsub(paste0("\\{", "messageId", "\\}"), URLencode(as.character(`message.id`), reserved = TRUE), urlPath)
}
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ResultOfMessageObject$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8"))
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
ApiResponse$new("API server error", resp)
}
},
GetMessages = function(page, page.size, x.channel.token=NULL, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`page`)) {
stop("Missing required parameter `page`.")
}
if (missing(`page.size`)) {
stop("Missing required parameter `page.size`.")
}
headerParams['x-channel-token'] <- `x.channel.token`
queryParams['page'] <- page
queryParams['pageSize'] <- page.size
urlPath <- "/api/v1/messages"
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
ResultOfPageResponseOfMessageObject$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8"))
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
ApiResponse$new("API server error", resp)
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.