library(testthat)
library(DaDaPushClient)
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test DaDaPushMessageApi")
# api_client <- ApiClient$new(basePath = "http://127.0.0.1:8080")
api_client <- ApiClient$new()
api <- DaDaPushMessageApi$new(api_client)
test_that("CreateMessage", {
# tests for CreateMessage
# base path: https://www.dadapush.com
# push Message to a Channel
# <h2>Rate Limit:</h2><ul><li>1 request per 1s</li><li>30 request per 1m</li><li>500 request per 1h</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul>
# @param MessagePushRequest body body
# @param character x.channel.token see: https://www.dadapush.com/channel/list (optional)
# @return [ResultOfMessagePushResponse]
# uncomment below to test the operation
action <- Action$new(name = "view", url = "https://www.dadapush.com/", type = "link")
body <- MessagePushRequest$new(title = "Good News!",
content = "Good News! DaDaPush releasing new version",
needPush = "true",
actions = c(action)
)
response = api$CreateMessage(body,x.channel.token="ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf")
print(response)
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("DeleteMessage", {
# tests for DeleteMessage
# base path: https://www.dadapush.com
# delete a Channel Message
# <h2>Rate Limit:</h2><ul><li>10 request per 1s</li><li>100 request per 1m</li><li>1000 request per 1h</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul>
# @param integer message.id messageId
# @param character x.channel.token see: https://www.dadapush.com/channel/list (optional)
# @return [Result]
# uncomment below to test the operation
# response = api$DeleteMessage(message.id=227851,x.channel.token="ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf")
# print(response)
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("GetMessage", {
# tests for GetMessage
# base path: https://www.dadapush.com
# get a Channel Message
# <h2>Rate Limit:</h2><ul><li>10 request per 1s</li><li>100 request per 1m</li><li>1000 request per 1h</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul>
# @param integer message.id messageId
# @param character x.channel.token see: https://www.dadapush.com/channel/list (optional)
# @return [ResultOfMessageObject]
# uncomment below to test the operation
# response = api$GetMessage(message.id=227851,x.channel.token="ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf")
# print(response)
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("GetMessages", {
# tests for GetMessages
# base path: https://www.dadapush.com
# get Message List
# <h2>Rate Limit:</h2><ul><li>1 request per 1s</li><li>45 request per 1m</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul>
# @param integer page greater than 1
# @param integer page.size range is 1,50
# @param character x.channel.token see: https://www.dadapush.com/channel/list (optional)
# @return [ResultOfPageResponseOfMessageObject]
# uncomment below to test the operation
# response = api$GetMessages(page=1,page.size=10,x.channel.token="ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf")
# print(response)
#expect_equal(result, "EXPECTED_RESULT")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.