mailslurp_client 8.1.1 → 8.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d1015cb70586961b4ce1cd1bfe2c9dbbe87aa499315a6495fcc019a50f77ec6
4
- data.tar.gz: 2b3a6d2204707518afeb7448eb5dc23779b0e07a368df4d9156076c6b7cb6af7
3
+ metadata.gz: 36ce41a5fe3eceb494c8afd8a919e2f5de8fcf5d6df42eea3ee221e4567ab428
4
+ data.tar.gz: 475f30343f6b85b51a55dec7531bd4bcfe83441f729fbf18d886d36106c2164b
5
5
  SHA512:
6
- metadata.gz: 0f613a4cd36d6946d5382a0535a601383851f385f67c457596a25e4d2c2f7624bd41ee0523ae1cd79bfa077b7bb7acacf4c90fe1d73490aadbe18350c70d7c85
7
- data.tar.gz: 20a5312fae03832be520fca753fdbd165975924fcb57b746db5718883b30c7e7a259b20282718f34c51bad42fb40e498ce13ff95f961bfdaa1f0318abe71b57f
6
+ metadata.gz: a62a060b64eee4163154b284d0ad61d00dfbdd07f6e07e2f5bca58080334f2e6c615b8280abbe1335289ee716fa73ca59d6ee6e2aab37c39bc84d9cc302181b4
7
+ data.tar.gz: c5dd378fa61330c8a38df16ec2f773ea42c2f34caff69d9a760e42c57bc69b2f18f699405b7e09f44443a524bb46d97c5fa9c5a1ce5e22b30a9efeccf06c48fe
@@ -33,6 +33,7 @@ require 'mailslurp_client/models/describe_domain_options'
33
33
  require 'mailslurp_client/models/describe_mail_server_domain_result'
34
34
  require 'mailslurp_client/models/domain_dto'
35
35
  require 'mailslurp_client/models/domain_preview'
36
+ require 'mailslurp_client/models/download_attachment_dto'
36
37
  require 'mailslurp_client/models/email'
37
38
  require 'mailslurp_client/models/email_analysis'
38
39
  require 'mailslurp_client/models/email_preview'
@@ -133,24 +133,24 @@ module MailSlurpClient
133
133
  return data, status_code, headers
134
134
  end
135
135
 
136
- # Get email attachment bytes
137
- # Returns the specified attachment for a given email as a byte stream (file download). You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
136
+ # Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
137
+ # Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
138
138
  # @param attachment_id [String] attachmentId
139
139
  # @param email_id [String] emailId
140
140
  # @param [Hash] opts the optional parameters
141
- # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser
141
+ # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.
142
142
  # @return [String]
143
143
  def download_attachment(attachment_id, email_id, opts = {})
144
144
  data, _status_code, _headers = download_attachment_with_http_info(attachment_id, email_id, opts)
145
145
  data
146
146
  end
147
147
 
148
- # Get email attachment bytes
149
- # Returns the specified attachment for a given email as a byte stream (file download). You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
148
+ # Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
149
+ # Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
150
150
  # @param attachment_id [String] attachmentId
151
151
  # @param email_id [String] emailId
152
152
  # @param [Hash] opts the optional parameters
153
- # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser
153
+ # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.
154
154
  # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
155
155
  def download_attachment_with_http_info(attachment_id, email_id, opts = {})
156
156
  if @api_client.config.debugging
@@ -204,6 +204,74 @@ module MailSlurpClient
204
204
  return data, status_code, headers
205
205
  end
206
206
 
207
+ # Get email attachment as base64 encoded string (alternative to binary responses)
208
+ # Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses.
209
+ # @param attachment_id [String] attachmentId
210
+ # @param email_id [String] emailId
211
+ # @param [Hash] opts the optional parameters
212
+ # @return [DownloadAttachmentDto]
213
+ def download_attachment_base64(attachment_id, email_id, opts = {})
214
+ data, _status_code, _headers = download_attachment_base64_with_http_info(attachment_id, email_id, opts)
215
+ data
216
+ end
217
+
218
+ # Get email attachment as base64 encoded string (alternative to binary responses)
219
+ # Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the &#x60;downloadAttachment&#x60; method but allows some clients to get around issues with binary responses.
220
+ # @param attachment_id [String] attachmentId
221
+ # @param email_id [String] emailId
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [Array<(DownloadAttachmentDto, Integer, Hash)>] DownloadAttachmentDto data, response status code and response headers
224
+ def download_attachment_base64_with_http_info(attachment_id, email_id, opts = {})
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment_base64 ...'
227
+ end
228
+ # verify the required parameter 'attachment_id' is set
229
+ if @api_client.config.client_side_validation && attachment_id.nil?
230
+ fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment_base64"
231
+ end
232
+ # verify the required parameter 'email_id' is set
233
+ if @api_client.config.client_side_validation && email_id.nil?
234
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment_base64"
235
+ end
236
+ # resource path
237
+ local_var_path = '/emails/{emailId}/attachments/{attachmentId}/base64'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
238
+
239
+ # query parameters
240
+ query_params = opts[:query_params] || {}
241
+
242
+ # header parameters
243
+ header_params = opts[:header_params] || {}
244
+ # HTTP header 'Accept' (if needed)
245
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
246
+
247
+ # form parameters
248
+ form_params = opts[:form_params] || {}
249
+
250
+ # http body (model)
251
+ post_body = opts[:body]
252
+
253
+ # return_type
254
+ return_type = opts[:return_type] || 'DownloadAttachmentDto'
255
+
256
+ # auth_names
257
+ auth_names = opts[:auth_names] || ['API_KEY']
258
+
259
+ new_options = opts.merge(
260
+ :header_params => header_params,
261
+ :query_params => query_params,
262
+ :form_params => form_params,
263
+ :body => post_body,
264
+ :auth_names => auth_names,
265
+ :return_type => return_type
266
+ )
267
+
268
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
269
+ if @api_client.config.debugging
270
+ @api_client.config.logger.debug "API called: EmailControllerApi#download_attachment_base64\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
271
+ end
272
+ return data, status_code, headers
273
+ end
274
+
207
275
  # Forward email
208
276
  # Forward an existing email to new recipients.
209
277
  # @param email_id [String] emailId
@@ -0,0 +1,228 @@
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
+ # Content of attachment
17
+ class DownloadAttachmentDto
18
+ # Base64 encoded string of attachment bytes. Decode the base64 string to get the raw file bytes
19
+ attr_accessor :base64_file_contents
20
+
21
+ # Content type of attachment
22
+ attr_accessor :content_type
23
+
24
+ # Size in bytes of attachment
25
+ attr_accessor :size_bytes
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'base64_file_contents' => :'base64FileContents',
31
+ :'content_type' => :'contentType',
32
+ :'size_bytes' => :'sizeBytes'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'base64_file_contents' => :'String',
40
+ :'content_type' => :'String',
41
+ :'size_bytes' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::DownloadAttachmentDto` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::DownloadAttachmentDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'base64_file_contents')
67
+ self.base64_file_contents = attributes[:'base64_file_contents']
68
+ end
69
+
70
+ if attributes.key?(:'content_type')
71
+ self.content_type = attributes[:'content_type']
72
+ end
73
+
74
+ if attributes.key?(:'size_bytes')
75
+ self.size_bytes = attributes[:'size_bytes']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ base64_file_contents == o.base64_file_contents &&
98
+ content_type == o.content_type &&
99
+ size_bytes == o.size_bytes
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [base64_file_contents, content_type, size_bytes].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ MailSlurpClient.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module MailSlurpClient
14
- VERSION = '8.1.1'
14
+ VERSION = '8.2.1'
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailslurp_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.1
4
+ version: 8.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mailslurp
@@ -57,6 +57,7 @@ files:
57
57
  - lib/mailslurp_client/models/describe_mail_server_domain_result.rb
58
58
  - lib/mailslurp_client/models/domain_dto.rb
59
59
  - lib/mailslurp_client/models/domain_preview.rb
60
+ - lib/mailslurp_client/models/download_attachment_dto.rb
60
61
  - lib/mailslurp_client/models/email.rb
61
62
  - lib/mailslurp_client/models/email_analysis.rb
62
63
  - lib/mailslurp_client/models/email_preview.rb