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

Returns:



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

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:



933
934
935
936
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 933

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



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

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:



996
997
998
999
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 996

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



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

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

Options Hash (opts):

  • :strict (Boolean)

    Strict content type match

  • :index (Integer)

    Index of content type part if multiple

Returns:



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

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

Get email content part by content type raw response Get email body content parts from a multipart email message for a given content type and return as response

Parameters:

  • email_id (String)

    ID of email to match against

  • content_type (String)

    Content type

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

    the optional parameters

Options Hash (opts):

  • :strict (Boolean)

    Strict content type match

  • :index (Integer)

    Index of content type part if multiple. Starts from 0 and applies to the result list after selecting for your content type. Content type parts are sorted by order found in original MIME message.

Returns:

  • (String)


1143
1144
1145
1146
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1143

def get_email_content_part_content(email_id, content_type, opts = {})
  data, _status_code, _headers = get_email_content_part_content_with_http_info(email_id, content_type, opts)
  data
end

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

Get email content part by content type raw response Get email body content parts from a multipart email message for a given content type and return as response

Parameters:

  • email_id (String)

    ID of email to match against

  • content_type (String)

    Content type

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

    the optional parameters

Options Hash (opts):

  • :strict (Boolean)

    Strict content type match

  • :index (Integer)

    Index of content type part if multiple. Starts from 0 and applies to the result list after selecting for your content type. Content type parts are sorted by order found in original MIME message.

Returns:

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

    String data, response status code and response headers



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
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1156

def get_email_content_part_content_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_content ...'
  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_content"
  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_content"
  end
  # resource path
  local_var_path = '/emails/{emailId}/contentPart/raw'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contentType'] = content_type
  query_params[:'strict'] = opts[:'strict'] if !opts[:'strict'].nil?
  query_params[:'index'] = opts[:'index'] if !opts[:'index'].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] || '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_content_part_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
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

Options Hash (opts):

  • :strict (Boolean)

    Strict content type match

  • :index (Integer)

    Index of content type part if multiple

Returns:

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

    EmailContentPartResult data, response status code and response headers



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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8', 'application/xml;charset=UTF-8', 'application/json; charset=UTF-8', 'application/xml; charset=UTF-8'])

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



1214
1215
1216
1217
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1214

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



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
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1223

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

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

Returns:

  • (String)


1273
1274
1275
1276
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1273

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

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

Returns:



1338
1339
1340
1341
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1338

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

  • :replace_cid_images (Boolean)

Returns:

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

    EmailHtmlDto data, response status code and response headers



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

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[:'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:



1403
1404
1405
1406
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1403

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



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
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1414

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

  • :replace_cid_images (Boolean)

Returns:

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

    String data, response status code and response headers



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
1324
1325
1326
1327
1328
1329
1330
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1284

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[:'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

Options Hash (opts):

  • :selector (String)

    Optional HTML query selector for links

Returns:



1472
1473
1474
1475
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1472

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

Options Hash (opts):

  • :selector (String)

    Optional HTML query selector for links

Returns:

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

    EmailLinksResult data, response status code and response headers



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
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1483

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] || {}
  query_params[:'selector'] = opts[:'selector'] if !opts[:'selector'].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] || '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:



1536
1537
1538
1539
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1536

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



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
1587
1588
1589
1590
1591
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1546

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:



1599
1600
1601
1602
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1599

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



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
1655
1656
1657
1658
1659
1660
1661
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1610

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)


1669
1670
1671
1672
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1669

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



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
1723
1724
1725
1726
1727
1728
1729
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1680

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

Get email data including headers but not 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. To retrieve the body see getEmail and to get raw unparsed email use the getRawEmail endpoints

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

Returns:



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

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

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

Get email data including headers but not 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. To retrieve the body see getEmail and to get raw unparsed email use the getRawEmail endpoints

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

Returns:

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

    EmailPreview data, response status code and response headers



1748
1749
1750
1751
1752
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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1748

def get_email_summary_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_summary ...'
  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_summary"
  end
  # resource path
  local_var_path = '/emails/{emailId}/summary'.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] || '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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailControllerApi#get_email_summary\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:



1803
1804
1805
1806
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1803

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



1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1815

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_thread(thread_id, opts = {}) ⇒ EmailThreadDto

Return email thread information. Use items endpoints to get messages for thread. Return email message thread summary from Message-ID, In-Reply-To, and References header. Get messages using items endpoint

Parameters:

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

    the optional parameters

Returns:



1869
1870
1871
1872
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1869

def get_email_thread(thread_id, opts = {})
  data, _status_code, _headers = get_email_thread_with_http_info(thread_id, opts)
  data
end

#get_email_thread_items(thread_id, opts = {}) ⇒ EmailThreadItemsDto

Return email thread items. Return email thread messages based on Message-ID, In-Reply-To, and References header

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :sort (String)

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

Returns:



1932
1933
1934
1935
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1932

def get_email_thread_items(thread_id, opts = {})
  data, _status_code, _headers = get_email_thread_items_with_http_info(thread_id, opts)
  data
end

#get_email_thread_items_with_http_info(thread_id, opts = {}) ⇒ Array<(EmailThreadItemsDto, Integer, Hash)>

Return email thread items. Return email thread messages based on Message-ID, In-Reply-To, and References header

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :sort (String)

    Optional createdAt sort direction ASC or DESC

Returns:

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

    EmailThreadItemsDto data, response status code and response headers



1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1943

def get_email_thread_items_with_http_info(thread_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_thread_items ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling EmailControllerApi.get_email_thread_items"
  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/threads/{threadId}/items'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))

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

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

#get_email_thread_with_http_info(thread_id, opts = {}) ⇒ Array<(EmailThreadDto, Integer, Hash)>

Return email thread information. Use items endpoints to get messages for thread. Return email message thread summary from Message-ID, In-Reply-To, and References header. Get messages using items endpoint

Parameters:

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

    the optional parameters

Returns:

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

    EmailThreadDto data, response status code and response headers



1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1879

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

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

#get_email_threads(opts = {}) ⇒ PageEmailThreadProjection

Return email threads in paginated form Return email message chains built from Message-ID, In-Reply-To, and References header.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :html_selector (String)

    Optional inbox filter

  • :page (Integer)

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

  • :size (Integer)

    Optional page size in email thread 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')

  • :search_filter (String)

    Optional search filter search filter for email threads.

  • :since (DateTime)

    Optional filter email threads created since time

  • :before (DateTime)

    Optional filter emails threads created before given date time

Returns:



2006
2007
2008
2009
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2006

def get_email_threads(opts = {})
  data, _status_code, _headers = get_email_threads_with_http_info(opts)
  data
end

#get_email_threads_with_http_info(opts = {}) ⇒ Array<(PageEmailThreadProjection, Integer, Hash)>

Return email threads in paginated form Return email message chains built from Message-ID, In-Reply-To, and References header.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :html_selector (String)

    Optional inbox filter

  • :page (Integer)

    Optional page index in email thread pagination

  • :size (Integer)

    Optional page size in email thread pagination. Maximum size is 100. Use page index and sort to page through larger results

  • :sort (String)

    Optional createdAt sort direction ASC or DESC

  • :search_filter (String)

    Optional search filter search filter for email threads.

  • :since (DateTime)

    Optional filter email threads created since time

  • :before (DateTime)

    Optional filter emails threads created before given date time

Returns:

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

    PageEmailThreadProjection data, response status code and response headers



2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2022

def get_email_threads_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_threads ...'
  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_email_threads, 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/threads'

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

  # 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_threads\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

Returns:

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

    Email data, response status code and response headers



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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8', 'application/xml;charset=UTF-8', 'application/json; charset=UTF-8', 'application/xml; charset=UTF-8'])

  # 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

  • :favourited (Boolean)

    Optional filter emails that are favourited

  • :sync_connectors (Boolean)

    Sync connectors

  • :plus_address_id (String)

    Optional plus address ID filter

Returns:



2095
2096
2097
2098
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2095

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

  • :favourited (Boolean)

    Optional filter emails that are favourited

  • :sync_connectors (Boolean)

    Sync connectors

  • :plus_address_id (String)

    Optional plus address ID filter

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

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?
  query_params[:'favourited'] = opts[:'favourited'] if !opts[:'favourited'].nil?
  query_params[:'syncConnectors'] = opts[:'sync_connectors'] if !opts[:'sync_connectors'].nil?
  query_params[:'plusAddressId'] = opts[:'plus_address_id'] if !opts[:'plus_address_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] || '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

  • :sync_connectors (Boolean)

    Sync connectors

  • :plus_address_id (String)

    Optional plus address ID filter

  • :favourited (Boolean)

    Optional filter emails that are favourited

Returns:



2192
2193
2194
2195
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2192

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

  • :sync_connectors (Boolean)

    Sync connectors

  • :plus_address_id (String)

    Optional plus address ID filter

  • :favourited (Boolean)

    Optional filter emails that are favourited

Returns:

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

    PageEmailProjection data, response status code and response headers



2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2212

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?
  query_params[:'syncConnectors'] = opts[:'sync_connectors'] if !opts[:'sync_connectors'].nil?
  query_params[:'plusAddressId'] = opts[:'plus_address_id'] if !opts[:'plus_address_id'].nil?
  query_params[:'favourited'] = opts[:'favourited'] if !opts[:'favourited'].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:



2279
2280
2281
2282
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2279

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



2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2289

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:



2343
2344
2345
2346
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2343

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:



2402
2403
2404
2405
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2402

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



2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2412

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



2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2353

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

  • :sync_connectors (Boolean)

    Sync connectors

  • :favourited (Boolean)

    Search only favorited emails

  • :plus_address_id (String)

    Optional plus address ID filter

Returns:



2475
2476
2477
2478
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2475

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

  • :sync_connectors (Boolean)

    Sync connectors

  • :favourited (Boolean)

    Search only favorited emails

  • :plus_address_id (String)

    Optional plus address ID filter

Returns:

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

    PageEmailProjection data, response status code and response headers



2495
2496
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
2549
2550
2551
2552
2553
2554
2555
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2495

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?
  query_params[:'syncConnectors'] = opts[:'sync_connectors'] if !opts[:'sync_connectors'].nil?
  query_params[:'favourited'] = opts[:'favourited'] if !opts[:'favourited'].nil?
  query_params[:'plusAddressId'] = opts[:'plus_address_id'] if !opts[:'plus_address_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] || '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)


2562
2563
2564
2565
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2562

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



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

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:



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

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



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

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:



2684
2685
2686
2687
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2684

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



2694
2695
2696
2697
2698
2699
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
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2694

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)


2744
2745
2746
2747
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2744

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



2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2755

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:



2804
2805
2806
2807
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2804

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



2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2815

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:



2869
2870
2871
2872
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2869

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



2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2880

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

Options Hash (opts):

  • :sync_connectors (Boolean)

    Sync connectors

  • :favourited (Boolean)

    Search only favourited emails

  • :plus_address_id (String)

    Optional plus address ID filter

Returns:



2941
2942
2943
2944
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2941

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

Options Hash (opts):

  • :sync_connectors (Boolean)

    Sync connectors

  • :favourited (Boolean)

    Search only favourited emails

  • :plus_address_id (String)

    Optional plus address ID filter

Returns:

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

    PageEmailProjection data, response status code and response headers



2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2954

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] || {}
  query_params[:'syncConnectors'] = opts[:'sync_connectors'] if !opts[:'sync_connectors'].nil?
  query_params[:'favourited'] = opts[:'favourited'] if !opts[:'favourited'].nil?
  query_params[:'plusAddressId'] = opts[:'plus_address_id'] if !opts[:'plus_address_id'].nil?

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

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(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)


3014
3015
3016
3017
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 3014

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



3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 3027

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

#set_email_favourited(email_id, favourited, opts = {}) ⇒ nil

Set email favourited state Set and return new favorite state for an email

Parameters:

  • email_id (String)

    ID of email to set favourite state

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

    the optional parameters

Returns:

  • (nil)


3083
3084
3085
3086
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 3083

def set_email_favourited(email_id, favourited, opts = {})
  set_email_favourited_with_http_info(email_id, favourited, opts)
  nil
end

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

Set email favourited state Set and return new favorite state for an email

Parameters:

  • email_id (String)

    ID of email to set favourite state

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 3094

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

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

  # 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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailControllerApi#set_email_favourited\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:



3149
3150
3151
3152
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 3149

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



3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 3159

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