ElasticEmail 4.2.0 → 4.4.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.
data/docs/EmailsApi.md CHANGED
@@ -177,7 +177,7 @@ end
177
177
 
178
178
  ## emails_mergefile_post
179
179
 
180
- > <EmailSend> emails_mergefile_post(merge_email_payload)
180
+ > <EmailSend> emails_mergefile_post(merge_email_payload, opts)
181
181
 
182
182
  Send Bulk Emails CSV
183
183
 
@@ -198,10 +198,13 @@ end
198
198
 
199
199
  api_instance = ElasticEmail::EmailsApi.new
200
200
  merge_email_payload = ElasticEmail::MergeEmailPayload.new({merge_file: ElasticEmail::MessageAttachment.new({binary_content: 'binary_content_example', name: 'name_example'}), content: ElasticEmail::EmailContent.new({from: 'John Doe <email@domain.com>'})}) # MergeEmailPayload | Email data
201
+ opts = {
202
+ idempotency_key: '6f1c2a7e-3b4d-4e8f-9a1b-2c3d4e5f6a7b' # String | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
203
+ }
201
204
 
202
205
  begin
203
206
  # Send Bulk Emails CSV
204
- result = api_instance.emails_mergefile_post(merge_email_payload)
207
+ result = api_instance.emails_mergefile_post(merge_email_payload, opts)
205
208
  p result
206
209
  rescue ElasticEmail::ApiError => e
207
210
  puts "Error when calling EmailsApi->emails_mergefile_post: #{e}"
@@ -212,12 +215,12 @@ end
212
215
 
213
216
  This returns an Array which contains the response data, status code and headers.
214
217
 
215
- > <Array(<EmailSend>, Integer, Hash)> emails_mergefile_post_with_http_info(merge_email_payload)
218
+ > <Array(<EmailSend>, Integer, Hash)> emails_mergefile_post_with_http_info(merge_email_payload, opts)
216
219
 
217
220
  ```ruby
218
221
  begin
219
222
  # Send Bulk Emails CSV
220
- data, status_code, headers = api_instance.emails_mergefile_post_with_http_info(merge_email_payload)
223
+ data, status_code, headers = api_instance.emails_mergefile_post_with_http_info(merge_email_payload, opts)
221
224
  p status_code # => 2xx
222
225
  p headers # => { ... }
223
226
  p data # => <EmailSend>
@@ -231,6 +234,7 @@ end
231
234
  | Name | Type | Description | Notes |
232
235
  | ---- | ---- | ----------- | ----- |
233
236
  | **merge_email_payload** | [**MergeEmailPayload**](MergeEmailPayload.md) | Email data | |
237
+ | **idempotency_key** | **String** | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request. | [optional] |
234
238
 
235
239
  ### Return type
236
240
 
@@ -248,7 +252,7 @@ end
248
252
 
249
253
  ## emails_post
250
254
 
251
- > <EmailSend> emails_post(email_message_data)
255
+ > <EmailSend> emails_post(email_message_data, opts)
252
256
 
253
257
  Send Bulk Emails
254
258
 
@@ -269,10 +273,13 @@ end
269
273
 
270
274
  api_instance = ElasticEmail::EmailsApi.new
271
275
  email_message_data = ElasticEmail::EmailMessageData.new({recipients: [ElasticEmail::EmailRecipient.new({email: 'mail@example.com'})], content: ElasticEmail::EmailContent.new({from: 'John Doe <email@domain.com>'})}) # EmailMessageData | Email data
276
+ opts = {
277
+ idempotency_key: '6f1c2a7e-3b4d-4e8f-9a1b-2c3d4e5f6a7b' # String | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
278
+ }
272
279
 
273
280
  begin
274
281
  # Send Bulk Emails
275
- result = api_instance.emails_post(email_message_data)
282
+ result = api_instance.emails_post(email_message_data, opts)
276
283
  p result
277
284
  rescue ElasticEmail::ApiError => e
278
285
  puts "Error when calling EmailsApi->emails_post: #{e}"
@@ -283,12 +290,12 @@ end
283
290
 
284
291
  This returns an Array which contains the response data, status code and headers.
285
292
 
286
- > <Array(<EmailSend>, Integer, Hash)> emails_post_with_http_info(email_message_data)
293
+ > <Array(<EmailSend>, Integer, Hash)> emails_post_with_http_info(email_message_data, opts)
287
294
 
288
295
  ```ruby
289
296
  begin
290
297
  # Send Bulk Emails
291
- data, status_code, headers = api_instance.emails_post_with_http_info(email_message_data)
298
+ data, status_code, headers = api_instance.emails_post_with_http_info(email_message_data, opts)
292
299
  p status_code # => 2xx
293
300
  p headers # => { ... }
294
301
  p data # => <EmailSend>
@@ -302,6 +309,7 @@ end
302
309
  | Name | Type | Description | Notes |
303
310
  | ---- | ---- | ----------- | ----- |
304
311
  | **email_message_data** | [**EmailMessageData**](EmailMessageData.md) | Email data | |
312
+ | **idempotency_key** | **String** | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request. | [optional] |
305
313
 
306
314
  ### Return type
307
315
 
@@ -319,7 +327,7 @@ end
319
327
 
320
328
  ## emails_transactional_post
321
329
 
322
- > <EmailSend> emails_transactional_post(email_transactional_message_data)
330
+ > <EmailSend> emails_transactional_post(email_transactional_message_data, opts)
323
331
 
324
332
  Send Transactional Email
325
333
 
@@ -340,10 +348,13 @@ end
340
348
 
341
349
  api_instance = ElasticEmail::EmailsApi.new
342
350
  email_transactional_message_data = ElasticEmail::EmailTransactionalMessageData.new({recipients: ElasticEmail::TransactionalRecipient.new({to: ['to_example']}), content: ElasticEmail::EmailContent.new({from: 'John Doe <email@domain.com>'})}) # EmailTransactionalMessageData | Email data
351
+ opts = {
352
+ idempotency_key: '6f1c2a7e-3b4d-4e8f-9a1b-2c3d4e5f6a7b' # String | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
353
+ }
343
354
 
344
355
  begin
345
356
  # Send Transactional Email
346
- result = api_instance.emails_transactional_post(email_transactional_message_data)
357
+ result = api_instance.emails_transactional_post(email_transactional_message_data, opts)
347
358
  p result
348
359
  rescue ElasticEmail::ApiError => e
349
360
  puts "Error when calling EmailsApi->emails_transactional_post: #{e}"
@@ -354,12 +365,12 @@ end
354
365
 
355
366
  This returns an Array which contains the response data, status code and headers.
356
367
 
357
- > <Array(<EmailSend>, Integer, Hash)> emails_transactional_post_with_http_info(email_transactional_message_data)
368
+ > <Array(<EmailSend>, Integer, Hash)> emails_transactional_post_with_http_info(email_transactional_message_data, opts)
358
369
 
359
370
  ```ruby
360
371
  begin
361
372
  # Send Transactional Email
362
- data, status_code, headers = api_instance.emails_transactional_post_with_http_info(email_transactional_message_data)
373
+ data, status_code, headers = api_instance.emails_transactional_post_with_http_info(email_transactional_message_data, opts)
363
374
  p status_code # => 2xx
364
375
  p headers # => { ... }
365
376
  p data # => <EmailSend>
@@ -373,6 +384,7 @@ end
373
384
  | Name | Type | Description | Notes |
374
385
  | ---- | ---- | ----------- | ----- |
375
386
  | **email_transactional_message_data** | [**EmailTransactionalMessageData**](EmailTransactionalMessageData.md) | Email data | |
387
+ | **idempotency_key** | **String** | Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request. | [optional] |
376
388
 
377
389
  ### Return type
378
390
 
data/docs/Webhook.md CHANGED
@@ -17,6 +17,9 @@
17
17
  | **notification_for_abuse_report** | **Boolean** | | [optional] |
18
18
  | **notification_for_error** | **Boolean** | | [optional] |
19
19
  | **is_enabled** | **Boolean** | | [optional] |
20
+ | **signing_enabled** | **Boolean** | Requests carry an HMAC-SHA256 signature. Chosen when the webhook is created and can&#39;t be changed. | [optional] |
21
+ | **delivery_method** | [**WebhookDeliveryMethod**](WebhookDeliveryMethod.md) | | [optional][default to &#39;Get&#39;] |
22
+ | **signing_secret** | **String** | Signing secret - returned only once, when a webhook is created with signing or its secret is rotated. Store it safely. | [optional] |
20
23
 
21
24
  ## Example
22
25
 
@@ -36,7 +39,10 @@ instance = ElasticEmail::Webhook.new(
36
39
  notification_for_unsubscribed: null,
37
40
  notification_for_abuse_report: null,
38
41
  notification_for_error: null,
39
- is_enabled: null
42
+ is_enabled: null,
43
+ signing_enabled: null,
44
+ delivery_method: null,
45
+ signing_secret: null
40
46
  )
41
47
  ```
42
48
 
data/docs/WebhookApi.md CHANGED
@@ -7,6 +7,7 @@ All URIs are relative to *https://api.elasticemail.com/v4*
7
7
  | [**webhook_by_publicid_delete**](WebhookApi.md#webhook_by_publicid_delete) | **DELETE** /webhook/{publicid} | Delete Webhook |
8
8
  | [**webhook_by_publicid_get**](WebhookApi.md#webhook_by_publicid_get) | **GET** /webhook/{publicid} | Load Webhook |
9
9
  | [**webhook_by_publicid_put**](WebhookApi.md#webhook_by_publicid_put) | **PUT** /webhook/{publicid} | Update Webhook |
10
+ | [**webhook_by_publicid_secret_rotate_post**](WebhookApi.md#webhook_by_publicid_secret_rotate_post) | **POST** /webhook/{publicid}/secret/rotate | Rotate Webhook Secret |
10
11
  | [**webhook_get**](WebhookApi.md#webhook_get) | **GET** /webhook | Load Webhooks |
11
12
  | [**webhook_post**](WebhookApi.md#webhook_post) | **POST** /webhook | Add Webhook |
12
13
 
@@ -225,6 +226,77 @@ end
225
226
  - **Accept**: application/json
226
227
 
227
228
 
229
+ ## webhook_by_publicid_secret_rotate_post
230
+
231
+ > <Webhook> webhook_by_publicid_secret_rotate_post(publicid)
232
+
233
+ Rotate Webhook Secret
234
+
235
+ Replace the signing secret of a webhook created with signing. The old secret stops being used at once - there is no grace period. The new secret is returned only in this response. Notifications your endpoint rejects while it still has the old secret are retried and signed with the new one. Required Access Level: ModifyWebNotifications
236
+
237
+ ### Examples
238
+
239
+ ```ruby
240
+ require 'time'
241
+ require 'ElasticEmail'
242
+ # setup authorization
243
+ ElasticEmail.configure do |config|
244
+ # Configure API key authorization: apikey
245
+ config.api_key['X-ElasticEmail-ApiKey'] = 'YOUR API KEY'
246
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
247
+ # config.api_key_prefix['X-ElasticEmail-ApiKey'] = 'Bearer'
248
+ end
249
+
250
+ api_instance = ElasticEmail::WebhookApi.new
251
+ publicid = 'publicid_example' # String |
252
+
253
+ begin
254
+ # Rotate Webhook Secret
255
+ result = api_instance.webhook_by_publicid_secret_rotate_post(publicid)
256
+ p result
257
+ rescue ElasticEmail::ApiError => e
258
+ puts "Error when calling WebhookApi->webhook_by_publicid_secret_rotate_post: #{e}"
259
+ end
260
+ ```
261
+
262
+ #### Using the webhook_by_publicid_secret_rotate_post_with_http_info variant
263
+
264
+ This returns an Array which contains the response data, status code and headers.
265
+
266
+ > <Array(<Webhook>, Integer, Hash)> webhook_by_publicid_secret_rotate_post_with_http_info(publicid)
267
+
268
+ ```ruby
269
+ begin
270
+ # Rotate Webhook Secret
271
+ data, status_code, headers = api_instance.webhook_by_publicid_secret_rotate_post_with_http_info(publicid)
272
+ p status_code # => 2xx
273
+ p headers # => { ... }
274
+ p data # => <Webhook>
275
+ rescue ElasticEmail::ApiError => e
276
+ puts "Error when calling WebhookApi->webhook_by_publicid_secret_rotate_post_with_http_info: #{e}"
277
+ end
278
+ ```
279
+
280
+ ### Parameters
281
+
282
+ | Name | Type | Description | Notes |
283
+ | ---- | ---- | ----------- | ----- |
284
+ | **publicid** | **String** | | |
285
+
286
+ ### Return type
287
+
288
+ [**Webhook**](Webhook.md)
289
+
290
+ ### Authorization
291
+
292
+ [apikey](../README.md#apikey)
293
+
294
+ ### HTTP request headers
295
+
296
+ - **Content-Type**: Not defined
297
+ - **Accept**: application/json
298
+
299
+
228
300
  ## webhook_get
229
301
 
230
302
  > <Array<Webhook>> webhook_get(opts)
@@ -13,6 +13,8 @@
13
13
  | **notification_for_unsubscribed** | **Boolean** | | [optional] |
14
14
  | **notification_for_abuse_report** | **Boolean** | | [optional] |
15
15
  | **notification_for_error** | **Boolean** | | [optional] |
16
+ | **enable_signing** | **Boolean** | Sign every request with HMAC-SHA256. Can be set only when the webhook is created. Default: false. | [optional] |
17
+ | **delivery_method** | [**WebhookDeliveryMethod**](WebhookDeliveryMethod.md) | | [optional][default to &#39;Get&#39;] |
16
18
 
17
19
  ## Example
18
20
 
@@ -28,7 +30,9 @@ instance = ElasticEmail::WebhookCreatePayload.new(
28
30
  notification_for_clicked: null,
29
31
  notification_for_unsubscribed: null,
30
32
  notification_for_abuse_report: null,
31
- notification_for_error: null
33
+ notification_for_error: null,
34
+ enable_signing: null,
35
+ delivery_method: null
32
36
  )
33
37
  ```
34
38
 
@@ -0,0 +1,15 @@
1
+ # ElasticEmail::WebhookDeliveryMethod
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'ElasticEmail'
12
+
13
+ instance = ElasticEmail::WebhookDeliveryMethod.new()
14
+ ```
15
+
@@ -179,6 +179,7 @@ module ElasticEmail
179
179
  # Send to a list of contacts submitted in a CSV data file. The first column in the CSV must be the email address and the CSV must contain a header row. Additional fields can be included with a named header row and can be merged with the template using {merge} tags in the content. Example CSV: email, firstname, lastname test1@gmail.com, michael, smith test2@gmail.com, janet, smith Merge file must not be empty. Required Access Level: SendHttp
180
180
  # @param merge_email_payload [MergeEmailPayload] Email data
181
181
  # @param [Hash] opts the optional parameters
182
+ # @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
182
183
  # @return [EmailSend]
183
184
  def emails_mergefile_post(merge_email_payload, opts = {})
184
185
  data, _status_code, _headers = emails_mergefile_post_with_http_info(merge_email_payload, opts)
@@ -189,6 +190,7 @@ module ElasticEmail
189
190
  # Send to a list of contacts submitted in a CSV data file. The first column in the CSV must be the email address and the CSV must contain a header row. Additional fields can be included with a named header row and can be merged with the template using {merge} tags in the content. Example CSV: email, firstname, lastname test1@gmail.com, michael, smith test2@gmail.com, janet, smith Merge file must not be empty. Required Access Level: SendHttp
190
191
  # @param merge_email_payload [MergeEmailPayload] Email data
191
192
  # @param [Hash] opts the optional parameters
193
+ # @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
192
194
  # @return [Array<(EmailSend, Integer, Hash)>] EmailSend data, response status code and response headers
193
195
  def emails_mergefile_post_with_http_info(merge_email_payload, opts = {})
194
196
  if @api_client.config.debugging
@@ -198,6 +200,19 @@ module ElasticEmail
198
200
  if @api_client.config.client_side_validation && merge_email_payload.nil?
199
201
  fail ArgumentError, "Missing the required parameter 'merge_email_payload' when calling EmailsApi.emails_mergefile_post"
200
202
  end
203
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
204
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_mergefile_post, the character length must be smaller than or equal to 255.'
205
+ end
206
+
207
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
208
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_mergefile_post, the character length must be great than or equal to 1.'
209
+ end
210
+
211
+ pattern = Regexp.new(/^[\x20-\x7E]+$/)
212
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
213
+ fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.emails_mergefile_post, must conform to the pattern #{pattern}."
214
+ end
215
+
201
216
  # resource path
202
217
  local_var_path = '/emails/mergefile'
203
218
 
@@ -213,6 +228,7 @@ module ElasticEmail
213
228
  if !content_type.nil?
214
229
  header_params['Content-Type'] = content_type
215
230
  end
231
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
216
232
 
217
233
  # form parameters
218
234
  form_params = opts[:form_params] || {}
@@ -247,6 +263,7 @@ module ElasticEmail
247
263
  # Send bulk merge email. Required Access Level: SendHttp
248
264
  # @param email_message_data [EmailMessageData] Email data
249
265
  # @param [Hash] opts the optional parameters
266
+ # @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
250
267
  # @return [EmailSend]
251
268
  def emails_post(email_message_data, opts = {})
252
269
  data, _status_code, _headers = emails_post_with_http_info(email_message_data, opts)
@@ -257,6 +274,7 @@ module ElasticEmail
257
274
  # Send bulk merge email. Required Access Level: SendHttp
258
275
  # @param email_message_data [EmailMessageData] Email data
259
276
  # @param [Hash] opts the optional parameters
277
+ # @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
260
278
  # @return [Array<(EmailSend, Integer, Hash)>] EmailSend data, response status code and response headers
261
279
  def emails_post_with_http_info(email_message_data, opts = {})
262
280
  if @api_client.config.debugging
@@ -266,6 +284,19 @@ module ElasticEmail
266
284
  if @api_client.config.client_side_validation && email_message_data.nil?
267
285
  fail ArgumentError, "Missing the required parameter 'email_message_data' when calling EmailsApi.emails_post"
268
286
  end
287
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
288
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_post, the character length must be smaller than or equal to 255.'
289
+ end
290
+
291
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
292
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_post, the character length must be great than or equal to 1.'
293
+ end
294
+
295
+ pattern = Regexp.new(/^[\x20-\x7E]+$/)
296
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
297
+ fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.emails_post, must conform to the pattern #{pattern}."
298
+ end
299
+
269
300
  # resource path
270
301
  local_var_path = '/emails'
271
302
 
@@ -281,6 +312,7 @@ module ElasticEmail
281
312
  if !content_type.nil?
282
313
  header_params['Content-Type'] = content_type
283
314
  end
315
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
284
316
 
285
317
  # form parameters
286
318
  form_params = opts[:form_params] || {}
@@ -315,6 +347,7 @@ module ElasticEmail
315
347
  # Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
316
348
  # @param email_transactional_message_data [EmailTransactionalMessageData] Email data
317
349
  # @param [Hash] opts the optional parameters
350
+ # @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
318
351
  # @return [EmailSend]
319
352
  def emails_transactional_post(email_transactional_message_data, opts = {})
320
353
  data, _status_code, _headers = emails_transactional_post_with_http_info(email_transactional_message_data, opts)
@@ -325,6 +358,7 @@ module ElasticEmail
325
358
  # Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
326
359
  # @param email_transactional_message_data [EmailTransactionalMessageData] Email data
327
360
  # @param [Hash] opts the optional parameters
361
+ # @option opts [String] :idempotency_key Makes a retry of this request safe. A repeated request with the same key and the same body gets the stored response of the first one and is not executed again. Generate a new key, e.g. a UUID v4, for each request and reuse it only to retry that request. Keys are scoped to the account and kept for 24 hours after the first request.
328
362
  # @return [Array<(EmailSend, Integer, Hash)>] EmailSend data, response status code and response headers
329
363
  def emails_transactional_post_with_http_info(email_transactional_message_data, opts = {})
330
364
  if @api_client.config.debugging
@@ -334,6 +368,19 @@ module ElasticEmail
334
368
  if @api_client.config.client_side_validation && email_transactional_message_data.nil?
335
369
  fail ArgumentError, "Missing the required parameter 'email_transactional_message_data' when calling EmailsApi.emails_transactional_post"
336
370
  end
371
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
372
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_transactional_post, the character length must be smaller than or equal to 255.'
373
+ end
374
+
375
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
376
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.emails_transactional_post, the character length must be great than or equal to 1.'
377
+ end
378
+
379
+ pattern = Regexp.new(/^[\x20-\x7E]+$/)
380
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
381
+ fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.emails_transactional_post, must conform to the pattern #{pattern}."
382
+ end
383
+
337
384
  # resource path
338
385
  local_var_path = '/emails/transactional'
339
386
 
@@ -349,6 +396,7 @@ module ElasticEmail
349
396
  if !content_type.nil?
350
397
  header_params['Content-Type'] = content_type
351
398
  end
399
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
352
400
 
353
401
  # form parameters
354
402
  form_params = opts[:form_params] || {}
@@ -217,6 +217,69 @@ module ElasticEmail
217
217
  return data, status_code, headers
218
218
  end
219
219
 
220
+ # Rotate Webhook Secret
221
+ # Replace the signing secret of a webhook created with signing. The old secret stops being used at once - there is no grace period. The new secret is returned only in this response. Notifications your endpoint rejects while it still has the old secret are retried and signed with the new one. Required Access Level: ModifyWebNotifications
222
+ # @param publicid [String]
223
+ # @param [Hash] opts the optional parameters
224
+ # @return [Webhook]
225
+ def webhook_by_publicid_secret_rotate_post(publicid, opts = {})
226
+ data, _status_code, _headers = webhook_by_publicid_secret_rotate_post_with_http_info(publicid, opts)
227
+ data
228
+ end
229
+
230
+ # Rotate Webhook Secret
231
+ # Replace the signing secret of a webhook created with signing. The old secret stops being used at once - there is no grace period. The new secret is returned only in this response. Notifications your endpoint rejects while it still has the old secret are retried and signed with the new one. Required Access Level: ModifyWebNotifications
232
+ # @param publicid [String]
233
+ # @param [Hash] opts the optional parameters
234
+ # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
235
+ def webhook_by_publicid_secret_rotate_post_with_http_info(publicid, opts = {})
236
+ if @api_client.config.debugging
237
+ @api_client.config.logger.debug 'Calling API: WebhookApi.webhook_by_publicid_secret_rotate_post ...'
238
+ end
239
+ # verify the required parameter 'publicid' is set
240
+ if @api_client.config.client_side_validation && publicid.nil?
241
+ fail ArgumentError, "Missing the required parameter 'publicid' when calling WebhookApi.webhook_by_publicid_secret_rotate_post"
242
+ end
243
+ # resource path
244
+ local_var_path = '/webhook/{publicid}/secret/rotate'.sub('{' + 'publicid' + '}', CGI.escape(publicid.to_s))
245
+
246
+ # query parameters
247
+ query_params = opts[:query_params] || {}
248
+
249
+ # header parameters
250
+ header_params = opts[:header_params] || {}
251
+ # HTTP header 'Accept' (if needed)
252
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
253
+
254
+ # form parameters
255
+ form_params = opts[:form_params] || {}
256
+
257
+ # http body (model)
258
+ post_body = opts[:debug_body]
259
+
260
+ # return_type
261
+ return_type = opts[:debug_return_type] || 'Webhook'
262
+
263
+ # auth_names
264
+ auth_names = opts[:debug_auth_names] || ['apikey']
265
+
266
+ new_options = opts.merge(
267
+ :operation => :"WebhookApi.webhook_by_publicid_secret_rotate_post",
268
+ :header_params => header_params,
269
+ :query_params => query_params,
270
+ :form_params => form_params,
271
+ :body => post_body,
272
+ :auth_names => auth_names,
273
+ :return_type => return_type
274
+ )
275
+
276
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
277
+ if @api_client.config.debugging
278
+ @api_client.config.logger.debug "API called: WebhookApi#webhook_by_publicid_secret_rotate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
+ end
280
+ return data, status_code, headers
281
+ end
282
+
220
283
  # Load Webhooks
221
284
  # Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
222
285
  # @param [Hash] opts the optional parameters
@@ -47,6 +47,36 @@ module ElasticEmail
47
47
 
48
48
  attr_accessor :is_enabled
49
49
 
50
+ # Requests carry an HMAC-SHA256 signature. Chosen when the webhook is created and can't be changed.
51
+ attr_accessor :signing_enabled
52
+
53
+ attr_accessor :delivery_method
54
+
55
+ # Signing secret - returned only once, when a webhook is created with signing or its secret is rotated. Store it safely.
56
+ attr_accessor :signing_secret
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
50
80
  # Attribute mapping from ruby-style variable name to JSON key.
51
81
  def self.attribute_map
52
82
  {
@@ -62,7 +92,10 @@ module ElasticEmail
62
92
  :'notification_for_unsubscribed' => :'NotificationForUnsubscribed',
63
93
  :'notification_for_abuse_report' => :'NotificationForAbuseReport',
64
94
  :'notification_for_error' => :'NotificationForError',
65
- :'is_enabled' => :'IsEnabled'
95
+ :'is_enabled' => :'IsEnabled',
96
+ :'signing_enabled' => :'SigningEnabled',
97
+ :'delivery_method' => :'DeliveryMethod',
98
+ :'signing_secret' => :'SigningSecret'
66
99
  }
67
100
  end
68
101
 
@@ -86,7 +119,10 @@ module ElasticEmail
86
119
  :'notification_for_unsubscribed' => :'Boolean',
87
120
  :'notification_for_abuse_report' => :'Boolean',
88
121
  :'notification_for_error' => :'Boolean',
89
- :'is_enabled' => :'Boolean'
122
+ :'is_enabled' => :'Boolean',
123
+ :'signing_enabled' => :'Boolean',
124
+ :'delivery_method' => :'WebhookDeliveryMethod',
125
+ :'signing_secret' => :'String'
90
126
  }
91
127
  end
92
128
 
@@ -164,6 +200,20 @@ module ElasticEmail
164
200
  if attributes.key?(:'is_enabled')
165
201
  self.is_enabled = attributes[:'is_enabled']
166
202
  end
203
+
204
+ if attributes.key?(:'signing_enabled')
205
+ self.signing_enabled = attributes[:'signing_enabled']
206
+ end
207
+
208
+ if attributes.key?(:'delivery_method')
209
+ self.delivery_method = attributes[:'delivery_method']
210
+ else
211
+ self.delivery_method = 'Get'
212
+ end
213
+
214
+ if attributes.key?(:'signing_secret')
215
+ self.signing_secret = attributes[:'signing_secret']
216
+ end
167
217
  end
168
218
 
169
219
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -198,7 +248,10 @@ module ElasticEmail
198
248
  notification_for_unsubscribed == o.notification_for_unsubscribed &&
199
249
  notification_for_abuse_report == o.notification_for_abuse_report &&
200
250
  notification_for_error == o.notification_for_error &&
201
- is_enabled == o.is_enabled
251
+ is_enabled == o.is_enabled &&
252
+ signing_enabled == o.signing_enabled &&
253
+ delivery_method == o.delivery_method &&
254
+ signing_secret == o.signing_secret
202
255
  end
203
256
 
204
257
  # @see the `==` method
@@ -210,7 +263,7 @@ module ElasticEmail
210
263
  # Calculates hash code according to all attributes.
211
264
  # @return [Integer] Hash code
212
265
  def hash
213
- [webhook_id, name, date_created, date_updated, url, notify_once_per_email, notification_for_sent, notification_for_opened, notification_for_clicked, notification_for_unsubscribed, notification_for_abuse_report, notification_for_error, is_enabled].hash
266
+ [webhook_id, name, date_created, date_updated, url, notify_once_per_email, notification_for_sent, notification_for_opened, notification_for_clicked, notification_for_unsubscribed, notification_for_abuse_report, notification_for_error, is_enabled, signing_enabled, delivery_method, signing_secret].hash
214
267
  end
215
268
 
216
269
  # Builds the object from hash