mailslurp_client 11.8.10 → 11.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,13 +15,13 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Content of attachment
17
17
  class DownloadAttachmentDto
18
- # Base64 encoded string of attachment bytes. Decode the base64 string to get the raw file bytes
18
+ # Base64 encoded string of attachment bytes. Decode the base64 encoded string to get the raw contents. If the file has a content type such as `text/html` you can read the contents directly by converting it to string using `utf-8` encoding.
19
19
  attr_accessor :base64_file_contents
20
20
 
21
- # Content type of attachment
21
+ # Content type of attachment. Examples are `image/png`, `application/msword`, `text/csv` etc.
22
22
  attr_accessor :content_type
23
23
 
24
- # Size in bytes of attachment
24
+ # Size in bytes of attachment content
25
25
  attr_accessor :size_bytes
26
26
 
27
27
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Email model (also referred to as EmailDto). Represents an email that was received by an inbox. If you want the original SMTP message see the `getRawEmail` endpoint.
16
+ # Email entity (also known as EmailDto). When an SMTP email message is received by MailSlurp it is parsed. The body and attachments are written to disk and the fields such as to, from, subject etc are stored in a database. The `body` contains the email content. If you want the original SMTP message see the `getRawEmail` endpoints. The attachments can be fetched using the AttachmentController
17
17
  class Email
18
18
  attr_accessor :analysis
19
19
 
@@ -41,21 +41,22 @@ module MailSlurpClient
41
41
  # Who the email was sent from
42
42
  attr_accessor :from
43
43
 
44
+ # Collection of SMTP headers attached to email
44
45
  attr_accessor :headers
45
46
 
46
- # ID of the email
47
+ # ID of the email entity
47
48
  attr_accessor :id
48
49
 
49
50
  # ID of the inbox that received the email
50
51
  attr_accessor :inbox_id
51
52
 
52
- # Was HTML sent in the email body
53
+ # Is the email body HTML
53
54
  attr_accessor :is_html
54
55
 
55
- # Has the email been viewed ever. This means viewed in the dashboard or requested via the full email entity endpoints
56
+ # Read flag. Has the email ever been viewed in the dashboard or fetched via the API? If so the email is marked as read.
56
57
  attr_accessor :read
57
58
 
58
- # The replyTo field on the received email
59
+ # The `replyTo` field on the received email message
59
60
  attr_accessor :reply_to
60
61
 
61
62
  # The subject line of the email message
@@ -64,13 +65,13 @@ module MailSlurpClient
64
65
  # Can the email be accessed by organization team members
65
66
  attr_accessor :team_access
66
67
 
67
- # List of `To` recipients email was addressed to
68
+ # List of `To` recipients that email was addressed to
68
69
  attr_accessor :to
69
70
 
70
71
  # When was the email last updated
71
72
  attr_accessor :updated_at
72
73
 
73
- # ID of user that email belongs
74
+ # ID of user that email belongs to
74
75
  attr_accessor :user_id
75
76
 
76
77
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -30,16 +30,16 @@ module MailSlurpClient
30
30
  # Who the email was sent from
31
31
  attr_accessor :from
32
32
 
33
- # ID of the email
33
+ # ID of the email entity
34
34
  attr_accessor :id
35
35
 
36
- # Has the email been viewed ever. This means viewed in the dashboard or requested via the full email entity endpoints
36
+ # Read flag. Has the email ever been viewed in the dashboard or fetched via the API? If so the email is marked as read.
37
37
  attr_accessor :read
38
38
 
39
39
  # The subject line of the email message
40
40
  attr_accessor :subject
41
41
 
42
- # List of `To` recipients email was addressed to
42
+ # List of `To` recipients that email was addressed to
43
43
  attr_accessor :to
44
44
 
45
45
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Representation of a webhook for an inbox. The URL specified will be using by MailSlurp whenever an email is received by the attached inbox.
16
+ # Representation of a webhook for an inbox. The URL specified will be using by MailSlurp whenever an email is received by the attached inbox. A webhook entity should have a URL that points to your server. Your server should accept HTTP/S POST requests and return a success 200. MailSlurp will retry your webhooks if they fail. See https://api.mailslurp.com/schemas/webhook-payload for the payload schema.
17
17
  class WebhookDto
18
18
  # Does webhook expect basic authentication? If true it means you created this webhook with a username and password. MailSlurp will use these in the URL to authenticate itself.
19
19
  attr_accessor :basic_auth
@@ -0,0 +1,370 @@
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
+ # MailSlurp webhook payload schema is available at https://api.mailslurp.com/schemas/webhook-payload. This schema describes the JSON object that is sent via HTTP POST to webhook urls when an email is received by an inbox that a webhook is attached to. Payloads may be delivered multiple times so use the ID as a key for event uniqueness. The payload contains IDs for the email and inbox affected. Use these to fetch more data related to the event using appropriate inbox and email endpoints. See https://www.mailslurp.com/guides/email-webhooks/ for more information. Your webhook endpoint should accept POST HTTP request and return a 200 in under 30 seconds. Process the webhook asynchronously if you need to.
17
+ class WebhookPayload
18
+ # List of attachment meta data objects if attachments present
19
+ attr_accessor :attachment_meta_datas
20
+
21
+ # List of `BCC` recipients email was addressed to
22
+ attr_accessor :bcc
23
+
24
+ # List of `CC` recipients email was addressed to
25
+ attr_accessor :cc
26
+
27
+ # Date time of event creation
28
+ attr_accessor :created_at
29
+
30
+ # ID of the email that was received. Use this ID for fetching the email
31
+ attr_accessor :email_id
32
+
33
+ # Name of the event type webhook is being triggered for
34
+ attr_accessor :event_name
35
+
36
+ # Who the email was sent from
37
+ attr_accessor :from
38
+
39
+ # Id of the inbox that receive an email
40
+ attr_accessor :inbox_id
41
+
42
+ # Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
43
+ attr_accessor :message_id
44
+
45
+ # The subject line of the email message
46
+ attr_accessor :subject
47
+
48
+ # List of `To` recipients that email was addressed to
49
+ attr_accessor :to
50
+
51
+ # ID of webhook entity being triggered
52
+ attr_accessor :webhook_id
53
+
54
+ # Name of the webhook being triggered
55
+ attr_accessor :webhook_name
56
+
57
+ class EnumAttributeValidator
58
+ attr_reader :datatype
59
+ attr_reader :allowable_values
60
+
61
+ def initialize(datatype, allowable_values)
62
+ @allowable_values = allowable_values.map do |value|
63
+ case datatype.to_s
64
+ when /Integer/i
65
+ value.to_i
66
+ when /Float/i
67
+ value.to_f
68
+ else
69
+ value
70
+ end
71
+ end
72
+ end
73
+
74
+ def valid?(value)
75
+ !value || allowable_values.include?(value)
76
+ end
77
+ end
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'attachment_meta_datas' => :'attachmentMetaDatas',
83
+ :'bcc' => :'bcc',
84
+ :'cc' => :'cc',
85
+ :'created_at' => :'createdAt',
86
+ :'email_id' => :'emailId',
87
+ :'event_name' => :'eventName',
88
+ :'from' => :'from',
89
+ :'inbox_id' => :'inboxId',
90
+ :'message_id' => :'messageId',
91
+ :'subject' => :'subject',
92
+ :'to' => :'to',
93
+ :'webhook_id' => :'webhookId',
94
+ :'webhook_name' => :'webhookName'
95
+ }
96
+ end
97
+
98
+ # Attribute type mapping.
99
+ def self.openapi_types
100
+ {
101
+ :'attachment_meta_datas' => :'Array<AttachmentMetaData>',
102
+ :'bcc' => :'Array<String>',
103
+ :'cc' => :'Array<String>',
104
+ :'created_at' => :'DateTime',
105
+ :'email_id' => :'String',
106
+ :'event_name' => :'String',
107
+ :'from' => :'String',
108
+ :'inbox_id' => :'String',
109
+ :'message_id' => :'String',
110
+ :'subject' => :'String',
111
+ :'to' => :'Array<String>',
112
+ :'webhook_id' => :'String',
113
+ :'webhook_name' => :'String'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ ])
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ if (!attributes.is_a?(Hash))
127
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookPayload` initialize method"
128
+ end
129
+
130
+ # check to see if the attribute exists and convert string to symbol for hash key
131
+ attributes = attributes.each_with_object({}) { |(k, v), h|
132
+ if (!self.class.attribute_map.key?(k.to_sym))
133
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
134
+ end
135
+ h[k.to_sym] = v
136
+ }
137
+
138
+ if attributes.key?(:'attachment_meta_datas')
139
+ if (value = attributes[:'attachment_meta_datas']).is_a?(Array)
140
+ self.attachment_meta_datas = value
141
+ end
142
+ end
143
+
144
+ if attributes.key?(:'bcc')
145
+ if (value = attributes[:'bcc']).is_a?(Array)
146
+ self.bcc = value
147
+ end
148
+ end
149
+
150
+ if attributes.key?(:'cc')
151
+ if (value = attributes[:'cc']).is_a?(Array)
152
+ self.cc = value
153
+ end
154
+ end
155
+
156
+ if attributes.key?(:'created_at')
157
+ self.created_at = attributes[:'created_at']
158
+ end
159
+
160
+ if attributes.key?(:'email_id')
161
+ self.email_id = attributes[:'email_id']
162
+ end
163
+
164
+ if attributes.key?(:'event_name')
165
+ self.event_name = attributes[:'event_name']
166
+ end
167
+
168
+ if attributes.key?(:'from')
169
+ self.from = attributes[:'from']
170
+ end
171
+
172
+ if attributes.key?(:'inbox_id')
173
+ self.inbox_id = attributes[:'inbox_id']
174
+ end
175
+
176
+ if attributes.key?(:'message_id')
177
+ self.message_id = attributes[:'message_id']
178
+ end
179
+
180
+ if attributes.key?(:'subject')
181
+ self.subject = attributes[:'subject']
182
+ end
183
+
184
+ if attributes.key?(:'to')
185
+ if (value = attributes[:'to']).is_a?(Array)
186
+ self.to = value
187
+ end
188
+ end
189
+
190
+ if attributes.key?(:'webhook_id')
191
+ self.webhook_id = attributes[:'webhook_id']
192
+ end
193
+
194
+ if attributes.key?(:'webhook_name')
195
+ self.webhook_name = attributes[:'webhook_name']
196
+ end
197
+ end
198
+
199
+ # Show invalid properties with the reasons. Usually used together with valid?
200
+ # @return Array for valid properties with the reasons
201
+ def list_invalid_properties
202
+ invalid_properties = Array.new
203
+ invalid_properties
204
+ end
205
+
206
+ # Check to see if the all the properties in the model are valid
207
+ # @return true if the model is valid
208
+ def valid?
209
+ event_name_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED"])
210
+ return false unless event_name_validator.valid?(@event_name)
211
+ true
212
+ end
213
+
214
+ # Custom attribute writer method checking allowed values (enum).
215
+ # @param [Object] event_name Object to be assigned
216
+ def event_name=(event_name)
217
+ validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED"])
218
+ unless validator.valid?(event_name)
219
+ fail ArgumentError, "invalid value for \"event_name\", must be one of #{validator.allowable_values}."
220
+ end
221
+ @event_name = event_name
222
+ end
223
+
224
+ # Checks equality by comparing each attribute.
225
+ # @param [Object] Object to be compared
226
+ def ==(o)
227
+ return true if self.equal?(o)
228
+ self.class == o.class &&
229
+ attachment_meta_datas == o.attachment_meta_datas &&
230
+ bcc == o.bcc &&
231
+ cc == o.cc &&
232
+ created_at == o.created_at &&
233
+ email_id == o.email_id &&
234
+ event_name == o.event_name &&
235
+ from == o.from &&
236
+ inbox_id == o.inbox_id &&
237
+ message_id == o.message_id &&
238
+ subject == o.subject &&
239
+ to == o.to &&
240
+ webhook_id == o.webhook_id &&
241
+ webhook_name == o.webhook_name
242
+ end
243
+
244
+ # @see the `==` method
245
+ # @param [Object] Object to be compared
246
+ def eql?(o)
247
+ self == o
248
+ end
249
+
250
+ # Calculates hash code according to all attributes.
251
+ # @return [Integer] Hash code
252
+ def hash
253
+ [attachment_meta_datas, bcc, cc, created_at, email_id, event_name, from, inbox_id, message_id, subject, to, webhook_id, webhook_name].hash
254
+ end
255
+
256
+ # Builds the object from hash
257
+ # @param [Hash] attributes Model attributes in the form of hash
258
+ # @return [Object] Returns the model itself
259
+ def self.build_from_hash(attributes)
260
+ new.build_from_hash(attributes)
261
+ end
262
+
263
+ # Builds the object from hash
264
+ # @param [Hash] attributes Model attributes in the form of hash
265
+ # @return [Object] Returns the model itself
266
+ def build_from_hash(attributes)
267
+ return nil unless attributes.is_a?(Hash)
268
+ self.class.openapi_types.each_pair do |key, type|
269
+ if type =~ /\AArray<(.*)>/i
270
+ # check to ensure the input is an array given that the attribute
271
+ # is documented as an array but the input is not
272
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
273
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
274
+ end
275
+ elsif !attributes[self.class.attribute_map[key]].nil?
276
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
277
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
278
+ end
279
+
280
+ self
281
+ end
282
+
283
+ # Deserializes the data based on type
284
+ # @param string type Data type
285
+ # @param string value Value to be deserialized
286
+ # @return [Object] Deserialized data
287
+ def _deserialize(type, value)
288
+ case type.to_sym
289
+ when :DateTime
290
+ DateTime.parse(value)
291
+ when :Date
292
+ Date.parse(value)
293
+ when :String
294
+ value.to_s
295
+ when :Integer
296
+ value.to_i
297
+ when :Float
298
+ value.to_f
299
+ when :Boolean
300
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
301
+ true
302
+ else
303
+ false
304
+ end
305
+ when :Object
306
+ # generic object (usually a Hash), return directly
307
+ value
308
+ when /\AArray<(?<inner_type>.+)>\z/
309
+ inner_type = Regexp.last_match[:inner_type]
310
+ value.map { |v| _deserialize(inner_type, v) }
311
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
312
+ k_type = Regexp.last_match[:k_type]
313
+ v_type = Regexp.last_match[:v_type]
314
+ {}.tap do |hash|
315
+ value.each do |k, v|
316
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
317
+ end
318
+ end
319
+ else # model
320
+ MailSlurpClient.const_get(type).build_from_hash(value)
321
+ end
322
+ end
323
+
324
+ # Returns the string representation of the object
325
+ # @return [String] String presentation of the object
326
+ def to_s
327
+ to_hash.to_s
328
+ end
329
+
330
+ # to_body is an alias to to_hash (backward compatibility)
331
+ # @return [Hash] Returns the object in the form of hash
332
+ def to_body
333
+ to_hash
334
+ end
335
+
336
+ # Returns the object in the form of hash
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_hash
339
+ hash = {}
340
+ self.class.attribute_map.each_pair do |attr, param|
341
+ value = self.send(attr)
342
+ if value.nil?
343
+ is_nullable = self.class.openapi_nullable.include?(attr)
344
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
345
+ end
346
+
347
+ hash[param] = _to_hash(value)
348
+ end
349
+ hash
350
+ end
351
+
352
+ # Outputs non-array value in the form of hash
353
+ # For object, use to_hash. Otherwise, just return the value
354
+ # @param [Object] value Any valid value
355
+ # @return [Hash] Returns the value in the form of hash
356
+ def _to_hash(value)
357
+ if value.is_a?(Array)
358
+ value.compact.map { |v| _to_hash(v) }
359
+ elsif value.is_a?(Hash)
360
+ {}.tap do |hash|
361
+ value.each { |k, v| hash[k] = _to_hash(v) }
362
+ end
363
+ elsif value.respond_to? :to_hash
364
+ value.to_hash
365
+ else
366
+ value
367
+ end
368
+ end
369
+ end
370
+ end