smooch-api 5.25.1 → 5.26.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6953361cda33e901ed5ad46d57bc4ec2f43bbff4
4
- data.tar.gz: 170cd69494f5fd36f1b3195b01a39a2e8d436f68
3
+ metadata.gz: e2727c1b447fe8d1aa90b56594946efb1b2e72c5
4
+ data.tar.gz: 9e8963b11b0a1f30d8653c6f0c51f507176e6afb
5
5
  SHA512:
6
- metadata.gz: 8fa92ec43a8e0524d3b84fe0d9ec5aaa86d4c6424d656792e245443332f3afbfb77dbcb39bb4fcbec2f432f11a7d8be6e7a67110d0b32145f26a0ed2c05ee26b
7
- data.tar.gz: 5e04fb67c58ea79f96853455c1406642458eeb329a93c958fb248e887f0e68a099247e50bfaee468cb5b3cc0c5b05c9d779ab5c3fac7a7971bd4e5a8e9cdbe15
6
+ metadata.gz: b11f0920c3dd52f00dd66a408622bfe6dbe2dd4aa78cbc60bf3b33f2cf78099a90b2270f170f531d1dcb14ad1b81886e7dbc42d5bb05ec84376d61ba236700b8
7
+ data.tar.gz: 1c68d47c89909996083ea286fa56f2e662cea97572c5f0f9fa5e7b178c913f5f7e17808174f35b2a2200caeb18214dcb9cc50f142b0ecbc465c6bc675c2772b1
data/README.md CHANGED
@@ -25,7 +25,7 @@ gem install smooch-api
25
25
 
26
26
  Add this to the Gemfile:
27
27
 
28
- gem 'smooch-api', '~> 5.25.1'
28
+ gem 'smooch-api', '~> 5.26.0'
29
29
 
30
30
  ## Getting Started
31
31
 
@@ -156,6 +156,7 @@ Class | Method | HTTP request | Description
156
156
  *SmoochApi::MenuApi* | [**delete_menu**](docs/MenuApi.md#delete_menu) | **DELETE** /v1.1/apps/{appId}/menu |
157
157
  *SmoochApi::MenuApi* | [**get_menu**](docs/MenuApi.md#get_menu) | **GET** /v1.1/apps/{appId}/menu |
158
158
  *SmoochApi::MenuApi* | [**update_menu**](docs/MenuApi.md#update_menu) | **PUT** /v1.1/apps/{appId}/menu |
159
+ *SmoochApi::NotificationApi* | [**post_notification**](docs/NotificationApi.md#post_notification) | **POST** /v1/apps/{appId}/notifications |
159
160
  *SmoochApi::ServiceAccountApi* | [**create_secret_key**](docs/ServiceAccountApi.md#create_secret_key) | **POST** /v1.1/serviceaccounts/{serviceAccountId}/keys |
160
161
  *SmoochApi::ServiceAccountApi* | [**create_service_account**](docs/ServiceAccountApi.md#create_service_account) | **POST** /v1.1/serviceaccounts |
161
162
  *SmoochApi::ServiceAccountApi* | [**delete_secret_key**](docs/ServiceAccountApi.md#delete_secret_key) | **DELETE** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId} |
@@ -198,6 +199,7 @@ Class | Method | HTTP request | Description
198
199
  - [SmoochApi::AttachmentRemove](docs/AttachmentRemove.md)
199
200
  - [SmoochApi::AttachmentResponse](docs/AttachmentResponse.md)
200
201
  - [SmoochApi::AuthCodeResponse](docs/AuthCodeResponse.md)
202
+ - [SmoochApi::Author](docs/Author.md)
201
203
  - [SmoochApi::BusinessSystemItem](docs/BusinessSystemItem.md)
202
204
  - [SmoochApi::ChannelEntityItem](docs/ChannelEntityItem.md)
203
205
  - [SmoochApi::Client](docs/Client.md)
@@ -246,6 +248,10 @@ Class | Method | HTTP request | Description
246
248
  - [SmoochApi::MessageOverrideWhatsapp](docs/MessageOverrideWhatsapp.md)
247
249
  - [SmoochApi::MessagePost](docs/MessagePost.md)
248
250
  - [SmoochApi::MessageResponse](docs/MessageResponse.md)
251
+ - [SmoochApi::NotificationPost](docs/NotificationPost.md)
252
+ - [SmoochApi::NotificationPostDestination](docs/NotificationPostDestination.md)
253
+ - [SmoochApi::NotificationResponse](docs/NotificationResponse.md)
254
+ - [SmoochApi::NotificationResponseNotification](docs/NotificationResponseNotification.md)
249
255
  - [SmoochApi::Option](docs/Option.md)
250
256
  - [SmoochApi::QuotedMessage](docs/QuotedMessage.md)
251
257
  - [SmoochApi::SecretKey](docs/SecretKey.md)
@@ -0,0 +1,11 @@
1
+ # SmoochApi::Author
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **role** | **String** | The role of the individual posting the message. The only accepted value is \"appMaker\". |
7
+ **name** | **String** | The display name of the message author. | [optional]
8
+ **email** | **String** | The email address of the message author. | [optional]
9
+ **avatarUrl** | **String** | The URL of the desired message avatar image. | [optional]
10
+
11
+
@@ -0,0 +1,71 @@
1
+ # SmoochApi::NotificationApi
2
+
3
+ All URIs are relative to *https://api.smooch.io*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**post_notification**](NotificationApi.md#post_notification) | **POST** /v1/apps/{appId}/notifications |
8
+
9
+
10
+ # **post_notification**
11
+ > NotificationResponse post_notification(appId, notificationPostBody)
12
+
13
+
14
+
15
+ Post a notification to an externalId.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'smooch-api'
21
+ # setup authorization
22
+ SmoochApi.configure do |config|
23
+ # Configure HTTP basic authorization (recommended): basicAuth
24
+ config.username = 'API_KEY_ID'
25
+ config.password = 'API_KEY_SECRET'
26
+
27
+
28
+ # OR
29
+
30
+ # Configure API key authorization (alternative): jwt
31
+ config.api_key['Authorization'] = 'YOUR JWT'
32
+ config.api_key_prefix['Authorization'] = 'Bearer'
33
+ end
34
+
35
+ api_instance = SmoochApi::NotificationApi.new
36
+
37
+ appId = "appId_example" # String | Identifies the app.
38
+
39
+ notificationPostBody = SmoochApi::NotificationPost.new # NotificationPost | Body for a postNotification request.
40
+
41
+
42
+ begin
43
+ result = api_instance.post_notification(appId, notificationPostBody)
44
+ p result
45
+ rescue SmoochApi::ApiError => e
46
+ puts "Exception when calling NotificationApi->post_notification: #{e}"
47
+ end
48
+ ```
49
+
50
+ ### Parameters
51
+
52
+ Name | Type | Description | Notes
53
+ ------------- | ------------- | ------------- | -------------
54
+ **appId** | **String**| Identifies the app. |
55
+ **notificationPostBody** | [**NotificationPost**](NotificationPost.md)| Body for a postNotification request. |
56
+
57
+ ### Return type
58
+
59
+ [**NotificationResponse**](NotificationResponse.md)
60
+
61
+ ### Authorization
62
+
63
+ [basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt)
64
+
65
+ ### HTTP request headers
66
+
67
+ - **Content-Type**: application/json
68
+ - **Accept**: application/json
69
+
70
+
71
+
@@ -0,0 +1,11 @@
1
+ # SmoochApi::NotificationPost
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **destination** | [**NotificationPostDestination**](NotificationPostDestination.md) | The destination of the notification. |
7
+ **messageSchema** | **String** | If specified, the only accepted value is `whatsapp`. To be included when sending WhatsApp message templates. | [optional]
8
+ **author** | [**Author**](Author.md) | An object containing role, email, name and avatarUrl. |
9
+ **message** | **Object** | The notification message to send. |
10
+
11
+
@@ -0,0 +1,9 @@
1
+ # SmoochApi::NotificationPostDestination
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **integrationId** | **String** | The ID of the target integration. |
7
+ **destinationId** | **String** | The external ID (channel specific) of the target user. |
8
+
9
+
@@ -0,0 +1,8 @@
1
+ # SmoochApi::NotificationResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **notification** | [**NotificationResponseNotification**](NotificationResponseNotification.md) | | [optional]
7
+
8
+
@@ -0,0 +1,8 @@
1
+ # SmoochApi::NotificationResponseNotification
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **String** | Automatically generated UUID used to identify the notification in Webhooks. |
7
+
8
+
@@ -35,6 +35,7 @@ require 'smooch-api/models/app_user_update'
35
35
  require 'smooch-api/models/attachment_remove'
36
36
  require 'smooch-api/models/attachment_response'
37
37
  require 'smooch-api/models/auth_code_response'
38
+ require 'smooch-api/models/author'
38
39
  require 'smooch-api/models/business_system_item'
39
40
  require 'smooch-api/models/channel_entity_item'
40
41
  require 'smooch-api/models/client'
@@ -83,6 +84,10 @@ require 'smooch-api/models/message_override_messenger'
83
84
  require 'smooch-api/models/message_override_whatsapp'
84
85
  require 'smooch-api/models/message_post'
85
86
  require 'smooch-api/models/message_response'
87
+ require 'smooch-api/models/notification_post'
88
+ require 'smooch-api/models/notification_post_destination'
89
+ require 'smooch-api/models/notification_response'
90
+ require 'smooch-api/models/notification_response_notification'
86
91
  require 'smooch-api/models/option'
87
92
  require 'smooch-api/models/quoted_message'
88
93
  require 'smooch-api/models/secret_key'
@@ -113,6 +118,7 @@ require 'smooch-api/api/conversation_api'
113
118
  require 'smooch-api/api/deployment_api'
114
119
  require 'smooch-api/api/integration_api'
115
120
  require 'smooch-api/api/menu_api'
121
+ require 'smooch-api/api/notification_api'
116
122
  require 'smooch-api/api/service_account_api'
117
123
  require 'smooch-api/api/template_api'
118
124
  require 'smooch-api/api/webhook_api'
@@ -0,0 +1,84 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io).
5
+
6
+ OpenAPI spec version: 5.25
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module SmoochApi
16
+ class NotificationApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ #
24
+ # Post a notification to an externalId.
25
+ # @param appId Identifies the app.
26
+ # @param notificationPostBody Body for a postNotification request.
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [NotificationResponse]
29
+ def post_notification(appId, notificationPostBody, opts = {})
30
+ data, _status_code, _headers = post_notification_with_http_info(appId, notificationPostBody, opts)
31
+ return data
32
+ end
33
+
34
+ #
35
+ # Post a notification to an externalId.
36
+ # @param appId Identifies the app.
37
+ # @param notificationPostBody Body for a postNotification request.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(NotificationResponse, Fixnum, Hash)>] NotificationResponse data, response status code and response headers
40
+ def post_notification_with_http_info(appId, notificationPostBody, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: NotificationApi.post_notification ..."
43
+ end
44
+ # verify the required parameter 'appId' is set
45
+ if @api_client.config.client_side_validation && appId.nil?
46
+ fail ArgumentError, "Missing the required parameter 'appId' when calling NotificationApi.post_notification"
47
+ end
48
+ # verify the required parameter 'notificationPostBody' is set
49
+ if @api_client.config.client_side_validation && notificationPostBody.nil?
50
+ fail ArgumentError, "Missing the required parameter 'notificationPostBody' when calling NotificationApi.post_notification"
51
+ end
52
+ # resource path
53
+ local_var_path = "/v1/apps/{appId}/notifications".sub('{' + 'appId' + '}', appId.to_s)
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
62
+ # HTTP header 'Content-Type'
63
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
64
+
65
+ # form parameters
66
+ form_params = {}
67
+
68
+ # http body (model)
69
+ post_body = @api_client.object_to_http_body(notificationPostBody)
70
+ auth_names = ['basicAuth', 'jwt']
71
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names,
77
+ :return_type => 'NotificationResponse')
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug "API called: NotificationApi#post_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
80
+ end
81
+ return data, status_code, headers
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io).
5
+
6
+ OpenAPI spec version: 5.25
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SmoochApi
16
+
17
+ class Author
18
+ # The role of the individual posting the message. The only accepted value is \"appMaker\".
19
+ attr_accessor :role
20
+
21
+ # The display name of the message author.
22
+ attr_accessor :name
23
+
24
+ # The email address of the message author.
25
+ attr_accessor :email
26
+
27
+ # The URL of the desired message avatar image.
28
+ attr_accessor :avatarUrl
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'role' => :'role',
35
+ :'name' => :'name',
36
+ :'email' => :'email',
37
+ :'avatarUrl' => :'avatarUrl'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'role' => :'String',
45
+ :'name' => :'String',
46
+ :'email' => :'String',
47
+ :'avatarUrl' => :'String'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'role')
60
+ self.role = attributes[:'role']
61
+ end
62
+
63
+ if attributes.has_key?(:'name')
64
+ self.name = attributes[:'name']
65
+ end
66
+
67
+ if attributes.has_key?(:'email')
68
+ self.email = attributes[:'email']
69
+ end
70
+
71
+ if attributes.has_key?(:'avatarUrl')
72
+ self.avatarUrl = attributes[:'avatarUrl']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properies with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @role.nil?
82
+ invalid_properties.push("invalid value for 'role', role cannot be nil.")
83
+ end
84
+
85
+ return invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if @role.nil?
92
+ return true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ role == o.role &&
101
+ name == o.name &&
102
+ email == o.email &&
103
+ avatarUrl == o.avatarUrl
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [role, name, email, avatarUrl].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = SmoochApi.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map{ |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end