mailslurp_client 8.5.1 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed297a765d1c862f652f4522ea6f87da3484f6292bf2f47110a4b874ba4d0550
4
- data.tar.gz: bc44070fb6718ab1a91f240ded2d025508009aa33ed8013da51f01554de31e9b
3
+ metadata.gz: 5ccdb7be7e424bacdae29fcbf9dad515125046d5e38878a1f4e40179e8e8b9bd
4
+ data.tar.gz: b83426fe6e87feb55e23f019caac8b51f07eeabaa52fe21a491695168f5ff0bf
5
5
  SHA512:
6
- metadata.gz: bfef0f5bcceb239f890a4afafdc2bf0dc06f4db4ad5e5540a13c660b5829a9b24fc61b6692678050f713da5043c570806fd0f4b03f62dda5a78ed85176fb961a
7
- data.tar.gz: 0d7ca2dd658449478b0d57ff65a1857e0e5a2452ea5ebbe74901678c3bfee1eef7fc3b809d8a96310550ffab595c3383682d924556208c63bc87d63e3f56ee82
6
+ metadata.gz: b274c058ff4fee095c2f1e72683c1280377f751ffb5f5f5d385c78eb93c62f2ebcba89185219c833e703681c91ac3cb2bd80415646567e6c8db20714bfa0024c
7
+ data.tar.gz: 81d086b54c8c9bfc0197e6fe6a63b712b5c2a23373a7e20ad806ec84205e6fa3f0ab5d32c8f29fc6fe2ac14ca4ef17e15a9ed47aed65ae5a57b4f1ea0abad5bf
@@ -66,9 +66,11 @@ require 'mailslurp_client/models/page_group_projection'
66
66
  require 'mailslurp_client/models/page_inbox_projection'
67
67
  require 'mailslurp_client/models/page_sent_email_projection'
68
68
  require 'mailslurp_client/models/page_template_projection'
69
+ require 'mailslurp_client/models/page_thread_projection'
69
70
  require 'mailslurp_client/models/page_webhook_projection'
70
71
  require 'mailslurp_client/models/pageable'
71
72
  require 'mailslurp_client/models/raw_email_json'
73
+ require 'mailslurp_client/models/reply_to_alias_email_options'
72
74
  require 'mailslurp_client/models/reply_to_email_options'
73
75
  require 'mailslurp_client/models/send_email_options'
74
76
  require 'mailslurp_client/models/sent_email_dto'
@@ -79,6 +81,7 @@ require 'mailslurp_client/models/sort'
79
81
  require 'mailslurp_client/models/template_dto'
80
82
  require 'mailslurp_client/models/template_projection'
81
83
  require 'mailslurp_client/models/template_variable'
84
+ require 'mailslurp_client/models/thread_projection'
82
85
  require 'mailslurp_client/models/unread_count'
83
86
  require 'mailslurp_client/models/update_alias_options'
84
87
  require 'mailslurp_client/models/update_group_contacts'
@@ -203,6 +203,156 @@ module MailSlurpClient
203
203
  return data, status_code, headers
204
204
  end
205
205
 
206
+ # Get emails for an alias
207
+ # Get paginated emails for an alias by ID
208
+ # @param alias_id [String] aliasId
209
+ # @param [Hash] opts the optional parameters
210
+ # @option opts [Integer] :page Optional page index alias email list pagination (default to 0)
211
+ # @option opts [Integer] :size Optional page size alias email list pagination (default to 20)
212
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
213
+ # @return [PageEmailProjection]
214
+ def get_alias_emails(alias_id, opts = {})
215
+ data, _status_code, _headers = get_alias_emails_with_http_info(alias_id, opts)
216
+ data
217
+ end
218
+
219
+ # Get emails for an alias
220
+ # Get paginated emails for an alias by ID
221
+ # @param alias_id [String] aliasId
222
+ # @param [Hash] opts the optional parameters
223
+ # @option opts [Integer] :page Optional page index alias email list pagination
224
+ # @option opts [Integer] :size Optional page size alias email list pagination
225
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
226
+ # @return [Array<(PageEmailProjection, Integer, Hash)>] PageEmailProjection data, response status code and response headers
227
+ def get_alias_emails_with_http_info(alias_id, opts = {})
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug 'Calling API: AliasControllerApi.get_alias_emails ...'
230
+ end
231
+ # verify the required parameter 'alias_id' is set
232
+ if @api_client.config.client_side_validation && alias_id.nil?
233
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling AliasControllerApi.get_alias_emails"
234
+ end
235
+ allowable_values = ["ASC", "DESC"]
236
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
237
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
238
+ end
239
+ # resource path
240
+ local_var_path = '/aliases/{aliasId}/emails'.sub('{' + 'aliasId' + '}', CGI.escape(alias_id.to_s))
241
+
242
+ # query parameters
243
+ query_params = opts[:query_params] || {}
244
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
245
+ query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
246
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
247
+
248
+ # header parameters
249
+ header_params = opts[:header_params] || {}
250
+ # HTTP header 'Accept' (if needed)
251
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
252
+
253
+ # form parameters
254
+ form_params = opts[:form_params] || {}
255
+
256
+ # http body (model)
257
+ post_body = opts[:body]
258
+
259
+ # return_type
260
+ return_type = opts[:return_type] || 'PageEmailProjection'
261
+
262
+ # auth_names
263
+ auth_names = opts[:auth_names] || ['API_KEY']
264
+
265
+ new_options = opts.merge(
266
+ :header_params => header_params,
267
+ :query_params => query_params,
268
+ :form_params => form_params,
269
+ :body => post_body,
270
+ :auth_names => auth_names,
271
+ :return_type => return_type
272
+ )
273
+
274
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
275
+ if @api_client.config.debugging
276
+ @api_client.config.logger.debug "API called: AliasControllerApi#get_alias_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
277
+ end
278
+ return data, status_code, headers
279
+ end
280
+
281
+ # Get threads created for an alias
282
+ # Returns threads created for an email alias in paginated form
283
+ # @param alias_id [String] aliasId
284
+ # @param [Hash] opts the optional parameters
285
+ # @option opts [Integer] :page Optional page index in thread list pagination (default to 0)
286
+ # @option opts [Integer] :size Optional page size in thread list pagination (default to 20)
287
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
288
+ # @return [PageThreadProjection]
289
+ def get_alias_threads(alias_id, opts = {})
290
+ data, _status_code, _headers = get_alias_threads_with_http_info(alias_id, opts)
291
+ data
292
+ end
293
+
294
+ # Get threads created for an alias
295
+ # Returns threads created for an email alias in paginated form
296
+ # @param alias_id [String] aliasId
297
+ # @param [Hash] opts the optional parameters
298
+ # @option opts [Integer] :page Optional page index in thread list pagination
299
+ # @option opts [Integer] :size Optional page size in thread list pagination
300
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
301
+ # @return [Array<(PageThreadProjection, Integer, Hash)>] PageThreadProjection data, response status code and response headers
302
+ def get_alias_threads_with_http_info(alias_id, opts = {})
303
+ if @api_client.config.debugging
304
+ @api_client.config.logger.debug 'Calling API: AliasControllerApi.get_alias_threads ...'
305
+ end
306
+ # verify the required parameter 'alias_id' is set
307
+ if @api_client.config.client_side_validation && alias_id.nil?
308
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling AliasControllerApi.get_alias_threads"
309
+ end
310
+ allowable_values = ["ASC", "DESC"]
311
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
312
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
313
+ end
314
+ # resource path
315
+ local_var_path = '/aliases/{aliasId}/threads'.sub('{' + 'aliasId' + '}', CGI.escape(alias_id.to_s))
316
+
317
+ # query parameters
318
+ query_params = opts[:query_params] || {}
319
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
320
+ query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
321
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
322
+
323
+ # header parameters
324
+ header_params = opts[:header_params] || {}
325
+ # HTTP header 'Accept' (if needed)
326
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
327
+
328
+ # form parameters
329
+ form_params = opts[:form_params] || {}
330
+
331
+ # http body (model)
332
+ post_body = opts[:body]
333
+
334
+ # return_type
335
+ return_type = opts[:return_type] || 'PageThreadProjection'
336
+
337
+ # auth_names
338
+ auth_names = opts[:auth_names] || ['API_KEY']
339
+
340
+ new_options = opts.merge(
341
+ :header_params => header_params,
342
+ :query_params => query_params,
343
+ :form_params => form_params,
344
+ :body => post_body,
345
+ :auth_names => auth_names,
346
+ :return_type => return_type
347
+ )
348
+
349
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
350
+ if @api_client.config.debugging
351
+ @api_client.config.logger.debug "API called: AliasControllerApi#get_alias_threads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
352
+ end
353
+ return data, status_code, headers
354
+ end
355
+
206
356
  # Get all email aliases you have created
207
357
  # Get all email aliases in paginated form
208
358
  # @param [Hash] opts the optional parameters
@@ -272,6 +422,148 @@ module MailSlurpClient
272
422
  return data, status_code, headers
273
423
  end
274
424
 
425
+ # Reply to an email
426
+ # 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`.
427
+ # @param alias_id [String] ID of the alias that email belongs to
428
+ # @param email_id [String] ID of the email that should be replied to
429
+ # @param reply_to_alias_email_options [ReplyToAliasEmailOptions] replyToAliasEmailOptions
430
+ # @param [Hash] opts the optional parameters
431
+ # @return [SentEmailDto]
432
+ def reply_to_email(alias_id, email_id, reply_to_alias_email_options, opts = {})
433
+ data, _status_code, _headers = reply_to_email_with_http_info(alias_id, email_id, reply_to_alias_email_options, opts)
434
+ data
435
+ end
436
+
437
+ # Reply to an email
438
+ # 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;.
439
+ # @param alias_id [String] ID of the alias that email belongs to
440
+ # @param email_id [String] ID of the email that should be replied to
441
+ # @param reply_to_alias_email_options [ReplyToAliasEmailOptions] replyToAliasEmailOptions
442
+ # @param [Hash] opts the optional parameters
443
+ # @return [Array<(SentEmailDto, Integer, Hash)>] SentEmailDto data, response status code and response headers
444
+ def reply_to_email_with_http_info(alias_id, email_id, reply_to_alias_email_options, opts = {})
445
+ if @api_client.config.debugging
446
+ @api_client.config.logger.debug 'Calling API: AliasControllerApi.reply_to_email ...'
447
+ end
448
+ # verify the required parameter 'alias_id' is set
449
+ if @api_client.config.client_side_validation && alias_id.nil?
450
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling AliasControllerApi.reply_to_email"
451
+ end
452
+ # verify the required parameter 'email_id' is set
453
+ if @api_client.config.client_side_validation && email_id.nil?
454
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling AliasControllerApi.reply_to_email"
455
+ end
456
+ # verify the required parameter 'reply_to_alias_email_options' is set
457
+ if @api_client.config.client_side_validation && reply_to_alias_email_options.nil?
458
+ fail ArgumentError, "Missing the required parameter 'reply_to_alias_email_options' when calling AliasControllerApi.reply_to_email"
459
+ end
460
+ # resource path
461
+ local_var_path = '/aliases/{aliasId}/emails/{emailId}'.sub('{' + 'aliasId' + '}', CGI.escape(alias_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
462
+
463
+ # query parameters
464
+ query_params = opts[:query_params] || {}
465
+
466
+ # header parameters
467
+ header_params = opts[:header_params] || {}
468
+ # HTTP header 'Accept' (if needed)
469
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
470
+ # HTTP header 'Content-Type'
471
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
472
+
473
+ # form parameters
474
+ form_params = opts[:form_params] || {}
475
+
476
+ # http body (model)
477
+ post_body = opts[:body] || @api_client.object_to_http_body(reply_to_alias_email_options)
478
+
479
+ # return_type
480
+ return_type = opts[:return_type] || 'SentEmailDto'
481
+
482
+ # auth_names
483
+ auth_names = opts[:auth_names] || ['API_KEY']
484
+
485
+ new_options = opts.merge(
486
+ :header_params => header_params,
487
+ :query_params => query_params,
488
+ :form_params => form_params,
489
+ :body => post_body,
490
+ :auth_names => auth_names,
491
+ :return_type => return_type
492
+ )
493
+
494
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
495
+ if @api_client.config.debugging
496
+ @api_client.config.logger.debug "API called: AliasControllerApi#reply_to_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
497
+ end
498
+ return data, status_code, headers
499
+ end
500
+
501
+ # Send an email from an alias inbox
502
+ # Send an email from an alias. Replies to the email will be forwared to the alias masked email address
503
+ # @param alias_id [String] aliasId
504
+ # @param [Hash] opts the optional parameters
505
+ # @option opts [SendEmailOptions] :send_email_options Options for the email to be sent
506
+ # @return [SentEmailDto]
507
+ def send_alias_email(alias_id, opts = {})
508
+ data, _status_code, _headers = send_alias_email_with_http_info(alias_id, opts)
509
+ data
510
+ end
511
+
512
+ # Send an email from an alias inbox
513
+ # Send an email from an alias. Replies to the email will be forwared to the alias masked email address
514
+ # @param alias_id [String] aliasId
515
+ # @param [Hash] opts the optional parameters
516
+ # @option opts [SendEmailOptions] :send_email_options Options for the email to be sent
517
+ # @return [Array<(SentEmailDto, Integer, Hash)>] SentEmailDto data, response status code and response headers
518
+ def send_alias_email_with_http_info(alias_id, opts = {})
519
+ if @api_client.config.debugging
520
+ @api_client.config.logger.debug 'Calling API: AliasControllerApi.send_alias_email ...'
521
+ end
522
+ # verify the required parameter 'alias_id' is set
523
+ if @api_client.config.client_side_validation && alias_id.nil?
524
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling AliasControllerApi.send_alias_email"
525
+ end
526
+ # resource path
527
+ local_var_path = '/aliases/{aliasId}/emails'.sub('{' + 'aliasId' + '}', CGI.escape(alias_id.to_s))
528
+
529
+ # query parameters
530
+ query_params = opts[:query_params] || {}
531
+
532
+ # header parameters
533
+ header_params = opts[:header_params] || {}
534
+ # HTTP header 'Accept' (if needed)
535
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
536
+ # HTTP header 'Content-Type'
537
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
538
+
539
+ # form parameters
540
+ form_params = opts[:form_params] || {}
541
+
542
+ # http body (model)
543
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'send_email_options'])
544
+
545
+ # return_type
546
+ return_type = opts[:return_type] || 'SentEmailDto'
547
+
548
+ # auth_names
549
+ auth_names = opts[:auth_names] || ['API_KEY']
550
+
551
+ new_options = opts.merge(
552
+ :header_params => header_params,
553
+ :query_params => query_params,
554
+ :form_params => form_params,
555
+ :body => post_body,
556
+ :auth_names => auth_names,
557
+ :return_type => return_type
558
+ )
559
+
560
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
561
+ if @api_client.config.debugging
562
+ @api_client.config.logger.debug "API called: AliasControllerApi#send_alias_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
563
+ end
564
+ return data, status_code, headers
565
+ end
566
+
275
567
  # Update an email alias
276
568
  # @param alias_id [String] aliasId
277
569
  # @param update_alias_options [UpdateAliasOptions] updateAliasOptions
@@ -927,32 +927,32 @@ module MailSlurpClient
927
927
 
928
928
  # Reply to an email
929
929
  # 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`.
930
- # @param email_id [String] emailId
930
+ # @param email_id [String] ID of the email that should be replied to
931
931
  # @param reply_to_email_options [ReplyToEmailOptions] replyToEmailOptions
932
932
  # @param [Hash] opts the optional parameters
933
933
  # @return [SentEmailDto]
934
- def reply_to_email(email_id, reply_to_email_options, opts = {})
935
- data, _status_code, _headers = reply_to_email_with_http_info(email_id, reply_to_email_options, opts)
934
+ def reply_to_email1(email_id, reply_to_email_options, opts = {})
935
+ data, _status_code, _headers = reply_to_email1_with_http_info(email_id, reply_to_email_options, opts)
936
936
  data
937
937
  end
938
938
 
939
939
  # Reply to an email
940
940
  # 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;.
941
- # @param email_id [String] emailId
941
+ # @param email_id [String] ID of the email that should be replied to
942
942
  # @param reply_to_email_options [ReplyToEmailOptions] replyToEmailOptions
943
943
  # @param [Hash] opts the optional parameters
944
944
  # @return [Array<(SentEmailDto, Integer, Hash)>] SentEmailDto data, response status code and response headers
945
- def reply_to_email_with_http_info(email_id, reply_to_email_options, opts = {})
945
+ def reply_to_email1_with_http_info(email_id, reply_to_email_options, opts = {})
946
946
  if @api_client.config.debugging
947
- @api_client.config.logger.debug 'Calling API: EmailControllerApi.reply_to_email ...'
947
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.reply_to_email1 ...'
948
948
  end
949
949
  # verify the required parameter 'email_id' is set
950
950
  if @api_client.config.client_side_validation && email_id.nil?
951
- fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.reply_to_email"
951
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.reply_to_email1"
952
952
  end
953
953
  # verify the required parameter 'reply_to_email_options' is set
954
954
  if @api_client.config.client_side_validation && reply_to_email_options.nil?
955
- fail ArgumentError, "Missing the required parameter 'reply_to_email_options' when calling EmailControllerApi.reply_to_email"
955
+ fail ArgumentError, "Missing the required parameter 'reply_to_email_options' when calling EmailControllerApi.reply_to_email1"
956
956
  end
957
957
  # resource path
958
958
  local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
@@ -990,7 +990,7 @@ module MailSlurpClient
990
990
 
991
991
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
992
992
  if @api_client.config.debugging
993
- @api_client.config.logger.debug "API called: EmailControllerApi#reply_to_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
993
+ @api_client.config.logger.debug "API called: EmailControllerApi#reply_to_email1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
994
994
  end
995
995
  return data, status_code, headers
996
996
  end
@@ -18,6 +18,8 @@ module MailSlurpClient
18
18
 
19
19
  attr_accessor :created_at
20
20
 
21
+ attr_accessor :email_addresses
22
+
21
23
  attr_accessor :first_name
22
24
 
23
25
  attr_accessor :group_id
@@ -33,6 +35,7 @@ module MailSlurpClient
33
35
  {
34
36
  :'company' => :'company',
35
37
  :'created_at' => :'createdAt',
38
+ :'email_addresses' => :'emailAddresses',
36
39
  :'first_name' => :'firstName',
37
40
  :'group_id' => :'groupId',
38
41
  :'id' => :'id',
@@ -46,6 +49,7 @@ module MailSlurpClient
46
49
  {
47
50
  :'company' => :'String',
48
51
  :'created_at' => :'DateTime',
52
+ :'email_addresses' => :'Array<String>',
49
53
  :'first_name' => :'String',
50
54
  :'group_id' => :'String',
51
55
  :'id' => :'String',
@@ -83,6 +87,12 @@ module MailSlurpClient
83
87
  self.created_at = attributes[:'created_at']
84
88
  end
85
89
 
90
+ if attributes.key?(:'email_addresses')
91
+ if (value = attributes[:'email_addresses']).is_a?(Array)
92
+ self.email_addresses = value
93
+ end
94
+ end
95
+
86
96
  if attributes.key?(:'first_name')
87
97
  self.first_name = attributes[:'first_name']
88
98
  end
@@ -134,6 +144,7 @@ module MailSlurpClient
134
144
  self.class == o.class &&
135
145
  company == o.company &&
136
146
  created_at == o.created_at &&
147
+ email_addresses == o.email_addresses &&
137
148
  first_name == o.first_name &&
138
149
  group_id == o.group_id &&
139
150
  id == o.id &&
@@ -150,7 +161,7 @@ module MailSlurpClient
150
161
  # Calculates hash code according to all attributes.
151
162
  # @return [Integer] Hash code
152
163
  def hash
153
- [company, created_at, first_name, group_id, id, last_name, opt_out].hash
164
+ [company, created_at, email_addresses, first_name, group_id, id, last_name, opt_out].hash
154
165
  end
155
166
 
156
167
  # Builds the object from hash
@@ -0,0 +1,299 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ # Paginated email projection results. EmailProjections and EmailPreviews are essentially the same but have legacy naming issues. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full email entity use the projection ID with individual method calls. For emails there are several methods for fetching message bodies and attachments.
17
+ class PageThreadProjection
18
+ attr_accessor :content
19
+
20
+ attr_accessor :empty
21
+
22
+ attr_accessor :first
23
+
24
+ attr_accessor :last
25
+
26
+ attr_accessor :number
27
+
28
+ attr_accessor :number_of_elements
29
+
30
+ attr_accessor :pageable
31
+
32
+ attr_accessor :size
33
+
34
+ attr_accessor :sort
35
+
36
+ attr_accessor :total_elements
37
+
38
+ attr_accessor :total_pages
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'content' => :'content',
44
+ :'empty' => :'empty',
45
+ :'first' => :'first',
46
+ :'last' => :'last',
47
+ :'number' => :'number',
48
+ :'number_of_elements' => :'numberOfElements',
49
+ :'pageable' => :'pageable',
50
+ :'size' => :'size',
51
+ :'sort' => :'sort',
52
+ :'total_elements' => :'totalElements',
53
+ :'total_pages' => :'totalPages'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'content' => :'Array<ThreadProjection>',
61
+ :'empty' => :'Boolean',
62
+ :'first' => :'Boolean',
63
+ :'last' => :'Boolean',
64
+ :'number' => :'Integer',
65
+ :'number_of_elements' => :'Integer',
66
+ :'pageable' => :'Pageable',
67
+ :'size' => :'Integer',
68
+ :'sort' => :'Sort',
69
+ :'total_elements' => :'Integer',
70
+ :'total_pages' => :'Integer'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::PageThreadProjection` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::PageThreadProjection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'content')
96
+ if (value = attributes[:'content']).is_a?(Array)
97
+ self.content = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'empty')
102
+ self.empty = attributes[:'empty']
103
+ end
104
+
105
+ if attributes.key?(:'first')
106
+ self.first = attributes[:'first']
107
+ end
108
+
109
+ if attributes.key?(:'last')
110
+ self.last = attributes[:'last']
111
+ end
112
+
113
+ if attributes.key?(:'number')
114
+ self.number = attributes[:'number']
115
+ end
116
+
117
+ if attributes.key?(:'number_of_elements')
118
+ self.number_of_elements = attributes[:'number_of_elements']
119
+ end
120
+
121
+ if attributes.key?(:'pageable')
122
+ self.pageable = attributes[:'pageable']
123
+ end
124
+
125
+ if attributes.key?(:'size')
126
+ self.size = attributes[:'size']
127
+ end
128
+
129
+ if attributes.key?(:'sort')
130
+ self.sort = attributes[:'sort']
131
+ end
132
+
133
+ if attributes.key?(:'total_elements')
134
+ self.total_elements = attributes[:'total_elements']
135
+ end
136
+
137
+ if attributes.key?(:'total_pages')
138
+ self.total_pages = attributes[:'total_pages']
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ true
153
+ end
154
+
155
+ # Checks equality by comparing each attribute.
156
+ # @param [Object] Object to be compared
157
+ def ==(o)
158
+ return true if self.equal?(o)
159
+ self.class == o.class &&
160
+ content == o.content &&
161
+ empty == o.empty &&
162
+ first == o.first &&
163
+ last == o.last &&
164
+ number == o.number &&
165
+ number_of_elements == o.number_of_elements &&
166
+ pageable == o.pageable &&
167
+ size == o.size &&
168
+ sort == o.sort &&
169
+ total_elements == o.total_elements &&
170
+ total_pages == o.total_pages
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [content, empty, first, last, number, number_of_elements, pageable, size, sort, total_elements, total_pages].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.openapi_types.each_pair do |key, type|
198
+ if type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :DateTime
219
+ DateTime.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ MailSlurpClient.const_get(type).build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ if value.nil?
272
+ is_nullable = self.class.openapi_nullable.include?(attr)
273
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
274
+ end
275
+
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map { |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+ end
299
+ end