mailslurp_client 7.0.7 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client.rb +19 -3
  3. metadata +14 -345
  4. data/Gemfile +0 -9
  5. data/LICENSE +0 -22
  6. data/README.md +0 -226
  7. data/Rakefile +0 -10
  8. data/docs/AttachmentControllerApi.md +0 -124
  9. data/docs/AttachmentMetaData.md +0 -23
  10. data/docs/BasicAuthOptions.md +0 -19
  11. data/docs/BulkActionsControllerApi.md +0 -165
  12. data/docs/BulkSendEmailOptions.md +0 -19
  13. data/docs/CommonActionsControllerApi.md +0 -167
  14. data/docs/ContactControllerApi.md +0 -274
  15. data/docs/ContactDto.md +0 -31
  16. data/docs/ContactProjection.md +0 -27
  17. data/docs/CreateContactOptions.md +0 -31
  18. data/docs/CreateDomainOptions.md +0 -17
  19. data/docs/CreateGroupOptions.md +0 -19
  20. data/docs/CreateTemplateOptions.md +0 -19
  21. data/docs/CreateWebhookOptions.md +0 -21
  22. data/docs/DomainControllerApi.md +0 -223
  23. data/docs/DomainDto.md +0 -29
  24. data/docs/DomainPreview.md +0 -21
  25. data/docs/Email.md +0 -49
  26. data/docs/EmailAnalysis.md +0 -25
  27. data/docs/EmailControllerApi.md +0 -740
  28. data/docs/EmailPreview.md +0 -31
  29. data/docs/EmailProjection.md +0 -33
  30. data/docs/ForwardEmailOptions.md +0 -23
  31. data/docs/GroupContactsDto.md +0 -19
  32. data/docs/GroupControllerApi.md +0 -437
  33. data/docs/GroupDto.md +0 -23
  34. data/docs/GroupProjection.md +0 -23
  35. data/docs/HTMLValidationResult.md +0 -21
  36. data/docs/Inbox.md +0 -33
  37. data/docs/InboxControllerApi.md +0 -652
  38. data/docs/InboxProjection.md +0 -29
  39. data/docs/JsonNode.md +0 -59
  40. data/docs/MatchOption.md +0 -21
  41. data/docs/MatchOptions.md +0 -17
  42. data/docs/PageContactProjection.md +0 -37
  43. data/docs/PageEmailPreview.md +0 -37
  44. data/docs/PageEmailProjection.md +0 -37
  45. data/docs/PageGroupProjection.md +0 -37
  46. data/docs/PageInboxProjection.md +0 -37
  47. data/docs/PageTemplateProjection.md +0 -37
  48. data/docs/PageWebhookProjection.md +0 -37
  49. data/docs/Pageable.md +0 -27
  50. data/docs/RawEmailJson.md +0 -17
  51. data/docs/SendEmailOptions.md +0 -45
  52. data/docs/SetInboxFavouritedOptions.md +0 -17
  53. data/docs/Sort.md +0 -21
  54. data/docs/TemplateControllerApi.md +0 -274
  55. data/docs/TemplateDto.md +0 -25
  56. data/docs/TemplateProjection.md +0 -25
  57. data/docs/TemplateVariable.md +0 -19
  58. data/docs/UnreadCount.md +0 -17
  59. data/docs/UpdateGroupContacts.md +0 -17
  60. data/docs/UpdateInboxOptions.md +0 -25
  61. data/docs/UploadAttachmentOptions.md +0 -21
  62. data/docs/ValidationDto.md +0 -19
  63. data/docs/ValidationMessage.md +0 -19
  64. data/docs/WaitForConditions.md +0 -29
  65. data/docs/WaitForControllerApi.md +0 -317
  66. data/docs/WebhookControllerApi.md +0 -339
  67. data/docs/WebhookDto.md +0 -33
  68. data/docs/WebhookProjection.md +0 -27
  69. data/docs/WebhookTestRequest.md +0 -23
  70. data/docs/WebhookTestResponse.md +0 -19
  71. data/docs/WebhookTestResult.md +0 -21
  72. data/git_push.sh +0 -58
  73. data/lib/mailslurp_client/api/attachment_controller_api.rb +0 -157
  74. data/lib/mailslurp_client/api/bulk_actions_controller_api.rb +0 -203
  75. data/lib/mailslurp_client/api/common_actions_controller_api.rb +0 -201
  76. data/lib/mailslurp_client/api/contact_controller_api.rb +0 -323
  77. data/lib/mailslurp_client/api/domain_controller_api.rb +0 -264
  78. data/lib/mailslurp_client/api/email_controller_api.rb +0 -852
  79. data/lib/mailslurp_client/api/group_controller_api.rb +0 -519
  80. data/lib/mailslurp_client/api/inbox_controller_api.rb +0 -763
  81. data/lib/mailslurp_client/api/template_controller_api.rb +0 -323
  82. data/lib/mailslurp_client/api/wait_for_controller_api.rb +0 -359
  83. data/lib/mailslurp_client/api/webhook_controller_api.rb +0 -405
  84. data/lib/mailslurp_client/api_client.rb +0 -386
  85. data/lib/mailslurp_client/api_error.rb +0 -57
  86. data/lib/mailslurp_client/configuration.rb +0 -248
  87. data/lib/mailslurp_client/models/attachment_meta_data.rb +0 -253
  88. data/lib/mailslurp_client/models/basic_auth_options.rb +0 -226
  89. data/lib/mailslurp_client/models/bulk_send_email_options.rb +0 -224
  90. data/lib/mailslurp_client/models/contact_dto.rb +0 -288
  91. data/lib/mailslurp_client/models/contact_projection.rb +0 -261
  92. data/lib/mailslurp_client/models/create_contact_options.rb +0 -277
  93. data/lib/mailslurp_client/models/create_domain_options.rb +0 -208
  94. data/lib/mailslurp_client/models/create_group_options.rb +0 -220
  95. data/lib/mailslurp_client/models/create_template_options.rb +0 -225
  96. data/lib/mailslurp_client/models/create_webhook_options.rb +0 -227
  97. data/lib/mailslurp_client/models/domain_dto.rb +0 -296
  98. data/lib/mailslurp_client/models/domain_preview.rb +0 -240
  99. data/lib/mailslurp_client/models/email.rb +0 -376
  100. data/lib/mailslurp_client/models/email_analysis.rb +0 -243
  101. data/lib/mailslurp_client/models/email_preview.rb +0 -286
  102. data/lib/mailslurp_client/models/email_projection.rb +0 -306
  103. data/lib/mailslurp_client/models/forward_email_options.rb +0 -245
  104. data/lib/mailslurp_client/models/group_contacts_dto.rb +0 -227
  105. data/lib/mailslurp_client/models/group_dto.rb +0 -248
  106. data/lib/mailslurp_client/models/group_projection.rb +0 -248
  107. data/lib/mailslurp_client/models/html_validation_result.rb +0 -243
  108. data/lib/mailslurp_client/models/inbox.rb +0 -290
  109. data/lib/mailslurp_client/models/inbox_projection.rb +0 -272
  110. data/lib/mailslurp_client/models/json_node.rb +0 -429
  111. data/lib/mailslurp_client/models/match_option.rb +0 -274
  112. data/lib/mailslurp_client/models/match_options.rb +0 -210
  113. data/lib/mailslurp_client/models/page_contact_projection.rb +0 -298
  114. data/lib/mailslurp_client/models/page_email_preview.rb +0 -298
  115. data/lib/mailslurp_client/models/page_email_projection.rb +0 -298
  116. data/lib/mailslurp_client/models/page_group_projection.rb +0 -298
  117. data/lib/mailslurp_client/models/page_inbox_projection.rb +0 -298
  118. data/lib/mailslurp_client/models/page_template_projection.rb +0 -298
  119. data/lib/mailslurp_client/models/page_webhook_projection.rb +0 -298
  120. data/lib/mailslurp_client/models/pageable.rb +0 -251
  121. data/lib/mailslurp_client/models/raw_email_json.rb +0 -211
  122. data/lib/mailslurp_client/models/send_email_options.rb +0 -392
  123. data/lib/mailslurp_client/models/set_inbox_favourited_options.rb +0 -208
  124. data/lib/mailslurp_client/models/sort.rb +0 -224
  125. data/lib/mailslurp_client/models/template_dto.rb +0 -269
  126. data/lib/mailslurp_client/models/template_projection.rb +0 -269
  127. data/lib/mailslurp_client/models/template_variable.rb +0 -259
  128. data/lib/mailslurp_client/models/unread_count.rb +0 -211
  129. data/lib/mailslurp_client/models/update_group_contacts.rb +0 -213
  130. data/lib/mailslurp_client/models/update_inbox_options.rb +0 -250
  131. data/lib/mailslurp_client/models/upload_attachment_options.rb +0 -228
  132. data/lib/mailslurp_client/models/validation_dto.rb +0 -225
  133. data/lib/mailslurp_client/models/validation_message.rb +0 -220
  134. data/lib/mailslurp_client/models/wait_for_conditions.rb +0 -315
  135. data/lib/mailslurp_client/models/webhook_dto.rb +0 -326
  136. data/lib/mailslurp_client/models/webhook_projection.rb +0 -277
  137. data/lib/mailslurp_client/models/webhook_test_request.rb +0 -284
  138. data/lib/mailslurp_client/models/webhook_test_response.rb +0 -215
  139. data/lib/mailslurp_client/models/webhook_test_result.rb +0 -235
  140. data/lib/mailslurp_client/version.rb +0 -15
  141. data/mailslurp_client.gemspec +0 -39
  142. data/spec/api/attachment_controller_api_spec.rb +0 -61
  143. data/spec/api/bulk_actions_controller_api_spec.rb +0 -68
  144. data/spec/api/common_actions_controller_api_spec.rb +0 -129
  145. data/spec/api/contact_controller_api_spec.rb +0 -91
  146. data/spec/api/domain_controller_api_spec.rb +0 -82
  147. data/spec/api/email_controller_api_spec.rb +0 -162
  148. data/spec/api/group_controller_api_spec.rb +0 -126
  149. data/spec/api/inbox_controller_api_spec.rb +0 -172
  150. data/spec/api/template_controller_api_spec.rb +0 -91
  151. data/spec/api/wait_for_controller_api_spec.rb +0 -107
  152. data/spec/api/webhook_controller_api_spec.rb +0 -107
  153. data/spec/api_client_spec.rb +0 -226
  154. data/spec/configuration_spec.rb +0 -42
  155. data/spec/models/attachment_meta_data_spec.rb +0 -59
  156. data/spec/models/basic_auth_options_spec.rb +0 -47
  157. data/spec/models/bulk_send_email_options_spec.rb +0 -47
  158. data/spec/models/contact_dto_spec.rb +0 -83
  159. data/spec/models/contact_projection_spec.rb +0 -71
  160. data/spec/models/create_contact_options_spec.rb +0 -83
  161. data/spec/models/create_domain_options_spec.rb +0 -41
  162. data/spec/models/create_group_options_spec.rb +0 -47
  163. data/spec/models/create_template_options_spec.rb +0 -47
  164. data/spec/models/create_webhook_options_spec.rb +0 -53
  165. data/spec/models/domain_dto_spec.rb +0 -77
  166. data/spec/models/domain_preview_spec.rb +0 -53
  167. data/spec/models/email_analysis_spec.rb +0 -65
  168. data/spec/models/email_preview_spec.rb +0 -83
  169. data/spec/models/email_projection_spec.rb +0 -89
  170. data/spec/models/email_spec.rb +0 -137
  171. data/spec/models/forward_email_options_spec.rb +0 -59
  172. data/spec/models/group_contacts_dto_spec.rb +0 -47
  173. data/spec/models/group_dto_spec.rb +0 -59
  174. data/spec/models/group_projection_spec.rb +0 -59
  175. data/spec/models/html_validation_result_spec.rb +0 -53
  176. data/spec/models/inbox_projection_spec.rb +0 -77
  177. data/spec/models/inbox_spec.rb +0 -89
  178. data/spec/models/json_node_spec.rb +0 -171
  179. data/spec/models/match_option_spec.rb +0 -61
  180. data/spec/models/match_options_spec.rb +0 -41
  181. data/spec/models/page_contact_projection_spec.rb +0 -101
  182. data/spec/models/page_email_preview_spec.rb +0 -101
  183. data/spec/models/page_email_projection_spec.rb +0 -101
  184. data/spec/models/page_group_projection_spec.rb +0 -101
  185. data/spec/models/page_inbox_projection_spec.rb +0 -101
  186. data/spec/models/page_template_projection_spec.rb +0 -101
  187. data/spec/models/page_webhook_projection_spec.rb +0 -101
  188. data/spec/models/pageable_spec.rb +0 -71
  189. data/spec/models/raw_email_json_spec.rb +0 -41
  190. data/spec/models/send_email_options_spec.rb +0 -129
  191. data/spec/models/set_inbox_favourited_options_spec.rb +0 -41
  192. data/spec/models/sort_spec.rb +0 -53
  193. data/spec/models/template_dto_spec.rb +0 -65
  194. data/spec/models/template_projection_spec.rb +0 -65
  195. data/spec/models/template_variable_spec.rb +0 -51
  196. data/spec/models/unread_count_spec.rb +0 -41
  197. data/spec/models/update_group_contacts_spec.rb +0 -41
  198. data/spec/models/update_inbox_options_spec.rb +0 -65
  199. data/spec/models/upload_attachment_options_spec.rb +0 -53
  200. data/spec/models/validation_dto_spec.rb +0 -47
  201. data/spec/models/validation_message_spec.rb +0 -47
  202. data/spec/models/wait_for_conditions_spec.rb +0 -85
  203. data/spec/models/webhook_dto_spec.rb +0 -93
  204. data/spec/models/webhook_projection_spec.rb +0 -71
  205. data/spec/models/webhook_test_request_spec.rb +0 -63
  206. data/spec/models/webhook_test_response_spec.rb +0 -47
  207. data/spec/models/webhook_test_result_spec.rb +0 -53
  208. data/spec/spec_helper.rb +0 -111
@@ -1,405 +0,0 @@
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 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
@@ -1,386 +0,0 @@
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 'date'
14
- require 'json'
15
- require 'logger'
16
- require 'tempfile'
17
- require 'typhoeus'
18
-
19
- module MailSlurpClient
20
- class ApiClient
21
- # The Configuration object holding settings to be used in the API client.
22
- attr_accessor :config
23
-
24
- # Defines the headers to be used in HTTP requests of all API calls by default.
25
- #
26
- # @return [Hash]
27
- attr_accessor :default_headers
28
-
29
- # Initializes the ApiClient
30
- # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
- def initialize(config = Configuration.default)
32
- @config = config
33
- @user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
34
- @default_headers = {
35
- 'Content-Type' => 'application/json',
36
- 'User-Agent' => @user_agent
37
- }
38
- end
39
-
40
- def self.default
41
- @@default ||= ApiClient.new
42
- end
43
-
44
- # Call an API with given options.
45
- #
46
- # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
47
- # the data deserialized from response body (could be nil), response status code and response headers.
48
- def call_api(http_method, path, opts = {})
49
- request = build_request(http_method, path, opts)
50
- response = request.run
51
-
52
- if @config.debugging
53
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
54
- end
55
-
56
- unless response.success?
57
- if response.timed_out?
58
- fail ApiError.new('Connection timed out')
59
- elsif response.code == 0
60
- # Errors from libcurl will be made visible here
61
- fail ApiError.new(:code => 0,
62
- :message => response.return_message)
63
- else
64
- fail ApiError.new(:code => response.code,
65
- :response_headers => response.headers,
66
- :response_body => response.body),
67
- response.status_message
68
- end
69
- end
70
-
71
- if opts[:return_type]
72
- data = deserialize(response, opts[:return_type])
73
- else
74
- data = nil
75
- end
76
- return data, response.code, response.headers
77
- end
78
-
79
- # Builds the HTTP request
80
- #
81
- # @param [String] http_method HTTP method/verb (e.g. POST)
82
- # @param [String] path URL path (e.g. /account/new)
83
- # @option opts [Hash] :header_params Header parameters
84
- # @option opts [Hash] :query_params Query parameters
85
- # @option opts [Hash] :form_params Query parameters
86
- # @option opts [Object] :body HTTP body (JSON/XML)
87
- # @return [Typhoeus::Request] A Typhoeus Request
88
- def build_request(http_method, path, opts = {})
89
- url = build_request_url(path)
90
- http_method = http_method.to_sym.downcase
91
-
92
- header_params = @default_headers.merge(opts[:header_params] || {})
93
- query_params = opts[:query_params] || {}
94
- form_params = opts[:form_params] || {}
95
-
96
- update_params_for_auth! header_params, query_params, opts[:auth_names]
97
-
98
- # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
99
- _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
100
-
101
- req_opts = {
102
- :method => http_method,
103
- :headers => header_params,
104
- :params => query_params,
105
- :params_encoding => @config.params_encoding,
106
- :timeout => @config.timeout,
107
- :ssl_verifypeer => @config.verify_ssl,
108
- :ssl_verifyhost => _verify_ssl_host,
109
- :sslcert => @config.cert_file,
110
- :sslkey => @config.key_file,
111
- :verbose => @config.debugging
112
- }
113
-
114
- # set custom cert, if provided
115
- req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
116
-
117
- if [:post, :patch, :put, :delete].include?(http_method)
118
- req_body = build_request_body(header_params, form_params, opts[:body])
119
- req_opts.update :body => req_body
120
- if @config.debugging
121
- @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
122
- end
123
- end
124
-
125
- request = Typhoeus::Request.new(url, req_opts)
126
- download_file(request) if opts[:return_type] == 'File'
127
- request
128
- end
129
-
130
- # Builds the HTTP request body
131
- #
132
- # @param [Hash] header_params Header parameters
133
- # @param [Hash] form_params Query parameters
134
- # @param [Object] body HTTP body (JSON/XML)
135
- # @return [String] HTTP body data in the form of string
136
- def build_request_body(header_params, form_params, body)
137
- # http form
138
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
139
- header_params['Content-Type'] == 'multipart/form-data'
140
- data = {}
141
- form_params.each do |key, value|
142
- case value
143
- when ::File, ::Array, nil
144
- # let typhoeus handle File, Array and nil parameters
145
- data[key] = value
146
- else
147
- data[key] = value.to_s
148
- end
149
- end
150
- elsif body
151
- data = body.is_a?(String) ? body : body.to_json
152
- else
153
- data = nil
154
- end
155
- data
156
- end
157
-
158
- # Check if the given MIME is a JSON MIME.
159
- # JSON MIME examples:
160
- # application/json
161
- # application/json; charset=UTF8
162
- # APPLICATION/JSON
163
- # */*
164
- # @param [String] mime MIME
165
- # @return [Boolean] True if the MIME is application/json
166
- def json_mime?(mime)
167
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
168
- end
169
-
170
- # Deserialize the response to the given return type.
171
- #
172
- # @param [Response] response HTTP response
173
- # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
174
- def deserialize(response, return_type)
175
- body = response.body
176
-
177
- # handle file downloading - return the File instance processed in request callbacks
178
- # note that response body is empty when the file is written in chunks in request on_body callback
179
- return @tempfile if return_type == 'File'
180
-
181
- return nil if body.nil? || body.empty?
182
-
183
- # return response body directly for String return type
184
- return body if return_type == 'String'
185
-
186
- # ensuring a default content type
187
- content_type = response.headers['Content-Type'] || 'application/json'
188
-
189
- fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
190
-
191
- begin
192
- data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
193
- rescue JSON::ParserError => e
194
- if %w(String Date DateTime).include?(return_type)
195
- data = body
196
- else
197
- raise e
198
- end
199
- end
200
-
201
- convert_to_type data, return_type
202
- end
203
-
204
- # Convert data to the given return type.
205
- # @param [Object] data Data to be converted
206
- # @param [String] return_type Return type
207
- # @return [Mixed] Data in a particular type
208
- def convert_to_type(data, return_type)
209
- return nil if data.nil?
210
- case return_type
211
- when 'String'
212
- data.to_s
213
- when 'Integer'
214
- data.to_i
215
- when 'Float'
216
- data.to_f
217
- when 'Boolean'
218
- data == true
219
- when 'DateTime'
220
- # parse date time (expecting ISO 8601 format)
221
- DateTime.parse data
222
- when 'Date'
223
- # parse date time (expecting ISO 8601 format)
224
- Date.parse data
225
- when 'Object'
226
- # generic object (usually a Hash), return directly
227
- data
228
- when /\AArray<(.+)>\z/
229
- # e.g. Array<Pet>
230
- sub_type = $1
231
- data.map { |item| convert_to_type(item, sub_type) }
232
- when /\AHash\<String, (.+)\>\z/
233
- # e.g. Hash<String, Integer>
234
- sub_type = $1
235
- {}.tap do |hash|
236
- data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
237
- end
238
- else
239
- # models, e.g. Pet
240
- MailSlurpClient.const_get(return_type).build_from_hash(data)
241
- end
242
- end
243
-
244
- # Save response body into a file in (the defined) temporary folder, using the filename
245
- # from the "Content-Disposition" header if provided, otherwise a random filename.
246
- # The response body is written to the file in chunks in order to handle files which
247
- # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
248
- # process can use.
249
- #
250
- # @see Configuration#temp_folder_path
251
- def download_file(request)
252
- tempfile = nil
253
- encoding = nil
254
- request.on_headers do |response|
255
- content_disposition = response.headers['Content-Disposition']
256
- if content_disposition && content_disposition =~ /filename=/i
257
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
258
- prefix = sanitize_filename(filename)
259
- else
260
- prefix = 'download-'
261
- end
262
- prefix = prefix + '-' unless prefix.end_with?('-')
263
- encoding = response.body.encoding
264
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
265
- @tempfile = tempfile
266
- end
267
- request.on_body do |chunk|
268
- chunk.force_encoding(encoding)
269
- tempfile.write(chunk)
270
- end
271
- request.on_complete do |response|
272
- tempfile.close if tempfile
273
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
274
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
275
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
276
- "explicitly with `tempfile.delete`"
277
- end
278
- end
279
-
280
- # Sanitize filename by removing path.
281
- # e.g. ../../sun.gif becomes sun.gif
282
- #
283
- # @param [String] filename the filename to be sanitized
284
- # @return [String] the sanitized filename
285
- def sanitize_filename(filename)
286
- filename.gsub(/.*[\/\\]/, '')
287
- end
288
-
289
- def build_request_url(path)
290
- # Add leading and trailing slashes to path
291
- path = "/#{path}".gsub(/\/+/, '/')
292
- @config.base_url + path
293
- end
294
-
295
- # Update hearder and query params based on authentication settings.
296
- #
297
- # @param [Hash] header_params Header parameters
298
- # @param [Hash] query_params Query parameters
299
- # @param [String] auth_names Authentication scheme name
300
- def update_params_for_auth!(header_params, query_params, auth_names)
301
- Array(auth_names).each do |auth_name|
302
- auth_setting = @config.auth_settings[auth_name]
303
- next unless auth_setting
304
- case auth_setting[:in]
305
- when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
306
- when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
307
- else fail ArgumentError, 'Authentication token must be in `query` of `header`'
308
- end
309
- end
310
- end
311
-
312
- # Sets user agent in HTTP header
313
- #
314
- # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
315
- def user_agent=(user_agent)
316
- @user_agent = user_agent
317
- @default_headers['User-Agent'] = @user_agent
318
- end
319
-
320
- # Return Accept header based on an array of accepts provided.
321
- # @param [Array] accepts array for Accept
322
- # @return [String] the Accept header (e.g. application/json)
323
- def select_header_accept(accepts)
324
- return nil if accepts.nil? || accepts.empty?
325
- # use JSON when present, otherwise use all of the provided
326
- json_accept = accepts.find { |s| json_mime?(s) }
327
- json_accept || accepts.join(',')
328
- end
329
-
330
- # Return Content-Type header based on an array of content types provided.
331
- # @param [Array] content_types array for Content-Type
332
- # @return [String] the Content-Type header (e.g. application/json)
333
- def select_header_content_type(content_types)
334
- # use application/json by default
335
- return 'application/json' if content_types.nil? || content_types.empty?
336
- # use JSON when present, otherwise use the first one
337
- json_content_type = content_types.find { |s| json_mime?(s) }
338
- json_content_type || content_types.first
339
- end
340
-
341
- # Convert object (array, hash, object, etc) to JSON string.
342
- # @param [Object] model object to be converted into JSON string
343
- # @return [String] JSON string representation of the object
344
- def object_to_http_body(model)
345
- return model if model.nil? || model.is_a?(String)
346
- local_body = nil
347
- if model.is_a?(Array)
348
- local_body = model.map { |m| object_to_hash(m) }
349
- else
350
- local_body = object_to_hash(model)
351
- end
352
- local_body.to_json
353
- end
354
-
355
- # Convert object(non-array) to hash.
356
- # @param [Object] obj object to be converted into JSON string
357
- # @return [String] JSON string representation of the object
358
- def object_to_hash(obj)
359
- if obj.respond_to?(:to_hash)
360
- obj.to_hash
361
- else
362
- obj
363
- end
364
- end
365
-
366
- # Build parameter value according to the given collection format.
367
- # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
368
- def build_collection_param(param, collection_format)
369
- case collection_format
370
- when :csv
371
- param.join(',')
372
- when :ssv
373
- param.join(' ')
374
- when :tsv
375
- param.join("\t")
376
- when :pipes
377
- param.join('|')
378
- when :multi
379
- # return the array directly as typhoeus will handle it as expected
380
- param
381
- else
382
- fail "unknown collection format: #{collection_format.inspect}"
383
- end
384
- end
385
- end
386
- end