mailslurp_client 15.17.24 → 15.17.26

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/email_controller_api.rb +64 -0
  3. data/lib/mailslurp_client/api/inbox_controller_api.rb +64 -0
  4. data/lib/mailslurp_client/models/alias_projection.rb +15 -15
  5. data/lib/mailslurp_client/models/bounce_projection.rb +11 -11
  6. data/lib/mailslurp_client/models/connector_projection.rb +15 -15
  7. data/lib/mailslurp_client/models/email_projection.rb +21 -21
  8. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +11 -11
  9. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +11 -11
  10. data/lib/mailslurp_client/models/missed_email_projection.rb +11 -11
  11. data/lib/mailslurp_client/models/page_alias.rb +16 -17
  12. data/lib/mailslurp_client/models/page_attachment_entity.rb +16 -17
  13. data/lib/mailslurp_client/models/page_bounced_email.rb +16 -17
  14. data/lib/mailslurp_client/models/page_bounced_recipients.rb +16 -17
  15. data/lib/mailslurp_client/models/page_complaint.rb +16 -17
  16. data/lib/mailslurp_client/models/page_connector.rb +16 -17
  17. data/lib/mailslurp_client/models/page_connector_sync_events.rb +16 -17
  18. data/lib/mailslurp_client/models/page_contact_projection.rb +16 -17
  19. data/lib/mailslurp_client/models/page_delivery_status.rb +16 -17
  20. data/lib/mailslurp_client/models/page_email_preview.rb +16 -17
  21. data/lib/mailslurp_client/models/page_email_projection.rb +21 -12
  22. data/lib/mailslurp_client/models/page_email_validation_request.rb +16 -17
  23. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +16 -17
  24. data/lib/mailslurp_client/models/page_group_projection.rb +16 -17
  25. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +16 -17
  26. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +16 -17
  27. data/lib/mailslurp_client/models/page_inbox_projection.rb +16 -17
  28. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +16 -17
  29. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +16 -17
  30. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +16 -17
  31. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +16 -17
  32. data/lib/mailslurp_client/models/page_missed_email_projection.rb +16 -17
  33. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +16 -17
  34. data/lib/mailslurp_client/models/page_phone_number_projection.rb +16 -17
  35. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +16 -17
  36. data/lib/mailslurp_client/models/page_sent_email_projection.rb +69 -34
  37. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +69 -34
  38. data/lib/mailslurp_client/models/page_sms_projection.rb +16 -17
  39. data/lib/mailslurp_client/models/page_template_projection.rb +16 -17
  40. data/lib/mailslurp_client/models/page_thread_projection.rb +16 -17
  41. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +16 -17
  42. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +16 -17
  43. data/lib/mailslurp_client/models/page_webhook_projection.rb +16 -17
  44. data/lib/mailslurp_client/models/page_webhook_result.rb +16 -17
  45. data/lib/mailslurp_client/models/pageable_object.rb +10 -10
  46. data/lib/mailslurp_client/models/search_emails_options.rb +328 -0
  47. data/lib/mailslurp_client/models/search_inboxes_options.rb +376 -0
  48. data/lib/mailslurp_client/models/send_with_queue_result.rb +1 -0
  49. data/lib/mailslurp_client/models/sent_email_projection.rb +17 -16
  50. data/lib/mailslurp_client/models/thread_projection.rb +23 -23
  51. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  52. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +10 -10
  53. data/lib/mailslurp_client/version.rb +1 -1
  54. data/lib/mailslurp_client.rb +2 -0
  55. metadata +4 -2
@@ -0,0 +1,328 @@
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://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
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
+ class SearchEmailsOptions
17
+ # Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
18
+ attr_accessor :inbox_ids
19
+
20
+ # Optional page index in email list pagination
21
+ attr_accessor :page_index
22
+
23
+ # Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results
24
+ attr_accessor :page_size
25
+
26
+ # Optional createdAt sort direction ASC or DESC
27
+ attr_accessor :sort_direction
28
+
29
+ # Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly
30
+ attr_accessor :unread_only
31
+
32
+ # Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body
33
+ attr_accessor :search_filter
34
+
35
+ # Optional filter emails received after given date time
36
+ attr_accessor :since
37
+
38
+ # Optional filter emails received before given date time
39
+ attr_accessor :before
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'inbox_ids' => :'inboxIds',
67
+ :'page_index' => :'pageIndex',
68
+ :'page_size' => :'pageSize',
69
+ :'sort_direction' => :'sortDirection',
70
+ :'unread_only' => :'unreadOnly',
71
+ :'search_filter' => :'searchFilter',
72
+ :'since' => :'since',
73
+ :'before' => :'before'
74
+ }
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'inbox_ids' => :'Array<String>',
81
+ :'page_index' => :'Integer',
82
+ :'page_size' => :'Integer',
83
+ :'sort_direction' => :'String',
84
+ :'unread_only' => :'Boolean',
85
+ :'search_filter' => :'String',
86
+ :'since' => :'DateTime',
87
+ :'before' => :'DateTime'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ ])
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::SearchEmailsOptions` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!self.class.attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::SearchEmailsOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'inbox_ids')
113
+ if (value = attributes[:'inbox_ids']).is_a?(Array)
114
+ self.inbox_ids = value
115
+ end
116
+ end
117
+
118
+ if attributes.key?(:'page_index')
119
+ self.page_index = attributes[:'page_index']
120
+ end
121
+
122
+ if attributes.key?(:'page_size')
123
+ self.page_size = attributes[:'page_size']
124
+ end
125
+
126
+ if attributes.key?(:'sort_direction')
127
+ self.sort_direction = attributes[:'sort_direction']
128
+ end
129
+
130
+ if attributes.key?(:'unread_only')
131
+ self.unread_only = attributes[:'unread_only']
132
+ end
133
+
134
+ if attributes.key?(:'search_filter')
135
+ self.search_filter = attributes[:'search_filter']
136
+ end
137
+
138
+ if attributes.key?(:'since')
139
+ self.since = attributes[:'since']
140
+ end
141
+
142
+ if attributes.key?(:'before')
143
+ self.before = attributes[:'before']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ if !@page_size.nil? && @page_size > 100
152
+ invalid_properties.push('invalid value for "page_size", must be smaller than or equal to 100.')
153
+ end
154
+
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ return false if !@page_size.nil? && @page_size > 100
162
+ sort_direction_validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
163
+ return false unless sort_direction_validator.valid?(@sort_direction)
164
+ true
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] page_size Value to be assigned
169
+ def page_size=(page_size)
170
+ if !page_size.nil? && page_size > 100
171
+ fail ArgumentError, 'invalid value for "page_size", must be smaller than or equal to 100.'
172
+ end
173
+
174
+ @page_size = page_size
175
+ end
176
+
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] sort_direction Object to be assigned
179
+ def sort_direction=(sort_direction)
180
+ validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
181
+ unless validator.valid?(sort_direction)
182
+ fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{validator.allowable_values}."
183
+ end
184
+ @sort_direction = sort_direction
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ inbox_ids == o.inbox_ids &&
193
+ page_index == o.page_index &&
194
+ page_size == o.page_size &&
195
+ sort_direction == o.sort_direction &&
196
+ unread_only == o.unread_only &&
197
+ search_filter == o.search_filter &&
198
+ since == o.since &&
199
+ before == o.before
200
+ end
201
+
202
+ # @see the `==` method
203
+ # @param [Object] Object to be compared
204
+ def eql?(o)
205
+ self == o
206
+ end
207
+
208
+ # Calculates hash code according to all attributes.
209
+ # @return [Integer] Hash code
210
+ def hash
211
+ [inbox_ids, page_index, page_size, sort_direction, unread_only, search_filter, since, before].hash
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def self.build_from_hash(attributes)
218
+ new.build_from_hash(attributes)
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ self.class.openapi_types.each_pair do |key, type|
227
+ if type =~ /\AArray<(.*)>/i
228
+ # check to ensure the input is an array given that the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
231
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
232
+ end
233
+ elsif !attributes[self.class.attribute_map[key]].nil?
234
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
235
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
236
+ end
237
+
238
+ self
239
+ end
240
+
241
+ # Deserializes the data based on type
242
+ # @param string type Data type
243
+ # @param string value Value to be deserialized
244
+ # @return [Object] Deserialized data
245
+ def _deserialize(type, value)
246
+ case type.to_sym
247
+ when :DateTime
248
+ DateTime.parse(value)
249
+ when :Date
250
+ Date.parse(value)
251
+ when :String
252
+ value.to_s
253
+ when :Integer
254
+ value.to_i
255
+ when :Float
256
+ value.to_f
257
+ when :Boolean
258
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
259
+ true
260
+ else
261
+ false
262
+ end
263
+ when :Object
264
+ # generic object (usually a Hash), return directly
265
+ value
266
+ when /\AArray<(?<inner_type>.+)>\z/
267
+ inner_type = Regexp.last_match[:inner_type]
268
+ value.map { |v| _deserialize(inner_type, v) }
269
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
270
+ k_type = Regexp.last_match[:k_type]
271
+ v_type = Regexp.last_match[:v_type]
272
+ {}.tap do |hash|
273
+ value.each do |k, v|
274
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
275
+ end
276
+ end
277
+ else # model
278
+ MailSlurpClient.const_get(type).build_from_hash(value)
279
+ end
280
+ end
281
+
282
+ # Returns the string representation of the object
283
+ # @return [String] String presentation of the object
284
+ def to_s
285
+ to_hash.to_s
286
+ end
287
+
288
+ # to_body is an alias to to_hash (backward compatibility)
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_body
291
+ to_hash
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ if value.nil?
301
+ is_nullable = self.class.openapi_nullable.include?(attr)
302
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
303
+ end
304
+
305
+ hash[param] = _to_hash(value)
306
+ end
307
+ hash
308
+ end
309
+
310
+ # Outputs non-array value in the form of hash
311
+ # For object, use to_hash. Otherwise, just return the value
312
+ # @param [Object] value Any valid value
313
+ # @return [Hash] Returns the value in the form of hash
314
+ def _to_hash(value)
315
+ if value.is_a?(Array)
316
+ value.compact.map { |v| _to_hash(v) }
317
+ elsif value.is_a?(Hash)
318
+ {}.tap do |hash|
319
+ value.each { |k, v| hash[k] = _to_hash(v) }
320
+ end
321
+ elsif value.respond_to? :to_hash
322
+ value.to_hash
323
+ else
324
+ value
325
+ end
326
+ end
327
+ end
328
+ end
@@ -0,0 +1,376 @@
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://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
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
+ class SearchInboxesOptions
17
+ # Optional page index in list pagination
18
+ attr_accessor :page_index
19
+
20
+ # Optional page size in list pagination
21
+ attr_accessor :page_size
22
+
23
+ # Optional createdAt sort direction ASC or DESC
24
+ attr_accessor :sort_direction
25
+
26
+ # Optionally filter results for favourites only
27
+ attr_accessor :favourite
28
+
29
+ # Optionally filter by search words partial matching ID, tags, name, and email address
30
+ attr_accessor :search
31
+
32
+ # Optionally filter by tags. Will return inboxes that include given tags
33
+ attr_accessor :tag
34
+
35
+ # Optional filter by created after given date time
36
+ attr_accessor :since
37
+
38
+ # Optional filter by created before given date time
39
+ attr_accessor :before
40
+
41
+ # Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
42
+ attr_accessor :inbox_type
43
+
44
+ # Optional filter by inbox function
45
+ attr_accessor :inbox_function
46
+
47
+ # Optional domain ID filter
48
+ attr_accessor :domain_id
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'page_index' => :'pageIndex',
76
+ :'page_size' => :'pageSize',
77
+ :'sort_direction' => :'sortDirection',
78
+ :'favourite' => :'favourite',
79
+ :'search' => :'search',
80
+ :'tag' => :'tag',
81
+ :'since' => :'since',
82
+ :'before' => :'before',
83
+ :'inbox_type' => :'inboxType',
84
+ :'inbox_function' => :'inboxFunction',
85
+ :'domain_id' => :'domainId'
86
+ }
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'page_index' => :'Integer',
93
+ :'page_size' => :'Integer',
94
+ :'sort_direction' => :'String',
95
+ :'favourite' => :'Boolean',
96
+ :'search' => :'String',
97
+ :'tag' => :'String',
98
+ :'since' => :'DateTime',
99
+ :'before' => :'DateTime',
100
+ :'inbox_type' => :'String',
101
+ :'inbox_function' => :'String',
102
+ :'domain_id' => :'String'
103
+ }
104
+ end
105
+
106
+ # List of attributes with nullable: true
107
+ def self.openapi_nullable
108
+ Set.new([
109
+ :'page_index',
110
+ :'page_size',
111
+ :'sort_direction',
112
+ :'favourite',
113
+ :'search',
114
+ :'tag',
115
+ :'since',
116
+ :'before',
117
+ :'inbox_type',
118
+ :'inbox_function',
119
+ :'domain_id'
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::SearchInboxesOptions` 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::SearchInboxesOptions`. 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?(:'page_index')
139
+ self.page_index = attributes[:'page_index']
140
+ end
141
+
142
+ if attributes.key?(:'page_size')
143
+ self.page_size = attributes[:'page_size']
144
+ end
145
+
146
+ if attributes.key?(:'sort_direction')
147
+ self.sort_direction = attributes[:'sort_direction']
148
+ end
149
+
150
+ if attributes.key?(:'favourite')
151
+ self.favourite = attributes[:'favourite']
152
+ end
153
+
154
+ if attributes.key?(:'search')
155
+ self.search = attributes[:'search']
156
+ end
157
+
158
+ if attributes.key?(:'tag')
159
+ self.tag = attributes[:'tag']
160
+ end
161
+
162
+ if attributes.key?(:'since')
163
+ self.since = attributes[:'since']
164
+ end
165
+
166
+ if attributes.key?(:'before')
167
+ self.before = attributes[:'before']
168
+ end
169
+
170
+ if attributes.key?(:'inbox_type')
171
+ self.inbox_type = attributes[:'inbox_type']
172
+ end
173
+
174
+ if attributes.key?(:'inbox_function')
175
+ self.inbox_function = attributes[:'inbox_function']
176
+ end
177
+
178
+ if attributes.key?(:'domain_id')
179
+ self.domain_id = attributes[:'domain_id']
180
+ end
181
+ end
182
+
183
+ # Show invalid properties with the reasons. Usually used together with valid?
184
+ # @return Array for valid properties with the reasons
185
+ def list_invalid_properties
186
+ invalid_properties = Array.new
187
+ invalid_properties
188
+ end
189
+
190
+ # Check to see if the all the properties in the model are valid
191
+ # @return true if the model is valid
192
+ def valid?
193
+ sort_direction_validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
194
+ return false unless sort_direction_validator.valid?(@sort_direction)
195
+ inbox_type_validator = EnumAttributeValidator.new('String', ["HTTP_INBOX", "SMTP_INBOX"])
196
+ return false unless inbox_type_validator.valid?(@inbox_type)
197
+ inbox_function_validator = EnumAttributeValidator.new('String', ["ALIAS", "THREAD", "CATCH_ALL", "CONNECTOR"])
198
+ return false unless inbox_function_validator.valid?(@inbox_function)
199
+ true
200
+ end
201
+
202
+ # Custom attribute writer method checking allowed values (enum).
203
+ # @param [Object] sort_direction Object to be assigned
204
+ def sort_direction=(sort_direction)
205
+ validator = EnumAttributeValidator.new('String', ["ASC", "DESC"])
206
+ unless validator.valid?(sort_direction)
207
+ fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{validator.allowable_values}."
208
+ end
209
+ @sort_direction = sort_direction
210
+ end
211
+
212
+ # Custom attribute writer method checking allowed values (enum).
213
+ # @param [Object] inbox_type Object to be assigned
214
+ def inbox_type=(inbox_type)
215
+ validator = EnumAttributeValidator.new('String', ["HTTP_INBOX", "SMTP_INBOX"])
216
+ unless validator.valid?(inbox_type)
217
+ fail ArgumentError, "invalid value for \"inbox_type\", must be one of #{validator.allowable_values}."
218
+ end
219
+ @inbox_type = inbox_type
220
+ end
221
+
222
+ # Custom attribute writer method checking allowed values (enum).
223
+ # @param [Object] inbox_function Object to be assigned
224
+ def inbox_function=(inbox_function)
225
+ validator = EnumAttributeValidator.new('String', ["ALIAS", "THREAD", "CATCH_ALL", "CONNECTOR"])
226
+ unless validator.valid?(inbox_function)
227
+ fail ArgumentError, "invalid value for \"inbox_function\", must be one of #{validator.allowable_values}."
228
+ end
229
+ @inbox_function = inbox_function
230
+ end
231
+
232
+ # Checks equality by comparing each attribute.
233
+ # @param [Object] Object to be compared
234
+ def ==(o)
235
+ return true if self.equal?(o)
236
+ self.class == o.class &&
237
+ page_index == o.page_index &&
238
+ page_size == o.page_size &&
239
+ sort_direction == o.sort_direction &&
240
+ favourite == o.favourite &&
241
+ search == o.search &&
242
+ tag == o.tag &&
243
+ since == o.since &&
244
+ before == o.before &&
245
+ inbox_type == o.inbox_type &&
246
+ inbox_function == o.inbox_function &&
247
+ domain_id == o.domain_id
248
+ end
249
+
250
+ # @see the `==` method
251
+ # @param [Object] Object to be compared
252
+ def eql?(o)
253
+ self == o
254
+ end
255
+
256
+ # Calculates hash code according to all attributes.
257
+ # @return [Integer] Hash code
258
+ def hash
259
+ [page_index, page_size, sort_direction, favourite, search, tag, since, before, inbox_type, inbox_function, domain_id].hash
260
+ end
261
+
262
+ # Builds the object from hash
263
+ # @param [Hash] attributes Model attributes in the form of hash
264
+ # @return [Object] Returns the model itself
265
+ def self.build_from_hash(attributes)
266
+ new.build_from_hash(attributes)
267
+ end
268
+
269
+ # Builds the object from hash
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ # @return [Object] Returns the model itself
272
+ def build_from_hash(attributes)
273
+ return nil unless attributes.is_a?(Hash)
274
+ self.class.openapi_types.each_pair do |key, type|
275
+ if type =~ /\AArray<(.*)>/i
276
+ # check to ensure the input is an array given that the attribute
277
+ # is documented as an array but the input is not
278
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
279
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
280
+ end
281
+ elsif !attributes[self.class.attribute_map[key]].nil?
282
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
283
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
284
+ end
285
+
286
+ self
287
+ end
288
+
289
+ # Deserializes the data based on type
290
+ # @param string type Data type
291
+ # @param string value Value to be deserialized
292
+ # @return [Object] Deserialized data
293
+ def _deserialize(type, value)
294
+ case type.to_sym
295
+ when :DateTime
296
+ DateTime.parse(value)
297
+ when :Date
298
+ Date.parse(value)
299
+ when :String
300
+ value.to_s
301
+ when :Integer
302
+ value.to_i
303
+ when :Float
304
+ value.to_f
305
+ when :Boolean
306
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
307
+ true
308
+ else
309
+ false
310
+ end
311
+ when :Object
312
+ # generic object (usually a Hash), return directly
313
+ value
314
+ when /\AArray<(?<inner_type>.+)>\z/
315
+ inner_type = Regexp.last_match[:inner_type]
316
+ value.map { |v| _deserialize(inner_type, v) }
317
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
318
+ k_type = Regexp.last_match[:k_type]
319
+ v_type = Regexp.last_match[:v_type]
320
+ {}.tap do |hash|
321
+ value.each do |k, v|
322
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
323
+ end
324
+ end
325
+ else # model
326
+ MailSlurpClient.const_get(type).build_from_hash(value)
327
+ end
328
+ end
329
+
330
+ # Returns the string representation of the object
331
+ # @return [String] String presentation of the object
332
+ def to_s
333
+ to_hash.to_s
334
+ end
335
+
336
+ # to_body is an alias to to_hash (backward compatibility)
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_body
339
+ to_hash
340
+ end
341
+
342
+ # Returns the object in the form of hash
343
+ # @return [Hash] Returns the object in the form of hash
344
+ def to_hash
345
+ hash = {}
346
+ self.class.attribute_map.each_pair do |attr, param|
347
+ value = self.send(attr)
348
+ if value.nil?
349
+ is_nullable = self.class.openapi_nullable.include?(attr)
350
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
351
+ end
352
+
353
+ hash[param] = _to_hash(value)
354
+ end
355
+ hash
356
+ end
357
+
358
+ # Outputs non-array value in the form of hash
359
+ # For object, use to_hash. Otherwise, just return the value
360
+ # @param [Object] value Any valid value
361
+ # @return [Hash] Returns the value in the form of hash
362
+ def _to_hash(value)
363
+ if value.is_a?(Array)
364
+ value.compact.map { |v| _to_hash(v) }
365
+ elsif value.is_a?(Hash)
366
+ {}.tap do |hash|
367
+ value.each { |k, v| hash[k] = _to_hash(v) }
368
+ end
369
+ elsif value.respond_to? :to_hash
370
+ value.to_hash
371
+ else
372
+ value
373
+ end
374
+ end
375
+ end
376
+ end