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

#apply_imap_flag_operation(email_id, imap_flag_operation_options, opts = {}) ⇒ EmailPreview

Set IMAP flags associated with a message. Only supports '\Seen' flag. Apply RFC3501 section-2.3.2 IMAP flag operations on an email

Parameters:

  • email_id (String)
  • imap_flag_operation_options (ImapFlagOperationOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 28

def apply_imap_flag_operation(email_id, imap_flag_operation_options, opts = {})
  data, _status_code, _headers = apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts)
  data
end

#apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts = {}) ⇒ Array<(EmailPreview, Integer, Hash)>

Set IMAP flags associated with a message. Only supports &#39;\Seen&#39; flag. Apply RFC3501 section-2.3.2 IMAP flag operations on an email

Parameters:

  • email_id (String)
  • imap_flag_operation_options (ImapFlagOperationOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    EmailPreview data, response status code and response headers



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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 39

def apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.apply_imap_flag_operation ...'
  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.apply_imap_flag_operation"
  end
  # verify the required parameter 'imap_flag_operation_options' is set
  if @api_client.config.client_side_validation && imap_flag_operation_options.nil?
    fail ArgumentError, "Missing the required parameter 'imap_flag_operation_options' when calling EmailControllerApi.apply_imap_flag_operation"
  end
  # resource path
  local_var_path = '/emails/{emailId}/imap-flag-operation'.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(['*/*'])
  # 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(imap_flag_operation_options) 

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

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

#can_send(inbox_id, send_email_options, opts = {}) ⇒ CanSendEmailResults

Check if email can be sent and options are valid. Can user send email to given recipient or is the recipient blocked

Parameters:

  • inbox_id (String)

    ID of the inbox you want to send the email from

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

    the optional parameters

Returns:



98
99
100
101
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 98

def can_send(inbox_id, send_email_options, opts = {})
  data, _status_code, _headers = can_send_with_http_info(inbox_id, send_email_options, opts)
  data
end

#can_send_with_http_info(inbox_id, send_email_options, opts = {}) ⇒ Array<(CanSendEmailResults, Integer, Hash)>

Check if email can be sent and options are valid. Can user send email to given recipient or is the recipient blocked

Parameters:

  • inbox_id (String)

    ID of the inbox you want to send the email from

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

    the optional parameters

Returns:

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

    CanSendEmailResults data, response status code and response headers



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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 109

def can_send_with_http_info(inbox_id, send_email_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.can_send ...'
  end
  # verify the required parameter 'inbox_id' is set
  if @api_client.config.client_side_validation && inbox_id.nil?
    fail ArgumentError, "Missing the required parameter 'inbox_id' when calling EmailControllerApi.can_send"
  end
  # verify the required parameter 'send_email_options' is set
  if @api_client.config.client_side_validation && send_email_options.nil?
    fail ArgumentError, "Missing the required parameter 'send_email_options' when calling EmailControllerApi.can_send"
  end
  # resource path
  local_var_path = '/emails/can-send'

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

  # 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(send_email_options) 

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

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

#check_email_body(email_id, opts = {}) ⇒ CheckEmailBodyResults

Detect broken links, spelling, and images in email content Find dead links, broken images, and spelling mistakes in email body. Will call included links via HTTP so do not invoke if your links are sensitive or stateful. Any resource that returns a 4xx or 5xx response or is not reachable via HEAD or GET HTTP operations will be considered unhealthy.

Parameters:

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

    the optional parameters

Returns:



168
169
170
171
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 168

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

#check_email_body_feature_support(email_id, opts = {}) ⇒ CheckEmailBodyFeatureSupportResults

Show which mail clients support the HTML and CSS features used in an email body. Detect HTML and CSS features inside an email body and return a report of email client support across different platforms and versions.

Parameters:

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

    the optional parameters

Returns:



230
231
232
233
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 230

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

#check_email_body_feature_support_with_http_info(email_id, opts = {}) ⇒ Array<(CheckEmailBodyFeatureSupportResults, Integer, Hash)>

Show which mail clients support the HTML and CSS features used in an email body. Detect HTML and CSS features inside an email body and return a report of email client support across different platforms and versions.

Parameters:

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

    the optional parameters

Returns:



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
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 240

def check_email_body_feature_support_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.check_email_body_feature_support ...'
  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.check_email_body_feature_support"
  end
  # resource path
  local_var_path = '/emails/{emailId}/check-email-body-feature-support'.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(['*/*'])

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

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

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

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

#check_email_body_with_http_info(email_id, opts = {}) ⇒ Array<(CheckEmailBodyResults, Integer, Hash)>

Detect broken links, spelling, and images in email content Find dead links, broken images, and spelling mistakes in email body. Will call included links via HTTP so do not invoke if your links are sensitive or stateful. Any resource that returns a 4xx or 5xx response or is not reachable via HEAD or GET HTTP operations will be considered unhealthy.

Parameters:

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

    the optional parameters

Returns:

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

    CheckEmailBodyResults data, response status code and response headers



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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 178

def check_email_body_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.check_email_body ...'
  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.check_email_body"
  end
  # resource path
  local_var_path = '/emails/{emailId}/check-email-body'.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(['*/*'])

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

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

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

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

#check_email_client_support(check_email_client_support_options, opts = {}) ⇒ CheckEmailClientSupportResults

Show which email programs and devices support the features used in an email body. Evaluate the features used in an email body and return a report of email client support across different platforms and versions.

Parameters:

Returns:



292
293
294
295
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 292

def check_email_client_support(check_email_client_support_options, opts = {})
  data, _status_code, _headers = check_email_client_support_with_http_info(check_email_client_support_options, opts)
  data
end

#check_email_client_support_with_http_info(check_email_client_support_options, opts = {}) ⇒ Array<(CheckEmailClientSupportResults, Integer, Hash)>

Show which email programs and devices support the features used in an email body. Evaluate the features used in an email body and return a report of email client support across different platforms and versions.

Parameters:

Returns:



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
342
343
344
345
346
347
348
349
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 302

def check_email_client_support_with_http_info(check_email_client_support_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.check_email_client_support ...'
  end
  # verify the required parameter 'check_email_client_support_options' is set
  if @api_client.config.client_side_validation && check_email_client_support_options.nil?
    fail ArgumentError, "Missing the required parameter 'check_email_client_support_options' when calling EmailControllerApi.check_email_client_support"
  end
  # resource path
  local_var_path = '/emails/check-email-client-support'

  # 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(check_email_client_support_options) 

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

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

#delete_all_emails(opts = {}) ⇒ nil

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

Parameters:

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

    the optional parameters

Returns:

  • (nil)


355
356
357
358
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 355

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 in all inboxes. 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



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 364

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)

    ID of email to delete

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

    the optional parameters

Returns:

  • (nil)


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

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)

    ID of email to delete

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

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(email_id, attachment_id, opts = {}) ⇒ String

Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. 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:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • 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. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.

Returns:

  • (String)


472
473
474
475
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 472

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

#download_attachment_base64(email_id, attachment_id, opts = {}) ⇒ DownloadAttachmentDto

Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. 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:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

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

    the optional parameters

Returns:



542
543
544
545
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 542

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

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

Get email attachment as base64 encoded string as an alternative to binary responses. Decode the &#x60;base64FileContents&#x60; as a &#x60;utf-8&#x60; encoded string or array of bytes depending on the &#x60;contentType&#x60;. 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:

  • email_id (String)

    ID of email

  • 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



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
596
597
598
599
600
601
602
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 553

def download_attachment_base64_with_http_info(email_id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment_base64 ...'
  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_base64"
  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_base64"
  end
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}/base64'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).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: EmailControllerApi#download_attachment_base64\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get email attachment bytes. Returned as &#x60;octet-stream&#x60; with content type header. If you have trouble with byte responses try the &#x60;downloadAttachmentBase64&#x60; response endpoints and convert the base 64 encoded content to a file or string. 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:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • 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. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.

Returns:

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

    String data, response status code and response headers



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

def download_attachment_with_http_info(email_id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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
  # 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
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_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

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

Get email body as string. Returned as `plain/text` with content type header. Returns the specified email body for a given email as a string

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

  • (String)


609
610
611
612
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 609

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

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

Get email body in bytes. Returned as `octet-stream` with content type header. Returns the specified email body for a given email as a stream / array of bytes.

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

  • (String)


671
672
673
674
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 671

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

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

Get email body in bytes. Returned as &#x60;octet-stream&#x60; with content type header. Returns the specified email body for a given email as a stream / array of bytes.

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



681
682
683
684
685
686
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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 681

def download_body_bytes_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_body_bytes ...'
  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_body_bytes"
  end
  # resource path
  local_var_path = '/emails/{emailId}/body-bytes'.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/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_body_bytes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get email body as string. Returned as &#x60;plain/text&#x60; with content type header. Returns the specified email body for a given email as a string

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
659
660
661
662
663
664
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 619

def download_body_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_body ...'
  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_body"
  end
  # resource path
  local_var_path = '/emails/{emailId}/body'.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', '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#download_body\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Forward email to recipients Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints.

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:



734
735
736
737
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 734

def forward_email(email_id, forward_email_options, opts = {})
  data, _status_code, _headers = forward_email_with_http_info(email_id, forward_email_options, opts)
  data
end

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

Forward email to recipients Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the &#x60;from&#x60; option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints.

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

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

    SentEmailDto data, response status code and response headers



745
746
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
789
790
791
792
793
794
795
796
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 745

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 '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(forward_email_options) 

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

  # 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(email_id, attachment_id, opts = {}) ⇒ AttachmentMetaData

Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. Returns the metadata such as name and content-type for a given attachment and email.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

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

    the optional parameters

Returns:



804
805
806
807
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 804

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

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

Get email attachment metadata. This is the &#x60;contentType&#x60; and &#x60;contentLength&#x60; of an attachment. To get the individual attachments use the &#x60;downloadAttachment&#x60; methods. Returns the metadata such as name and content-type for a given attachment and email.

Parameters:

  • email_id (String)

    ID of email

  • 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



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
851
852
853
854
855
856
857
858
859
860
861
862
863
864
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 815

def (email_id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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
  # 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
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}/metadata'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).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: EmailControllerApi#get_attachment_meta_data\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 including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints

Parameters:

  • email_id (String)
  • 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:



872
873
874
875
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 872

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

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

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

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:



936
937
938
939
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 936

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

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

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

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

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

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



946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 946

def get_email_attachments_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_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_email_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(['*/*'])

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

#get_email_content_match(email_id, content_match_options, opts = {}) ⇒ EmailContentMatchResult

Get email content regex pattern match results. Runs regex against email body and returns match groups. Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\d6)`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns.

Parameters:

  • email_id (String)

    ID of email to match against

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

    the optional parameters

Returns:



999
1000
1001
1002
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 999

def get_email_content_match(email_id, content_match_options, opts = {})
  data, _status_code, _headers = get_email_content_match_with_http_info(email_id, content_match_options, opts)
  data
end

#get_email_content_match_with_http_info(email_id, content_match_options, opts = {}) ⇒ Array<(EmailContentMatchResult, Integer, Hash)>

Get email content regex pattern match results. Runs regex against email body and returns match groups. Return the matches for a given Java style regex pattern. Do not include the typical &#x60;/&#x60; at start or end of regex in some languages. Given an example &#x60;your code is: 12345&#x60; the pattern to extract match looks like &#x60;code is: (\d6)&#x60;. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: &#x60;[&#39;code is: 123456&#39;, &#39;123456&#39;]&#x60; See docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns.

Parameters:

  • email_id (String)

    ID of email to match against

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

    the optional parameters

Returns:

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

    EmailContentMatchResult data, response status code and response headers



1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1010

def get_email_content_match_with_http_info(email_id, content_match_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_content_match ...'
  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_content_match"
  end
  # verify the required parameter 'content_match_options' is set
  if @api_client.config.client_side_validation && content_match_options.nil?
    fail ArgumentError, "Missing the required parameter 'content_match_options' when calling EmailControllerApi.get_email_content_match"
  end
  # resource path
  local_var_path = '/emails/{emailId}/contentMatch'.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(['*/*'])
  # 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(content_match_options) 

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

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

#get_email_content_part(email_id, content_type, opts = {}) ⇒ EmailContentPartResult

Get email content part by content type Get email body content parts from a multipart email message for a given content type

Parameters:

  • email_id (String)

    ID of email to match against

  • content_type (String)

    Content type

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

    the optional parameters

Returns:



1069
1070
1071
1072
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1069

def get_email_content_part(email_id, content_type, opts = {})
  data, _status_code, _headers = get_email_content_part_with_http_info(email_id, content_type, opts)
  data
end

#get_email_content_part_with_http_info(email_id, content_type, opts = {}) ⇒ Array<(EmailContentPartResult, Integer, Hash)>

Get email content part by content type Get email body content parts from a multipart email message for a given content type

Parameters:

  • email_id (String)

    ID of email to match against

  • content_type (String)

    Content type

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

    the optional parameters

Returns:

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

    EmailContentPartResult data, response status code and response headers



1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1080

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

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

  # 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] || 'EmailContentPartResult' 

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

#get_email_count(opts = {}) ⇒ CountDto

Get email count

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

Returns:



1136
1137
1138
1139
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1136

def get_email_count(opts = {})
  data, _status_code, _headers = get_email_count_with_http_info(opts)
  data
end

#get_email_count_with_http_info(opts = {}) ⇒ Array<(CountDto, Integer, Hash)>

Get email count

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

Returns:

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

    CountDto data, response status code and response headers



1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1145

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

  # query parameters
  query_params = opts[:query_params] || {}
  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] || 'CountDto' 

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

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

Get email content as HTML. For displaying emails in browser context. 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`. Returns content-type `text/html;charset=utf-8` so you must call expecting that content response not JSON. For JSON response see the `getEmailHTMLJson` method.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean) — default: default to false
  • :replace_cid_images (Boolean) — default: default to false

Returns:

  • (String)


1196
1197
1198
1199
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1196

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_json(email_id, opts = {}) ⇒ EmailHtmlDto

Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content Retrieve email content as HTML response. Decodes quoted-printable entities and converts charset to UTF-8. Returns content-type `application/json;charset=utf-8` so you must call expecting that content response not JSON.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean) — default: default to false
  • :replace_cid_images (Boolean) — default: default to false

Returns:



1264
1265
1266
1267
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1264

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

#get_email_html_json_with_http_info(email_id, opts = {}) ⇒ Array<(EmailHtmlDto, Integer, Hash)>

Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content Retrieve email content as HTML response. Decodes quoted-printable entities and converts charset to UTF-8. Returns content-type &#x60;application/json;charset&#x3D;utf-8&#x60; so you must call expecting that content response not JSON.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)
  • :replace_cid_images (Boolean)

Returns:

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

    EmailHtmlDto data, response status code and response headers



1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1276

def get_email_html_json_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html_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_email_html_json"
  end
  # resource path
  local_var_path = '/emails/{emailId}/html/json'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil?
  query_params[:'replaceCidImages'] = opts[:'replace_cid_images'] if !opts[:'replace_cid_images'].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] || 'EmailHtmlDto' 

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

#get_email_html_query(email_id, html_selector, opts = {}) ⇒ EmailTextLinesResult

Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors

Parameters:

  • email_id (String)

    ID of email to perform HTML query on

  • html_selector (String)

    HTML selector to search for. Uses JQuery/JSoup/CSS style selector like &#39;.my-div&#39; to match content. See jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.

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

    the optional parameters

Returns:



1331
1332
1333
1334
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1331

def get_email_html_query(email_id, html_selector, opts = {})
  data, _status_code, _headers = get_email_html_query_with_http_info(email_id, html_selector, opts)
  data
end

#get_email_html_query_with_http_info(email_id, html_selector, opts = {}) ⇒ Array<(EmailTextLinesResult, Integer, Hash)>

Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors

Parameters:

  • email_id (String)

    ID of email to perform HTML query on

  • html_selector (String)

    HTML selector to search for. Uses JQuery/JSoup/CSS style selector like &#39;.my-div&#39; to match content. See jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.

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

    the optional parameters

Returns:

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

    EmailTextLinesResult data, response status code and response headers



1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1342

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

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

  # 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] || 'EmailTextLinesResult' 

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

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

Get email content as HTML. For displaying emails in browser context. 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;. Returns content-type &#x60;text/html;charset&#x3D;utf-8&#x60; so you must call expecting that content response not JSON. For JSON response see the &#x60;getEmailHTMLJson&#x60; method.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)
  • :replace_cid_images (Boolean)

Returns:

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

    String data, response status code and response headers



1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1208

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?
  query_params[:'replaceCidImages'] = opts[:'replace_cid_images'] if !opts[:'replace_cid_images'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/html;charset=utf-8', '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

Parse and return list of links found in an email (only works for HTML content) HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes

Parameters:

  • email_id (String)

    ID of email to fetch text for

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

    the optional parameters

Returns:



1399
1400
1401
1402
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1399

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

Parse and return list of links found in an email (only works for HTML content) HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes

Parameters:

  • email_id (String)

    ID of email to fetch text for

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

    the optional parameters

Returns:

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

    EmailLinksResult data, response status code and response headers



1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1409

def get_email_links_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_links ...'
  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_links"
  end
  # resource path
  local_var_path = '/emails/{emailId}/links'.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(['*/*'])

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

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

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

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

#get_email_preview_ur_ls(email_id, opts = {}) ⇒ EmailPreviewUrls

Get email URLs for viewing in browser or downloading Get a list of URLs for email content as text/html or raw SMTP message for viewing the message in a browser.

Parameters:

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

    the optional parameters

Returns:



1461
1462
1463
1464
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1461

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

#get_email_preview_ur_ls_with_http_info(email_id, opts = {}) ⇒ Array<(EmailPreviewUrls, Integer, Hash)>

Get email URLs for viewing in browser or downloading Get a list of URLs for email content as text/html or raw SMTP message for viewing the message in a browser.

Parameters:

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

    the optional parameters

Returns:

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

    EmailPreviewUrls data, response status code and response headers



1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1471

def get_email_preview_ur_ls_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_preview_ur_ls ...'
  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_preview_ur_ls"
  end
  # resource path
  local_var_path = '/emails/{emailId}/urls'.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(['*/*'])

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

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

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

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

#get_email_screenshot_as_base64(email_id, get_email_screenshot_options, opts = {}) ⇒ EmailScreenshotResult

Take a screenshot of an email in a browser and return base64 encoded string Capture image of email screenshot and return as base64 encoded string. Useful for embedding in HTML. Be careful as this may contain sensitive information.

Parameters:

  • email_id (String)
  • get_email_screenshot_options (GetEmailScreenshotOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1524
1525
1526
1527
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1524

def get_email_screenshot_as_base64(email_id, get_email_screenshot_options, opts = {})
  data, _status_code, _headers = get_email_screenshot_as_base64_with_http_info(email_id, get_email_screenshot_options, opts)
  data
end

#get_email_screenshot_as_base64_with_http_info(email_id, get_email_screenshot_options, opts = {}) ⇒ Array<(EmailScreenshotResult, Integer, Hash)>

Take a screenshot of an email in a browser and return base64 encoded string Capture image of email screenshot and return as base64 encoded string. Useful for embedding in HTML. Be careful as this may contain sensitive information.

Parameters:

  • email_id (String)
  • get_email_screenshot_options (GetEmailScreenshotOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    EmailScreenshotResult data, response status code and response headers



1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1535

def get_email_screenshot_as_base64_with_http_info(email_id, get_email_screenshot_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_screenshot_as_base64 ...'
  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_screenshot_as_base64"
  end
  # verify the required parameter 'get_email_screenshot_options' is set
  if @api_client.config.client_side_validation && get_email_screenshot_options.nil?
    fail ArgumentError, "Missing the required parameter 'get_email_screenshot_options' when calling EmailControllerApi.get_email_screenshot_as_base64"
  end
  # resource path
  local_var_path = '/emails/{emailId}/screenshot/base64'.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(['*/*'])
  # 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(get_email_screenshot_options) 

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

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

#get_email_screenshot_as_binary(email_id, get_email_screenshot_options, opts = {}) ⇒ nil

Take a screenshot of an email in a browser Returns binary octet-stream of screenshot of the given email

Parameters:

  • email_id (String)
  • get_email_screenshot_options (GetEmailScreenshotOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


1594
1595
1596
1597
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1594

def get_email_screenshot_as_binary(email_id, get_email_screenshot_options, opts = {})
  get_email_screenshot_as_binary_with_http_info(email_id, get_email_screenshot_options, opts)
  nil
end

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

Take a screenshot of an email in a browser Returns binary octet-stream of screenshot of the given email

Parameters:

  • email_id (String)
  • get_email_screenshot_options (GetEmailScreenshotOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1605

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

#get_email_text_lines(email_id, opts = {}) ⇒ EmailTextLinesResult

Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.

Parameters:

  • email_id (String)

    ID of email to fetch text for

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

    the optional parameters

Options Hash (opts):

  • :decode_html_entities (Boolean)

    Decode HTML entities

  • :line_separator (String)

    Line separator character

Returns:



1663
1664
1665
1666
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1663

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

#get_email_text_lines_with_http_info(email_id, opts = {}) ⇒ Array<(EmailTextLinesResult, Integer, Hash)>

Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.

Parameters:

  • email_id (String)

    ID of email to fetch text for

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

    the optional parameters

Options Hash (opts):

  • :decode_html_entities (Boolean)

    Decode HTML entities

  • :line_separator (String)

    Line separator character

Returns:

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

    EmailTextLinesResult data, response status code and response headers



1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1675

def get_email_text_lines_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_text_lines ...'
  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_text_lines"
  end
  # resource path
  local_var_path = '/emails/{emailId}/textLines'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'decodeHtmlEntities'] = opts[:'decode_html_entities'] if !opts[:'decode_html_entities'].nil?
  query_params[:'lineSeparator'] = opts[:'line_separator'] if !opts[:'line_separator'].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] || 'EmailTextLinesResult' 

  # 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_text_lines\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 including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints

Parameters:

  • email_id (String)
  • 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



883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 883

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(['*/*'])

  # 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_offset_paginated(opts = {}) ⇒ PageEmailProjection

Get all emails in all inboxes in paginated form. Email API list all. 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. Maximum size is 100. Use page index and sort to page through larger results (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)

  • :search_filter (String)

    Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • :since (DateTime)

    Optional filter emails received after given date time

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:



1736
1737
1738
1739
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1736

def get_emails_offset_paginated(opts = {})
  data, _status_code, _headers = get_emails_offset_paginated_with_http_info(opts)
  data
end

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

Get all emails in all inboxes in paginated form. Email API list all. 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. Maximum size is 100. Use page index and sort to page through larger results

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

  • :search_filter (String)

    Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • :since (DateTime)

    Optional filter emails received after given date time

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:

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

    PageEmailProjection data, response status code and response headers



1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1753

def get_emails_offset_paginated_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_emails_offset_paginated ...'
  end
  if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"size"]" when calling EmailControllerApi.get_emails_offset_paginated, must be smaller than or equal to 100.'
  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/offset-paginated'

  # 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?
  query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].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] || '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_offset_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_emails_paginated(opts = {}) ⇒ PageEmailProjection

Get all emails in all inboxes in paginated form. Email API list all. 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. Maximum size is 100. Use page index and sort to page through larger results (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)

  • :search_filter (String)

    Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • :since (DateTime)

    Optional filter emails received after given date time. If unset will use time 24hours prior to now.

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:



1824
1825
1826
1827
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1824

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 in all inboxes in paginated form. Email API list all. 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. Maximum size is 100. Use page index and sort to page through larger results

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

  • :search_filter (String)

    Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • :since (DateTime)

    Optional filter emails received after given date time. If unset will use time 24hours prior to now.

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:

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

    PageEmailProjection data, response status code and response headers



1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1841

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
  if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"size"]" when calling EmailControllerApi.get_emails_paginated, must be smaller than or equal to 100.'
  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?
  query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].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] || '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_gravatar_url_for_email_address(email_address, opts = {}) ⇒ GravatarUrl

Get gravatar url for email address

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :size (String)

Returns:



1905
1906
1907
1908
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1905

def get_gravatar_url_for_email_address(email_address, opts = {})
  data, _status_code, _headers = get_gravatar_url_for_email_address_with_http_info(email_address, opts)
  data
end

#get_gravatar_url_for_email_address_with_http_info(email_address, opts = {}) ⇒ Array<(GravatarUrl, Integer, Hash)>

Get gravatar url for email address

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :size (String)

Returns:

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

    GravatarUrl data, response status code and response headers



1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1915

def get_gravatar_url_for_email_address_with_http_info(email_address, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_gravatar_url_for_email_address ...'
  end
  # verify the required parameter 'email_address' is set
  if @api_client.config.client_side_validation && email_address.nil?
    fail ArgumentError, "Missing the required parameter 'email_address' when calling EmailControllerApi.get_gravatar_url_for_email_address"
  end
  # resource path
  local_var_path = '/emails/gravatarFor'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'emailAddress'] = email_address
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].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] || 'GravatarUrl' 

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

#get_latest_email(opts = {}) ⇒ Email

Get latest email in all inboxes. Most recently received. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_ids (Array<String>)

    Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes

Returns:



1969
1970
1971
1972
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1969

def get_latest_email(opts = {})
  data, _status_code, _headers = get_latest_email_with_http_info(opts)
  data
end

#get_latest_email_in_inbox1(inbox_id, opts = {}) ⇒ Email

Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

  • inbox_id (String)

    ID of the inbox you want to get the latest email from

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

    the optional parameters

Returns:



2028
2029
2030
2031
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2028

def get_latest_email_in_inbox1(inbox_id, opts = {})
  data, _status_code, _headers = get_latest_email_in_inbox1_with_http_info(inbox_id, opts)
  data
end

#get_latest_email_in_inbox1_with_http_info(inbox_id, opts = {}) ⇒ Array<(Email, Integer, Hash)>

Get latest email in an inbox. Use &#x60;WaitForController&#x60; to get emails that may not have arrived yet. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

  • inbox_id (String)

    ID of the inbox you want to get the latest email from

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

    the optional parameters

Returns:

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

    Email data, response status code and response headers



2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2038

def get_latest_email_in_inbox1_with_http_info(inbox_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_latest_email_in_inbox1 ...'
  end
  # verify the required parameter 'inbox_id' is set
  if @api_client.config.client_side_validation && inbox_id.nil?
    fail ArgumentError, "Missing the required parameter 'inbox_id' when calling EmailControllerApi.get_latest_email_in_inbox1"
  end
  # resource path
  local_var_path = '/emails/latestIn'

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

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

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

Get latest email in all inboxes. Most recently received. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_ids (Array<String>)

    Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes

Returns:

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

    Email data, response status code and response headers



1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1979

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxIds'] = @api_client.build_collection_param(opts[:'inbox_ids'], :multi) if !opts[:'inbox_ids'].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] || '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_latest_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_organization_emails_paginated(opts = {}) ⇒ PageEmailProjection

Get all organization emails. List team or shared test email accounts By default returns all emails across all team 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. Maximum size is 100. Use page index and sort to page through larger results (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)

  • :search_filter (String)

    Optional search filter search filter for emails.

  • :since (DateTime)

    Optional filter emails received after given date time. If unset will use time 24hours prior to now.

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:



2098
2099
2100
2101
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2098

def get_organization_emails_paginated(opts = {})
  data, _status_code, _headers = get_organization_emails_paginated_with_http_info(opts)
  data
end

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

Get all organization emails. List team or shared test email accounts By default returns all emails across all team 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. Maximum size is 100. Use page index and sort to page through larger results

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

  • :search_filter (String)

    Optional search filter search filter for emails.

  • :since (DateTime)

    Optional filter emails received after given date time. If unset will use time 24hours prior to now.

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:

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

    PageEmailProjection data, response status code and response headers



2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2115

def get_organization_emails_paginated_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_organization_emails_paginated ...'
  end
  if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"size"]" when calling EmailControllerApi.get_organization_emails_paginated, must be smaller than or equal to 100.'
  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/organization'

  # 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?
  query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].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] || '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_organization_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 = {}) ⇒ nil

Get raw email string. Returns unparsed raw SMTP message with headers and body. 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)

    ID of email

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

    the optional parameters

Returns:

  • (nil)


2179
2180
2181
2182
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2179

def get_raw_email_contents(email_id, opts = {})
  get_raw_email_contents_with_http_info(email_id, opts)
  nil
end

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

Get raw email string. Returns unparsed raw SMTP message with headers and body. 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)

    ID of email

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2189

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] || {}

  # 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(: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. Unparsed SMTP message in JSON wrapper format. 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)

    ID of email

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

    the optional parameters

Returns:



2239
2240
2241
2242
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2239

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. Unparsed SMTP message in JSON wrapper format. 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)

    ID of email

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

    the optional parameters

Returns:

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

    RawEmailJson data, response status code and response headers



2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2249

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(['*/*'])

  # 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. Unread means has not been viewed in dashboard or returned in an email API response

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Optional inbox ID filter

Returns:



2301
2302
2303
2304
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2301

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. Unread means has not been viewed in dashboard or returned in an email API response

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    Optional inbox ID filter

Returns:

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

    UnreadCount data, response status code and response headers



2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2311

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] || {}
  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] || '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

#mark_all_as_read(opts = {}) ⇒ nil

Mark all emails as read or unread Marks all emails as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :read (Boolean)

    What value to assign to email read property. Default true. (default to true)

  • :inbox_id (String)

    Optional inbox ID filter

Returns:

  • (nil)


2361
2362
2363
2364
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2361

def mark_all_as_read(opts = {})
  mark_all_as_read_with_http_info(opts)
  nil
end

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

Mark all emails as read or unread Marks all emails as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :read (Boolean)

    What value to assign to email read property. Default true.

  • :inbox_id (String)

    Optional inbox ID filter

Returns:

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

    nil, response status code and response headers



2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2372

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

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

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

#mark_as_read(email_id, opts = {}) ⇒ EmailPreview

Mark an email as read or unread Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :read (Boolean)

    What value to assign to email read property. Default true. (default to true)

Returns:



2421
2422
2423
2424
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2421

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

#mark_as_read_with_http_info(email_id, opts = {}) ⇒ Array<(EmailPreview, Integer, Hash)>

Mark an email as read or unread Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :read (Boolean)

    What value to assign to email read property. Default true.

Returns:

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

    EmailPreview data, response status code and response headers



2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2432

def mark_as_read_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.mark_as_read ...'
  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.mark_as_read"
  end
  # resource path
  local_var_path = '/emails/{emailId}/read'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'read'] = opts[:'read'] if !opts[:'read'].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] || 'EmailPreview' 

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

#reply_to_email(email_id, reply_to_email_options, opts = {}) ⇒ SentEmailDto

Reply to an email Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`.

Parameters:

  • email_id (String)

    ID of the email that should be replied to

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

    the optional parameters

Returns:



2486
2487
2488
2489
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2486

def reply_to_email(email_id, reply_to_email_options, opts = {})
  data, _status_code, _headers = reply_to_email_with_http_info(email_id, reply_to_email_options, opts)
  data
end

#reply_to_email_with_http_info(email_id, reply_to_email_options, opts = {}) ⇒ Array<(SentEmailDto, Integer, Hash)>

Reply to an email Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails &#x60;to&#x60;, &#x60;cc&#x60;, and &#x60;bcc&#x60;.

Parameters:

  • email_id (String)

    ID of the email that should be replied to

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

    the optional parameters

Returns:

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

    SentEmailDto data, response status code and response headers



2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2497

def reply_to_email_with_http_info(email_id, reply_to_email_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.reply_to_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.reply_to_email"
  end
  # verify the required parameter 'reply_to_email_options' is set
  if @api_client.config.client_side_validation && reply_to_email_options.nil?
    fail ArgumentError, "Missing the required parameter 'reply_to_email_options' when calling EmailControllerApi.reply_to_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] || {}
  # 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(reply_to_email_options) 

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

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

#search_emails(search_emails_options, opts = {}) ⇒ PageEmailProjection

Get all emails by search criteria. Return in paginated form. Search emails by given criteria return matches in paginated format. Searches against email recipients, sender, subject, email address and ID. Does not search email body

Parameters:

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

    the optional parameters

Returns:



2555
2556
2557
2558
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2555

def search_emails(search_emails_options, opts = {})
  data, _status_code, _headers = search_emails_with_http_info(search_emails_options, opts)
  data
end

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

Get all emails by search criteria. Return in paginated form. Search emails by given criteria return matches in paginated format. Searches against email recipients, sender, subject, email address and ID. Does not search email body

Parameters:

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

    the optional parameters

Returns:

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

    PageEmailProjection data, response status code and response headers



2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2565

def search_emails_with_http_info(search_emails_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.search_emails ...'
  end
  # verify the required parameter 'search_emails_options' is set
  if @api_client.config.client_side_validation && search_emails_options.nil?
    fail ArgumentError, "Missing the required parameter 'search_emails_options' when calling EmailControllerApi.search_emails"
  end
  # resource path
  local_var_path = '/emails/search'

  # 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(search_emails_options) 

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

#send_email_source_optional(send_email_options, opts = {}) ⇒ nil

Send email Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    ID of the inbox you want to send the email from

  • :use_domain_pool (Boolean)

    Use domain pool. Optionally create inbox to send from using the mailslurp domain pool.

  • :virtual_send (Boolean)

    Optionally create inbox to send from that is a virtual inbox and won&#39;t send to external addresses

Returns:

  • (nil)


2622
2623
2624
2625
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2622

def send_email_source_optional(send_email_options, opts = {})
  send_email_source_optional_with_http_info(send_email_options, opts)
  nil
end

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

Send email Alias for &#x60;InboxController.sendEmail&#x60; method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    ID of the inbox you want to send the email from

  • :use_domain_pool (Boolean)

    Use domain pool. Optionally create inbox to send from using the mailslurp domain pool.

  • :virtual_send (Boolean)

    Optionally create inbox to send from that is a virtual inbox and won&#39;t send to external addresses

Returns:

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

    nil, response status code and response headers



2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2635

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
  query_params[:'useDomainPool'] = opts[:'use_domain_pool'] if !opts[:'use_domain_pool'].nil?
  query_params[:'virtualSend'] = opts[:'virtual_send'] if !opts[:'virtual_send'].nil?

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

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

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

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:



2690
2691
2692
2693
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2690

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 HTML contents Validate the HTML content of email if HTML is found. Considered valid if no HTML is present.

Parameters:

  • email_id (String)

    ID of email

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

    the optional parameters

Returns:

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

    ValidationDto data, response status code and response headers



2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2700

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(['*/*'])

  # 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