mailslurp_client 15.21.1 → 16.0.2
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.
- checksums.yaml +4 -4
- data/lib/mailslurp_client/api/ai_controller_api.rb +86 -0
- data/lib/mailslurp_client/api/phone_controller_api.rb +20 -6
- data/lib/mailslurp_client/models/email_projection.rb +11 -11
- data/lib/mailslurp_client/models/email_thread_projection.rb +16 -16
- data/lib/mailslurp_client/models/generate_structured_content_email_options.rb +281 -0
- data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +18 -18
- data/lib/mailslurp_client/models/sent_email_projection.rb +21 -21
- data/lib/mailslurp_client/models/structured_content_result.rb +211 -0
- data/lib/mailslurp_client/models/structured_output_schema.rb +533 -0
- data/lib/mailslurp_client/version.rb +1 -1
- data/lib/mailslurp_client.rb +4 -1
- metadata +6 -3
- data/lib/mailslurp_client/api/sse_controller_api.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8418a224ac9130e45b67e5dae9ecf460fee1ef4cbe130ca08ead41e60b1552fb
|
4
|
+
data.tar.gz: 531ff9cf7c5b6a9ee4416ccdd15aa863ed0760034827dc05bfc30df66ddd383f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99f2e4bbd21a7698260a6619bb96a9292f5ebc2f1a4b94b82be8d1f8d8d39429f044d77dd2f3be57cb549b6fc637507318dd4efa539bf1fb1b4d315b10f8f53b
|
7
|
+
data.tar.gz: c64551c1eb51d5f730406bc98c1d4da01d841634b0251dd9205c9f012ca03f65ce8e850302e5424e1b5147da6fc66c81efafdaca1bb2d2d3384372e788343095
|
@@ -0,0 +1,86 @@
|
|
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 'cgi'
|
14
|
+
|
15
|
+
module MailSlurpClient
|
16
|
+
class AIControllerApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Generate structured content for an email
|
23
|
+
# Use output schemas to extract data from an email using AI
|
24
|
+
# @param generate_structured_content_email_options [GenerateStructuredContentEmailOptions]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [StructuredContentResult]
|
27
|
+
def generate_structured_content_from_email(generate_structured_content_email_options, opts = {})
|
28
|
+
data, _status_code, _headers = generate_structured_content_from_email_with_http_info(generate_structured_content_email_options, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Generate structured content for an email
|
33
|
+
# Use output schemas to extract data from an email using AI
|
34
|
+
# @param generate_structured_content_email_options [GenerateStructuredContentEmailOptions]
|
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_email_with_http_info(generate_structured_content_email_options, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: AIControllerApi.generate_structured_content_from_email ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'generate_structured_content_email_options' is set
|
42
|
+
if @api_client.config.client_side_validation && generate_structured_content_email_options.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'generate_structured_content_email_options' when calling AIControllerApi.generate_structured_content_from_email"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/ai/structured-content/email'
|
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_email_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_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -711,26 +711,33 @@ module MailSlurpClient
|
|
711
711
|
|
712
712
|
# Get a phone number by name
|
713
713
|
# Get a phone number by name
|
714
|
+
# @param name [String]
|
714
715
|
# @param [Hash] opts the optional parameters
|
715
716
|
# @return [PhoneNumberDto]
|
716
|
-
def get_phone_number_by_name(opts = {})
|
717
|
-
data, _status_code, _headers = get_phone_number_by_name_with_http_info(opts)
|
717
|
+
def get_phone_number_by_name(name, opts = {})
|
718
|
+
data, _status_code, _headers = get_phone_number_by_name_with_http_info(name, opts)
|
718
719
|
data
|
719
720
|
end
|
720
721
|
|
721
722
|
# Get a phone number by name
|
722
723
|
# Get a phone number by name
|
724
|
+
# @param name [String]
|
723
725
|
# @param [Hash] opts the optional parameters
|
724
726
|
# @return [Array<(PhoneNumberDto, Integer, Hash)>] PhoneNumberDto data, response status code and response headers
|
725
|
-
def get_phone_number_by_name_with_http_info(opts = {})
|
727
|
+
def get_phone_number_by_name_with_http_info(name, opts = {})
|
726
728
|
if @api_client.config.debugging
|
727
729
|
@api_client.config.logger.debug 'Calling API: PhoneControllerApi.get_phone_number_by_name ...'
|
728
730
|
end
|
731
|
+
# verify the required parameter 'name' is set
|
732
|
+
if @api_client.config.client_side_validation && name.nil?
|
733
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling PhoneControllerApi.get_phone_number_by_name"
|
734
|
+
end
|
729
735
|
# resource path
|
730
736
|
local_var_path = '/phone/numbers/by-name'
|
731
737
|
|
732
738
|
# query parameters
|
733
739
|
query_params = opts[:query_params] || {}
|
740
|
+
query_params[:'name'] = name
|
734
741
|
|
735
742
|
# header parameters
|
736
743
|
header_params = opts[:header_params] || {}
|
@@ -767,26 +774,33 @@ module MailSlurpClient
|
|
767
774
|
|
768
775
|
# Get a phone number by phone number
|
769
776
|
# Get a phone number by phone number
|
777
|
+
# @param phone_number [String]
|
770
778
|
# @param [Hash] opts the optional parameters
|
771
779
|
# @return [PhoneNumberDto]
|
772
|
-
def get_phone_number_by_phone_number(opts = {})
|
773
|
-
data, _status_code, _headers = get_phone_number_by_phone_number_with_http_info(opts)
|
780
|
+
def get_phone_number_by_phone_number(phone_number, opts = {})
|
781
|
+
data, _status_code, _headers = get_phone_number_by_phone_number_with_http_info(phone_number, opts)
|
774
782
|
data
|
775
783
|
end
|
776
784
|
|
777
785
|
# Get a phone number by phone number
|
778
786
|
# Get a phone number by phone number
|
787
|
+
# @param phone_number [String]
|
779
788
|
# @param [Hash] opts the optional parameters
|
780
789
|
# @return [Array<(PhoneNumberDto, Integer, Hash)>] PhoneNumberDto data, response status code and response headers
|
781
|
-
def get_phone_number_by_phone_number_with_http_info(opts = {})
|
790
|
+
def get_phone_number_by_phone_number_with_http_info(phone_number, opts = {})
|
782
791
|
if @api_client.config.debugging
|
783
792
|
@api_client.config.logger.debug 'Calling API: PhoneControllerApi.get_phone_number_by_phone_number ...'
|
784
793
|
end
|
794
|
+
# verify the required parameter 'phone_number' is set
|
795
|
+
if @api_client.config.client_side_validation && phone_number.nil?
|
796
|
+
fail ArgumentError, "Missing the required parameter 'phone_number' when calling PhoneControllerApi.get_phone_number_by_phone_number"
|
797
|
+
end
|
785
798
|
# resource path
|
786
799
|
local_var_path = '/phone/numbers/by-phone-number'
|
787
800
|
|
788
801
|
# query parameters
|
789
802
|
query_params = opts[:query_params] || {}
|
803
|
+
query_params[:'phoneNumber'] = phone_number
|
790
804
|
|
791
805
|
# header parameters
|
792
806
|
header_params = opts[:header_params] || {}
|
@@ -37,12 +37,12 @@ module MailSlurpClient
|
|
37
37
|
|
38
38
|
attr_accessor :favourite
|
39
39
|
|
40
|
+
attr_accessor :in_reply_to
|
41
|
+
|
40
42
|
attr_accessor :plus_address
|
41
43
|
|
42
44
|
attr_accessor :size_bytes
|
43
45
|
|
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',
|
80
81
|
:'plus_address' => :'plusAddress',
|
81
82
|
:'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',
|
110
111
|
:'plus_address' => :'String',
|
111
112
|
:'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',
|
137
138
|
:'plus_address',
|
138
139
|
:'size_bytes',
|
139
|
-
:'in_reply_to',
|
140
140
|
:'body_excerpt',
|
141
141
|
:'text_excerpt',
|
142
142
|
:'body_part_content_types',
|
@@ -214,6 +214,10 @@ 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
|
+
|
217
221
|
if attributes.key?(:'plus_address')
|
218
222
|
self.plus_address = attributes[:'plus_address']
|
219
223
|
end
|
@@ -222,10 +226,6 @@ module MailSlurpClient
|
|
222
226
|
self.size_bytes = attributes[:'size_bytes']
|
223
227
|
end
|
224
228
|
|
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 &&
|
331
332
|
plus_address == o.plus_address &&
|
332
333
|
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, plus_address, size_bytes,
|
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
|
356
356
|
end
|
357
357
|
|
358
358
|
# Builds the object from hash
|
@@ -43,9 +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
46
|
# Number of messages in the thread
|
50
47
|
attr_accessor :message_count
|
51
48
|
|
@@ -63,6 +60,9 @@ module MailSlurpClient
|
|
63
60
|
|
64
61
|
attr_accessor :last_sender
|
65
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
88
|
:'message_count' => :'messageCount',
|
90
89
|
:'last_body_excerpt' => :'lastBodyExcerpt',
|
91
90
|
:'last_text_excerpt' => :'lastTextExcerpt',
|
92
91
|
:'last_created_at' => :'lastCreatedAt',
|
93
92
|
:'last_from' => :'lastFrom',
|
94
93
|
:'last_sender' => :'lastSender',
|
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
114
|
:'message_count' => :'Integer',
|
116
115
|
:'last_body_excerpt' => :'String',
|
117
116
|
:'last_text_excerpt' => :'String',
|
118
117
|
:'last_created_at' => :'DateTime',
|
119
118
|
:'last_from' => :'String',
|
120
119
|
:'last_sender' => :'SenderProjection',
|
120
|
+
:'unread' => :'Boolean',
|
121
121
|
:'subject' => :'String',
|
122
122
|
:'id' => :'String',
|
123
123
|
:'from' => :'String'
|
@@ -191,10 +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
194
|
if attributes.key?(:'message_count')
|
199
195
|
self.message_count = attributes[:'message_count']
|
200
196
|
end
|
@@ -219,6 +215,10 @@ module MailSlurpClient
|
|
219
215
|
self.last_sender = attributes[:'last_sender']
|
220
216
|
end
|
221
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
303
|
message_count == o.message_count &&
|
305
304
|
last_body_excerpt == o.last_body_excerpt &&
|
306
305
|
last_text_excerpt == o.last_text_excerpt &&
|
307
306
|
last_created_at == o.last_created_at &&
|
308
307
|
last_from == o.last_from &&
|
309
308
|
last_sender == o.last_sender &&
|
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,
|
324
|
+
[sender, recipients, user_id, inbox_id, updated_at, created_at, to, cc, bcc, has_attachments, message_count, last_body_excerpt, last_text_excerpt, last_created_at, last_from, last_sender, unread, subject, id, from].hash
|
325
325
|
end
|
326
326
|
|
327
327
|
# Builds the object from hash
|
@@ -0,0 +1,281 @@
|
|
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 email
|
17
|
+
class GenerateStructuredContentEmailOptions
|
18
|
+
# Email ID to read and pass to AI
|
19
|
+
attr_accessor :email_id
|
20
|
+
|
21
|
+
# Content selector to select part of email to operate on
|
22
|
+
attr_accessor :content_selector
|
23
|
+
|
24
|
+
# Optional instructions for the AI to follow. Try to be precise and clear. You can include examples and hints.
|
25
|
+
attr_accessor :instructions
|
26
|
+
|
27
|
+
attr_accessor :output_schema
|
28
|
+
|
29
|
+
class EnumAttributeValidator
|
30
|
+
attr_reader :datatype
|
31
|
+
attr_reader :allowable_values
|
32
|
+
|
33
|
+
def initialize(datatype, allowable_values)
|
34
|
+
@allowable_values = allowable_values.map do |value|
|
35
|
+
case datatype.to_s
|
36
|
+
when /Integer/i
|
37
|
+
value.to_i
|
38
|
+
when /Float/i
|
39
|
+
value.to_f
|
40
|
+
else
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def valid?(value)
|
47
|
+
!value || allowable_values.include?(value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'email_id' => :'emailId',
|
55
|
+
:'content_selector' => :'contentSelector',
|
56
|
+
:'instructions' => :'instructions',
|
57
|
+
:'output_schema' => :'outputSchema'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Attribute type mapping.
|
62
|
+
def self.openapi_types
|
63
|
+
{
|
64
|
+
:'email_id' => :'String',
|
65
|
+
:'content_selector' => :'String',
|
66
|
+
:'instructions' => :'String',
|
67
|
+
:'output_schema' => :'StructuredOutputSchema'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of attributes with nullable: true
|
72
|
+
def self.openapi_nullable
|
73
|
+
Set.new([
|
74
|
+
])
|
75
|
+
end
|
76
|
+
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
|
+
def initialize(attributes = {})
|
80
|
+
if (!attributes.is_a?(Hash))
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::GenerateStructuredContentEmailOptions` initialize method"
|
82
|
+
end
|
83
|
+
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
86
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
87
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::GenerateStructuredContentEmailOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
88
|
+
end
|
89
|
+
h[k.to_sym] = v
|
90
|
+
}
|
91
|
+
|
92
|
+
if attributes.key?(:'email_id')
|
93
|
+
self.email_id = attributes[:'email_id']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'content_selector')
|
97
|
+
self.content_selector = attributes[:'content_selector']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'instructions')
|
101
|
+
self.instructions = attributes[:'instructions']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'output_schema')
|
105
|
+
self.output_schema = attributes[:'output_schema']
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
110
|
+
# @return Array for valid properties with the reasons
|
111
|
+
def list_invalid_properties
|
112
|
+
invalid_properties = Array.new
|
113
|
+
if @email_id.nil?
|
114
|
+
invalid_properties.push('invalid value for "email_id", email_id cannot be nil.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if @output_schema.nil?
|
118
|
+
invalid_properties.push('invalid value for "output_schema", output_schema cannot be nil.')
|
119
|
+
end
|
120
|
+
|
121
|
+
invalid_properties
|
122
|
+
end
|
123
|
+
|
124
|
+
# Check to see if the all the properties in the model are valid
|
125
|
+
# @return true if the model is valid
|
126
|
+
def valid?
|
127
|
+
return false if @email_id.nil?
|
128
|
+
content_selector_validator = EnumAttributeValidator.new('String', ["RAW", "BODY"])
|
129
|
+
return false unless content_selector_validator.valid?(@content_selector)
|
130
|
+
return false if @output_schema.nil?
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
# Custom attribute writer method checking allowed values (enum).
|
135
|
+
# @param [Object] content_selector Object to be assigned
|
136
|
+
def content_selector=(content_selector)
|
137
|
+
validator = EnumAttributeValidator.new('String', ["RAW", "BODY"])
|
138
|
+
unless validator.valid?(content_selector)
|
139
|
+
fail ArgumentError, "invalid value for \"content_selector\", must be one of #{validator.allowable_values}."
|
140
|
+
end
|
141
|
+
@content_selector = content_selector
|
142
|
+
end
|
143
|
+
|
144
|
+
# Checks equality by comparing each attribute.
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def ==(o)
|
147
|
+
return true if self.equal?(o)
|
148
|
+
self.class == o.class &&
|
149
|
+
email_id == o.email_id &&
|
150
|
+
content_selector == o.content_selector &&
|
151
|
+
instructions == o.instructions &&
|
152
|
+
output_schema == o.output_schema
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def eql?(o)
|
158
|
+
self == o
|
159
|
+
end
|
160
|
+
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Integer] Hash code
|
163
|
+
def hash
|
164
|
+
[email_id, content_selector, instructions, output_schema].hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Builds the object from hash
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
+
# @return [Object] Returns the model itself
|
170
|
+
def self.build_from_hash(attributes)
|
171
|
+
new.build_from_hash(attributes)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Builds the object from hash
|
175
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
176
|
+
# @return [Object] Returns the model itself
|
177
|
+
def build_from_hash(attributes)
|
178
|
+
return nil unless attributes.is_a?(Hash)
|
179
|
+
self.class.openapi_types.each_pair do |key, type|
|
180
|
+
if type =~ /\AArray<(.*)>/i
|
181
|
+
# check to ensure the input is an array given that the attribute
|
182
|
+
# is documented as an array but the input is not
|
183
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
184
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
185
|
+
end
|
186
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
187
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
188
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
189
|
+
end
|
190
|
+
|
191
|
+
self
|
192
|
+
end
|
193
|
+
|
194
|
+
# Deserializes the data based on type
|
195
|
+
# @param string type Data type
|
196
|
+
# @param string value Value to be deserialized
|
197
|
+
# @return [Object] Deserialized data
|
198
|
+
def _deserialize(type, value)
|
199
|
+
case type.to_sym
|
200
|
+
when :DateTime
|
201
|
+
DateTime.parse(value)
|
202
|
+
when :Date
|
203
|
+
Date.parse(value)
|
204
|
+
when :String
|
205
|
+
value.to_s
|
206
|
+
when :Integer
|
207
|
+
value.to_i
|
208
|
+
when :Float
|
209
|
+
value.to_f
|
210
|
+
when :Boolean
|
211
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
212
|
+
true
|
213
|
+
else
|
214
|
+
false
|
215
|
+
end
|
216
|
+
when :Object
|
217
|
+
# generic object (usually a Hash), return directly
|
218
|
+
value
|
219
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
220
|
+
inner_type = Regexp.last_match[:inner_type]
|
221
|
+
value.map { |v| _deserialize(inner_type, v) }
|
222
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
223
|
+
k_type = Regexp.last_match[:k_type]
|
224
|
+
v_type = Regexp.last_match[:v_type]
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each do |k, v|
|
227
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
else # model
|
231
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns the string representation of the object
|
236
|
+
# @return [String] String presentation of the object
|
237
|
+
def to_s
|
238
|
+
to_hash.to_s
|
239
|
+
end
|
240
|
+
|
241
|
+
# to_body is an alias to to_hash (backward compatibility)
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
243
|
+
def to_body
|
244
|
+
to_hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Returns the object in the form of hash
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
249
|
+
def to_hash
|
250
|
+
hash = {}
|
251
|
+
self.class.attribute_map.each_pair do |attr, param|
|
252
|
+
value = self.send(attr)
|
253
|
+
if value.nil?
|
254
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
255
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
256
|
+
end
|
257
|
+
|
258
|
+
hash[param] = _to_hash(value)
|
259
|
+
end
|
260
|
+
hash
|
261
|
+
end
|
262
|
+
|
263
|
+
# Outputs non-array value in the form of hash
|
264
|
+
# For object, use to_hash. Otherwise, just return the value
|
265
|
+
# @param [Object] value Any valid value
|
266
|
+
# @return [Hash] Returns the value in the form of hash
|
267
|
+
def _to_hash(value)
|
268
|
+
if value.is_a?(Array)
|
269
|
+
value.compact.map { |v| _to_hash(v) }
|
270
|
+
elsif value.is_a?(Hash)
|
271
|
+
{}.tap do |hash|
|
272
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
273
|
+
end
|
274
|
+
elsif value.respond_to? :to_hash
|
275
|
+
value.to_hash
|
276
|
+
else
|
277
|
+
value
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|