Class: MailSlurpClient::EmailControllerApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EmailControllerApi

Returns a new instance of EmailControllerApi.



19
20
21
# File 'lib/mailslurp_client/api/email_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/email_controller_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_all_emails(opts = {}) ⇒ nil

Delete all emails Deletes all emails in your account. Be careful as emails cannot be recovered

Parameters:

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

    the optional parameters

Returns:

  • (nil)


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

def delete_all_emails(opts = {})
  delete_all_emails_with_http_info(opts)
  nil
end

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

Delete all emails Deletes all emails in your account. Be careful as emails cannot be recovered

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/email_controller_api.rb', line 35

def delete_all_emails_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_all_emails ...'
  end
  # resource path
  local_var_path = '/emails'

  # 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: EmailControllerApi#delete_all_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_email(email_id, opts = {}) ⇒ nil

Delete an email Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

  • (nil)


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

def delete_email(email_id, opts = {})
  delete_email_with_http_info(email_id, opts)
  nil
end

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

Delete an email Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.

Parameters:

  • email_id (String)

    emailId

  • 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/email_controller_api.rb', line 91

def delete_email_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_email ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.delete_email"
  end
  # resource path
  local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_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: EmailControllerApi#delete_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_attachment(attachment_id, email_id, opts = {}) ⇒ String

Get email attachment bytes 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.

Parameters:

  • attachment_id (String)

    attachmentId

  • email_id (String)

    emailId

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

    the optional parameters

Options Hash (opts):

  • :api_key (String)

    Can pass apiKey in url for this request if you wish to download the file in a browser

Returns:

  • (String)


143
144
145
146
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 143

def download_attachment(attachment_id, email_id, opts = {})
  data, _status_code, _headers = download_attachment_with_http_info(attachment_id, email_id, opts)
  data
end

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

Get email attachment bytes 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.

Parameters:

  • attachment_id (String)

    attachmentId

  • email_id (String)

    emailId

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

    the optional parameters

Options Hash (opts):

  • :api_key (String)

    Can pass apiKey in url for this request if you wish to download the file in a browser

Returns:

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

    String data, response status code and response headers



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
197
198
199
200
201
202
203
204
205
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 155

def download_attachment_with_http_info(attachment_id, email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_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 EmailControllerApi.download_attachment"
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment"
  end
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'apiKey'] = opts[:'api_key'] if !opts[:'api_key'].nil?

  # 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: EmailControllerApi#download_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#forward_email(email_id, forward_email_options, opts = {}) ⇒ nil

Forward email Forward an existing email to new recipients.

Parameters:

  • email_id (String)

    emailId

  • forward_email_options (ForwardEmailOptions)

    forwardEmailOptions

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

    the optional parameters

Returns:

  • (nil)


213
214
215
216
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 213

def forward_email(email_id, forward_email_options, opts = {})
  forward_email_with_http_info(email_id, forward_email_options, opts)
  nil
end

#forward_email_with_http_info(email_id, forward_email_options, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Forward email Forward an existing email to new recipients.

Parameters:

  • email_id (String)

    emailId

  • forward_email_options (ForwardEmailOptions)

    forwardEmailOptions

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 224

def forward_email_with_http_info(email_id, forward_email_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.forward_email ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.forward_email"
  end
  # verify the required parameter 'forward_email_options' is set
  if @api_client.config.client_side_validation && forward_email_options.nil?
    fail ArgumentError, "Missing the required parameter 'forward_email_options' when calling EmailControllerApi.forward_email"
  end
  # resource path
  local_var_path = '/emails/{emailId}/forward'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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(forward_email_options) 

  # 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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailControllerApi#forward_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attachment_meta_data(attachment_id, email_id, opts = {}) ⇒ AttachmentMetaData

Get email attachment metadata Returns the metadata such as name and content-type for a given attachment and email.

Parameters:

  • attachment_id (String)

    attachmentId

  • email_id (String)

    emailId

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

    the optional parameters

Returns:



281
282
283
284
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 281

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

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

Get email attachment metadata Returns the metadata such as name and content-type for a given attachment and email.

Parameters:

  • attachment_id (String)

    attachmentId

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

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

    AttachmentMetaData data, response status code and response headers



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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 292

def (attachment_id, email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachment_meta_data ...'
  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 EmailControllerApi.get_attachment_meta_data"
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachment_meta_data"
  end
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}/metadata'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_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/json'])

  # 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: EmailControllerApi#get_attachment_meta_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attachments(email_id, opts = {}) ⇒ Array<AttachmentMetaData>

Get all email attachment metadata Returns an array of attachment metadata such as name and content-type for a given email if present.

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:



348
349
350
351
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 348

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

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

Get all email attachment metadata Returns an array of attachment metadata such as name and content-type for a given email if present.

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

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

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



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 358

def get_attachments_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachments ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachments"
  end
  # resource path
  local_var_path = '/emails/{emailId}/attachments'.sub('{' + 'emailId' + '}', CGI.escape(email_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/json'])

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

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

  # return_type
  return_type = opts[:return_type] || 'Array<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: EmailControllerApi#get_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email(email_id, opts = {}) ⇒ Email

Get email content Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

    Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance &#x60;&#x3D;D7&#x60;). This can be a pain for testing (default to false)

Returns:



411
412
413
414
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 411

def get_email(email_id, opts = {})
  data, _status_code, _headers = get_email_with_http_info(email_id, opts)
  data
end

#get_email_html(email_id, opts = {}) ⇒ String

Get email content as HTML Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: ‘?apiKey=xxx`

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

    decode (default to false)

Returns:

  • (String)


476
477
478
479
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 476

def get_email_html(email_id, opts = {})
  data, _status_code, _headers = get_email_html_with_http_info(email_id, opts)
  data
end

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

Get email content as HTML Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: &#x60;?apiKey&#x3D;xxx&#x60;

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

    decode

Returns:

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

    String data, response status code and response headers



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
524
525
526
527
528
529
530
531
532
533
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 487

def get_email_html_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html"
  end
  # resource path
  local_var_path = '/emails/{emailId}/html'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil?

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

  # 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: EmailControllerApi#get_email_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_with_http_info(email_id, opts = {}) ⇒ Array<(Email, Integer, Hash)>

Get email content Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

    Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance &#x60;&#x3D;D7&#x60;). This can be a pain for testing

Returns:

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

    Email data, response status code and response headers



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
462
463
464
465
466
467
468
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 422

def get_email_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email"
  end
  # resource path
  local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil?

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

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

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

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

  # 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: EmailControllerApi#get_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_emails_paginated(opts = {}) ⇒ PageEmailProjection

Get all emails By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (Array<String>)

    Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • :page (Integer)

    Optional page index in email list pagination (default to 0)

  • :size (Integer)

    Optional page size in email list pagination (default to 20)

  • :sort (String)

    Optional createdAt sort direction ASC or DESC (default to ‘ASC’)

  • :unread_only (Boolean)

    Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false)

Returns:



544
545
546
547
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 544

def get_emails_paginated(opts = {})
  data, _status_code, _headers = get_emails_paginated_with_http_info(opts)
  data
end

#get_emails_paginated_with_http_info(opts = {}) ⇒ Array<(PageEmailProjection, Integer, Hash)>

Get all emails By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (Array<String>)

    Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • :page (Integer)

    Optional page index in email list pagination

  • :size (Integer)

    Optional page size in email list pagination

  • :sort (String)

    Optional createdAt sort direction ASC or DESC

  • :unread_only (Boolean)

    Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

Returns:

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

    PageEmailProjection data, response status code and response headers



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
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 558

def get_emails_paginated_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_emails_paginated ...'
  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 = '/emails'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = @api_client.build_collection_param(opts[:'inbox_id'], :multi) if !opts[:'inbox_id'].nil?
  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[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?

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

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

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

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

  # 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: EmailControllerApi#get_emails_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_raw_email_contents(email_id, opts = {}) ⇒ String

Get raw email string Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

  • (String)


615
616
617
618
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 615

def get_raw_email_contents(email_id, opts = {})
  data, _status_code, _headers = get_raw_email_contents_with_http_info(email_id, opts)
  data
end

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

Get raw email string Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 625

def get_raw_email_contents_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_contents ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_contents"
  end
  # resource path
  local_var_path = '/emails/{emailId}/raw'.sub('{' + 'emailId' + '}', CGI.escape(email_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(['text/plain'])

  # 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: EmailControllerApi#get_raw_email_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_raw_email_json(email_id, opts = {}) ⇒ RawEmailJson

Get raw email in JSON Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:



677
678
679
680
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 677

def get_raw_email_json(email_id, opts = {})
  data, _status_code, _headers = get_raw_email_json_with_http_info(email_id, opts)
  data
end

#get_raw_email_json_with_http_info(email_id, opts = {}) ⇒ Array<(RawEmailJson, Integer, Hash)>

Get raw email in JSON Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

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

    RawEmailJson data, response status code and response headers



687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 687

def get_raw_email_json_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_json ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_json"
  end
  # resource path
  local_var_path = '/emails/{emailId}/raw/json'.sub('{' + 'emailId' + '}', CGI.escape(email_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/json'])

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

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

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

  # 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: EmailControllerApi#get_raw_email_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_unread_email_count(opts = {}) ⇒ UnreadCount

Get unread email count Get number of emails unread

Parameters:

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

    the optional parameters

Returns:



738
739
740
741
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 738

def get_unread_email_count(opts = {})
  data, _status_code, _headers = get_unread_email_count_with_http_info(opts)
  data
end

#get_unread_email_count_with_http_info(opts = {}) ⇒ Array<(UnreadCount, Integer, Hash)>

Get unread email count Get number of emails unread

Parameters:

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

    the optional parameters

Returns:

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

    UnreadCount data, response status code and response headers



747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 747

def get_unread_email_count_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_unread_email_count ...'
  end
  # resource path
  local_var_path = '/emails/unreadCount'

  # 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/json'])

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

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

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

  # 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: EmailControllerApi#get_unread_email_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#validate_email(email_id, opts = {}) ⇒ ValidationDto

Validate email Validate the HTML content of email if HTML is found. Considered valid if no HTML.

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:



795
796
797
798
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 795

def validate_email(email_id, opts = {})
  data, _status_code, _headers = validate_email_with_http_info(email_id, opts)
  data
end

#validate_email_with_http_info(email_id, opts = {}) ⇒ Array<(ValidationDto, Integer, Hash)>

Validate email Validate the HTML content of email if HTML is found. Considered valid if no HTML.

Parameters:

  • email_id (String)

    emailId

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

    the optional parameters

Returns:

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

    ValidationDto data, response status code and response headers



805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 805

def validate_email_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.validate_email ...'
  end
  # verify the required parameter 'email_id' is set
  if @api_client.config.client_side_validation && email_id.nil?
    fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.validate_email"
  end
  # resource path
  local_var_path = '/emails/{emailId}/validate'.sub('{' + 'emailId' + '}', CGI.escape(email_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/json'])

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

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

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

  # 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: EmailControllerApi#validate_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end