mailslurp_client 12.1.0 → 12.1.25

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
  SHA256:
3
- metadata.gz: 680e803f1dded14fd5a2950806c2151fc3b3491bb6f54d34f7f6aa059698fa1b
4
- data.tar.gz: 167978e04b87d5de123a191af703e22088637f914dcfc926bf4a8d8188d7a843
3
+ metadata.gz: 767ccfb4afc67c269a988b11d5e0ea4a6adf7929a69e7e649603ed7e56aedd44
4
+ data.tar.gz: 5379b06fd3c294e4096b67b118195db13df2b0d2254197835d2cdb26171d102b
5
5
  SHA512:
6
- metadata.gz: 0aae09815da7765057f48b07fe81fa598668b056c392ad24bbcbe0930d601e8f273b46b393acf715487ca91a0597a412d11246565f1b4cba3e13b699fc444d7f
7
- data.tar.gz: e06902b5725220bd679d7152d755ec013faf95714664f4d7fc8ec35a53983c5aecfd42cef7c4364410825948bb5d36fbaa7afbcfa440e8a09597dca1a21c4884
6
+ metadata.gz: 7f6c31030ef640a06fc71524443869fc541df189fe967743622fdd910f7e221366d26c4ae4917342ba0e2fd4994bfcee5915258ef6879b78921e6a1bcd64479b
7
+ data.tar.gz: 91bd1fa758ee85bf642263be872c3c9066e23c8c5186f217f3df452b47d39f086535a2ac8102c9fe4519cf7ae59770f321ff1e99fe9602082d2f1e898e879245
@@ -24,6 +24,7 @@ require 'mailslurp_client/models/attachment_meta_data'
24
24
  require 'mailslurp_client/models/attachment_projection'
25
25
  require 'mailslurp_client/models/basic_auth_options'
26
26
  require 'mailslurp_client/models/bulk_send_email_options'
27
+ require 'mailslurp_client/models/condition_option'
27
28
  require 'mailslurp_client/models/contact_dto'
28
29
  require 'mailslurp_client/models/contact_projection'
29
30
  require 'mailslurp_client/models/content_match_options'
@@ -107,6 +108,9 @@ require 'mailslurp_client/models/validation_message'
107
108
  require 'mailslurp_client/models/verify_email_address_options'
108
109
  require 'mailslurp_client/models/wait_for_conditions'
109
110
  require 'mailslurp_client/models/webhook_dto'
111
+ require 'mailslurp_client/models/webhook_new_attachment_payload'
112
+ require 'mailslurp_client/models/webhook_new_contact_payload'
113
+ require 'mailslurp_client/models/webhook_new_email_payload'
110
114
  require 'mailslurp_client/models/webhook_projection'
111
115
  require 'mailslurp_client/models/webhook_test_request'
112
116
  require 'mailslurp_client/models/webhook_test_response'
@@ -288,7 +288,7 @@ module MailSlurpClient
288
288
  return data, status_code, headers
289
289
  end
290
290
 
291
- # Wait for or return the first email that matches proved MatchOptions array
291
+ # Wait for or return the first email that matches provided MatchOptions array
292
292
  # Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.
293
293
  # @param match_options [MatchOptions] matchOptions
294
294
  # @param [Hash] opts the optional parameters
@@ -301,7 +301,7 @@ module MailSlurpClient
301
301
  data
302
302
  end
303
303
 
304
- # Wait for or return the first email that matches proved MatchOptions array
304
+ # Wait for or return the first email that matches provided MatchOptions array
305
305
  # Perform a search of emails in an inbox with the given patterns. If a result if found then return or else retry the search until a result is found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options. An example payload is `{ matches: [{field: 'SUBJECT',should:'CONTAIN',value:'needle'}] }`. You can use an array of matches and they will be applied sequentially to filter out emails. If you want to perform matches and extractions of content using Regex patterns see the EmailController `getEmailContentMatch` method.
306
306
  # @param match_options [MatchOptions] matchOptions
307
307
  # @param [Hash] opts the optional parameters
@@ -283,6 +283,168 @@ module MailSlurpClient
283
283
  return data, status_code, headers
284
284
  end
285
285
 
286
+ # Get webhook test payload for new attachment event
287
+ # @param [Hash] opts the optional parameters
288
+ # @return [WebhookNewAttachmentPayload]
289
+ def get_test_webhook_payload_new_attachment(opts = {})
290
+ data, _status_code, _headers = get_test_webhook_payload_new_attachment_with_http_info(opts)
291
+ data
292
+ end
293
+
294
+ # Get webhook test payload for new attachment event
295
+ # @param [Hash] opts the optional parameters
296
+ # @return [Array<(WebhookNewAttachmentPayload, Integer, Hash)>] WebhookNewAttachmentPayload data, response status code and response headers
297
+ def get_test_webhook_payload_new_attachment_with_http_info(opts = {})
298
+ if @api_client.config.debugging
299
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_attachment ...'
300
+ end
301
+ # resource path
302
+ local_var_path = '/webhooks/test/new-attachment-payload'
303
+
304
+ # query parameters
305
+ query_params = opts[:query_params] || {}
306
+
307
+ # header parameters
308
+ header_params = opts[:header_params] || {}
309
+ # HTTP header 'Accept' (if needed)
310
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
311
+
312
+ # form parameters
313
+ form_params = opts[:form_params] || {}
314
+
315
+ # http body (model)
316
+ post_body = opts[:body]
317
+
318
+ # return_type
319
+ return_type = opts[:return_type] || 'WebhookNewAttachmentPayload'
320
+
321
+ # auth_names
322
+ auth_names = opts[:auth_names] || ['API_KEY']
323
+
324
+ new_options = opts.merge(
325
+ :header_params => header_params,
326
+ :query_params => query_params,
327
+ :form_params => form_params,
328
+ :body => post_body,
329
+ :auth_names => auth_names,
330
+ :return_type => return_type
331
+ )
332
+
333
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
334
+ if @api_client.config.debugging
335
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
336
+ end
337
+ return data, status_code, headers
338
+ end
339
+
340
+ # Get webhook test payload for new contact event
341
+ # @param [Hash] opts the optional parameters
342
+ # @return [WebhookNewContactPayload]
343
+ def get_test_webhook_payload_new_contact(opts = {})
344
+ data, _status_code, _headers = get_test_webhook_payload_new_contact_with_http_info(opts)
345
+ data
346
+ end
347
+
348
+ # Get webhook test payload for new contact event
349
+ # @param [Hash] opts the optional parameters
350
+ # @return [Array<(WebhookNewContactPayload, Integer, Hash)>] WebhookNewContactPayload data, response status code and response headers
351
+ def get_test_webhook_payload_new_contact_with_http_info(opts = {})
352
+ if @api_client.config.debugging
353
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_contact ...'
354
+ end
355
+ # resource path
356
+ local_var_path = '/webhooks/test/new-contact-payload'
357
+
358
+ # query parameters
359
+ query_params = opts[:query_params] || {}
360
+
361
+ # header parameters
362
+ header_params = opts[:header_params] || {}
363
+ # HTTP header 'Accept' (if needed)
364
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
365
+
366
+ # form parameters
367
+ form_params = opts[:form_params] || {}
368
+
369
+ # http body (model)
370
+ post_body = opts[:body]
371
+
372
+ # return_type
373
+ return_type = opts[:return_type] || 'WebhookNewContactPayload'
374
+
375
+ # auth_names
376
+ auth_names = opts[:auth_names] || ['API_KEY']
377
+
378
+ new_options = opts.merge(
379
+ :header_params => header_params,
380
+ :query_params => query_params,
381
+ :form_params => form_params,
382
+ :body => post_body,
383
+ :auth_names => auth_names,
384
+ :return_type => return_type
385
+ )
386
+
387
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
388
+ if @api_client.config.debugging
389
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
390
+ end
391
+ return data, status_code, headers
392
+ end
393
+
394
+ # Get webhook test payload for new email event
395
+ # @param [Hash] opts the optional parameters
396
+ # @return [WebhookNewEmailPayload]
397
+ def get_test_webhook_payload_new_email(opts = {})
398
+ data, _status_code, _headers = get_test_webhook_payload_new_email_with_http_info(opts)
399
+ data
400
+ end
401
+
402
+ # Get webhook test payload for new email event
403
+ # @param [Hash] opts the optional parameters
404
+ # @return [Array<(WebhookNewEmailPayload, Integer, Hash)>] WebhookNewEmailPayload data, response status code and response headers
405
+ def get_test_webhook_payload_new_email_with_http_info(opts = {})
406
+ if @api_client.config.debugging
407
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_email ...'
408
+ end
409
+ # resource path
410
+ local_var_path = '/webhooks/test/new-email-payload'
411
+
412
+ # query parameters
413
+ query_params = opts[:query_params] || {}
414
+
415
+ # header parameters
416
+ header_params = opts[:header_params] || {}
417
+ # HTTP header 'Accept' (if needed)
418
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
419
+
420
+ # form parameters
421
+ form_params = opts[:form_params] || {}
422
+
423
+ # http body (model)
424
+ post_body = opts[:body]
425
+
426
+ # return_type
427
+ return_type = opts[:return_type] || 'WebhookNewEmailPayload'
428
+
429
+ # auth_names
430
+ auth_names = opts[:auth_names] || ['API_KEY']
431
+
432
+ new_options = opts.merge(
433
+ :header_params => header_params,
434
+ :query_params => query_params,
435
+ :form_params => form_params,
436
+ :body => post_body,
437
+ :auth_names => auth_names,
438
+ :return_type => return_type
439
+ )
440
+
441
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
442
+ if @api_client.config.debugging
443
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
444
+ end
445
+ return data, status_code, headers
446
+ end
447
+
286
448
  # Get a webhook for an Inbox
287
449
  # @param webhook_id [String] webhookId
288
450
  # @param [Hash] opts the optional parameters
@@ -13,6 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
+ # Abstract webhook payload. Use the correct payload type for your webhook event type in order to access all the specific properties for that event. See the `NEW_EMAIL`,`NEW_CONTACT` and `NEW_ATTACHMENT` payloads for the properties available for those events.
16
17
  class AbstractWebhookPayload
17
18
  attr_accessor :event_name
18
19
 
@@ -0,0 +1,264 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ # Options for matching emails in an inbox based on a condition such as `HAS_ATTACHMENTS=TRUE`
17
+ class ConditionOption
18
+ # The condition to evaluate against the email
19
+ attr_accessor :condition
20
+
21
+ # What the condition should evaluate to. A string 'TRUE|FALSE' not a boolean.
22
+ attr_accessor :value
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'condition' => :'condition',
50
+ :'value' => :'value'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'condition' => :'String',
58
+ :'value' => :'String'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ConditionOption` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ConditionOption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'condition')
84
+ self.condition = attributes[:'condition']
85
+ end
86
+
87
+ if attributes.key?(:'value')
88
+ self.value = attributes[:'value']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ condition_validator = EnumAttributeValidator.new('String', ["HAS_ATTACHMENTS"])
103
+ return false unless condition_validator.valid?(@condition)
104
+ value_validator = EnumAttributeValidator.new('String', ["TRUE", "FALSE"])
105
+ return false unless value_validator.valid?(@value)
106
+ true
107
+ end
108
+
109
+ # Custom attribute writer method checking allowed values (enum).
110
+ # @param [Object] condition Object to be assigned
111
+ def condition=(condition)
112
+ validator = EnumAttributeValidator.new('String', ["HAS_ATTACHMENTS"])
113
+ unless validator.valid?(condition)
114
+ fail ArgumentError, "invalid value for \"condition\", must be one of #{validator.allowable_values}."
115
+ end
116
+ @condition = condition
117
+ end
118
+
119
+ # Custom attribute writer method checking allowed values (enum).
120
+ # @param [Object] value Object to be assigned
121
+ def value=(value)
122
+ validator = EnumAttributeValidator.new('String', ["TRUE", "FALSE"])
123
+ unless validator.valid?(value)
124
+ fail ArgumentError, "invalid value for \"value\", must be one of #{validator.allowable_values}."
125
+ end
126
+ @value = value
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ condition == o.condition &&
135
+ value == o.value
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [condition, value].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ new.build_from_hash(attributes)
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
167
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
168
+ end
169
+ elsif !attributes[self.class.attribute_map[key]].nil?
170
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
172
+ end
173
+
174
+ self
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def _deserialize(type, value)
182
+ case type.to_sym
183
+ when :DateTime
184
+ DateTime.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ MailSlurpClient.const_get(type).build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+ end
264
+ end