mailslurp_client 12.6.4 → 12.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -149,6 +149,66 @@ module MailSlurpClient
149
149
  return data, status_code, headers
150
150
  end
151
151
 
152
+ # Get sent email HTML content
153
+ # @param id [String] id
154
+ # @param [Hash] opts the optional parameters
155
+ # @return [String]
156
+ def get_sent_email_html_content(id, opts = {})
157
+ data, _status_code, _headers = get_sent_email_html_content_with_http_info(id, opts)
158
+ data
159
+ end
160
+
161
+ # Get sent email HTML content
162
+ # @param id [String] id
163
+ # @param [Hash] opts the optional parameters
164
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
165
+ def get_sent_email_html_content_with_http_info(id, opts = {})
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug 'Calling API: SentEmailsControllerApi.get_sent_email_html_content ...'
168
+ end
169
+ # verify the required parameter 'id' is set
170
+ if @api_client.config.client_side_validation && id.nil?
171
+ fail ArgumentError, "Missing the required parameter 'id' when calling SentEmailsControllerApi.get_sent_email_html_content"
172
+ end
173
+ # resource path
174
+ local_var_path = '/sent/{id}/html'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
175
+
176
+ # query parameters
177
+ query_params = opts[:query_params] || {}
178
+
179
+ # header parameters
180
+ header_params = opts[:header_params] || {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['text/html'])
183
+
184
+ # form parameters
185
+ form_params = opts[:form_params] || {}
186
+
187
+ # http body (model)
188
+ post_body = opts[:body]
189
+
190
+ # return_type
191
+ return_type = opts[:return_type] || 'String'
192
+
193
+ # auth_names
194
+ auth_names = opts[:auth_names] || ['API_KEY']
195
+
196
+ new_options = opts.merge(
197
+ :header_params => header_params,
198
+ :query_params => query_params,
199
+ :form_params => form_params,
200
+ :body => post_body,
201
+ :auth_names => auth_names,
202
+ :return_type => return_type
203
+ )
204
+
205
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
206
+ if @api_client.config.debugging
207
+ @api_client.config.logger.debug "API called: SentEmailsControllerApi#get_sent_email_html_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
208
+ end
209
+ return data, status_code, headers
210
+ end
211
+
152
212
  # Get all tracking pixels for a sent email in paginated form
153
213
  # @param id [String] id
154
214
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,325 @@
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
+ class Bounce
17
+ attr_accessor :bounce_mta
18
+
19
+ attr_accessor :bounce_recipients
20
+
21
+ attr_accessor :bounce_sub_type
22
+
23
+ attr_accessor :bounce_type
24
+
25
+ attr_accessor :created_at
26
+
27
+ attr_accessor :id
28
+
29
+ attr_accessor :notification_type
30
+
31
+ attr_accessor :sender
32
+
33
+ attr_accessor :sent_to_recipients
34
+
35
+ attr_accessor :updated_at
36
+
37
+ attr_accessor :user_id
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'bounce_mta' => :'bounceMta',
43
+ :'bounce_recipients' => :'bounceRecipients',
44
+ :'bounce_sub_type' => :'bounceSubType',
45
+ :'bounce_type' => :'bounceType',
46
+ :'created_at' => :'createdAt',
47
+ :'id' => :'id',
48
+ :'notification_type' => :'notificationType',
49
+ :'sender' => :'sender',
50
+ :'sent_to_recipients' => :'sentToRecipients',
51
+ :'updated_at' => :'updatedAt',
52
+ :'user_id' => :'userId'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'bounce_mta' => :'String',
60
+ :'bounce_recipients' => :'Array<String>',
61
+ :'bounce_sub_type' => :'String',
62
+ :'bounce_type' => :'String',
63
+ :'created_at' => :'DateTime',
64
+ :'id' => :'String',
65
+ :'notification_type' => :'String',
66
+ :'sender' => :'String',
67
+ :'sent_to_recipients' => :'Array<String>',
68
+ :'updated_at' => :'DateTime',
69
+ :'user_id' => :'String'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::Bounce` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::Bounce`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'bounce_mta')
95
+ self.bounce_mta = attributes[:'bounce_mta']
96
+ end
97
+
98
+ if attributes.key?(:'bounce_recipients')
99
+ if (value = attributes[:'bounce_recipients']).is_a?(Array)
100
+ self.bounce_recipients = value
101
+ end
102
+ end
103
+
104
+ if attributes.key?(:'bounce_sub_type')
105
+ self.bounce_sub_type = attributes[:'bounce_sub_type']
106
+ end
107
+
108
+ if attributes.key?(:'bounce_type')
109
+ self.bounce_type = attributes[:'bounce_type']
110
+ end
111
+
112
+ if attributes.key?(:'created_at')
113
+ self.created_at = attributes[:'created_at']
114
+ end
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ end
119
+
120
+ if attributes.key?(:'notification_type')
121
+ self.notification_type = attributes[:'notification_type']
122
+ end
123
+
124
+ if attributes.key?(:'sender')
125
+ self.sender = attributes[:'sender']
126
+ end
127
+
128
+ if attributes.key?(:'sent_to_recipients')
129
+ if (value = attributes[:'sent_to_recipients']).is_a?(Array)
130
+ self.sent_to_recipients = value
131
+ end
132
+ end
133
+
134
+ if attributes.key?(:'updated_at')
135
+ self.updated_at = attributes[:'updated_at']
136
+ end
137
+
138
+ if attributes.key?(:'user_id')
139
+ self.user_id = attributes[:'user_id']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ invalid_properties = Array.new
147
+ if @created_at.nil?
148
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
149
+ end
150
+
151
+ if @notification_type.nil?
152
+ invalid_properties.push('invalid value for "notification_type", notification_type cannot be nil.')
153
+ end
154
+
155
+ if @sender.nil?
156
+ invalid_properties.push('invalid value for "sender", sender cannot be nil.')
157
+ end
158
+
159
+ if @updated_at.nil?
160
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
161
+ end
162
+
163
+ if @user_id.nil?
164
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ return false if @created_at.nil?
174
+ return false if @notification_type.nil?
175
+ return false if @sender.nil?
176
+ return false if @updated_at.nil?
177
+ return false if @user_id.nil?
178
+ true
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ bounce_mta == o.bounce_mta &&
187
+ bounce_recipients == o.bounce_recipients &&
188
+ bounce_sub_type == o.bounce_sub_type &&
189
+ bounce_type == o.bounce_type &&
190
+ created_at == o.created_at &&
191
+ id == o.id &&
192
+ notification_type == o.notification_type &&
193
+ sender == o.sender &&
194
+ sent_to_recipients == o.sent_to_recipients &&
195
+ updated_at == o.updated_at &&
196
+ user_id == o.user_id
197
+ end
198
+
199
+ # @see the `==` method
200
+ # @param [Object] Object to be compared
201
+ def eql?(o)
202
+ self == o
203
+ end
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Integer] Hash code
207
+ def hash
208
+ [bounce_mta, bounce_recipients, bounce_sub_type, bounce_type, created_at, id, notification_type, sender, sent_to_recipients, updated_at, user_id].hash
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def self.build_from_hash(attributes)
215
+ new.build_from_hash(attributes)
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ self.class.openapi_types.each_pair do |key, type|
224
+ if type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :DateTime
245
+ DateTime.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ MailSlurpClient.const_get(type).build_from_hash(value)
276
+ end
277
+ end
278
+
279
+ # Returns the string representation of the object
280
+ # @return [String] String presentation of the object
281
+ def to_s
282
+ to_hash.to_s
283
+ end
284
+
285
+ # to_body is an alias to to_hash (backward compatibility)
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_body
288
+ to_hash
289
+ end
290
+
291
+ # Returns the object in the form of hash
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_hash
294
+ hash = {}
295
+ self.class.attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ if value.nil?
298
+ is_nullable = self.class.openapi_nullable.include?(attr)
299
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
+ end
301
+
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map { |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+ end
325
+ end
@@ -0,0 +1,234 @@
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
+ class BounceProjection
17
+ attr_accessor :created_at
18
+
19
+ attr_accessor :id
20
+
21
+ attr_accessor :sender
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'created_at' => :'createdAt',
27
+ :'id' => :'id',
28
+ :'sender' => :'sender'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'created_at' => :'DateTime',
36
+ :'id' => :'String',
37
+ :'sender' => :'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::BounceProjection` 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::BounceProjection`. 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?(:'created_at')
63
+ self.created_at = attributes[:'created_at']
64
+ end
65
+
66
+ if attributes.key?(:'id')
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes.key?(:'sender')
71
+ self.sender = attributes[:'sender']
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 @created_at.nil?
80
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
81
+ end
82
+
83
+ if @sender.nil?
84
+ invalid_properties.push('invalid value for "sender", sender cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if @created_at.nil?
94
+ return false if @sender.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ created_at == o.created_at &&
104
+ id == o.id &&
105
+ sender == o.sender
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [created_at, id, sender].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ DateTime.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ MailSlurpClient.const_get(type).build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+ end
234
+ end