mailslurp_client 15.18.5 → 15.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/connector_controller_api.rb +260 -0
  3. data/lib/mailslurp_client/api/domain_controller_api.rb +126 -0
  4. data/lib/mailslurp_client/api/email_controller_api.rb +138 -0
  5. data/lib/mailslurp_client/api/imap_controller_api.rb +279 -0
  6. data/lib/mailslurp_client/api/inbox_controller_api.rb +114 -0
  7. data/lib/mailslurp_client/api/inbox_forwarder_controller_api.rb +3 -0
  8. data/lib/mailslurp_client/api/mail_server_controller_api.rb +62 -0
  9. data/lib/mailslurp_client/models/alias_projection.rb +29 -29
  10. data/lib/mailslurp_client/models/attachment_projection.rb +29 -29
  11. data/lib/mailslurp_client/models/bounce_projection.rb +29 -29
  12. data/lib/mailslurp_client/models/bounce_recipient_projection.rb +22 -22
  13. data/lib/mailslurp_client/models/connector_dto.rb +42 -108
  14. data/lib/mailslurp_client/models/connector_imap_connection_dto.rb +311 -0
  15. data/lib/mailslurp_client/models/connector_projection.rb +39 -43
  16. data/lib/mailslurp_client/models/connector_smtp_connection_dto.rb +293 -0
  17. data/lib/mailslurp_client/models/connector_sync_event_projection.rb +15 -15
  18. data/lib/mailslurp_client/models/contact_projection.rb +10 -10
  19. data/lib/mailslurp_client/models/create_connector_imap_connection_options.rb +286 -0
  20. data/lib/mailslurp_client/models/create_connector_options.rb +38 -87
  21. data/lib/mailslurp_client/models/create_connector_smtp_connection_options.rb +256 -0
  22. data/lib/mailslurp_client/models/dns_lookup_options.rb +1 -1
  23. data/lib/mailslurp_client/models/dns_lookups_options.rb +214 -0
  24. data/lib/mailslurp_client/models/domain_group.rb +261 -0
  25. data/lib/mailslurp_client/models/domain_groups_dto.rb +213 -0
  26. data/lib/mailslurp_client/models/domain_information.rb +274 -0
  27. data/lib/mailslurp_client/models/email_preview_urls.rb +18 -4
  28. data/lib/mailslurp_client/models/email_projection.rb +19 -19
  29. data/lib/mailslurp_client/models/email_screenshot_result.rb +211 -0
  30. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  31. data/lib/mailslurp_client/models/get_email_screenshot_options.rb +220 -0
  32. data/lib/mailslurp_client/models/imap_access_details.rb +273 -0
  33. data/lib/mailslurp_client/models/imap_email_projection.rb +239 -0
  34. data/lib/mailslurp_client/models/{create_connector_imap_options.rb → imap_server_fetch_item.rb} +55 -49
  35. data/lib/mailslurp_client/models/imap_server_fetch_result.rb +208 -0
  36. data/lib/mailslurp_client/models/{create_connector_imap_fetch_options.rb → imap_server_list_options.rb} +18 -16
  37. data/lib/mailslurp_client/models/imap_server_list_result.rb +213 -0
  38. data/lib/mailslurp_client/models/imap_server_search_options.rb +318 -0
  39. data/lib/mailslurp_client/models/imap_server_search_result.rb +213 -0
  40. data/lib/mailslurp_client/models/imap_smtp_access_details.rb +16 -1
  41. data/lib/mailslurp_client/models/imap_update_flags_options.rb +277 -0
  42. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +10 -10
  43. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +10 -10
  44. data/lib/mailslurp_client/models/list_unsubscribe_recipient_projection.rb +15 -15
  45. data/lib/mailslurp_client/models/match_option.rb +4 -4
  46. data/lib/mailslurp_client/models/missed_email_projection.rb +14 -14
  47. data/lib/mailslurp_client/models/page_alias.rb +15 -15
  48. data/lib/mailslurp_client/models/page_attachment_entity.rb +15 -15
  49. data/lib/mailslurp_client/models/page_bounced_email.rb +15 -15
  50. data/lib/mailslurp_client/models/page_bounced_recipients.rb +15 -15
  51. data/lib/mailslurp_client/models/page_complaint.rb +15 -15
  52. data/lib/mailslurp_client/models/page_connector.rb +15 -15
  53. data/lib/mailslurp_client/models/page_connector_sync_events.rb +15 -15
  54. data/lib/mailslurp_client/models/page_contact_projection.rb +15 -15
  55. data/lib/mailslurp_client/models/page_delivery_status.rb +15 -15
  56. data/lib/mailslurp_client/models/page_email_preview.rb +15 -15
  57. data/lib/mailslurp_client/models/page_email_projection.rb +15 -15
  58. data/lib/mailslurp_client/models/page_email_validation_request.rb +15 -15
  59. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +15 -15
  60. data/lib/mailslurp_client/models/page_group_projection.rb +15 -15
  61. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +15 -15
  62. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +15 -15
  63. data/lib/mailslurp_client/models/page_inbox_projection.rb +15 -15
  64. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +15 -15
  65. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +15 -15
  66. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +15 -15
  67. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +15 -15
  68. data/lib/mailslurp_client/models/page_missed_email_projection.rb +15 -15
  69. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +15 -15
  70. data/lib/mailslurp_client/models/page_phone_number_projection.rb +15 -15
  71. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +15 -15
  72. data/lib/mailslurp_client/models/page_sent_email_projection.rb +15 -15
  73. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +15 -15
  74. data/lib/mailslurp_client/models/page_sms_projection.rb +15 -15
  75. data/lib/mailslurp_client/models/page_template_projection.rb +15 -15
  76. data/lib/mailslurp_client/models/page_thread_projection.rb +15 -15
  77. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +15 -15
  78. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +15 -15
  79. data/lib/mailslurp_client/models/page_webhook_projection.rb +15 -15
  80. data/lib/mailslurp_client/models/page_webhook_result.rb +15 -15
  81. data/lib/mailslurp_client/models/phone_number_projection.rb +15 -15
  82. data/lib/mailslurp_client/models/sent_email_projection.rb +35 -35
  83. data/lib/mailslurp_client/models/sms_match_option.rb +2 -2
  84. data/lib/mailslurp_client/models/sms_projection.rb +29 -29
  85. data/lib/mailslurp_client/models/smtp_access_details.rb +329 -0
  86. data/lib/mailslurp_client/models/template_projection.rb +17 -17
  87. data/lib/mailslurp_client/models/thread_projection.rb +35 -35
  88. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +15 -15
  89. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +13 -13
  90. data/lib/mailslurp_client/models/webhook_projection.rb +25 -25
  91. data/lib/mailslurp_client/version.rb +1 -1
  92. data/lib/mailslurp_client.rb +21 -2
  93. metadata +23 -4
@@ -0,0 +1,239 @@
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 ImapEmailProjection
17
+ attr_accessor :uid
18
+
19
+ attr_accessor :seq_num
20
+
21
+ attr_accessor :id
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'uid' => :'uid',
27
+ :'seq_num' => :'seqNum',
28
+ :'id' => :'id'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'uid' => :'Integer',
36
+ :'seq_num' => :'Integer',
37
+ :'id' => :'String'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapEmailProjection` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapEmailProjection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'uid')
63
+ self.uid = attributes[:'uid']
64
+ end
65
+
66
+ if attributes.key?(:'seq_num')
67
+ self.seq_num = attributes[:'seq_num']
68
+ end
69
+
70
+ if attributes.key?(:'id')
71
+ self.id = attributes[:'id']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @uid.nil?
80
+ invalid_properties.push('invalid value for "uid", uid cannot be nil.')
81
+ end
82
+
83
+ if @seq_num.nil?
84
+ invalid_properties.push('invalid value for "seq_num", seq_num cannot be nil.')
85
+ end
86
+
87
+ if @id.nil?
88
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @uid.nil?
98
+ return false if @seq_num.nil?
99
+ return false if @id.nil?
100
+ true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ uid == o.uid &&
109
+ seq_num == o.seq_num &&
110
+ id == o.id
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [uid, seq_num, id].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ MailSlurpClient.const_get(type).build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+ end
239
+ end
@@ -13,36 +13,42 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- class CreateConnectorImapOptions
17
- attr_accessor :host
16
+ # IMAP fetch content in raw format
17
+ class ImapServerFetchItem
18
+ # Content of the email
19
+ attr_accessor :content
18
20
 
19
- attr_accessor :port
21
+ # ID of the email
22
+ attr_accessor :id
20
23
 
21
- attr_accessor :username
24
+ # UID of the email
25
+ attr_accessor :uid
22
26
 
23
- attr_accessor :password
27
+ # Sequence number of the email
28
+ attr_accessor :seq_num
24
29
 
25
- attr_accessor :use_ssl
30
+ # Read status of the email
31
+ attr_accessor :read
26
32
 
27
33
  # Attribute mapping from ruby-style variable name to JSON key.
28
34
  def self.attribute_map
29
35
  {
30
- :'host' => :'host',
31
- :'port' => :'port',
32
- :'username' => :'username',
33
- :'password' => :'password',
34
- :'use_ssl' => :'useSSL'
36
+ :'content' => :'content',
37
+ :'id' => :'id',
38
+ :'uid' => :'uid',
39
+ :'seq_num' => :'seqNum',
40
+ :'read' => :'read'
35
41
  }
36
42
  end
37
43
 
38
44
  # Attribute type mapping.
39
45
  def self.openapi_types
40
46
  {
41
- :'host' => :'String',
42
- :'port' => :'Integer',
43
- :'username' => :'String',
44
- :'password' => :'String',
45
- :'use_ssl' => :'Boolean'
47
+ :'content' => :'String',
48
+ :'id' => :'String',
49
+ :'uid' => :'Integer',
50
+ :'seq_num' => :'Integer',
51
+ :'read' => :'Boolean'
46
52
  }
47
53
  end
48
54
 
@@ -56,35 +62,35 @@ module MailSlurpClient
56
62
  # @param [Hash] attributes Model attributes in the form of hash
57
63
  def initialize(attributes = {})
58
64
  if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateConnectorImapOptions` initialize method"
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapServerFetchItem` initialize method"
60
66
  end
61
67
 
62
68
  # check to see if the attribute exists and convert string to symbol for hash key
63
69
  attributes = attributes.each_with_object({}) { |(k, v), h|
64
70
  if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateConnectorImapOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapServerFetchItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
72
  end
67
73
  h[k.to_sym] = v
68
74
  }
69
75
 
70
- if attributes.key?(:'host')
71
- self.host = attributes[:'host']
76
+ if attributes.key?(:'content')
77
+ self.content = attributes[:'content']
72
78
  end
73
79
 
74
- if attributes.key?(:'port')
75
- self.port = attributes[:'port']
80
+ if attributes.key?(:'id')
81
+ self.id = attributes[:'id']
76
82
  end
77
83
 
78
- if attributes.key?(:'username')
79
- self.username = attributes[:'username']
84
+ if attributes.key?(:'uid')
85
+ self.uid = attributes[:'uid']
80
86
  end
81
87
 
82
- if attributes.key?(:'password')
83
- self.password = attributes[:'password']
88
+ if attributes.key?(:'seq_num')
89
+ self.seq_num = attributes[:'seq_num']
84
90
  end
85
91
 
86
- if attributes.key?(:'use_ssl')
87
- self.use_ssl = attributes[:'use_ssl']
92
+ if attributes.key?(:'read')
93
+ self.read = attributes[:'read']
88
94
  end
89
95
  end
90
96
 
@@ -92,24 +98,24 @@ module MailSlurpClient
92
98
  # @return Array for valid properties with the reasons
93
99
  def list_invalid_properties
94
100
  invalid_properties = Array.new
95
- if @host.nil?
96
- invalid_properties.push('invalid value for "host", host cannot be nil.')
101
+ if @content.nil?
102
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
97
103
  end
98
104
 
99
- if @port.nil?
100
- invalid_properties.push('invalid value for "port", port cannot be nil.')
105
+ if @id.nil?
106
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
101
107
  end
102
108
 
103
- if @username.nil?
104
- invalid_properties.push('invalid value for "username", username cannot be nil.')
109
+ if @uid.nil?
110
+ invalid_properties.push('invalid value for "uid", uid cannot be nil.')
105
111
  end
106
112
 
107
- if @password.nil?
108
- invalid_properties.push('invalid value for "password", password cannot be nil.')
113
+ if @seq_num.nil?
114
+ invalid_properties.push('invalid value for "seq_num", seq_num cannot be nil.')
109
115
  end
110
116
 
111
- if @use_ssl.nil?
112
- invalid_properties.push('invalid value for "use_ssl", use_ssl cannot be nil.')
117
+ if @read.nil?
118
+ invalid_properties.push('invalid value for "read", read cannot be nil.')
113
119
  end
114
120
 
115
121
  invalid_properties
@@ -118,11 +124,11 @@ module MailSlurpClient
118
124
  # Check to see if the all the properties in the model are valid
119
125
  # @return true if the model is valid
120
126
  def valid?
121
- return false if @host.nil?
122
- return false if @port.nil?
123
- return false if @username.nil?
124
- return false if @password.nil?
125
- return false if @use_ssl.nil?
127
+ return false if @content.nil?
128
+ return false if @id.nil?
129
+ return false if @uid.nil?
130
+ return false if @seq_num.nil?
131
+ return false if @read.nil?
126
132
  true
127
133
  end
128
134
 
@@ -131,11 +137,11 @@ module MailSlurpClient
131
137
  def ==(o)
132
138
  return true if self.equal?(o)
133
139
  self.class == o.class &&
134
- host == o.host &&
135
- port == o.port &&
136
- username == o.username &&
137
- password == o.password &&
138
- use_ssl == o.use_ssl
140
+ content == o.content &&
141
+ id == o.id &&
142
+ uid == o.uid &&
143
+ seq_num == o.seq_num &&
144
+ read == o.read
139
145
  end
140
146
 
141
147
  # @see the `==` method
@@ -147,7 +153,7 @@ module MailSlurpClient
147
153
  # Calculates hash code according to all attributes.
148
154
  # @return [Integer] Hash code
149
155
  def hash
150
- [host, port, username, password, use_ssl].hash
156
+ [content, id, uid, seq_num, read].hash
151
157
  end
152
158
 
153
159
  # Builds the object from hash
@@ -0,0 +1,208 @@
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
+ # IMAP fetch email result
17
+ class ImapServerFetchResult
18
+ attr_accessor :result
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'result' => :'result'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'result' => :'ImapServerFetchItem'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ :'result'
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapServerFetchResult` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapServerFetchResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'result')
57
+ self.result = attributes[:'result']
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ true
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ result == o.result
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(o)
85
+ self == o
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Integer] Hash code
90
+ def hash
91
+ [result].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ new.build_from_hash(attributes)
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.openapi_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :Boolean
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ MailSlurpClient.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+ end
208
+ end