Class: MailSlurpClient::AttachmentControllerApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/api/attachment_controller_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AttachmentControllerApi

Returns a new instance of AttachmentControllerApi.



19
20
21
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_all_attachments(opts = {}) ⇒ nil

Delete all attachments Delete all attachments

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


26
27
28
29
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 26

def delete_all_attachments(opts = {})
  delete_all_attachments_with_http_info(opts)
  nil
end

#delete_all_attachments_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete all attachments Delete all attachments

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 35

def delete_all_attachments_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.delete_all_attachments ...'
  end
  # resource path
  local_var_path = '/attachments'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#delete_all_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_attachment(attachment_id, opts = {}) ⇒ nil

Delete an attachment Delete an attachment

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


81
82
83
84
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 81

def delete_attachment(attachment_id, opts = {})
  delete_attachment_with_http_info(attachment_id, opts)
  nil
end

#delete_attachment_with_http_info(attachment_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete an attachment Delete an attachment

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 91

def delete_attachment_with_http_info(attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.delete_attachment ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.delete_attachment"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#delete_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_attachment_as_base64_encoded(attachment_id, opts = {}) ⇒ DownloadAttachmentDto

Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. 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.

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



141
142
143
144
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 141

def download_attachment_as_base64_encoded(attachment_id, opts = {})
  data, _status_code, _headers = download_attachment_as_base64_encoded_with_http_info(attachment_id, opts)
  data
end

#download_attachment_as_base64_encoded_with_http_info(attachment_id, opts = {}) ⇒ Array<(DownloadAttachmentDto, Integer, Hash)>

Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. 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.

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DownloadAttachmentDto, Integer, Hash)>)

    DownloadAttachmentDto data, response status code and response headers



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 151

def download_attachment_as_base64_encoded_with_http_info(attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.download_attachment_as_base64_encoded ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.download_attachment_as_base64_encoded"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}/base64'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'DownloadAttachmentDto' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#download_attachment_as_base64_encoded\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_attachment_as_bytes(attachment_id, opts = {}) ⇒ String

Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints. 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.

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


203
204
205
206
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 203

def download_attachment_as_bytes(attachment_id, opts = {})
  data, _status_code, _headers = download_attachment_as_bytes_with_http_info(attachment_id, opts)
  data
end

#download_attachment_as_bytes_with_http_info(attachment_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download attachments. Get email attachment bytes. If you have trouble with byte responses try the &#x60;downloadAttachmentBase64&#x60; response endpoints. 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.

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 213

def download_attachment_as_bytes_with_http_info(attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.download_attachment_as_bytes ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.download_attachment_as_bytes"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}/bytes'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'String' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#download_attachment_as_bytes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attachment(attachment_id, opts = {}) ⇒ AttachmentEntityDto

Get an attachment entity

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



264
265
266
267
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 264

def get_attachment(attachment_id, opts = {})
  data, _status_code, _headers = get_attachment_with_http_info(attachment_id, opts)
  data
end

#get_attachment_info(attachment_id, opts = {}) ⇒ AttachmentMetaData

Get email attachment metadata information Returns the metadata for an attachment. It is saved separately to the content of the attachment. Contains properties `name` and `content-type` and `content-length` in bytes for a given attachment.

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



325
326
327
328
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 325

def get_attachment_info(attachment_id, opts = {})
  data, _status_code, _headers = get_attachment_info_with_http_info(attachment_id, opts)
  data
end

#get_attachment_info_with_http_info(attachment_id, opts = {}) ⇒ Array<(AttachmentMetaData, Integer, Hash)>

Get email attachment metadata information Returns the metadata for an attachment. It is saved separately to the content of the attachment. Contains properties &#x60;name&#x60; and &#x60;content-type&#x60; and &#x60;content-length&#x60; in bytes for a given attachment.

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AttachmentMetaData, Integer, Hash)>)

    AttachmentMetaData data, response status code and response headers



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 335

def get_attachment_info_with_http_info(attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.get_attachment_info ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.get_attachment_info"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}/metadata'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'AttachmentMetaData' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#get_attachment_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attachment_with_http_info(attachment_id, opts = {}) ⇒ Array<(AttachmentEntityDto, Integer, Hash)>

Get an attachment entity

Parameters:

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AttachmentEntityDto, Integer, Hash)>)

    AttachmentEntityDto data, response status code and response headers



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 273

def get_attachment_with_http_info(attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.get_attachment ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.get_attachment"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'AttachmentEntityDto' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#get_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attachments(opts = {}) ⇒ PageAttachmentEntity

Get email attachments Get all attachments in paginated response. Each entity contains meta data for the attachment such as `name` and `content-type`. Use the `attachmentId` and the download endpoints to get the file contents.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Optional page index for list pagination (default to 0)

  • :size (Integer)

    Optional page size for list pagination (default to 20)

  • :sort (String)

    Optional createdAt sort direction ASC or DESC (default to 'ASC')

  • :file_name_filter (String)

    Optional file name and content type search filter

  • :since (DateTime)

    Filter by created at after the given timestamp

  • :before (DateTime)

    Filter by created at before the given timestamp

  • :inbox_id (String)

    Optional inboxId to filter attachments by

Returns:



393
394
395
396
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 393

def get_attachments(opts = {})
  data, _status_code, _headers = get_attachments_with_http_info(opts)
  data
end

#get_attachments_with_http_info(opts = {}) ⇒ Array<(PageAttachmentEntity, Integer, Hash)>

Get email attachments Get all attachments in paginated response. Each entity contains meta data for the attachment such as &#x60;name&#x60; and &#x60;content-type&#x60;. Use the &#x60;attachmentId&#x60; and the download endpoints to get the file contents.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Optional page index for list pagination

  • :size (Integer)

    Optional page size for list pagination

  • :sort (String)

    Optional createdAt sort direction ASC or DESC

  • :file_name_filter (String)

    Optional file name and content type search filter

  • :since (DateTime)

    Filter by created at after the given timestamp

  • :before (DateTime)

    Filter by created at before the given timestamp

  • :inbox_id (String)

    Optional inboxId to filter attachments by

Returns:

  • (Array<(PageAttachmentEntity, Integer, Hash)>)

    PageAttachmentEntity data, response status code and response headers



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 409

def get_attachments_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.get_attachments ...'
  end
  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/attachments'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'fileNameFilter'] = opts[:'file_name_filter'] if !opts[:'file_name_filter'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'PageAttachmentEntity' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#get_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_attachment(upload_attachment_options, opts = {}) ⇒ Array<String>

Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.

Parameters:

Returns:

  • (Array<String>)


467
468
469
470
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 467

def upload_attachment(upload_attachment_options, opts = {})
  data, _status_code, _headers = upload_attachment_with_http_info(upload_attachment_options, opts)
  data
end

#upload_attachment_bytes(opts = {}) ⇒ Array<String>

Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :content_type (String)
  • :content_type2 (String)

    Optional contentType for file. For instance &#x60;application/pdf&#x60;

  • :content_id (String)

    Optional content ID (CID) to save upload with

  • :filename (String)

    Optional filename to save upload with

  • :file_size (Integer)

    Optional byte length to save upload with

  • :filename2 (String)

Returns:

  • (Array<String>)


534
535
536
537
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 534

def upload_attachment_bytes(opts = {})
  data, _status_code, _headers = upload_attachment_bytes_with_http_info(opts)
  data
end

#upload_attachment_bytes_with_http_info(opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :content_type (String)
  • :content_type2 (String)

    Optional contentType for file. For instance &#x60;application/pdf&#x60;

  • :content_id (String)

    Optional content ID (CID) to save upload with

  • :filename (String)

    Optional filename to save upload with

  • :file_size (Integer)

    Optional byte length to save upload with

  • :filename2 (String)

Returns:

  • (Array<(Array<String>, Integer, Hash)>)

    Array<String> data, response status code and response headers



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 548

def upload_attachment_bytes_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.upload_attachment_bytes ...'
  end
  # resource path
  local_var_path = '/attachments/bytes'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contentType'] = opts[:'content_type2'] if !opts[:'content_type2'].nil?
  query_params[:'contentId'] = opts[:'content_id'] if !opts[:'content_id'].nil?
  query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil?
  query_params[:'fileSize'] = opts[:'file_size'] if !opts[:'file_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'contentType'] = opts[:'content_type'] if !opts[:'content_type'].nil?
  header_params[:'filename'] = opts[:'filename2'] if !opts[:'filename2'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<String>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#upload_attachment_bytes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_attachment_with_http_info(upload_attachment_options, opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.

Parameters:

Returns:

  • (Array<(Array<String>, Integer, Hash)>)

    Array<String> data, response status code and response headers



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 476

def upload_attachment_with_http_info(upload_attachment_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.upload_attachment ...'
  end
  # verify the required parameter 'upload_attachment_options' is set
  if @api_client.config.client_side_validation && upload_attachment_options.nil?
    fail ArgumentError, "Missing the required parameter 'upload_attachment_options' when calling AttachmentControllerApi.upload_attachment"
  end
  # resource path
  local_var_path = '/attachments'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(upload_attachment_options) 

  # return_type
  return_type = opts[:return_type] || 'Array<String>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_multipart_form(opts = {}) ⇒ Array<String>

Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :content_id (String)

    Optional content ID of attachment

  • :content_type (String)

    Optional content type of attachment

  • :filename (String)

    Optional name of file

  • :content_type_header (String)

    Optional content type header of attachment

  • :x_filename (String)

    Optional filename header of attachment

  • :x_filename_raw (String)

    Optional raw filename header of attachment that will be converted to punycode

  • :x_filesize (Integer)

    Optional content size of attachment

  • :inline_object (InlineObject)

Returns:

  • (Array<String>)


608
609
610
611
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 608

def upload_multipart_form(opts = {})
  data, _status_code, _headers = upload_multipart_form_with_http_info(opts)
  data
end

#upload_multipart_form_with_http_info(opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :content_id (String)

    Optional content ID of attachment

  • :content_type (String)

    Optional content type of attachment

  • :filename (String)

    Optional name of file

  • :content_type_header (String)

    Optional content type header of attachment

  • :x_filename (String)

    Optional filename header of attachment

  • :x_filename_raw (String)

    Optional raw filename header of attachment that will be converted to punycode

  • :x_filesize (Integer)

    Optional content size of attachment

  • :inline_object (InlineObject)

Returns:

  • (Array<(Array<String>, Integer, Hash)>)

    Array<String> data, response status code and response headers



624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 624

def upload_multipart_form_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.upload_multipart_form ...'
  end
  # resource path
  local_var_path = '/attachments/multipart'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contentId'] = opts[:'content_id'] if !opts[:'content_id'].nil?
  query_params[:'contentType'] = opts[:'content_type'] if !opts[:'content_type'].nil?
  query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil?
  query_params[:'contentTypeHeader'] = opts[:'content_type_header'] if !opts[:'content_type_header'].nil?
  query_params[:'x-filename'] = opts[:'x_filename'] if !opts[:'x_filename'].nil?
  query_params[:'x-filename-raw'] = opts[:'x_filename_raw'] if !opts[:'x_filename_raw'].nil?
  query_params[:'x-filesize'] = opts[:'x_filesize'] if !opts[:'x_filesize'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'inline_object']) 

  # return_type
  return_type = opts[:return_type] || 'Array<String>' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentControllerApi#upload_multipart_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end