mailslurp_client 8.0.10 → 8.0.15

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 (90) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +7 -0
  3. data/README.md +123 -0
  4. data/SECURITY.md +4 -0
  5. data/SUPPORT.md +4 -0
  6. data/lib/mailslurp_client/api/alias_controller_api.rb +405 -0
  7. data/lib/mailslurp_client/api/attachment_controller_api.rb +160 -0
  8. data/lib/mailslurp_client/api/bulk_actions_controller_api.rb +203 -0
  9. data/lib/mailslurp_client/api/common_actions_controller_api.rb +257 -0
  10. data/lib/mailslurp_client/api/contact_controller_api.rb +323 -0
  11. data/lib/mailslurp_client/api/domain_controller_api.rb +264 -0
  12. data/lib/mailslurp_client/api/email_controller_api.rb +852 -0
  13. data/lib/mailslurp_client/api/form_controller_api.rb +104 -0
  14. data/lib/mailslurp_client/api/group_controller_api.rb +592 -0
  15. data/lib/mailslurp_client/api/inbox_controller_api.rb +897 -0
  16. data/lib/mailslurp_client/api/mail_server_controller_api.rb +146 -0
  17. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +152 -0
  18. data/lib/mailslurp_client/api/template_controller_api.rb +323 -0
  19. data/lib/mailslurp_client/api/wait_for_controller_api.rb +359 -0
  20. data/lib/mailslurp_client/api/webhook_controller_api.rb +405 -0
  21. data/lib/mailslurp_client/api_client.rb +388 -0
  22. data/lib/mailslurp_client/api_error.rb +57 -0
  23. data/lib/mailslurp_client/configuration.rb +248 -0
  24. data/lib/mailslurp_client/models/attachment_meta_data.rb +238 -0
  25. data/lib/mailslurp_client/models/basic_auth_options.rb +226 -0
  26. data/lib/mailslurp_client/models/bulk_send_email_options.rb +219 -0
  27. data/lib/mailslurp_client/models/contact_dto.rb +311 -0
  28. data/lib/mailslurp_client/models/contact_projection.rb +270 -0
  29. data/lib/mailslurp_client/models/create_anonymous_alias_options.rb +208 -0
  30. data/lib/mailslurp_client/models/create_contact_options.rb +277 -0
  31. data/lib/mailslurp_client/models/create_domain_options.rb +208 -0
  32. data/lib/mailslurp_client/models/create_group_options.rb +220 -0
  33. data/lib/mailslurp_client/models/create_owned_alias_options.rb +238 -0
  34. data/lib/mailslurp_client/models/create_template_options.rb +225 -0
  35. data/lib/mailslurp_client/models/create_webhook_options.rb +227 -0
  36. data/lib/mailslurp_client/models/describe_domain_options.rb +211 -0
  37. data/lib/mailslurp_client/models/describe_mail_server_domain_result.rb +237 -0
  38. data/lib/mailslurp_client/models/domain_dto.rb +296 -0
  39. data/lib/mailslurp_client/models/domain_preview.rb +240 -0
  40. data/lib/mailslurp_client/models/email.rb +386 -0
  41. data/lib/mailslurp_client/models/email_analysis.rb +248 -0
  42. data/lib/mailslurp_client/models/email_preview.rb +296 -0
  43. data/lib/mailslurp_client/models/email_projection.rb +325 -0
  44. data/lib/mailslurp_client/models/email_verification_result.rb +263 -0
  45. data/lib/mailslurp_client/models/forward_email_options.rb +244 -0
  46. data/lib/mailslurp_client/models/group_contacts_dto.rb +227 -0
  47. data/lib/mailslurp_client/models/group_dto.rb +248 -0
  48. data/lib/mailslurp_client/models/group_projection.rb +248 -0
  49. data/lib/mailslurp_client/models/html_validation_result.rb +244 -0
  50. data/lib/mailslurp_client/models/inbox.rb +290 -0
  51. data/lib/mailslurp_client/models/inbox_projection.rb +263 -0
  52. data/lib/mailslurp_client/models/match_option.rb +274 -0
  53. data/lib/mailslurp_client/models/match_options.rb +210 -0
  54. data/lib/mailslurp_client/models/model_alias.rb +284 -0
  55. data/lib/mailslurp_client/models/name_server_record.rb +254 -0
  56. data/lib/mailslurp_client/models/page_alias.rb +298 -0
  57. data/lib/mailslurp_client/models/page_contact_projection.rb +298 -0
  58. data/lib/mailslurp_client/models/page_email_preview.rb +298 -0
  59. data/lib/mailslurp_client/models/page_email_projection.rb +298 -0
  60. data/lib/mailslurp_client/models/page_group_projection.rb +298 -0
  61. data/lib/mailslurp_client/models/page_inbox_projection.rb +298 -0
  62. data/lib/mailslurp_client/models/page_sent_email_projection.rb +298 -0
  63. data/lib/mailslurp_client/models/page_template_projection.rb +298 -0
  64. data/lib/mailslurp_client/models/page_webhook_projection.rb +298 -0
  65. data/lib/mailslurp_client/models/pageable.rb +251 -0
  66. data/lib/mailslurp_client/models/raw_email_json.rb +211 -0
  67. data/lib/mailslurp_client/models/send_email_options.rb +392 -0
  68. data/lib/mailslurp_client/models/sent_email_dto.rb +351 -0
  69. data/lib/mailslurp_client/models/sent_email_projection.rb +344 -0
  70. data/lib/mailslurp_client/models/set_inbox_favourited_options.rb +208 -0
  71. data/lib/mailslurp_client/models/simple_send_email_options.rb +237 -0
  72. data/lib/mailslurp_client/models/sort.rb +224 -0
  73. data/lib/mailslurp_client/models/template_dto.rb +269 -0
  74. data/lib/mailslurp_client/models/template_projection.rb +269 -0
  75. data/lib/mailslurp_client/models/template_variable.rb +259 -0
  76. data/lib/mailslurp_client/models/unread_count.rb +211 -0
  77. data/lib/mailslurp_client/models/update_group_contacts.rb +213 -0
  78. data/lib/mailslurp_client/models/update_inbox_options.rb +250 -0
  79. data/lib/mailslurp_client/models/upload_attachment_options.rb +228 -0
  80. data/lib/mailslurp_client/models/validation_dto.rb +217 -0
  81. data/lib/mailslurp_client/models/validation_message.rb +220 -0
  82. data/lib/mailslurp_client/models/verify_email_address_options.rb +239 -0
  83. data/lib/mailslurp_client/models/wait_for_conditions.rb +316 -0
  84. data/lib/mailslurp_client/models/webhook_dto.rb +326 -0
  85. data/lib/mailslurp_client/models/webhook_projection.rb +277 -0
  86. data/lib/mailslurp_client/models/webhook_test_request.rb +284 -0
  87. data/lib/mailslurp_client/models/webhook_test_response.rb +215 -0
  88. data/lib/mailslurp_client/models/webhook_test_result.rb +235 -0
  89. data/lib/mailslurp_client/version.rb +15 -0
  90. metadata +90 -2
@@ -0,0 +1,359 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module MailSlurpClient
16
+ class WaitForControllerApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Wait for conditions to be met
23
+ # Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [WaitForConditions] :wait_for_conditions Conditions to wait for
26
+ # @return [Array<EmailPreview>]
27
+ def wait_for(opts = {})
28
+ data, _status_code, _headers = wait_for_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Wait for conditions to be met
33
+ # Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [WaitForConditions] :wait_for_conditions Conditions to wait for
36
+ # @return [Array<(Array<EmailPreview>, Integer, Hash)>] Array<EmailPreview> data, response status code and response headers
37
+ def wait_for_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/waitFor'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ # HTTP header 'Content-Type'
52
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'wait_for_conditions'])
59
+
60
+ # return_type
61
+ return_type = opts[:return_type] || 'Array<EmailPreview>'
62
+
63
+ # auth_names
64
+ auth_names = opts[:auth_names] || ['API_KEY']
65
+
66
+ new_options = opts.merge(
67
+ :header_params => header_params,
68
+ :query_params => query_params,
69
+ :form_params => form_params,
70
+ :body => post_body,
71
+ :auth_names => auth_names,
72
+ :return_type => return_type
73
+ )
74
+
75
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # Wait for and return count number of emails
83
+ # If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.
84
+ # @param [Hash] opts the optional parameters
85
+ # @option opts [Integer] :count Number of emails to wait for. Must be greater that 1
86
+ # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
87
+ # @option opts [Integer] :timeout Max milliseconds to wait
88
+ # @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
89
+ # @return [Array<EmailPreview>]
90
+ def wait_for_email_count(opts = {})
91
+ data, _status_code, _headers = wait_for_email_count_with_http_info(opts)
92
+ data
93
+ end
94
+
95
+ # Wait for and return count number of emails
96
+ # If inbox contains count or more emails at time of request then return count worth of emails. If not wait until the count is reached and return those or return an error if timeout is exceeded.
97
+ # @param [Hash] opts the optional parameters
98
+ # @option opts [Integer] :count Number of emails to wait for. Must be greater that 1
99
+ # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
100
+ # @option opts [Integer] :timeout Max milliseconds to wait
101
+ # @option opts [Boolean] :unread_only Optional filter for unread only
102
+ # @return [Array<(Array<EmailPreview>, Integer, Hash)>] Array<EmailPreview> data, response status code and response headers
103
+ def wait_for_email_count_with_http_info(opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_email_count ...'
106
+ end
107
+ # resource path
108
+ local_var_path = '/waitForEmailCount'
109
+
110
+ # query parameters
111
+ query_params = opts[:query_params] || {}
112
+ query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
113
+ query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
114
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
115
+ query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
116
+
117
+ # header parameters
118
+ header_params = opts[:header_params] || {}
119
+ # HTTP header 'Accept' (if needed)
120
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
121
+
122
+ # form parameters
123
+ form_params = opts[:form_params] || {}
124
+
125
+ # http body (model)
126
+ post_body = opts[:body]
127
+
128
+ # return_type
129
+ return_type = opts[:return_type] || 'Array<EmailPreview>'
130
+
131
+ # auth_names
132
+ auth_names = opts[:auth_names] || ['API_KEY']
133
+
134
+ new_options = opts.merge(
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names,
140
+ :return_type => return_type
141
+ )
142
+
143
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_email_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
146
+ end
147
+ return data, status_code, headers
148
+ end
149
+
150
+ # Fetch inbox's latest email or if empty wait for an email to arrive
151
+ # Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set `unreadOnly=true` or see the other receive methods such as `waitForNthEmail` or `waitForEmailCount`.
152
+ # @param [Hash] opts the optional parameters
153
+ # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
154
+ # @option opts [Integer] :timeout Max milliseconds to wait
155
+ # @option opts [Boolean] :unread_only Optional filter for unread only. (default to false)
156
+ # @return [Email]
157
+ def wait_for_latest_email(opts = {})
158
+ data, _status_code, _headers = wait_for_latest_email_with_http_info(opts)
159
+ data
160
+ end
161
+
162
+ # Fetch inbox&#39;s latest email or if empty wait for an email to arrive
163
+ # Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set &#x60;unreadOnly&#x3D;true&#x60; or see the other receive methods such as &#x60;waitForNthEmail&#x60; or &#x60;waitForEmailCount&#x60;.
164
+ # @param [Hash] opts the optional parameters
165
+ # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
166
+ # @option opts [Integer] :timeout Max milliseconds to wait
167
+ # @option opts [Boolean] :unread_only Optional filter for unread only.
168
+ # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers
169
+ def wait_for_latest_email_with_http_info(opts = {})
170
+ if @api_client.config.debugging
171
+ @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_latest_email ...'
172
+ end
173
+ # resource path
174
+ local_var_path = '/waitForLatestEmail'
175
+
176
+ # query parameters
177
+ query_params = opts[:query_params] || {}
178
+ query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
179
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
180
+ query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
181
+
182
+ # header parameters
183
+ header_params = opts[:header_params] || {}
184
+ # HTTP header 'Accept' (if needed)
185
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
186
+
187
+ # form parameters
188
+ form_params = opts[:form_params] || {}
189
+
190
+ # http body (model)
191
+ post_body = opts[:body]
192
+
193
+ # return_type
194
+ return_type = opts[:return_type] || 'Email'
195
+
196
+ # auth_names
197
+ auth_names = opts[:auth_names] || ['API_KEY']
198
+
199
+ new_options = opts.merge(
200
+ :header_params => header_params,
201
+ :query_params => query_params,
202
+ :form_params => form_params,
203
+ :body => post_body,
204
+ :auth_names => auth_names,
205
+ :return_type => return_type
206
+ )
207
+
208
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
209
+ if @api_client.config.debugging
210
+ @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_latest_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
211
+ end
212
+ return data, status_code, headers
213
+ end
214
+
215
+ # Wait or return list of emails that match simple matching patterns
216
+ # Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the `MatchOptions` object for options.
217
+ # @param match_options [MatchOptions] matchOptions
218
+ # @param [Hash] opts the optional parameters
219
+ # @option opts [Integer] :count Number of emails to wait for. Must be greater that 1
220
+ # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
221
+ # @option opts [Integer] :timeout Max milliseconds to wait
222
+ # @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
223
+ # @return [Array<EmailPreview>]
224
+ def wait_for_matching_email(match_options, opts = {})
225
+ data, _status_code, _headers = wait_for_matching_email_with_http_info(match_options, opts)
226
+ data
227
+ end
228
+
229
+ # Wait or return list of emails that match simple matching patterns
230
+ # Perform a search of emails in an inbox with the given patterns. If results match expected count then return or else retry the search until results are found or timeout is reached. Match options allow simple CONTAINS or EQUALS filtering on SUBJECT, TO, BCC, CC, and FROM. See the &#x60;MatchOptions&#x60; object for options.
231
+ # @param match_options [MatchOptions] matchOptions
232
+ # @param [Hash] opts the optional parameters
233
+ # @option opts [Integer] :count Number of emails to wait for. Must be greater that 1
234
+ # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
235
+ # @option opts [Integer] :timeout Max milliseconds to wait
236
+ # @option opts [Boolean] :unread_only Optional filter for unread only
237
+ # @return [Array<(Array<EmailPreview>, Integer, Hash)>] Array<EmailPreview> data, response status code and response headers
238
+ def wait_for_matching_email_with_http_info(match_options, opts = {})
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_matching_email ...'
241
+ end
242
+ # verify the required parameter 'match_options' is set
243
+ if @api_client.config.client_side_validation && match_options.nil?
244
+ fail ArgumentError, "Missing the required parameter 'match_options' when calling WaitForControllerApi.wait_for_matching_email"
245
+ end
246
+ # resource path
247
+ local_var_path = '/waitForMatchingEmails'
248
+
249
+ # query parameters
250
+ query_params = opts[:query_params] || {}
251
+ query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
252
+ query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
253
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
254
+ query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
255
+
256
+ # header parameters
257
+ header_params = opts[:header_params] || {}
258
+ # HTTP header 'Accept' (if needed)
259
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
260
+ # HTTP header 'Content-Type'
261
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
262
+
263
+ # form parameters
264
+ form_params = opts[:form_params] || {}
265
+
266
+ # http body (model)
267
+ post_body = opts[:body] || @api_client.object_to_http_body(match_options)
268
+
269
+ # return_type
270
+ return_type = opts[:return_type] || 'Array<EmailPreview>'
271
+
272
+ # auth_names
273
+ auth_names = opts[:auth_names] || ['API_KEY']
274
+
275
+ new_options = opts.merge(
276
+ :header_params => header_params,
277
+ :query_params => query_params,
278
+ :form_params => form_params,
279
+ :body => post_body,
280
+ :auth_names => auth_names,
281
+ :return_type => return_type
282
+ )
283
+
284
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
285
+ if @api_client.config.debugging
286
+ @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_matching_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
287
+ end
288
+ return data, status_code, headers
289
+ end
290
+
291
+ # Wait for or fetch the email with a given index in the inbox specified
292
+ # If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.
293
+ # @param [Hash] opts the optional parameters
294
+ # @option opts [String] :inbox_id Id of the inbox you are fetching emails from
295
+ # @option opts [Integer] :index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index&#x3D;1 (default to 0)
296
+ # @option opts [Integer] :timeout Max milliseconds to wait for the nth email if not already present
297
+ # @option opts [Boolean] :unread_only Optional filter for unread only (default to false)
298
+ # @return [Email]
299
+ def wait_for_nth_email(opts = {})
300
+ data, _status_code, _headers = wait_for_nth_email_with_http_info(opts)
301
+ data
302
+ end
303
+
304
+ # Wait for or fetch the email with a given index in the inbox specified
305
+ # If nth email is already present in inbox then return it. If not hold the connection open until timeout expires or the nth email is received and returned.
306
+ # @param [Hash] opts the optional parameters
307
+ # @option opts [String] :inbox_id Id of the inbox you are fetching emails from
308
+ # @option opts [Integer] :index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index&#x3D;1
309
+ # @option opts [Integer] :timeout Max milliseconds to wait for the nth email if not already present
310
+ # @option opts [Boolean] :unread_only Optional filter for unread only
311
+ # @return [Array<(Email, Integer, Hash)>] Email data, response status code and response headers
312
+ def wait_for_nth_email_with_http_info(opts = {})
313
+ if @api_client.config.debugging
314
+ @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for_nth_email ...'
315
+ end
316
+ # resource path
317
+ local_var_path = '/waitForNthEmail'
318
+
319
+ # query parameters
320
+ query_params = opts[:query_params] || {}
321
+ query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
322
+ query_params[:'index'] = opts[:'index'] if !opts[:'index'].nil?
323
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
324
+ query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil?
325
+
326
+ # header parameters
327
+ header_params = opts[:header_params] || {}
328
+ # HTTP header 'Accept' (if needed)
329
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
330
+
331
+ # form parameters
332
+ form_params = opts[:form_params] || {}
333
+
334
+ # http body (model)
335
+ post_body = opts[:body]
336
+
337
+ # return_type
338
+ return_type = opts[:return_type] || 'Email'
339
+
340
+ # auth_names
341
+ auth_names = opts[:auth_names] || ['API_KEY']
342
+
343
+ new_options = opts.merge(
344
+ :header_params => header_params,
345
+ :query_params => query_params,
346
+ :form_params => form_params,
347
+ :body => post_body,
348
+ :auth_names => auth_names,
349
+ :return_type => return_type
350
+ )
351
+
352
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug "API called: WaitForControllerApi#wait_for_nth_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
355
+ end
356
+ return data, status_code, headers
357
+ end
358
+ end
359
+ end
@@ -0,0 +1,405 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module MailSlurpClient
16
+ class WebhookControllerApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Attach a WebHook URL to an inbox
23
+ # Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint.
24
+ # @param inbox_id [String] inboxId
25
+ # @param webhook_options [CreateWebhookOptions] webhookOptions
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [WebhookDto]
28
+ def create_webhook(inbox_id, webhook_options, opts = {})
29
+ data, _status_code, _headers = create_webhook_with_http_info(inbox_id, webhook_options, opts)
30
+ data
31
+ end
32
+
33
+ # Attach a WebHook URL to an inbox
34
+ # Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint.
35
+ # @param inbox_id [String] inboxId
36
+ # @param webhook_options [CreateWebhookOptions] webhookOptions
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers
39
+ def create_webhook_with_http_info(inbox_id, webhook_options, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.create_webhook ...'
42
+ end
43
+ # verify the required parameter 'inbox_id' is set
44
+ if @api_client.config.client_side_validation && inbox_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.create_webhook"
46
+ end
47
+ # verify the required parameter 'webhook_options' is set
48
+ if @api_client.config.client_side_validation && webhook_options.nil?
49
+ fail ArgumentError, "Missing the required parameter 'webhook_options' when calling WebhookControllerApi.create_webhook"
50
+ end
51
+ # resource path
52
+ local_var_path = '/inboxes/{inboxId}/webhooks'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:body] || @api_client.object_to_http_body(webhook_options)
69
+
70
+ # return_type
71
+ return_type = opts[:return_type] || 'WebhookDto'
72
+
73
+ # auth_names
74
+ auth_names = opts[:auth_names] || ['API_KEY']
75
+
76
+ new_options = opts.merge(
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: WebhookControllerApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
92
+ # Delete and disable a Webhook for an Inbox
93
+ # @param inbox_id [String] inboxId
94
+ # @param webhook_id [String] webhookId
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [nil]
97
+ def delete_webhook(inbox_id, webhook_id, opts = {})
98
+ delete_webhook_with_http_info(inbox_id, webhook_id, opts)
99
+ nil
100
+ end
101
+
102
+ # Delete and disable a Webhook for an Inbox
103
+ # @param inbox_id [String] inboxId
104
+ # @param webhook_id [String] webhookId
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
107
+ def delete_webhook_with_http_info(inbox_id, webhook_id, opts = {})
108
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.delete_webhook ...'
110
+ end
111
+ # verify the required parameter 'inbox_id' is set
112
+ if @api_client.config.client_side_validation && inbox_id.nil?
113
+ fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.delete_webhook"
114
+ end
115
+ # verify the required parameter 'webhook_id' is set
116
+ if @api_client.config.client_side_validation && webhook_id.nil?
117
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.delete_webhook"
118
+ end
119
+ # resource path
120
+ local_var_path = '/inboxes/{inboxId}/webhooks/{webhookId}'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s)).sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s))
121
+
122
+ # query parameters
123
+ query_params = opts[:query_params] || {}
124
+
125
+ # header parameters
126
+ header_params = opts[:header_params] || {}
127
+
128
+ # form parameters
129
+ form_params = opts[:form_params] || {}
130
+
131
+ # http body (model)
132
+ post_body = opts[:body]
133
+
134
+ # return_type
135
+ return_type = opts[:return_type]
136
+
137
+ # auth_names
138
+ auth_names = opts[:auth_names] || ['API_KEY']
139
+
140
+ new_options = opts.merge(
141
+ :header_params => header_params,
142
+ :query_params => query_params,
143
+ :form_params => form_params,
144
+ :body => post_body,
145
+ :auth_names => auth_names,
146
+ :return_type => return_type
147
+ )
148
+
149
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug "API called: WebhookControllerApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
+ end
153
+ return data, status_code, headers
154
+ end
155
+
156
+ # List Webhooks Paginated
157
+ # List webhooks in paginated form. Allows for page index, page size, and sort direction.
158
+ # @param [Hash] opts the optional parameters
159
+ # @option opts [Integer] :page Optional page index in inbox list pagination (default to 0)
160
+ # @option opts [Integer] :size Optional page size in inbox list pagination (default to 20)
161
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
162
+ # @return [PageWebhookProjection]
163
+ def get_all_webhooks(opts = {})
164
+ data, _status_code, _headers = get_all_webhooks_with_http_info(opts)
165
+ data
166
+ end
167
+
168
+ # List Webhooks Paginated
169
+ # List webhooks in paginated form. Allows for page index, page size, and sort direction.
170
+ # @param [Hash] opts the optional parameters
171
+ # @option opts [Integer] :page Optional page index in inbox list pagination
172
+ # @option opts [Integer] :size Optional page size in inbox list pagination
173
+ # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
174
+ # @return [Array<(PageWebhookProjection, Integer, Hash)>] PageWebhookProjection data, response status code and response headers
175
+ def get_all_webhooks_with_http_info(opts = {})
176
+ if @api_client.config.debugging
177
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_all_webhooks ...'
178
+ end
179
+ allowable_values = ["ASC", "DESC"]
180
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
181
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
182
+ end
183
+ # resource path
184
+ local_var_path = '/webhooks/paginated'
185
+
186
+ # query parameters
187
+ query_params = opts[:query_params] || {}
188
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
189
+ query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
190
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
191
+
192
+ # header parameters
193
+ header_params = opts[:header_params] || {}
194
+ # HTTP header 'Accept' (if needed)
195
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
196
+
197
+ # form parameters
198
+ form_params = opts[:form_params] || {}
199
+
200
+ # http body (model)
201
+ post_body = opts[:body]
202
+
203
+ # return_type
204
+ return_type = opts[:return_type] || 'PageWebhookProjection'
205
+
206
+ # auth_names
207
+ auth_names = opts[:auth_names] || ['API_KEY']
208
+
209
+ new_options = opts.merge(
210
+ :header_params => header_params,
211
+ :query_params => query_params,
212
+ :form_params => form_params,
213
+ :body => post_body,
214
+ :auth_names => auth_names,
215
+ :return_type => return_type
216
+ )
217
+
218
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
219
+ if @api_client.config.debugging
220
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_all_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
221
+ end
222
+ return data, status_code, headers
223
+ end
224
+
225
+ # Get a webhook for an Inbox
226
+ # @param webhook_id [String] webhookId
227
+ # @param [Hash] opts the optional parameters
228
+ # @return [WebhookDto]
229
+ def get_webhook(webhook_id, opts = {})
230
+ data, _status_code, _headers = get_webhook_with_http_info(webhook_id, opts)
231
+ data
232
+ end
233
+
234
+ # Get a webhook for an Inbox
235
+ # @param webhook_id [String] webhookId
236
+ # @param [Hash] opts the optional parameters
237
+ # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers
238
+ def get_webhook_with_http_info(webhook_id, opts = {})
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhook ...'
241
+ end
242
+ # verify the required parameter 'webhook_id' is set
243
+ if @api_client.config.client_side_validation && webhook_id.nil?
244
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.get_webhook"
245
+ end
246
+ # resource path
247
+ local_var_path = '/webhooks/{webhookId}'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s))
248
+
249
+ # query parameters
250
+ query_params = opts[:query_params] || {}
251
+
252
+ # header parameters
253
+ header_params = opts[:header_params] || {}
254
+ # HTTP header 'Accept' (if needed)
255
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
256
+
257
+ # form parameters
258
+ form_params = opts[:form_params] || {}
259
+
260
+ # http body (model)
261
+ post_body = opts[:body]
262
+
263
+ # return_type
264
+ return_type = opts[:return_type] || 'WebhookDto'
265
+
266
+ # auth_names
267
+ auth_names = opts[:auth_names] || ['API_KEY']
268
+
269
+ new_options = opts.merge(
270
+ :header_params => header_params,
271
+ :query_params => query_params,
272
+ :form_params => form_params,
273
+ :body => post_body,
274
+ :auth_names => auth_names,
275
+ :return_type => return_type
276
+ )
277
+
278
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
279
+ if @api_client.config.debugging
280
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
281
+ end
282
+ return data, status_code, headers
283
+ end
284
+
285
+ # Get all Webhooks for an Inbox
286
+ # @param inbox_id [String] inboxId
287
+ # @param [Hash] opts the optional parameters
288
+ # @return [Array<WebhookDto>]
289
+ def get_webhooks(inbox_id, opts = {})
290
+ data, _status_code, _headers = get_webhooks_with_http_info(inbox_id, opts)
291
+ data
292
+ end
293
+
294
+ # Get all Webhooks for an Inbox
295
+ # @param inbox_id [String] inboxId
296
+ # @param [Hash] opts the optional parameters
297
+ # @return [Array<(Array<WebhookDto>, Integer, Hash)>] Array<WebhookDto> data, response status code and response headers
298
+ def get_webhooks_with_http_info(inbox_id, opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhooks ...'
301
+ end
302
+ # verify the required parameter 'inbox_id' is set
303
+ if @api_client.config.client_side_validation && inbox_id.nil?
304
+ fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.get_webhooks"
305
+ end
306
+ # resource path
307
+ local_var_path = '/inboxes/{inboxId}/webhooks'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))
308
+
309
+ # query parameters
310
+ query_params = opts[:query_params] || {}
311
+
312
+ # header parameters
313
+ header_params = opts[:header_params] || {}
314
+ # HTTP header 'Accept' (if needed)
315
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
316
+
317
+ # form parameters
318
+ form_params = opts[:form_params] || {}
319
+
320
+ # http body (model)
321
+ post_body = opts[:body]
322
+
323
+ # return_type
324
+ return_type = opts[:return_type] || 'Array<WebhookDto>'
325
+
326
+ # auth_names
327
+ auth_names = opts[:auth_names] || ['API_KEY']
328
+
329
+ new_options = opts.merge(
330
+ :header_params => header_params,
331
+ :query_params => query_params,
332
+ :form_params => form_params,
333
+ :body => post_body,
334
+ :auth_names => auth_names,
335
+ :return_type => return_type
336
+ )
337
+
338
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
339
+ if @api_client.config.debugging
340
+ @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
341
+ end
342
+ return data, status_code, headers
343
+ end
344
+
345
+ # Send webhook test data
346
+ # @param webhook_id [String] webhookId
347
+ # @param [Hash] opts the optional parameters
348
+ # @return [WebhookTestResult]
349
+ def send_test_data(webhook_id, opts = {})
350
+ data, _status_code, _headers = send_test_data_with_http_info(webhook_id, opts)
351
+ data
352
+ end
353
+
354
+ # Send webhook test data
355
+ # @param webhook_id [String] webhookId
356
+ # @param [Hash] opts the optional parameters
357
+ # @return [Array<(WebhookTestResult, Integer, Hash)>] WebhookTestResult data, response status code and response headers
358
+ def send_test_data_with_http_info(webhook_id, opts = {})
359
+ if @api_client.config.debugging
360
+ @api_client.config.logger.debug 'Calling API: WebhookControllerApi.send_test_data ...'
361
+ end
362
+ # verify the required parameter 'webhook_id' is set
363
+ if @api_client.config.client_side_validation && webhook_id.nil?
364
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.send_test_data"
365
+ end
366
+ # resource path
367
+ local_var_path = '/webhooks/{webhookId}/test'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_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] || 'WebhookTestResult'
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(:POST, local_var_path, new_options)
399
+ if @api_client.config.debugging
400
+ @api_client.config.logger.debug "API called: WebhookControllerApi#send_test_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
401
+ end
402
+ return data, status_code, headers
403
+ end
404
+ end
405
+ end