mailslurp_client 5.0.0 → 7.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.md +127 -40
  4. data/docs/AttachmentControllerApi.md +124 -0
  5. data/docs/AttachmentMetaData.md +23 -0
  6. data/docs/BasicAuthOptions.md +10 -0
  7. data/docs/BulkActionsControllerApi.md +165 -0
  8. data/docs/BulkSendEmailOptions.md +11 -1
  9. data/docs/CommonActionsControllerApi.md +167 -0
  10. data/docs/ContactControllerApi.md +274 -0
  11. data/docs/ContactDto.md +31 -0
  12. data/docs/ContactProjection.md +27 -0
  13. data/docs/CreateContactOptions.md +31 -0
  14. data/docs/CreateDomainOptions.md +17 -0
  15. data/docs/CreateGroupOptions.md +19 -0
  16. data/docs/CreateTemplateOptions.md +19 -0
  17. data/docs/CreateWebhookOptions.md +13 -2
  18. data/docs/DomainControllerApi.md +223 -0
  19. data/docs/DomainDto.md +29 -0
  20. data/docs/DomainPreview.md +21 -0
  21. data/docs/Email.md +40 -15
  22. data/docs/EmailAnalysis.md +18 -5
  23. data/docs/EmailControllerApi.md +740 -0
  24. data/docs/EmailPreview.md +24 -6
  25. data/docs/EmailProjection.md +33 -0
  26. data/docs/ForwardEmailOptions.md +12 -0
  27. data/docs/GroupContactsDto.md +19 -0
  28. data/docs/GroupControllerApi.md +437 -0
  29. data/docs/GroupDto.md +23 -0
  30. data/docs/GroupProjection.md +23 -0
  31. data/docs/HTMLValidationResult.md +21 -0
  32. data/docs/Inbox.md +26 -4
  33. data/docs/InboxControllerApi.md +652 -0
  34. data/docs/InboxProjection.md +29 -0
  35. data/docs/JsonNode.md +59 -0
  36. data/docs/MatchOption.md +13 -2
  37. data/docs/MatchOptions.md +9 -0
  38. data/docs/PageContactProjection.md +37 -0
  39. data/docs/PageEmailPreview.md +37 -0
  40. data/docs/PageEmailProjection.md +37 -0
  41. data/docs/PageGroupProjection.md +37 -0
  42. data/docs/PageInboxProjection.md +37 -0
  43. data/docs/PageTemplateProjection.md +37 -0
  44. data/docs/PageWebhookProjection.md +37 -0
  45. data/docs/Pageable.md +27 -0
  46. data/docs/RawEmailJson.md +17 -0
  47. data/docs/SendEmailOptions.md +33 -6
  48. data/docs/SetInboxFavouritedOptions.md +17 -0
  49. data/docs/Sort.md +21 -0
  50. data/docs/TemplateControllerApi.md +274 -0
  51. data/docs/TemplateDto.md +25 -0
  52. data/docs/TemplateProjection.md +25 -0
  53. data/docs/TemplateVariable.md +19 -0
  54. data/docs/UnreadCount.md +17 -0
  55. data/docs/UpdateGroupContacts.md +17 -0
  56. data/docs/UpdateInboxOptions.md +25 -0
  57. data/docs/UploadAttachmentOptions.md +12 -1
  58. data/docs/ValidationDto.md +19 -0
  59. data/docs/ValidationMessage.md +19 -0
  60. data/docs/WaitForConditions.md +29 -0
  61. data/docs/WaitForControllerApi.md +317 -0
  62. data/docs/WebhookControllerApi.md +339 -0
  63. data/docs/WebhookDto.md +33 -0
  64. data/docs/WebhookProjection.md +27 -0
  65. data/docs/WebhookTestRequest.md +23 -0
  66. data/docs/WebhookTestResponse.md +19 -0
  67. data/docs/WebhookTestResult.md +21 -0
  68. data/git_push.sh +10 -7
  69. data/lib/mailslurp_client.rb +56 -7
  70. data/lib/mailslurp_client/api/attachment_controller_api.rb +157 -0
  71. data/lib/mailslurp_client/api/bulk_actions_controller_api.rb +203 -0
  72. data/lib/mailslurp_client/api/common_actions_controller_api.rb +201 -0
  73. data/lib/mailslurp_client/api/contact_controller_api.rb +323 -0
  74. data/lib/mailslurp_client/api/domain_controller_api.rb +264 -0
  75. data/lib/mailslurp_client/api/email_controller_api.rb +852 -0
  76. data/lib/mailslurp_client/api/group_controller_api.rb +519 -0
  77. data/lib/mailslurp_client/api/inbox_controller_api.rb +763 -0
  78. data/lib/mailslurp_client/api/template_controller_api.rb +323 -0
  79. data/lib/mailslurp_client/api/wait_for_controller_api.rb +359 -0
  80. data/lib/mailslurp_client/api/webhook_controller_api.rb +405 -0
  81. data/lib/mailslurp_client/api_client.rb +36 -39
  82. data/lib/mailslurp_client/api_error.rb +23 -4
  83. data/lib/mailslurp_client/configuration.rb +8 -11
  84. data/lib/mailslurp_client/models/attachment_meta_data.rb +253 -0
  85. data/lib/mailslurp_client/models/basic_auth_options.rb +39 -15
  86. data/lib/mailslurp_client/models/bulk_send_email_options.rb +42 -19
  87. data/lib/mailslurp_client/models/contact_dto.rb +288 -0
  88. data/lib/mailslurp_client/models/contact_projection.rb +261 -0
  89. data/lib/mailslurp_client/models/create_contact_options.rb +277 -0
  90. data/lib/mailslurp_client/models/create_domain_options.rb +208 -0
  91. data/lib/mailslurp_client/models/create_group_options.rb +220 -0
  92. data/lib/mailslurp_client/models/create_template_options.rb +225 -0
  93. data/lib/mailslurp_client/models/create_webhook_options.rb +54 -29
  94. data/lib/mailslurp_client/models/domain_dto.rb +296 -0
  95. data/lib/mailslurp_client/models/domain_preview.rb +240 -0
  96. data/lib/mailslurp_client/models/email.rb +86 -78
  97. data/lib/mailslurp_client/models/email_analysis.rb +46 -48
  98. data/lib/mailslurp_client/models/email_preview.rb +77 -41
  99. data/lib/mailslurp_client/models/email_projection.rb +306 -0
  100. data/lib/mailslurp_client/models/forward_email_options.rb +40 -17
  101. data/lib/mailslurp_client/models/group_contacts_dto.rb +227 -0
  102. data/lib/mailslurp_client/models/{webhook.rb → group_dto.rb} +60 -54
  103. data/lib/mailslurp_client/models/group_projection.rb +248 -0
  104. data/lib/mailslurp_client/models/html_validation_result.rb +243 -0
  105. data/lib/mailslurp_client/models/inbox.rb +104 -26
  106. data/lib/mailslurp_client/models/inbox_projection.rb +272 -0
  107. data/lib/mailslurp_client/models/json_node.rb +429 -0
  108. data/lib/mailslurp_client/models/match_option.rb +48 -24
  109. data/lib/mailslurp_client/models/match_options.rb +37 -14
  110. data/lib/mailslurp_client/models/page_contact_projection.rb +298 -0
  111. data/lib/mailslurp_client/models/page_email_preview.rb +298 -0
  112. data/lib/mailslurp_client/models/page_email_projection.rb +298 -0
  113. data/lib/mailslurp_client/models/page_group_projection.rb +298 -0
  114. data/lib/mailslurp_client/models/page_inbox_projection.rb +298 -0
  115. data/lib/mailslurp_client/models/page_template_projection.rb +298 -0
  116. data/lib/mailslurp_client/models/page_webhook_projection.rb +298 -0
  117. data/lib/mailslurp_client/models/pageable.rb +251 -0
  118. data/lib/mailslurp_client/models/raw_email_json.rb +211 -0
  119. data/lib/mailslurp_client/models/send_email_options.rb +141 -46
  120. data/lib/mailslurp_client/models/set_inbox_favourited_options.rb +208 -0
  121. data/lib/mailslurp_client/models/sort.rb +224 -0
  122. data/lib/mailslurp_client/models/template_dto.rb +269 -0
  123. data/lib/mailslurp_client/models/template_projection.rb +269 -0
  124. data/lib/mailslurp_client/models/template_variable.rb +259 -0
  125. data/lib/mailslurp_client/models/unread_count.rb +211 -0
  126. data/lib/mailslurp_client/models/update_group_contacts.rb +213 -0
  127. data/lib/mailslurp_client/models/update_inbox_options.rb +250 -0
  128. data/lib/mailslurp_client/models/upload_attachment_options.rb +43 -20
  129. data/lib/mailslurp_client/models/validation_dto.rb +225 -0
  130. data/lib/mailslurp_client/models/validation_message.rb +220 -0
  131. data/lib/mailslurp_client/models/wait_for_conditions.rb +315 -0
  132. data/lib/mailslurp_client/models/webhook_dto.rb +326 -0
  133. data/lib/mailslurp_client/models/webhook_projection.rb +277 -0
  134. data/lib/mailslurp_client/models/webhook_test_request.rb +284 -0
  135. data/lib/mailslurp_client/models/webhook_test_response.rb +215 -0
  136. data/lib/mailslurp_client/models/webhook_test_result.rb +235 -0
  137. data/lib/mailslurp_client/version.rb +5 -5
  138. data/mailslurp_client.gemspec +4 -10
  139. data/spec/api/attachment_controller_api_spec.rb +61 -0
  140. data/spec/api/bulk_actions_controller_api_spec.rb +68 -0
  141. data/spec/api/common_actions_controller_api_spec.rb +129 -0
  142. data/spec/api/contact_controller_api_spec.rb +91 -0
  143. data/spec/api/domain_controller_api_spec.rb +82 -0
  144. data/spec/api/email_controller_api_spec.rb +162 -0
  145. data/spec/api/group_controller_api_spec.rb +126 -0
  146. data/spec/api/inbox_controller_api_spec.rb +172 -0
  147. data/spec/api/template_controller_api_spec.rb +91 -0
  148. data/spec/api/wait_for_controller_api_spec.rb +107 -0
  149. data/spec/api/webhook_controller_api_spec.rb +107 -0
  150. data/spec/api_client_spec.rb +5 -5
  151. data/spec/configuration_spec.rb +4 -4
  152. data/spec/models/attachment_meta_data_spec.rb +59 -0
  153. data/spec/models/basic_auth_options_spec.rb +4 -4
  154. data/spec/models/bulk_send_email_options_spec.rb +4 -4
  155. data/spec/models/contact_dto_spec.rb +83 -0
  156. data/spec/models/contact_projection_spec.rb +71 -0
  157. data/spec/models/create_contact_options_spec.rb +83 -0
  158. data/spec/models/create_domain_options_spec.rb +41 -0
  159. data/spec/models/create_group_options_spec.rb +47 -0
  160. data/spec/models/create_template_options_spec.rb +47 -0
  161. data/spec/models/create_webhook_options_spec.rb +6 -6
  162. data/spec/models/domain_dto_spec.rb +77 -0
  163. data/spec/models/domain_preview_spec.rb +53 -0
  164. data/spec/models/email_analysis_spec.rb +4 -4
  165. data/spec/models/email_preview_spec.rb +41 -5
  166. data/spec/models/email_projection_spec.rb +89 -0
  167. data/spec/models/email_spec.rb +17 -5
  168. data/spec/models/forward_email_options_spec.rb +4 -4
  169. data/spec/models/group_contacts_dto_spec.rb +47 -0
  170. data/spec/models/group_dto_spec.rb +59 -0
  171. data/spec/models/group_projection_spec.rb +59 -0
  172. data/spec/models/html_validation_result_spec.rb +53 -0
  173. data/spec/models/inbox_projection_spec.rb +77 -0
  174. data/spec/models/inbox_spec.rb +35 -5
  175. data/spec/models/json_node_spec.rb +171 -0
  176. data/spec/models/match_option_spec.rb +4 -4
  177. data/spec/models/match_options_spec.rb +4 -4
  178. data/spec/models/page_contact_projection_spec.rb +101 -0
  179. data/spec/models/page_email_preview_spec.rb +101 -0
  180. data/spec/models/page_email_projection_spec.rb +101 -0
  181. data/spec/models/page_group_projection_spec.rb +101 -0
  182. data/spec/models/page_inbox_projection_spec.rb +101 -0
  183. data/spec/models/page_template_projection_spec.rb +101 -0
  184. data/spec/models/page_webhook_projection_spec.rb +101 -0
  185. data/spec/models/pageable_spec.rb +71 -0
  186. data/spec/models/raw_email_json_spec.rb +41 -0
  187. data/spec/models/send_email_options_spec.rb +45 -5
  188. data/spec/models/set_inbox_favourited_options_spec.rb +41 -0
  189. data/spec/models/sort_spec.rb +53 -0
  190. data/spec/models/template_dto_spec.rb +65 -0
  191. data/spec/models/template_projection_spec.rb +65 -0
  192. data/spec/models/template_variable_spec.rb +51 -0
  193. data/spec/models/unread_count_spec.rb +41 -0
  194. data/spec/models/update_group_contacts_spec.rb +41 -0
  195. data/spec/models/{webhook_spec.rb → update_inbox_options_spec.rb} +14 -20
  196. data/spec/models/upload_attachment_options_spec.rb +4 -4
  197. data/spec/models/validation_dto_spec.rb +47 -0
  198. data/spec/models/validation_message_spec.rb +47 -0
  199. data/spec/models/wait_for_conditions_spec.rb +85 -0
  200. data/spec/models/webhook_dto_spec.rb +93 -0
  201. data/spec/models/webhook_projection_spec.rb +71 -0
  202. data/spec/models/webhook_test_request_spec.rb +63 -0
  203. data/spec/models/webhook_test_response_spec.rb +47 -0
  204. data/spec/models/webhook_test_result_spec.rb +53 -0
  205. data/spec/spec_helper.rb +4 -4
  206. metadata +223 -149
  207. data/Gemfile.lock +0 -79
  208. data/docs/CommonOperationsApi.md +0 -499
  209. data/docs/ExtraOperationsApi.md +0 -1021
  210. data/docs/Webhook.md +0 -13
  211. data/lib/mailslurp_client/api/common_operations_api.rb +0 -502
  212. data/lib/mailslurp_client/api/extra_operations_api.rb +0 -1054
  213. data/spec/api/common_operations_api_spec.rb +0 -95
  214. data/spec/api/extra_operations_api_spec.rb +0 -231
@@ -0,0 +1,264 @@
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: 67c9a1eda264be4cfe0bb2c76151f0aadf0862bc
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module MailSlurpClient
16
+ class DomainControllerApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Domain
23
+ # Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider's DNS setup to verify the domain.
24
+ # @param domain_options [CreateDomainOptions] domainOptions
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [DomainDto]
27
+ def create_domain(domain_options, opts = {})
28
+ data, _status_code, _headers = create_domain_with_http_info(domain_options, opts)
29
+ data
30
+ end
31
+
32
+ # Create Domain
33
+ # Link a domain that you own with MailSlurp so you can create email addresses using it. Endpoint returns DNS records used for validation. You must add these verification records to your host provider's DNS setup to verify the domain.
34
+ # @param domain_options [CreateDomainOptions] domainOptions
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(DomainDto, Integer, Hash)>] DomainDto data, response status code and response headers
37
+ def create_domain_with_http_info(domain_options, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: DomainControllerApi.create_domain ...'
40
+ end
41
+ # verify the required parameter 'domain_options' is set
42
+ if @api_client.config.client_side_validation && domain_options.nil?
43
+ fail ArgumentError, "Missing the required parameter 'domain_options' when calling DomainControllerApi.create_domain"
44
+ end
45
+ # resource path
46
+ local_var_path = '/domains'
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(['application/json'])
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(domain_options)
63
+
64
+ # return_type
65
+ return_type = opts[:return_type] || 'DomainDto'
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: DomainControllerApi#create_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Delete a domain
87
+ # Delete a domain. This will disable any existing inboxes that use this domain.
88
+ # @param id [String] id
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [nil]
91
+ def delete_domain(id, opts = {})
92
+ delete_domain_with_http_info(id, opts)
93
+ nil
94
+ end
95
+
96
+ # Delete a domain
97
+ # Delete a domain. This will disable any existing inboxes that use this domain.
98
+ # @param id [String] id
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
101
+ def delete_domain_with_http_info(id, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: DomainControllerApi.delete_domain ...'
104
+ end
105
+ # verify the required parameter 'id' is set
106
+ if @api_client.config.client_side_validation && id.nil?
107
+ fail ArgumentError, "Missing the required parameter 'id' when calling DomainControllerApi.delete_domain"
108
+ end
109
+ # resource path
110
+ local_var_path = '/domains/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+
118
+ # form parameters
119
+ form_params = opts[:form_params] || {}
120
+
121
+ # http body (model)
122
+ post_body = opts[:body]
123
+
124
+ # return_type
125
+ return_type = opts[:return_type]
126
+
127
+ # auth_names
128
+ auth_names = opts[:auth_names] || ['API_KEY']
129
+
130
+ new_options = opts.merge(
131
+ :header_params => header_params,
132
+ :query_params => query_params,
133
+ :form_params => form_params,
134
+ :body => post_body,
135
+ :auth_names => auth_names,
136
+ :return_type => return_type
137
+ )
138
+
139
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: DomainControllerApi#delete_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+
146
+ # Get a domain
147
+ # Returns domain verification status and tokens for a given domain
148
+ # @param id [String] id
149
+ # @param [Hash] opts the optional parameters
150
+ # @return [DomainDto]
151
+ def get_domain(id, opts = {})
152
+ data, _status_code, _headers = get_domain_with_http_info(id, opts)
153
+ data
154
+ end
155
+
156
+ # Get a domain
157
+ # Returns domain verification status and tokens for a given domain
158
+ # @param id [String] id
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [Array<(DomainDto, Integer, Hash)>] DomainDto data, response status code and response headers
161
+ def get_domain_with_http_info(id, opts = {})
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domain ...'
164
+ end
165
+ # verify the required parameter 'id' is set
166
+ if @api_client.config.client_side_validation && id.nil?
167
+ fail ArgumentError, "Missing the required parameter 'id' when calling DomainControllerApi.get_domain"
168
+ end
169
+ # resource path
170
+ local_var_path = '/domains/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
171
+
172
+ # query parameters
173
+ query_params = opts[:query_params] || {}
174
+
175
+ # header parameters
176
+ header_params = opts[:header_params] || {}
177
+ # HTTP header 'Accept' (if needed)
178
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
179
+
180
+ # form parameters
181
+ form_params = opts[:form_params] || {}
182
+
183
+ # http body (model)
184
+ post_body = opts[:body]
185
+
186
+ # return_type
187
+ return_type = opts[:return_type] || 'DomainDto'
188
+
189
+ # auth_names
190
+ auth_names = opts[:auth_names] || ['API_KEY']
191
+
192
+ new_options = opts.merge(
193
+ :header_params => header_params,
194
+ :query_params => query_params,
195
+ :form_params => form_params,
196
+ :body => post_body,
197
+ :auth_names => auth_names,
198
+ :return_type => return_type
199
+ )
200
+
201
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
202
+ if @api_client.config.debugging
203
+ @api_client.config.logger.debug "API called: DomainControllerApi#get_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
204
+ end
205
+ return data, status_code, headers
206
+ end
207
+
208
+ # Get domains
209
+ # List all custom domains you have created
210
+ # @param [Hash] opts the optional parameters
211
+ # @return [Array<DomainPreview>]
212
+ def get_domains(opts = {})
213
+ data, _status_code, _headers = get_domains_with_http_info(opts)
214
+ data
215
+ end
216
+
217
+ # Get domains
218
+ # List all custom domains you have created
219
+ # @param [Hash] opts the optional parameters
220
+ # @return [Array<(Array<DomainPreview>, Integer, Hash)>] Array<DomainPreview> data, response status code and response headers
221
+ def get_domains_with_http_info(opts = {})
222
+ if @api_client.config.debugging
223
+ @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domains ...'
224
+ end
225
+ # resource path
226
+ local_var_path = '/domains'
227
+
228
+ # query parameters
229
+ query_params = opts[:query_params] || {}
230
+
231
+ # header parameters
232
+ header_params = opts[:header_params] || {}
233
+ # HTTP header 'Accept' (if needed)
234
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
235
+
236
+ # form parameters
237
+ form_params = opts[:form_params] || {}
238
+
239
+ # http body (model)
240
+ post_body = opts[:body]
241
+
242
+ # return_type
243
+ return_type = opts[:return_type] || 'Array<DomainPreview>'
244
+
245
+ # auth_names
246
+ auth_names = opts[:auth_names] || ['API_KEY']
247
+
248
+ new_options = opts.merge(
249
+ :header_params => header_params,
250
+ :query_params => query_params,
251
+ :form_params => form_params,
252
+ :body => post_body,
253
+ :auth_names => auth_names,
254
+ :return_type => return_type
255
+ )
256
+
257
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
258
+ if @api_client.config.debugging
259
+ @api_client.config.logger.debug "API called: DomainControllerApi#get_domains\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
260
+ end
261
+ return data, status_code, headers
262
+ end
263
+ end
264
+ end
@@ -0,0 +1,852 @@
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: 67c9a1eda264be4cfe0bb2c76151f0aadf0862bc
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module MailSlurpClient
16
+ class EmailControllerApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete all emails
23
+ # Deletes all emails in your account. Be careful as emails cannot be recovered
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [nil]
26
+ def delete_all_emails(opts = {})
27
+ delete_all_emails_with_http_info(opts)
28
+ nil
29
+ end
30
+
31
+ # Delete all emails
32
+ # Deletes all emails in your account. Be careful as emails cannot be recovered
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
35
+ def delete_all_emails_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_all_emails ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/emails'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+
48
+ # form parameters
49
+ form_params = opts[:form_params] || {}
50
+
51
+ # http body (model)
52
+ post_body = opts[:body]
53
+
54
+ # return_type
55
+ return_type = opts[:return_type]
56
+
57
+ # auth_names
58
+ auth_names = opts[:auth_names] || ['API_KEY']
59
+
60
+ new_options = opts.merge(
61
+ :header_params => header_params,
62
+ :query_params => query_params,
63
+ :form_params => form_params,
64
+ :body => post_body,
65
+ :auth_names => auth_names,
66
+ :return_type => return_type
67
+ )
68
+
69
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "API called: EmailControllerApi#delete_all_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ end
73
+ return data, status_code, headers
74
+ end
75
+
76
+ # Delete an email
77
+ # Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.
78
+ # @param email_id [String] emailId
79
+ # @param [Hash] opts the optional parameters
80
+ # @return [nil]
81
+ def delete_email(email_id, opts = {})
82
+ delete_email_with_http_info(email_id, opts)
83
+ nil
84
+ end
85
+
86
+ # Delete an email
87
+ # Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.
88
+ # @param email_id [String] emailId
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
91
+ def delete_email_with_http_info(email_id, opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_email ...'
94
+ end
95
+ # verify the required parameter 'email_id' is set
96
+ if @api_client.config.client_side_validation && email_id.nil?
97
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.delete_email"
98
+ end
99
+ # resource path
100
+ local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
101
+
102
+ # query parameters
103
+ query_params = opts[:query_params] || {}
104
+
105
+ # header parameters
106
+ header_params = opts[:header_params] || {}
107
+
108
+ # form parameters
109
+ form_params = opts[:form_params] || {}
110
+
111
+ # http body (model)
112
+ post_body = opts[:body]
113
+
114
+ # return_type
115
+ return_type = opts[:return_type]
116
+
117
+ # auth_names
118
+ auth_names = opts[:auth_names] || ['API_KEY']
119
+
120
+ new_options = opts.merge(
121
+ :header_params => header_params,
122
+ :query_params => query_params,
123
+ :form_params => form_params,
124
+ :body => post_body,
125
+ :auth_names => auth_names,
126
+ :return_type => return_type
127
+ )
128
+
129
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
130
+ if @api_client.config.debugging
131
+ @api_client.config.logger.debug "API called: EmailControllerApi#delete_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
132
+ end
133
+ return data, status_code, headers
134
+ end
135
+
136
+ # Get email attachment bytes
137
+ # Returns the specified attachment for a given email as a byte stream (file download). You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
138
+ # @param attachment_id [String] attachmentId
139
+ # @param email_id [String] emailId
140
+ # @param [Hash] opts the optional parameters
141
+ # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser
142
+ # @return [String]
143
+ def download_attachment(attachment_id, email_id, opts = {})
144
+ data, _status_code, _headers = download_attachment_with_http_info(attachment_id, email_id, opts)
145
+ data
146
+ end
147
+
148
+ # Get email attachment bytes
149
+ # Returns the specified attachment for a given email as a byte stream (file download). You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
150
+ # @param attachment_id [String] attachmentId
151
+ # @param email_id [String] emailId
152
+ # @param [Hash] opts the optional parameters
153
+ # @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser
154
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
155
+ def download_attachment_with_http_info(attachment_id, email_id, opts = {})
156
+ if @api_client.config.debugging
157
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment ...'
158
+ end
159
+ # verify the required parameter 'attachment_id' is set
160
+ if @api_client.config.client_side_validation && attachment_id.nil?
161
+ fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment"
162
+ end
163
+ # verify the required parameter 'email_id' is set
164
+ if @api_client.config.client_side_validation && email_id.nil?
165
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment"
166
+ end
167
+ # resource path
168
+ local_var_path = '/emails/{emailId}/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
169
+
170
+ # query parameters
171
+ query_params = opts[:query_params] || {}
172
+ query_params[:'apiKey'] = opts[:'api_key'] if !opts[:'api_key'].nil?
173
+
174
+ # header parameters
175
+ header_params = opts[:header_params] || {}
176
+ # HTTP header 'Accept' (if needed)
177
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
178
+
179
+ # form parameters
180
+ form_params = opts[:form_params] || {}
181
+
182
+ # http body (model)
183
+ post_body = opts[:body]
184
+
185
+ # return_type
186
+ return_type = opts[:return_type] || 'String'
187
+
188
+ # auth_names
189
+ auth_names = opts[:auth_names] || ['API_KEY']
190
+
191
+ new_options = opts.merge(
192
+ :header_params => header_params,
193
+ :query_params => query_params,
194
+ :form_params => form_params,
195
+ :body => post_body,
196
+ :auth_names => auth_names,
197
+ :return_type => return_type
198
+ )
199
+
200
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
201
+ if @api_client.config.debugging
202
+ @api_client.config.logger.debug "API called: EmailControllerApi#download_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
203
+ end
204
+ return data, status_code, headers
205
+ end
206
+
207
+ # Forward email
208
+ # Forward an existing email to new recipients.
209
+ # @param email_id [String] emailId
210
+ # @param forward_email_options [ForwardEmailOptions] forwardEmailOptions
211
+ # @param [Hash] opts the optional parameters
212
+ # @return [nil]
213
+ def forward_email(email_id, forward_email_options, opts = {})
214
+ forward_email_with_http_info(email_id, forward_email_options, opts)
215
+ nil
216
+ end
217
+
218
+ # Forward email
219
+ # Forward an existing email to new recipients.
220
+ # @param email_id [String] emailId
221
+ # @param forward_email_options [ForwardEmailOptions] forwardEmailOptions
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
224
+ def forward_email_with_http_info(email_id, forward_email_options, opts = {})
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.forward_email ...'
227
+ end
228
+ # verify the required parameter 'email_id' is set
229
+ if @api_client.config.client_side_validation && email_id.nil?
230
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.forward_email"
231
+ end
232
+ # verify the required parameter 'forward_email_options' is set
233
+ if @api_client.config.client_side_validation && forward_email_options.nil?
234
+ fail ArgumentError, "Missing the required parameter 'forward_email_options' when calling EmailControllerApi.forward_email"
235
+ end
236
+ # resource path
237
+ local_var_path = '/emails/{emailId}/forward'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
238
+
239
+ # query parameters
240
+ query_params = opts[:query_params] || {}
241
+
242
+ # header parameters
243
+ header_params = opts[:header_params] || {}
244
+ # HTTP header 'Content-Type'
245
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
246
+
247
+ # form parameters
248
+ form_params = opts[:form_params] || {}
249
+
250
+ # http body (model)
251
+ post_body = opts[:body] || @api_client.object_to_http_body(forward_email_options)
252
+
253
+ # return_type
254
+ return_type = opts[:return_type]
255
+
256
+ # auth_names
257
+ auth_names = opts[:auth_names] || ['API_KEY']
258
+
259
+ new_options = opts.merge(
260
+ :header_params => header_params,
261
+ :query_params => query_params,
262
+ :form_params => form_params,
263
+ :body => post_body,
264
+ :auth_names => auth_names,
265
+ :return_type => return_type
266
+ )
267
+
268
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
269
+ if @api_client.config.debugging
270
+ @api_client.config.logger.debug "API called: EmailControllerApi#forward_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
271
+ end
272
+ return data, status_code, headers
273
+ end
274
+
275
+ # Get email attachment metadata
276
+ # Returns the metadata such as name and content-type for a given attachment and email.
277
+ # @param attachment_id [String] attachmentId
278
+ # @param email_id [String] emailId
279
+ # @param [Hash] opts the optional parameters
280
+ # @return [AttachmentMetaData]
281
+ def get_attachment_meta_data(attachment_id, email_id, opts = {})
282
+ data, _status_code, _headers = get_attachment_meta_data_with_http_info(attachment_id, email_id, opts)
283
+ data
284
+ end
285
+
286
+ # Get email attachment metadata
287
+ # Returns the metadata such as name and content-type for a given attachment and email.
288
+ # @param attachment_id [String] attachmentId
289
+ # @param email_id [String] emailId
290
+ # @param [Hash] opts the optional parameters
291
+ # @return [Array<(AttachmentMetaData, Integer, Hash)>] AttachmentMetaData data, response status code and response headers
292
+ def get_attachment_meta_data_with_http_info(attachment_id, email_id, opts = {})
293
+ if @api_client.config.debugging
294
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachment_meta_data ...'
295
+ end
296
+ # verify the required parameter 'attachment_id' is set
297
+ if @api_client.config.client_side_validation && attachment_id.nil?
298
+ fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.get_attachment_meta_data"
299
+ end
300
+ # verify the required parameter 'email_id' is set
301
+ if @api_client.config.client_side_validation && email_id.nil?
302
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachment_meta_data"
303
+ end
304
+ # resource path
305
+ local_var_path = '/emails/{emailId}/attachments/{attachmentId}/metadata'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
306
+
307
+ # query parameters
308
+ query_params = opts[:query_params] || {}
309
+
310
+ # header parameters
311
+ header_params = opts[:header_params] || {}
312
+ # HTTP header 'Accept' (if needed)
313
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
314
+
315
+ # form parameters
316
+ form_params = opts[:form_params] || {}
317
+
318
+ # http body (model)
319
+ post_body = opts[:body]
320
+
321
+ # return_type
322
+ return_type = opts[:return_type] || 'AttachmentMetaData'
323
+
324
+ # auth_names
325
+ auth_names = opts[:auth_names] || ['API_KEY']
326
+
327
+ new_options = opts.merge(
328
+ :header_params => header_params,
329
+ :query_params => query_params,
330
+ :form_params => form_params,
331
+ :body => post_body,
332
+ :auth_names => auth_names,
333
+ :return_type => return_type
334
+ )
335
+
336
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
337
+ if @api_client.config.debugging
338
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_attachment_meta_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
339
+ end
340
+ return data, status_code, headers
341
+ end
342
+
343
+ # Get all email attachment metadata
344
+ # Returns an array of attachment metadata such as name and content-type for a given email if present.
345
+ # @param email_id [String] emailId
346
+ # @param [Hash] opts the optional parameters
347
+ # @return [Array<AttachmentMetaData>]
348
+ def get_attachments(email_id, opts = {})
349
+ data, _status_code, _headers = get_attachments_with_http_info(email_id, opts)
350
+ data
351
+ end
352
+
353
+ # Get all email attachment metadata
354
+ # Returns an array of attachment metadata such as name and content-type for a given email if present.
355
+ # @param email_id [String] emailId
356
+ # @param [Hash] opts the optional parameters
357
+ # @return [Array<(Array<AttachmentMetaData>, Integer, Hash)>] Array<AttachmentMetaData> data, response status code and response headers
358
+ def get_attachments_with_http_info(email_id, opts = {})
359
+ if @api_client.config.debugging
360
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachments ...'
361
+ end
362
+ # verify the required parameter 'email_id' is set
363
+ if @api_client.config.client_side_validation && email_id.nil?
364
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachments"
365
+ end
366
+ # resource path
367
+ local_var_path = '/emails/{emailId}/attachments'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
368
+
369
+ # query parameters
370
+ query_params = opts[:query_params] || {}
371
+
372
+ # header parameters
373
+ header_params = opts[:header_params] || {}
374
+ # HTTP header 'Accept' (if needed)
375
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
376
+
377
+ # form parameters
378
+ form_params = opts[:form_params] || {}
379
+
380
+ # http body (model)
381
+ post_body = opts[:body]
382
+
383
+ # return_type
384
+ return_type = opts[:return_type] || 'Array<AttachmentMetaData>'
385
+
386
+ # auth_names
387
+ auth_names = opts[:auth_names] || ['API_KEY']
388
+
389
+ new_options = opts.merge(
390
+ :header_params => header_params,
391
+ :query_params => query_params,
392
+ :form_params => form_params,
393
+ :body => post_body,
394
+ :auth_names => auth_names,
395
+ :return_type => return_type
396
+ )
397
+
398
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
399
+ if @api_client.config.debugging
400
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
401
+ end
402
+ return data, status_code, headers
403
+ end
404
+
405
+ # Get email content
406
+ # Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints
407
+ # @param email_id [String] emailId
408
+ # @param [Hash] opts the optional parameters
409
+ # @option opts [Boolean] :decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance &#x60;&#x3D;D7&#x60;). This can be a pain for testing (default to false)
410
+ # @return [Email]
411
+ def get_email(email_id, opts = {})
412
+ data, _status_code, _headers = get_email_with_http_info(email_id, opts)
413
+ data
414
+ end
415
+
416
+ # Get email content
417
+ # Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints
418
+ # @param email_id [String] emailId
419
+ # @param [Hash] opts the optional parameters
420
+ # @option opts [Boolean] :decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance &#x60;&#x3D;D7&#x60;). This can be a pain for testing
421
+ # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers
422
+ def get_email_with_http_info(email_id, opts = {})
423
+ if @api_client.config.debugging
424
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email ...'
425
+ end
426
+ # verify the required parameter 'email_id' is set
427
+ if @api_client.config.client_side_validation && email_id.nil?
428
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email"
429
+ end
430
+ # resource path
431
+ local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
432
+
433
+ # query parameters
434
+ query_params = opts[:query_params] || {}
435
+ query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil?
436
+
437
+ # header parameters
438
+ header_params = opts[:header_params] || {}
439
+ # HTTP header 'Accept' (if needed)
440
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
441
+
442
+ # form parameters
443
+ form_params = opts[:form_params] || {}
444
+
445
+ # http body (model)
446
+ post_body = opts[:body]
447
+
448
+ # return_type
449
+ return_type = opts[:return_type] || 'Email'
450
+
451
+ # auth_names
452
+ auth_names = opts[:auth_names] || ['API_KEY']
453
+
454
+ new_options = opts.merge(
455
+ :header_params => header_params,
456
+ :query_params => query_params,
457
+ :form_params => form_params,
458
+ :body => post_body,
459
+ :auth_names => auth_names,
460
+ :return_type => return_type
461
+ )
462
+
463
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
464
+ if @api_client.config.debugging
465
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
466
+ end
467
+ return data, status_code, headers
468
+ end
469
+
470
+ # Get email content as HTML
471
+ # 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`
472
+ # @param email_id [String] emailId
473
+ # @param [Hash] opts the optional parameters
474
+ # @option opts [Boolean] :decode decode (default to false)
475
+ # @return [String]
476
+ def get_email_html(email_id, opts = {})
477
+ data, _status_code, _headers = get_email_html_with_http_info(email_id, opts)
478
+ data
479
+ end
480
+
481
+ # Get email content as HTML
482
+ # 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;
483
+ # @param email_id [String] emailId
484
+ # @param [Hash] opts the optional parameters
485
+ # @option opts [Boolean] :decode decode
486
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
487
+ def get_email_html_with_http_info(email_id, opts = {})
488
+ if @api_client.config.debugging
489
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html ...'
490
+ end
491
+ # verify the required parameter 'email_id' is set
492
+ if @api_client.config.client_side_validation && email_id.nil?
493
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html"
494
+ end
495
+ # resource path
496
+ local_var_path = '/emails/{emailId}/html'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
497
+
498
+ # query parameters
499
+ query_params = opts[:query_params] || {}
500
+ query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil?
501
+
502
+ # header parameters
503
+ header_params = opts[:header_params] || {}
504
+ # HTTP header 'Accept' (if needed)
505
+ header_params['Accept'] = @api_client.select_header_accept(['text/html'])
506
+
507
+ # form parameters
508
+ form_params = opts[:form_params] || {}
509
+
510
+ # http body (model)
511
+ post_body = opts[:body]
512
+
513
+ # return_type
514
+ return_type = opts[:return_type] || 'String'
515
+
516
+ # auth_names
517
+ auth_names = opts[:auth_names] || ['API_KEY']
518
+
519
+ new_options = opts.merge(
520
+ :header_params => header_params,
521
+ :query_params => query_params,
522
+ :form_params => form_params,
523
+ :body => post_body,
524
+ :auth_names => auth_names,
525
+ :return_type => return_type
526
+ )
527
+
528
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
529
+ if @api_client.config.debugging
530
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_email_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
531
+ end
532
+ return data, status_code, headers
533
+ end
534
+
535
+ # Get all emails
536
+ # 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
537
+ # @param [Hash] opts the optional parameters
538
+ # @option opts [Array<String>] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
539
+ # @option opts [Integer] :page Optional page index in email list pagination (default to 0)
540
+ # @option opts [Integer] :size Optional page size in email list pagination (default to 20)
541
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
542
+ # @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false)
543
+ # @return [PageEmailProjection]
544
+ def get_emails_paginated(opts = {})
545
+ data, _status_code, _headers = get_emails_paginated_with_http_info(opts)
546
+ data
547
+ end
548
+
549
+ # Get all emails
550
+ # 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
551
+ # @param [Hash] opts the optional parameters
552
+ # @option opts [Array<String>] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
553
+ # @option opts [Integer] :page Optional page index in email list pagination
554
+ # @option opts [Integer] :size Optional page size in email list pagination
555
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
556
+ # @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly
557
+ # @return [Array<(PageEmailProjection, Integer, Hash)>] PageEmailProjection data, response status code and response headers
558
+ def get_emails_paginated_with_http_info(opts = {})
559
+ if @api_client.config.debugging
560
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_emails_paginated ...'
561
+ end
562
+ allowable_values = ["ASC", "DESC"]
563
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
564
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
565
+ end
566
+ # resource path
567
+ local_var_path = '/emails'
568
+
569
+ # query parameters
570
+ query_params = opts[:query_params] || {}
571
+ query_params[:'inboxId'] = @api_client.build_collection_param(opts[:'inbox_id'], :multi) if !opts[:'inbox_id'].nil?
572
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
573
+ query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
574
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
575
+ query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
576
+
577
+ # header parameters
578
+ header_params = opts[:header_params] || {}
579
+ # HTTP header 'Accept' (if needed)
580
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
581
+
582
+ # form parameters
583
+ form_params = opts[:form_params] || {}
584
+
585
+ # http body (model)
586
+ post_body = opts[:body]
587
+
588
+ # return_type
589
+ return_type = opts[:return_type] || 'PageEmailProjection'
590
+
591
+ # auth_names
592
+ auth_names = opts[:auth_names] || ['API_KEY']
593
+
594
+ new_options = opts.merge(
595
+ :header_params => header_params,
596
+ :query_params => query_params,
597
+ :form_params => form_params,
598
+ :body => post_body,
599
+ :auth_names => auth_names,
600
+ :return_type => return_type
601
+ )
602
+
603
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
604
+ if @api_client.config.debugging
605
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_emails_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
606
+ end
607
+ return data, status_code, headers
608
+ end
609
+
610
+ # Get raw email string
611
+ # 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
612
+ # @param email_id [String] emailId
613
+ # @param [Hash] opts the optional parameters
614
+ # @return [String]
615
+ def get_raw_email_contents(email_id, opts = {})
616
+ data, _status_code, _headers = get_raw_email_contents_with_http_info(email_id, opts)
617
+ data
618
+ end
619
+
620
+ # Get raw email string
621
+ # 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
622
+ # @param email_id [String] emailId
623
+ # @param [Hash] opts the optional parameters
624
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
625
+ def get_raw_email_contents_with_http_info(email_id, opts = {})
626
+ if @api_client.config.debugging
627
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_contents ...'
628
+ end
629
+ # verify the required parameter 'email_id' is set
630
+ if @api_client.config.client_side_validation && email_id.nil?
631
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_contents"
632
+ end
633
+ # resource path
634
+ local_var_path = '/emails/{emailId}/raw'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
635
+
636
+ # query parameters
637
+ query_params = opts[:query_params] || {}
638
+
639
+ # header parameters
640
+ header_params = opts[:header_params] || {}
641
+ # HTTP header 'Accept' (if needed)
642
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain'])
643
+
644
+ # form parameters
645
+ form_params = opts[:form_params] || {}
646
+
647
+ # http body (model)
648
+ post_body = opts[:body]
649
+
650
+ # return_type
651
+ return_type = opts[:return_type] || 'String'
652
+
653
+ # auth_names
654
+ auth_names = opts[:auth_names] || ['API_KEY']
655
+
656
+ new_options = opts.merge(
657
+ :header_params => header_params,
658
+ :query_params => query_params,
659
+ :form_params => form_params,
660
+ :body => post_body,
661
+ :auth_names => auth_names,
662
+ :return_type => return_type
663
+ )
664
+
665
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
666
+ if @api_client.config.debugging
667
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_raw_email_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
668
+ end
669
+ return data, status_code, headers
670
+ end
671
+
672
+ # Get raw email in JSON
673
+ # Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response
674
+ # @param email_id [String] emailId
675
+ # @param [Hash] opts the optional parameters
676
+ # @return [RawEmailJson]
677
+ def get_raw_email_json(email_id, opts = {})
678
+ data, _status_code, _headers = get_raw_email_json_with_http_info(email_id, opts)
679
+ data
680
+ end
681
+
682
+ # Get raw email in JSON
683
+ # Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response
684
+ # @param email_id [String] emailId
685
+ # @param [Hash] opts the optional parameters
686
+ # @return [Array<(RawEmailJson, Integer, Hash)>] RawEmailJson data, response status code and response headers
687
+ def get_raw_email_json_with_http_info(email_id, opts = {})
688
+ if @api_client.config.debugging
689
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_json ...'
690
+ end
691
+ # verify the required parameter 'email_id' is set
692
+ if @api_client.config.client_side_validation && email_id.nil?
693
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_json"
694
+ end
695
+ # resource path
696
+ local_var_path = '/emails/{emailId}/raw/json'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
697
+
698
+ # query parameters
699
+ query_params = opts[:query_params] || {}
700
+
701
+ # header parameters
702
+ header_params = opts[:header_params] || {}
703
+ # HTTP header 'Accept' (if needed)
704
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
705
+
706
+ # form parameters
707
+ form_params = opts[:form_params] || {}
708
+
709
+ # http body (model)
710
+ post_body = opts[:body]
711
+
712
+ # return_type
713
+ return_type = opts[:return_type] || 'RawEmailJson'
714
+
715
+ # auth_names
716
+ auth_names = opts[:auth_names] || ['API_KEY']
717
+
718
+ new_options = opts.merge(
719
+ :header_params => header_params,
720
+ :query_params => query_params,
721
+ :form_params => form_params,
722
+ :body => post_body,
723
+ :auth_names => auth_names,
724
+ :return_type => return_type
725
+ )
726
+
727
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
728
+ if @api_client.config.debugging
729
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_raw_email_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
730
+ end
731
+ return data, status_code, headers
732
+ end
733
+
734
+ # Get unread email count
735
+ # Get number of emails unread
736
+ # @param [Hash] opts the optional parameters
737
+ # @return [UnreadCount]
738
+ def get_unread_email_count(opts = {})
739
+ data, _status_code, _headers = get_unread_email_count_with_http_info(opts)
740
+ data
741
+ end
742
+
743
+ # Get unread email count
744
+ # Get number of emails unread
745
+ # @param [Hash] opts the optional parameters
746
+ # @return [Array<(UnreadCount, Integer, Hash)>] UnreadCount data, response status code and response headers
747
+ def get_unread_email_count_with_http_info(opts = {})
748
+ if @api_client.config.debugging
749
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_unread_email_count ...'
750
+ end
751
+ # resource path
752
+ local_var_path = '/emails/unreadCount'
753
+
754
+ # query parameters
755
+ query_params = opts[:query_params] || {}
756
+
757
+ # header parameters
758
+ header_params = opts[:header_params] || {}
759
+ # HTTP header 'Accept' (if needed)
760
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
761
+
762
+ # form parameters
763
+ form_params = opts[:form_params] || {}
764
+
765
+ # http body (model)
766
+ post_body = opts[:body]
767
+
768
+ # return_type
769
+ return_type = opts[:return_type] || 'UnreadCount'
770
+
771
+ # auth_names
772
+ auth_names = opts[:auth_names] || ['API_KEY']
773
+
774
+ new_options = opts.merge(
775
+ :header_params => header_params,
776
+ :query_params => query_params,
777
+ :form_params => form_params,
778
+ :body => post_body,
779
+ :auth_names => auth_names,
780
+ :return_type => return_type
781
+ )
782
+
783
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
784
+ if @api_client.config.debugging
785
+ @api_client.config.logger.debug "API called: EmailControllerApi#get_unread_email_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
786
+ end
787
+ return data, status_code, headers
788
+ end
789
+
790
+ # Validate email
791
+ # Validate the HTML content of email if HTML is found. Considered valid if no HTML.
792
+ # @param email_id [String] emailId
793
+ # @param [Hash] opts the optional parameters
794
+ # @return [ValidationDto]
795
+ def validate_email(email_id, opts = {})
796
+ data, _status_code, _headers = validate_email_with_http_info(email_id, opts)
797
+ data
798
+ end
799
+
800
+ # Validate email
801
+ # Validate the HTML content of email if HTML is found. Considered valid if no HTML.
802
+ # @param email_id [String] emailId
803
+ # @param [Hash] opts the optional parameters
804
+ # @return [Array<(ValidationDto, Integer, Hash)>] ValidationDto data, response status code and response headers
805
+ def validate_email_with_http_info(email_id, opts = {})
806
+ if @api_client.config.debugging
807
+ @api_client.config.logger.debug 'Calling API: EmailControllerApi.validate_email ...'
808
+ end
809
+ # verify the required parameter 'email_id' is set
810
+ if @api_client.config.client_side_validation && email_id.nil?
811
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.validate_email"
812
+ end
813
+ # resource path
814
+ local_var_path = '/emails/{emailId}/validate'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
815
+
816
+ # query parameters
817
+ query_params = opts[:query_params] || {}
818
+
819
+ # header parameters
820
+ header_params = opts[:header_params] || {}
821
+ # HTTP header 'Accept' (if needed)
822
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
823
+
824
+ # form parameters
825
+ form_params = opts[:form_params] || {}
826
+
827
+ # http body (model)
828
+ post_body = opts[:body]
829
+
830
+ # return_type
831
+ return_type = opts[:return_type] || 'ValidationDto'
832
+
833
+ # auth_names
834
+ auth_names = opts[:auth_names] || ['API_KEY']
835
+
836
+ new_options = opts.merge(
837
+ :header_params => header_params,
838
+ :query_params => query_params,
839
+ :form_params => form_params,
840
+ :body => post_body,
841
+ :auth_names => auth_names,
842
+ :return_type => return_type
843
+ )
844
+
845
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
846
+ if @api_client.config.debugging
847
+ @api_client.config.logger.debug "API called: EmailControllerApi#validate_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
848
+ end
849
+ return data, status_code, headers
850
+ end
851
+ end
852
+ end