mailslurp_client 15.3.1 → 15.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,261 @@
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
+ 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 ImapFlagOperationOptions
17
+ attr_accessor :flag_operation
18
+
19
+ attr_accessor :flags
20
+
21
+ class EnumAttributeValidator
22
+ attr_reader :datatype
23
+ attr_reader :allowable_values
24
+
25
+ def initialize(datatype, allowable_values)
26
+ @allowable_values = allowable_values.map do |value|
27
+ case datatype.to_s
28
+ when /Integer/i
29
+ value.to_i
30
+ when /Float/i
31
+ value.to_f
32
+ else
33
+ value
34
+ end
35
+ end
36
+ end
37
+
38
+ def valid?(value)
39
+ !value || allowable_values.include?(value)
40
+ end
41
+ end
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'flag_operation' => :'flagOperation',
47
+ :'flags' => :'flags'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'flag_operation' => :'String',
55
+ :'flags' => :'Array<String>'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapFlagOperationOptions` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapFlagOperationOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'flag_operation')
81
+ self.flag_operation = attributes[:'flag_operation']
82
+ end
83
+
84
+ if attributes.key?(:'flags')
85
+ if (value = attributes[:'flags']).is_a?(Array)
86
+ self.flags = value
87
+ end
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ if @flag_operation.nil?
96
+ invalid_properties.push('invalid value for "flag_operation", flag_operation cannot be nil.')
97
+ end
98
+
99
+ if @flags.nil?
100
+ invalid_properties.push('invalid value for "flags", flags cannot be nil.')
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if @flag_operation.nil?
110
+ flag_operation_validator = EnumAttributeValidator.new('String', ["SET_FLAGS", "ADD_FLAGS", "REMOVE_FLAGS"])
111
+ return false unless flag_operation_validator.valid?(@flag_operation)
112
+ return false if @flags.nil?
113
+ true
114
+ end
115
+
116
+ # Custom attribute writer method checking allowed values (enum).
117
+ # @param [Object] flag_operation Object to be assigned
118
+ def flag_operation=(flag_operation)
119
+ validator = EnumAttributeValidator.new('String', ["SET_FLAGS", "ADD_FLAGS", "REMOVE_FLAGS"])
120
+ unless validator.valid?(flag_operation)
121
+ fail ArgumentError, "invalid value for \"flag_operation\", must be one of #{validator.allowable_values}."
122
+ end
123
+ @flag_operation = flag_operation
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ flag_operation == o.flag_operation &&
132
+ flags == o.flags
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [flag_operation, flags].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ new.build_from_hash(attributes)
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.openapi_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :DateTime
181
+ DateTime.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ MailSlurpClient.const_get(type).build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,309 @@
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
+ 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 ImapSmtpAccessDetails
17
+ attr_accessor :smtp_server_host
18
+
19
+ attr_accessor :smtp_server_port
20
+
21
+ attr_accessor :smtp_username
22
+
23
+ attr_accessor :smtp_password
24
+
25
+ attr_accessor :imap_server_host
26
+
27
+ attr_accessor :imap_server_port
28
+
29
+ attr_accessor :imap_username
30
+
31
+ attr_accessor :imap_password
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'smtp_server_host' => :'smtpServerHost',
37
+ :'smtp_server_port' => :'smtpServerPort',
38
+ :'smtp_username' => :'smtpUsername',
39
+ :'smtp_password' => :'smtpPassword',
40
+ :'imap_server_host' => :'imapServerHost',
41
+ :'imap_server_port' => :'imapServerPort',
42
+ :'imap_username' => :'imapUsername',
43
+ :'imap_password' => :'imapPassword'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'smtp_server_host' => :'String',
51
+ :'smtp_server_port' => :'Integer',
52
+ :'smtp_username' => :'String',
53
+ :'smtp_password' => :'String',
54
+ :'imap_server_host' => :'String',
55
+ :'imap_server_port' => :'Integer',
56
+ :'imap_username' => :'String',
57
+ :'imap_password' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapSmtpAccessDetails` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapSmtpAccessDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'smtp_server_host')
83
+ self.smtp_server_host = attributes[:'smtp_server_host']
84
+ end
85
+
86
+ if attributes.key?(:'smtp_server_port')
87
+ self.smtp_server_port = attributes[:'smtp_server_port']
88
+ end
89
+
90
+ if attributes.key?(:'smtp_username')
91
+ self.smtp_username = attributes[:'smtp_username']
92
+ end
93
+
94
+ if attributes.key?(:'smtp_password')
95
+ self.smtp_password = attributes[:'smtp_password']
96
+ end
97
+
98
+ if attributes.key?(:'imap_server_host')
99
+ self.imap_server_host = attributes[:'imap_server_host']
100
+ end
101
+
102
+ if attributes.key?(:'imap_server_port')
103
+ self.imap_server_port = attributes[:'imap_server_port']
104
+ end
105
+
106
+ if attributes.key?(:'imap_username')
107
+ self.imap_username = attributes[:'imap_username']
108
+ end
109
+
110
+ if attributes.key?(:'imap_password')
111
+ self.imap_password = attributes[:'imap_password']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @smtp_server_host.nil?
120
+ invalid_properties.push('invalid value for "smtp_server_host", smtp_server_host cannot be nil.')
121
+ end
122
+
123
+ if @smtp_server_port.nil?
124
+ invalid_properties.push('invalid value for "smtp_server_port", smtp_server_port cannot be nil.')
125
+ end
126
+
127
+ if @smtp_username.nil?
128
+ invalid_properties.push('invalid value for "smtp_username", smtp_username cannot be nil.')
129
+ end
130
+
131
+ if @smtp_password.nil?
132
+ invalid_properties.push('invalid value for "smtp_password", smtp_password cannot be nil.')
133
+ end
134
+
135
+ if @imap_server_host.nil?
136
+ invalid_properties.push('invalid value for "imap_server_host", imap_server_host cannot be nil.')
137
+ end
138
+
139
+ if @imap_server_port.nil?
140
+ invalid_properties.push('invalid value for "imap_server_port", imap_server_port cannot be nil.')
141
+ end
142
+
143
+ if @imap_username.nil?
144
+ invalid_properties.push('invalid value for "imap_username", imap_username cannot be nil.')
145
+ end
146
+
147
+ if @imap_password.nil?
148
+ invalid_properties.push('invalid value for "imap_password", imap_password cannot be nil.')
149
+ end
150
+
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ return false if @smtp_server_host.nil?
158
+ return false if @smtp_server_port.nil?
159
+ return false if @smtp_username.nil?
160
+ return false if @smtp_password.nil?
161
+ return false if @imap_server_host.nil?
162
+ return false if @imap_server_port.nil?
163
+ return false if @imap_username.nil?
164
+ return false if @imap_password.nil?
165
+ true
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ smtp_server_host == o.smtp_server_host &&
174
+ smtp_server_port == o.smtp_server_port &&
175
+ smtp_username == o.smtp_username &&
176
+ smtp_password == o.smtp_password &&
177
+ imap_server_host == o.imap_server_host &&
178
+ imap_server_port == o.imap_server_port &&
179
+ imap_username == o.imap_username &&
180
+ imap_password == o.imap_password
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [smtp_server_host, smtp_server_port, smtp_username, smtp_password, imap_server_host, imap_server_port, imap_username, imap_password].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ new.build_from_hash(attributes)
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ self.class.openapi_types.each_pair do |key, type|
208
+ if type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :DateTime
229
+ DateTime.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ MailSlurpClient.const_get(type).build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+ end
309
+ end