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

Parameters:

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

    the optional parameters

Returns:

  • (nil)


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

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

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



33
34
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 33

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

Parameters:

  • attachment_id (String)

    ID of attachment

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

    the optional parameters

Returns:

  • (nil)


78
79
80
81
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 78

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

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



87
88
89
90
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 87

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:



137
138
139
140
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 137

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



147
148
149
150
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 147

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)


199
200
201
202
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 199

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



209
210
211
212
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 209

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 = {}) ⇒ AttachmentEntity

Get an attachment entity

Parameters:

  • attachment_id (String)

    ID of attachment

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

    the optional parameters

Returns:



260
261
262
263
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 260

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:



321
322
323
324
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 321

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



331
332
333
334
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 331

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<(AttachmentEntity, Integer, Hash)>

Get an attachment entity

Parameters:

  • attachment_id (String)

    ID of attachment

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

    the optional parameters

Returns:

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

    AttachmentEntity data, response status code and response headers



269
270
271
272
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 269

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] || 'AttachmentEntity' 

  # 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:



389
390
391
392
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 389

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



405
406
407
408
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 405

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>)


463
464
465
466
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 463

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

  • :filename2 (String)

Returns:

  • (Array<String>)


529
530
531
532
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 529

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

  • :filename2 (String)

Returns:

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

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



542
543
544
545
546
547
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 542

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?

  # 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



472
473
474
475
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 472

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

  • :x_filename (String)

    Optional content type header of attachment

  • :inline_object (InlineObject)

Returns:

  • (Array<String>)


598
599
600
601
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 598

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

  • :x_filename (String)

    Optional content type header of attachment

  • :inline_object (InlineObject)

Returns:

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

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



611
612
613
614
615
616
617
618
619
620
621
622
623
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
# File 'lib/mailslurp_client/api/attachment_controller_api.rb', line 611

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[:'x-filename'] = opts[:'x_filename'] if !opts[:'x_filename'].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