dadapush_client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +105 -0
- data/Rakefile +10 -0
- data/dadapush_client.gemspec +45 -0
- data/docs/Action.md +21 -0
- data/docs/DaDaPushMessageApi.md +218 -0
- data/docs/MessageObject.md +27 -0
- data/docs/MessagePushRequest.md +23 -0
- data/docs/MessagePushResponse.md +17 -0
- data/docs/PageResponseOfMessageObject.md +21 -0
- data/docs/Result.md +21 -0
- data/docs/ResultOfMessageObject.md +21 -0
- data/docs/ResultOfMessagePushResponse.md +21 -0
- data/docs/ResultOfPageResponseOfMessageObject.md +21 -0
- data/git_push.sh +55 -0
- data/lib/dadapush_client.rb +49 -0
- data/lib/dadapush_client/api/da_da_push_message_api.rb +292 -0
- data/lib/dadapush_client/api_client.rb +385 -0
- data/lib/dadapush_client/api_error.rb +57 -0
- data/lib/dadapush_client/configuration.rb +241 -0
- data/lib/dadapush_client/models/action.rb +328 -0
- data/lib/dadapush_client/models/message_object.rb +269 -0
- data/lib/dadapush_client/models/message_push_request.rb +300 -0
- data/lib/dadapush_client/models/message_push_response.rb +201 -0
- data/lib/dadapush_client/models/page_response_of_message_object.rb +216 -0
- data/lib/dadapush_client/models/result.rb +224 -0
- data/lib/dadapush_client/models/result_of_message_object.rb +224 -0
- data/lib/dadapush_client/models/result_of_message_push_response.rb +224 -0
- data/lib/dadapush_client/models/result_of_page_response_of_message_object.rb +224 -0
- data/lib/dadapush_client/version.rb +15 -0
- data/spec/api/da_da_push_message_api_spec.rb +88 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/action_spec.rb +57 -0
- data/spec/models/message_object_spec.rb +71 -0
- data/spec/models/message_push_request_spec.rb +59 -0
- data/spec/models/message_push_response_spec.rb +41 -0
- data/spec/models/page_response_of_message_object_spec.rb +53 -0
- data/spec/models/result_of_message_object_spec.rb +53 -0
- data/spec/models/result_of_message_push_response_spec.rb +53 -0
- data/spec/models/result_of_page_response_of_message_object_spec.rb +53 -0
- data/spec/models/result_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- metadata +282 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
# DaDaPushClient::MessageObject
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**actions** | [**Array<Action>**](Action.md) | action size range is 0,3 | [optional]
|
8
|
+
**channel_name** | **String** | |
|
9
|
+
**content** | **String** | |
|
10
|
+
**created_at** | **String** | |
|
11
|
+
**id** | **Integer** | |
|
12
|
+
**title** | **String** | |
|
13
|
+
|
14
|
+
## Code Sample
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'DaDaPushClient'
|
18
|
+
|
19
|
+
instance = DaDaPushClient::MessageObject.new(actions: null,
|
20
|
+
channel_name: channelName,
|
21
|
+
content: DaDaPush v1.0.0 releasing,
|
22
|
+
created_at: 2015-07-25T23:09:01.795+0700,
|
23
|
+
id: 123,
|
24
|
+
title: Good News!)
|
25
|
+
```
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# DaDaPushClient::MessagePushRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**actions** | [**Array<Action>**](Action.md) | action size range is 0,3 | [optional]
|
8
|
+
**content** | **String** | message content |
|
9
|
+
**need_push** | **Boolean** | when value is false, will not send client push |
|
10
|
+
**title** | **String** | message title |
|
11
|
+
|
12
|
+
## Code Sample
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'DaDaPushClient'
|
16
|
+
|
17
|
+
instance = DaDaPushClient::MessagePushRequest.new(actions: null,
|
18
|
+
content: Good News! DaDaPush releasing new version,
|
19
|
+
need_push: true,
|
20
|
+
title: Good News!)
|
21
|
+
```
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# DaDaPushClient::MessagePushResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**message_id** | **Integer** | |
|
8
|
+
|
9
|
+
## Code Sample
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'DaDaPushClient'
|
13
|
+
|
14
|
+
instance = DaDaPushClient::MessagePushResponse.new(message_id: 12345)
|
15
|
+
```
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# DaDaPushClient::PageResponseOfMessageObject
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**content** | [**Array<MessageObject>**](MessageObject.md) | | [optional]
|
8
|
+
**total_elements** | **Integer** | | [optional]
|
9
|
+
**total_pages** | **Integer** | | [optional]
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'DaDaPushClient'
|
15
|
+
|
16
|
+
instance = DaDaPushClient::PageResponseOfMessageObject.new(content: null,
|
17
|
+
total_elements: null,
|
18
|
+
total_pages: null)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
data/docs/Result.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# DaDaPushClient::Result
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**code** | **Integer** | |
|
8
|
+
**data** | [**Object**](.md) | | [optional]
|
9
|
+
**errmsg** | **String** | |
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'DaDaPushClient'
|
15
|
+
|
16
|
+
instance = DaDaPushClient::Result.new(code: 0,
|
17
|
+
data: null,
|
18
|
+
errmsg: ok)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# DaDaPushClient::ResultOfMessageObject
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**code** | **Integer** | |
|
8
|
+
**data** | [**MessageObject**](MessageObject.md) | | [optional]
|
9
|
+
**errmsg** | **String** | |
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'DaDaPushClient'
|
15
|
+
|
16
|
+
instance = DaDaPushClient::ResultOfMessageObject.new(code: 0,
|
17
|
+
data: null,
|
18
|
+
errmsg: ok)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# DaDaPushClient::ResultOfMessagePushResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**code** | **Integer** | |
|
8
|
+
**data** | [**MessagePushResponse**](MessagePushResponse.md) | | [optional]
|
9
|
+
**errmsg** | **String** | |
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'DaDaPushClient'
|
15
|
+
|
16
|
+
instance = DaDaPushClient::ResultOfMessagePushResponse.new(code: 0,
|
17
|
+
data: null,
|
18
|
+
errmsg: ok)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# DaDaPushClient::ResultOfPageResponseOfMessageObject
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**code** | **Integer** | |
|
8
|
+
**data** | [**PageResponseOfMessageObject**](PageResponseOfMessageObject.md) | | [optional]
|
9
|
+
**errmsg** | **String** | |
|
10
|
+
|
11
|
+
## Code Sample
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'DaDaPushClient'
|
15
|
+
|
16
|
+
instance = DaDaPushClient::ResultOfPageResponseOfMessageObject.new(code: 0,
|
17
|
+
data: null,
|
18
|
+
errmsg: ok)
|
19
|
+
```
|
20
|
+
|
21
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://openapi-generator.tech
|
4
|
+
#
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
6
|
+
#
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
8
|
+
|
9
|
+
git_user_id=$1
|
10
|
+
git_repo_id=$2
|
11
|
+
release_note=$3
|
12
|
+
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
14
|
+
git_user_id="GIT_USER_ID"
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
16
|
+
fi
|
17
|
+
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
19
|
+
git_repo_id="GIT_REPO_ID"
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ "$release_note" = "" ]; then
|
24
|
+
release_note="Minor update"
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
26
|
+
fi
|
27
|
+
|
28
|
+
# Initialize the local directory as a Git repository
|
29
|
+
git init
|
30
|
+
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
32
|
+
git add .
|
33
|
+
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
35
|
+
git commit -m "$release_note"
|
36
|
+
|
37
|
+
# Sets the new remote
|
38
|
+
git_remote=`git remote`
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
40
|
+
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
44
|
+
else
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
46
|
+
fi
|
47
|
+
|
48
|
+
fi
|
49
|
+
|
50
|
+
git pull origin master
|
51
|
+
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
55
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
=begin
|
2
|
+
#DaDaPush Public API
|
3
|
+
|
4
|
+
#DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: contacts@dadapush.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'dadapush_client/api_client'
|
15
|
+
require 'dadapush_client/api_error'
|
16
|
+
require 'dadapush_client/version'
|
17
|
+
require 'dadapush_client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'dadapush_client/models/action'
|
21
|
+
require 'dadapush_client/models/message_object'
|
22
|
+
require 'dadapush_client/models/message_push_request'
|
23
|
+
require 'dadapush_client/models/message_push_response'
|
24
|
+
require 'dadapush_client/models/page_response_of_message_object'
|
25
|
+
require 'dadapush_client/models/result'
|
26
|
+
require 'dadapush_client/models/result_of_message_object'
|
27
|
+
require 'dadapush_client/models/result_of_message_push_response'
|
28
|
+
require 'dadapush_client/models/result_of_page_response_of_message_object'
|
29
|
+
|
30
|
+
# APIs
|
31
|
+
require 'dadapush_client/api/da_da_push_message_api'
|
32
|
+
|
33
|
+
module DaDaPushClient
|
34
|
+
class << self
|
35
|
+
# Customize default settings for the SDK using block.
|
36
|
+
# DaDaPushClient.configure do |config|
|
37
|
+
# config.username = "xxx"
|
38
|
+
# config.password = "xxx"
|
39
|
+
# end
|
40
|
+
# If no block given, return the default Configuration object.
|
41
|
+
def configure
|
42
|
+
if block_given?
|
43
|
+
yield(Configuration.default)
|
44
|
+
else
|
45
|
+
Configuration.default
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,292 @@
|
|
1
|
+
=begin
|
2
|
+
#DaDaPush Public API
|
3
|
+
|
4
|
+
#DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: contacts@dadapush.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module DaDaPushClient
|
16
|
+
class DaDaPushMessageApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# push Message to a Channel
|
23
|
+
# <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>
|
24
|
+
# @param body [MessagePushRequest] body
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
27
|
+
# @return [ResultOfMessagePushResponse]
|
28
|
+
def create_message(body, opts = {})
|
29
|
+
data, _status_code, _headers = create_message_with_http_info(body, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# push Message to a Channel
|
34
|
+
# <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>
|
35
|
+
# @param body [MessagePushRequest] body
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
38
|
+
# @return [Array<(ResultOfMessagePushResponse, Integer, Hash)>] ResultOfMessagePushResponse data, response status code and response headers
|
39
|
+
def create_message_with_http_info(body, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: DaDaPushMessageApi.create_message ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'body' is set
|
44
|
+
if @api_client.config.client_side_validation && body.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling DaDaPushMessageApi.create_message"
|
46
|
+
end
|
47
|
+
# resource path
|
48
|
+
local_var_path = '/api/v1/message'
|
49
|
+
|
50
|
+
# query parameters
|
51
|
+
query_params = opts[:query_params] || {}
|
52
|
+
|
53
|
+
# header parameters
|
54
|
+
header_params = opts[:header_params] || {}
|
55
|
+
# HTTP header 'Accept' (if needed)
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
57
|
+
# HTTP header 'Content-Type'
|
58
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
59
|
+
header_params[:'x-channel-token'] = opts[:'x_channel_token'] if !opts[:'x_channel_token'].nil?
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:return_type] || 'ResultOfMessagePushResponse'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:auth_names] || []
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:header_params => header_params,
|
75
|
+
:query_params => query_params,
|
76
|
+
:form_params => form_params,
|
77
|
+
:body => post_body,
|
78
|
+
:auth_names => auth_names,
|
79
|
+
:return_type => return_type
|
80
|
+
)
|
81
|
+
|
82
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
83
|
+
if @api_client.config.debugging
|
84
|
+
@api_client.config.logger.debug "API called: DaDaPushMessageApi#create_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
85
|
+
end
|
86
|
+
return data, status_code, headers
|
87
|
+
end
|
88
|
+
|
89
|
+
# delete a Channel Message
|
90
|
+
# <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>
|
91
|
+
# @param message_id [Integer] messageId
|
92
|
+
# @param [Hash] opts the optional parameters
|
93
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
94
|
+
# @return [Result]
|
95
|
+
def delete_message(message_id, opts = {})
|
96
|
+
data, _status_code, _headers = delete_message_with_http_info(message_id, opts)
|
97
|
+
data
|
98
|
+
end
|
99
|
+
|
100
|
+
# delete a Channel Message
|
101
|
+
# <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>
|
102
|
+
# @param message_id [Integer] messageId
|
103
|
+
# @param [Hash] opts the optional parameters
|
104
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
105
|
+
# @return [Array<(Result, Integer, Hash)>] Result data, response status code and response headers
|
106
|
+
def delete_message_with_http_info(message_id, opts = {})
|
107
|
+
if @api_client.config.debugging
|
108
|
+
@api_client.config.logger.debug 'Calling API: DaDaPushMessageApi.delete_message ...'
|
109
|
+
end
|
110
|
+
# verify the required parameter 'message_id' is set
|
111
|
+
if @api_client.config.client_side_validation && message_id.nil?
|
112
|
+
fail ArgumentError, "Missing the required parameter 'message_id' when calling DaDaPushMessageApi.delete_message"
|
113
|
+
end
|
114
|
+
# resource path
|
115
|
+
local_var_path = '/api/v1/message/{messageId}'.sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))
|
116
|
+
|
117
|
+
# query parameters
|
118
|
+
query_params = opts[:query_params] || {}
|
119
|
+
|
120
|
+
# header parameters
|
121
|
+
header_params = opts[:header_params] || {}
|
122
|
+
# HTTP header 'Accept' (if needed)
|
123
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
124
|
+
header_params[:'x-channel-token'] = opts[:'x_channel_token'] if !opts[:'x_channel_token'].nil?
|
125
|
+
|
126
|
+
# form parameters
|
127
|
+
form_params = opts[:form_params] || {}
|
128
|
+
|
129
|
+
# http body (model)
|
130
|
+
post_body = opts[:body]
|
131
|
+
|
132
|
+
# return_type
|
133
|
+
return_type = opts[:return_type] || 'Result'
|
134
|
+
|
135
|
+
# auth_names
|
136
|
+
auth_names = opts[:auth_names] || []
|
137
|
+
|
138
|
+
new_options = opts.merge(
|
139
|
+
:header_params => header_params,
|
140
|
+
:query_params => query_params,
|
141
|
+
:form_params => form_params,
|
142
|
+
:body => post_body,
|
143
|
+
:auth_names => auth_names,
|
144
|
+
:return_type => return_type
|
145
|
+
)
|
146
|
+
|
147
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
148
|
+
if @api_client.config.debugging
|
149
|
+
@api_client.config.logger.debug "API called: DaDaPushMessageApi#delete_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
150
|
+
end
|
151
|
+
return data, status_code, headers
|
152
|
+
end
|
153
|
+
|
154
|
+
# get a Channel Message
|
155
|
+
# <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>
|
156
|
+
# @param message_id [Integer] messageId
|
157
|
+
# @param [Hash] opts the optional parameters
|
158
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
159
|
+
# @return [ResultOfMessageObject]
|
160
|
+
def get_message(message_id, opts = {})
|
161
|
+
data, _status_code, _headers = get_message_with_http_info(message_id, opts)
|
162
|
+
data
|
163
|
+
end
|
164
|
+
|
165
|
+
# get a Channel Message
|
166
|
+
# <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>
|
167
|
+
# @param message_id [Integer] messageId
|
168
|
+
# @param [Hash] opts the optional parameters
|
169
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
170
|
+
# @return [Array<(ResultOfMessageObject, Integer, Hash)>] ResultOfMessageObject data, response status code and response headers
|
171
|
+
def get_message_with_http_info(message_id, opts = {})
|
172
|
+
if @api_client.config.debugging
|
173
|
+
@api_client.config.logger.debug 'Calling API: DaDaPushMessageApi.get_message ...'
|
174
|
+
end
|
175
|
+
# verify the required parameter 'message_id' is set
|
176
|
+
if @api_client.config.client_side_validation && message_id.nil?
|
177
|
+
fail ArgumentError, "Missing the required parameter 'message_id' when calling DaDaPushMessageApi.get_message"
|
178
|
+
end
|
179
|
+
# resource path
|
180
|
+
local_var_path = '/api/v1/message/{messageId}'.sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))
|
181
|
+
|
182
|
+
# query parameters
|
183
|
+
query_params = opts[:query_params] || {}
|
184
|
+
|
185
|
+
# header parameters
|
186
|
+
header_params = opts[:header_params] || {}
|
187
|
+
# HTTP header 'Accept' (if needed)
|
188
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
189
|
+
header_params[:'x-channel-token'] = opts[:'x_channel_token'] if !opts[:'x_channel_token'].nil?
|
190
|
+
|
191
|
+
# form parameters
|
192
|
+
form_params = opts[:form_params] || {}
|
193
|
+
|
194
|
+
# http body (model)
|
195
|
+
post_body = opts[:body]
|
196
|
+
|
197
|
+
# return_type
|
198
|
+
return_type = opts[:return_type] || 'ResultOfMessageObject'
|
199
|
+
|
200
|
+
# auth_names
|
201
|
+
auth_names = opts[:auth_names] || []
|
202
|
+
|
203
|
+
new_options = opts.merge(
|
204
|
+
:header_params => header_params,
|
205
|
+
:query_params => query_params,
|
206
|
+
:form_params => form_params,
|
207
|
+
:body => post_body,
|
208
|
+
:auth_names => auth_names,
|
209
|
+
:return_type => return_type
|
210
|
+
)
|
211
|
+
|
212
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
213
|
+
if @api_client.config.debugging
|
214
|
+
@api_client.config.logger.debug "API called: DaDaPushMessageApi#get_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
215
|
+
end
|
216
|
+
return data, status_code, headers
|
217
|
+
end
|
218
|
+
|
219
|
+
# get Message List
|
220
|
+
# <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>
|
221
|
+
# @param page [Integer] greater than 1
|
222
|
+
# @param page_size [Integer] range is 1,50
|
223
|
+
# @param [Hash] opts the optional parameters
|
224
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
225
|
+
# @return [ResultOfPageResponseOfMessageObject]
|
226
|
+
def get_messages(page, page_size, opts = {})
|
227
|
+
data, _status_code, _headers = get_messages_with_http_info(page, page_size, opts)
|
228
|
+
data
|
229
|
+
end
|
230
|
+
|
231
|
+
# get Message List
|
232
|
+
# <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>
|
233
|
+
# @param page [Integer] greater than 1
|
234
|
+
# @param page_size [Integer] range is 1,50
|
235
|
+
# @param [Hash] opts the optional parameters
|
236
|
+
# @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list
|
237
|
+
# @return [Array<(ResultOfPageResponseOfMessageObject, Integer, Hash)>] ResultOfPageResponseOfMessageObject data, response status code and response headers
|
238
|
+
def get_messages_with_http_info(page, page_size, opts = {})
|
239
|
+
if @api_client.config.debugging
|
240
|
+
@api_client.config.logger.debug 'Calling API: DaDaPushMessageApi.get_messages ...'
|
241
|
+
end
|
242
|
+
# verify the required parameter 'page' is set
|
243
|
+
if @api_client.config.client_side_validation && page.nil?
|
244
|
+
fail ArgumentError, "Missing the required parameter 'page' when calling DaDaPushMessageApi.get_messages"
|
245
|
+
end
|
246
|
+
# verify the required parameter 'page_size' is set
|
247
|
+
if @api_client.config.client_side_validation && page_size.nil?
|
248
|
+
fail ArgumentError, "Missing the required parameter 'page_size' when calling DaDaPushMessageApi.get_messages"
|
249
|
+
end
|
250
|
+
# resource path
|
251
|
+
local_var_path = '/api/v1/messages'
|
252
|
+
|
253
|
+
# query parameters
|
254
|
+
query_params = opts[:query_params] || {}
|
255
|
+
query_params[:'page'] = page
|
256
|
+
query_params[:'pageSize'] = page_size
|
257
|
+
|
258
|
+
# header parameters
|
259
|
+
header_params = opts[:header_params] || {}
|
260
|
+
# HTTP header 'Accept' (if needed)
|
261
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
262
|
+
header_params[:'x-channel-token'] = opts[:'x_channel_token'] if !opts[:'x_channel_token'].nil?
|
263
|
+
|
264
|
+
# form parameters
|
265
|
+
form_params = opts[:form_params] || {}
|
266
|
+
|
267
|
+
# http body (model)
|
268
|
+
post_body = opts[:body]
|
269
|
+
|
270
|
+
# return_type
|
271
|
+
return_type = opts[:return_type] || 'ResultOfPageResponseOfMessageObject'
|
272
|
+
|
273
|
+
# auth_names
|
274
|
+
auth_names = opts[:auth_names] || []
|
275
|
+
|
276
|
+
new_options = opts.merge(
|
277
|
+
:header_params => header_params,
|
278
|
+
:query_params => query_params,
|
279
|
+
:form_params => form_params,
|
280
|
+
:body => post_body,
|
281
|
+
:auth_names => auth_names,
|
282
|
+
:return_type => return_type
|
283
|
+
)
|
284
|
+
|
285
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
286
|
+
if @api_client.config.debugging
|
287
|
+
@api_client.config.logger.debug "API called: DaDaPushMessageApi#get_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
288
|
+
end
|
289
|
+
return data, status_code, headers
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|