mailslurp_client 16.1.1 → 16.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/ai_controller_api.rb +64 -0
  3. data/lib/mailslurp_client/models/email_projection.rb +11 -11
  4. data/lib/mailslurp_client/models/email_thread_projection.rb +26 -26
  5. data/lib/mailslurp_client/models/generate_structured_content_attachment_options.rb +237 -0
  6. data/lib/mailslurp_client/models/page_alias.rb +15 -15
  7. data/lib/mailslurp_client/models/page_alias_thread_projection.rb +15 -15
  8. data/lib/mailslurp_client/models/page_attachment_entity.rb +15 -15
  9. data/lib/mailslurp_client/models/page_bounced_email.rb +15 -15
  10. data/lib/mailslurp_client/models/page_bounced_recipients.rb +15 -15
  11. data/lib/mailslurp_client/models/page_complaint.rb +15 -15
  12. data/lib/mailslurp_client/models/page_connector.rb +15 -15
  13. data/lib/mailslurp_client/models/page_connector_events.rb +15 -15
  14. data/lib/mailslurp_client/models/page_contact_projection.rb +15 -15
  15. data/lib/mailslurp_client/models/page_delivery_status.rb +15 -15
  16. data/lib/mailslurp_client/models/page_email_preview.rb +15 -15
  17. data/lib/mailslurp_client/models/page_email_projection.rb +15 -15
  18. data/lib/mailslurp_client/models/page_email_thread_projection.rb +15 -15
  19. data/lib/mailslurp_client/models/page_email_validation_request.rb +15 -15
  20. data/lib/mailslurp_client/models/page_entity_automation_items.rb +15 -15
  21. data/lib/mailslurp_client/models/page_entity_event_items.rb +15 -15
  22. data/lib/mailslurp_client/models/page_entity_favourite_items.rb +15 -15
  23. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +15 -15
  24. data/lib/mailslurp_client/models/page_group_projection.rb +15 -15
  25. data/lib/mailslurp_client/models/page_guest_portal_users.rb +15 -15
  26. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +15 -15
  27. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +15 -15
  28. data/lib/mailslurp_client/models/page_inbox_projection.rb +15 -15
  29. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +15 -15
  30. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +15 -15
  31. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +15 -15
  32. data/lib/mailslurp_client/models/page_inbox_tags.rb +15 -15
  33. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +15 -15
  34. data/lib/mailslurp_client/models/page_missed_email_projection.rb +15 -15
  35. data/lib/mailslurp_client/models/page_opt_in_identity_projection.rb +15 -15
  36. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +15 -15
  37. data/lib/mailslurp_client/models/page_phone_message_thread_item_projection.rb +15 -15
  38. data/lib/mailslurp_client/models/page_phone_message_thread_projection.rb +15 -15
  39. data/lib/mailslurp_client/models/page_phone_number_projection.rb +15 -15
  40. data/lib/mailslurp_client/models/page_plus_address_projection.rb +15 -15
  41. data/lib/mailslurp_client/models/page_reputation_items.rb +15 -15
  42. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +15 -15
  43. data/lib/mailslurp_client/models/page_sent_email_projection.rb +15 -15
  44. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +15 -15
  45. data/lib/mailslurp_client/models/page_sent_sms_projection.rb +15 -15
  46. data/lib/mailslurp_client/models/page_sms_projection.rb +15 -15
  47. data/lib/mailslurp_client/models/page_template_projection.rb +15 -15
  48. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +15 -15
  49. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +15 -15
  50. data/lib/mailslurp_client/models/page_webhook_endpoint_projection.rb +15 -15
  51. data/lib/mailslurp_client/models/page_webhook_projection.rb +15 -15
  52. data/lib/mailslurp_client/models/page_webhook_result.rb +15 -15
  53. data/lib/mailslurp_client/models/sent_email_projection.rb +11 -11
  54. data/lib/mailslurp_client/models/sort_object.rb +10 -10
  55. data/lib/mailslurp_client/version.rb +1 -1
  56. data/lib/mailslurp_client.rb +1 -0
  57. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 721d86a1a795042b4160e785468d389da75506821303cf137ad5f612eb03525d
4
- data.tar.gz: 93d521285ffeeff92219f75fb6beffd713c50d67e304f9cf19b376d5d75028b7
3
+ metadata.gz: b492d4191b18fa05d5e786346cef136f346825a1fd1720abf872b1f419c647da
4
+ data.tar.gz: 7e0c138324715014156cd2259353b04e9c6f04991dcb7ff649df3f4b6ed4a891
5
5
  SHA512:
6
- metadata.gz: cebe7dad2d5516d911ff06e7724f292f55ddc398b9426255328e30d2acf13099d677fb77a768787b2a4a180655cef95a4298d56de6010fac95d8c912a9e3da23
7
- data.tar.gz: b141f6384de76ddf78789d9663112880314fe856503f1f558f6e91634abf1c9a2ddb59ec903b6100276775134dd86d28a8195739e6325e60e3a959e3ae13725e
6
+ metadata.gz: 7c2e131375f887f41b8e4d263d36af50f39765f7dd7db40e6b7c0abc09b76eb42cc5bb26fd76a7503b8673ddefc577cf910409c8b60651ad4fa026664ec1e974
7
+ data.tar.gz: 342ec2079c9a1bb5740aaf12f2b141893178f18ae1f895a19158db8cd6e4bd8eab3d916290d909411d1e8e6ab50029f8495d5de9f08b69512eef2f6b7ca1fe46
@@ -19,6 +19,70 @@ module MailSlurpClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Generate structured content for an attachment
23
+ # Use output schemas to extract data from an attachment using AI
24
+ # @param generate_structured_content_attachment_options [GenerateStructuredContentAttachmentOptions]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [StructuredContentResult]
27
+ def generate_structured_content_from_attachment(generate_structured_content_attachment_options, opts = {})
28
+ data, _status_code, _headers = generate_structured_content_from_attachment_with_http_info(generate_structured_content_attachment_options, opts)
29
+ data
30
+ end
31
+
32
+ # Generate structured content for an attachment
33
+ # Use output schemas to extract data from an attachment using AI
34
+ # @param generate_structured_content_attachment_options [GenerateStructuredContentAttachmentOptions]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(StructuredContentResult, Integer, Hash)>] StructuredContentResult data, response status code and response headers
37
+ def generate_structured_content_from_attachment_with_http_info(generate_structured_content_attachment_options, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AIControllerApi.generate_structured_content_from_attachment ...'
40
+ end
41
+ # verify the required parameter 'generate_structured_content_attachment_options' is set
42
+ if @api_client.config.client_side_validation && generate_structured_content_attachment_options.nil?
43
+ fail ArgumentError, "Missing the required parameter 'generate_structured_content_attachment_options' when calling AIControllerApi.generate_structured_content_from_attachment"
44
+ end
45
+ # resource path
46
+ local_var_path = '/ai/structured-content/attachment'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
55
+ # HTTP header 'Content-Type'
56
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = opts[:form_params] || {}
60
+
61
+ # http body (model)
62
+ post_body = opts[:body] || @api_client.object_to_http_body(generate_structured_content_attachment_options)
63
+
64
+ # return_type
65
+ return_type = opts[:return_type] || 'StructuredContentResult'
66
+
67
+ # auth_names
68
+ auth_names = opts[:auth_names] || ['API_KEY']
69
+
70
+ new_options = opts.merge(
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: AIControllerApi#generate_structured_content_from_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
22
86
  # Generate structured content for an email
23
87
  # Use output schemas to extract data from an email using AI
24
88
  # @param generate_structured_content_email_options [GenerateStructuredContentEmailOptions]
@@ -37,12 +37,12 @@ module MailSlurpClient
37
37
 
38
38
  attr_accessor :favourite
39
39
 
40
- attr_accessor :in_reply_to
41
-
42
40
  attr_accessor :plus_address
43
41
 
44
42
  attr_accessor :size_bytes
45
43
 
44
+ attr_accessor :in_reply_to
45
+
46
46
  attr_accessor :read
47
47
 
48
48
  attr_accessor :body_excerpt
@@ -77,9 +77,9 @@ module MailSlurpClient
77
77
  :'message_id' => :'messageId',
78
78
  :'domain_id' => :'domainId',
79
79
  :'favourite' => :'favourite',
80
- :'in_reply_to' => :'inReplyTo',
81
80
  :'plus_address' => :'plusAddress',
82
81
  :'size_bytes' => :'sizeBytes',
82
+ :'in_reply_to' => :'inReplyTo',
83
83
  :'read' => :'read',
84
84
  :'body_excerpt' => :'bodyExcerpt',
85
85
  :'text_excerpt' => :'textExcerpt',
@@ -107,9 +107,9 @@ module MailSlurpClient
107
107
  :'message_id' => :'String',
108
108
  :'domain_id' => :'String',
109
109
  :'favourite' => :'Boolean',
110
- :'in_reply_to' => :'String',
111
110
  :'plus_address' => :'String',
112
111
  :'size_bytes' => :'Integer',
112
+ :'in_reply_to' => :'String',
113
113
  :'read' => :'Boolean',
114
114
  :'body_excerpt' => :'String',
115
115
  :'text_excerpt' => :'String',
@@ -134,9 +134,9 @@ module MailSlurpClient
134
134
  :'message_id',
135
135
  :'domain_id',
136
136
  :'favourite',
137
- :'in_reply_to',
138
137
  :'plus_address',
139
138
  :'size_bytes',
139
+ :'in_reply_to',
140
140
  :'body_excerpt',
141
141
  :'text_excerpt',
142
142
  :'body_part_content_types',
@@ -214,10 +214,6 @@ module MailSlurpClient
214
214
  self.favourite = attributes[:'favourite']
215
215
  end
216
216
 
217
- if attributes.key?(:'in_reply_to')
218
- self.in_reply_to = attributes[:'in_reply_to']
219
- end
220
-
221
217
  if attributes.key?(:'plus_address')
222
218
  self.plus_address = attributes[:'plus_address']
223
219
  end
@@ -226,6 +222,10 @@ module MailSlurpClient
226
222
  self.size_bytes = attributes[:'size_bytes']
227
223
  end
228
224
 
225
+ if attributes.key?(:'in_reply_to')
226
+ self.in_reply_to = attributes[:'in_reply_to']
227
+ end
228
+
229
229
  if attributes.key?(:'read')
230
230
  self.read = attributes[:'read']
231
231
  end
@@ -328,9 +328,9 @@ module MailSlurpClient
328
328
  message_id == o.message_id &&
329
329
  domain_id == o.domain_id &&
330
330
  favourite == o.favourite &&
331
- in_reply_to == o.in_reply_to &&
332
331
  plus_address == o.plus_address &&
333
332
  size_bytes == o.size_bytes &&
333
+ in_reply_to == o.in_reply_to &&
334
334
  read == o.read &&
335
335
  body_excerpt == o.body_excerpt &&
336
336
  text_excerpt == o.text_excerpt &&
@@ -352,7 +352,7 @@ module MailSlurpClient
352
352
  # Calculates hash code according to all attributes.
353
353
  # @return [Integer] Hash code
354
354
  def hash
355
- [sender, recipients, attachments, inbox_id, created_at, to, cc, bcc, message_id, domain_id, favourite, in_reply_to, plus_address, size_bytes, read, body_excerpt, text_excerpt, body_part_content_types, body_md5_hash, team_access, subject, id, thread_id, from].hash
355
+ [sender, recipients, attachments, inbox_id, created_at, to, cc, bcc, message_id, domain_id, favourite, plus_address, size_bytes, in_reply_to, read, body_excerpt, text_excerpt, body_part_content_types, body_md5_hash, team_access, subject, id, thread_id, from].hash
356
356
  end
357
357
 
358
358
  # Builds the object from hash
@@ -43,12 +43,6 @@ module MailSlurpClient
43
43
  # Has attachments
44
44
  attr_accessor :has_attachments
45
45
 
46
- # Has unread
47
- attr_accessor :unread
48
-
49
- # Number of messages in the thread
50
- attr_accessor :message_count
51
-
52
46
  # Last body excerpt
53
47
  attr_accessor :last_body_excerpt
54
48
 
@@ -63,6 +57,12 @@ module MailSlurpClient
63
57
 
64
58
  attr_accessor :last_sender
65
59
 
60
+ # Number of messages in the thread
61
+ attr_accessor :message_count
62
+
63
+ # Has unread
64
+ attr_accessor :unread
65
+
66
66
  # Thread topic subject
67
67
  attr_accessor :subject
68
68
 
@@ -85,13 +85,13 @@ module MailSlurpClient
85
85
  :'cc' => :'cc',
86
86
  :'bcc' => :'bcc',
87
87
  :'has_attachments' => :'hasAttachments',
88
- :'unread' => :'unread',
89
- :'message_count' => :'messageCount',
90
88
  :'last_body_excerpt' => :'lastBodyExcerpt',
91
89
  :'last_text_excerpt' => :'lastTextExcerpt',
92
90
  :'last_created_at' => :'lastCreatedAt',
93
91
  :'last_from' => :'lastFrom',
94
92
  :'last_sender' => :'lastSender',
93
+ :'message_count' => :'messageCount',
94
+ :'unread' => :'unread',
95
95
  :'subject' => :'subject',
96
96
  :'id' => :'id',
97
97
  :'from' => :'from'
@@ -111,13 +111,13 @@ module MailSlurpClient
111
111
  :'cc' => :'Array<String>',
112
112
  :'bcc' => :'Array<String>',
113
113
  :'has_attachments' => :'Boolean',
114
- :'unread' => :'Boolean',
115
- :'message_count' => :'Integer',
116
114
  :'last_body_excerpt' => :'String',
117
115
  :'last_text_excerpt' => :'String',
118
116
  :'last_created_at' => :'DateTime',
119
117
  :'last_from' => :'String',
120
118
  :'last_sender' => :'SenderProjection',
119
+ :'message_count' => :'Integer',
120
+ :'unread' => :'Boolean',
121
121
  :'subject' => :'String',
122
122
  :'id' => :'String',
123
123
  :'from' => :'String'
@@ -191,14 +191,6 @@ module MailSlurpClient
191
191
  self.has_attachments = attributes[:'has_attachments']
192
192
  end
193
193
 
194
- if attributes.key?(:'unread')
195
- self.unread = attributes[:'unread']
196
- end
197
-
198
- if attributes.key?(:'message_count')
199
- self.message_count = attributes[:'message_count']
200
- end
201
-
202
194
  if attributes.key?(:'last_body_excerpt')
203
195
  self.last_body_excerpt = attributes[:'last_body_excerpt']
204
196
  end
@@ -219,6 +211,14 @@ module MailSlurpClient
219
211
  self.last_sender = attributes[:'last_sender']
220
212
  end
221
213
 
214
+ if attributes.key?(:'message_count')
215
+ self.message_count = attributes[:'message_count']
216
+ end
217
+
218
+ if attributes.key?(:'unread')
219
+ self.unread = attributes[:'unread']
220
+ end
221
+
222
222
  if attributes.key?(:'subject')
223
223
  self.subject = attributes[:'subject']
224
224
  end
@@ -256,14 +256,14 @@ module MailSlurpClient
256
256
  invalid_properties.push('invalid value for "has_attachments", has_attachments cannot be nil.')
257
257
  end
258
258
 
259
- if @unread.nil?
260
- invalid_properties.push('invalid value for "unread", unread cannot be nil.')
261
- end
262
-
263
259
  if @message_count.nil?
264
260
  invalid_properties.push('invalid value for "message_count", message_count cannot be nil.')
265
261
  end
266
262
 
263
+ if @unread.nil?
264
+ invalid_properties.push('invalid value for "unread", unread cannot be nil.')
265
+ end
266
+
267
267
  if @id.nil?
268
268
  invalid_properties.push('invalid value for "id", id cannot be nil.')
269
269
  end
@@ -279,8 +279,8 @@ module MailSlurpClient
279
279
  return false if @created_at.nil?
280
280
  return false if @to.nil?
281
281
  return false if @has_attachments.nil?
282
- return false if @unread.nil?
283
282
  return false if @message_count.nil?
283
+ return false if @unread.nil?
284
284
  return false if @id.nil?
285
285
  true
286
286
  end
@@ -300,13 +300,13 @@ module MailSlurpClient
300
300
  cc == o.cc &&
301
301
  bcc == o.bcc &&
302
302
  has_attachments == o.has_attachments &&
303
- unread == o.unread &&
304
- message_count == o.message_count &&
305
303
  last_body_excerpt == o.last_body_excerpt &&
306
304
  last_text_excerpt == o.last_text_excerpt &&
307
305
  last_created_at == o.last_created_at &&
308
306
  last_from == o.last_from &&
309
307
  last_sender == o.last_sender &&
308
+ message_count == o.message_count &&
309
+ unread == o.unread &&
310
310
  subject == o.subject &&
311
311
  id == o.id &&
312
312
  from == o.from
@@ -321,7 +321,7 @@ module MailSlurpClient
321
321
  # Calculates hash code according to all attributes.
322
322
  # @return [Integer] Hash code
323
323
  def hash
324
- [sender, recipients, user_id, inbox_id, updated_at, created_at, to, cc, bcc, has_attachments, unread, message_count, last_body_excerpt, last_text_excerpt, last_created_at, last_from, last_sender, subject, id, from].hash
324
+ [sender, recipients, user_id, inbox_id, updated_at, created_at, to, cc, bcc, has_attachments, last_body_excerpt, last_text_excerpt, last_created_at, last_from, last_sender, message_count, unread, subject, id, from].hash
325
325
  end
326
326
 
327
327
  # Builds the object from hash
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
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
+ # Options for generating structured content output from an attachment
17
+ class GenerateStructuredContentAttachmentOptions
18
+ # Attachment ID to read and pass to AI
19
+ attr_accessor :attachment_id
20
+
21
+ # Optional instructions for the AI to follow. Try to be precise and clear. You can include examples and hints.
22
+ attr_accessor :instructions
23
+
24
+ attr_accessor :output_schema
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'attachment_id' => :'attachmentId',
30
+ :'instructions' => :'instructions',
31
+ :'output_schema' => :'outputSchema'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'attachment_id' => :'String',
39
+ :'instructions' => :'String',
40
+ :'output_schema' => :'StructuredOutputSchema'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::GenerateStructuredContentAttachmentOptions` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::GenerateStructuredContentAttachmentOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'attachment_id')
66
+ self.attachment_id = attributes[:'attachment_id']
67
+ end
68
+
69
+ if attributes.key?(:'instructions')
70
+ self.instructions = attributes[:'instructions']
71
+ end
72
+
73
+ if attributes.key?(:'output_schema')
74
+ self.output_schema = attributes[:'output_schema']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @attachment_id.nil?
83
+ invalid_properties.push('invalid value for "attachment_id", attachment_id cannot be nil.')
84
+ end
85
+
86
+ if @output_schema.nil?
87
+ invalid_properties.push('invalid value for "output_schema", output_schema cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return false if @attachment_id.nil?
97
+ return false if @output_schema.nil?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ attachment_id == o.attachment_id &&
107
+ instructions == o.instructions &&
108
+ output_schema == o.output_schema
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [attachment_id, instructions, output_schema].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ MailSlurpClient.const_get(type).build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end
@@ -19,10 +19,10 @@ module MailSlurpClient
19
19
 
20
20
  attr_accessor :pageable
21
21
 
22
- attr_accessor :total_elements
23
-
24
22
  attr_accessor :total_pages
25
23
 
24
+ attr_accessor :total_elements
25
+
26
26
  attr_accessor :last
27
27
 
28
28
  attr_accessor :number_of_elements
@@ -42,8 +42,8 @@ module MailSlurpClient
42
42
  {
43
43
  :'content' => :'content',
44
44
  :'pageable' => :'pageable',
45
- :'total_elements' => :'totalElements',
46
45
  :'total_pages' => :'totalPages',
46
+ :'total_elements' => :'totalElements',
47
47
  :'last' => :'last',
48
48
  :'number_of_elements' => :'numberOfElements',
49
49
  :'first' => :'first',
@@ -59,8 +59,8 @@ module MailSlurpClient
59
59
  {
60
60
  :'content' => :'Array<AliasProjection>',
61
61
  :'pageable' => :'PageableObject',
62
- :'total_elements' => :'Integer',
63
62
  :'total_pages' => :'Integer',
63
+ :'total_elements' => :'Integer',
64
64
  :'last' => :'Boolean',
65
65
  :'number_of_elements' => :'Integer',
66
66
  :'first' => :'Boolean',
@@ -102,14 +102,14 @@ module MailSlurpClient
102
102
  self.pageable = attributes[:'pageable']
103
103
  end
104
104
 
105
- if attributes.key?(:'total_elements')
106
- self.total_elements = attributes[:'total_elements']
107
- end
108
-
109
105
  if attributes.key?(:'total_pages')
110
106
  self.total_pages = attributes[:'total_pages']
111
107
  end
112
108
 
109
+ if attributes.key?(:'total_elements')
110
+ self.total_elements = attributes[:'total_elements']
111
+ end
112
+
113
113
  if attributes.key?(:'last')
114
114
  self.last = attributes[:'last']
115
115
  end
@@ -143,22 +143,22 @@ module MailSlurpClient
143
143
  # @return Array for valid properties with the reasons
144
144
  def list_invalid_properties
145
145
  invalid_properties = Array.new
146
- if @total_elements.nil?
147
- invalid_properties.push('invalid value for "total_elements", total_elements cannot be nil.')
148
- end
149
-
150
146
  if @total_pages.nil?
151
147
  invalid_properties.push('invalid value for "total_pages", total_pages cannot be nil.')
152
148
  end
153
149
 
150
+ if @total_elements.nil?
151
+ invalid_properties.push('invalid value for "total_elements", total_elements cannot be nil.')
152
+ end
153
+
154
154
  invalid_properties
155
155
  end
156
156
 
157
157
  # Check to see if the all the properties in the model are valid
158
158
  # @return true if the model is valid
159
159
  def valid?
160
- return false if @total_elements.nil?
161
160
  return false if @total_pages.nil?
161
+ return false if @total_elements.nil?
162
162
  true
163
163
  end
164
164
 
@@ -169,8 +169,8 @@ module MailSlurpClient
169
169
  self.class == o.class &&
170
170
  content == o.content &&
171
171
  pageable == o.pageable &&
172
- total_elements == o.total_elements &&
173
172
  total_pages == o.total_pages &&
173
+ total_elements == o.total_elements &&
174
174
  last == o.last &&
175
175
  number_of_elements == o.number_of_elements &&
176
176
  first == o.first &&
@@ -189,7 +189,7 @@ module MailSlurpClient
189
189
  # Calculates hash code according to all attributes.
190
190
  # @return [Integer] Hash code
191
191
  def hash
192
- [content, pageable, total_elements, total_pages, last, number_of_elements, first, size, number, sort, empty].hash
192
+ [content, pageable, total_pages, total_elements, last, number_of_elements, first, size, number, sort, empty].hash
193
193
  end
194
194
 
195
195
  # Builds the object from hash