zyphr 0.1.19 → 0.1.21

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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -6
  3. data/docs/AuthEmailTemplate.md +42 -0
  4. data/docs/AuthEmailTemplateDefault.md +26 -0
  5. data/docs/AuthEmailTemplateDefaultResponse.md +20 -0
  6. data/docs/AuthEmailTemplateDeleteResponse.md +20 -0
  7. data/docs/{SuccessResultData.md → AuthEmailTemplateDeleteResponseData.md} +2 -2
  8. data/docs/AuthEmailTemplateListResponse.md +20 -0
  9. data/docs/AuthEmailTemplatePreviewDraft.md +28 -0
  10. data/docs/AuthEmailTemplatePreviewRequest.md +20 -0
  11. data/docs/AuthEmailTemplatePreviewResponse.md +20 -0
  12. data/docs/AuthEmailTemplatePreviewResult.md +26 -0
  13. data/docs/AuthEmailTemplateResponse.md +20 -0
  14. data/docs/AuthEmailTemplateTestRequest.md +20 -0
  15. data/docs/AuthEmailTemplateTestResponse.md +20 -0
  16. data/docs/AuthEmailTemplateTestResult.md +20 -0
  17. data/docs/AuthEmailTemplateVersion.md +38 -0
  18. data/docs/AuthEmailTemplateVersionsResponse.md +20 -0
  19. data/docs/AuthEmailTemplatesApi.md +782 -0
  20. data/docs/AuthEmailType.md +15 -0
  21. data/docs/BulkUpsertAuthEmailTemplatesRequest.md +22 -0
  22. data/docs/BulkUpsertAuthEmailTemplatesResponse.md +20 -0
  23. data/docs/ResubscribeResponse.md +1 -1
  24. data/docs/SendSlackMessageRequest.md +40 -0
  25. data/docs/SendSlackMessageResponse.md +20 -0
  26. data/docs/SendSlackMessageResult.md +28 -0
  27. data/docs/SlackApi.md +233 -0
  28. data/docs/SlackMessage.md +50 -0
  29. data/docs/SlackMessageListResponse.md +20 -0
  30. data/docs/SlackMessageListResponseMeta.md +24 -0
  31. data/docs/SlackMessageResponse.md +20 -0
  32. data/docs/SlackMessageStatus.md +15 -0
  33. data/docs/SlackMessageSummary.md +38 -0
  34. data/docs/SuccessResult.md +1 -1
  35. data/docs/UpsertAuthEmailTemplateRequest.md +34 -0
  36. data/lib/zyphr/api/auth_email_templates_api.rb +688 -0
  37. data/lib/zyphr/api/slack_api.rb +233 -0
  38. data/lib/zyphr/models/auth_email_template.rb +372 -0
  39. data/lib/zyphr/models/auth_email_template_default.rb +281 -0
  40. data/lib/zyphr/models/auth_email_template_default_response.rb +229 -0
  41. data/lib/zyphr/models/auth_email_template_delete_response.rb +229 -0
  42. data/lib/zyphr/models/{success_result_data.rb → auth_email_template_delete_response_data.rb} +3 -3
  43. data/lib/zyphr/models/auth_email_template_list_response.rb +231 -0
  44. data/lib/zyphr/models/auth_email_template_preview_draft.rb +272 -0
  45. data/lib/zyphr/models/auth_email_template_preview_request.rb +232 -0
  46. data/lib/zyphr/models/auth_email_template_preview_response.rb +229 -0
  47. data/lib/zyphr/models/auth_email_template_preview_result.rb +258 -0
  48. data/lib/zyphr/models/auth_email_template_response.rb +229 -0
  49. data/lib/zyphr/models/auth_email_template_test_request.rb +249 -0
  50. data/lib/zyphr/models/auth_email_template_test_response.rb +229 -0
  51. data/lib/zyphr/models/auth_email_template_test_result.rb +229 -0
  52. data/lib/zyphr/models/auth_email_template_version.rb +352 -0
  53. data/lib/zyphr/models/auth_email_template_versions_response.rb +231 -0
  54. data/lib/zyphr/models/auth_email_type.rb +41 -0
  55. data/lib/zyphr/models/bulk_upsert_auth_email_templates_request.rb +239 -0
  56. data/lib/zyphr/models/bulk_upsert_auth_email_templates_response.rb +231 -0
  57. data/lib/zyphr/models/resubscribe_response.rb +1 -1
  58. data/lib/zyphr/models/send_slack_message_request.rb +340 -0
  59. data/lib/zyphr/models/send_slack_message_response.rb +229 -0
  60. data/lib/zyphr/models/send_slack_message_result.rb +289 -0
  61. data/lib/zyphr/models/slack_message.rb +406 -0
  62. data/lib/zyphr/models/slack_message_list_response.rb +231 -0
  63. data/lib/zyphr/models/slack_message_list_response_meta.rb +254 -0
  64. data/lib/zyphr/models/slack_message_response.rb +229 -0
  65. data/lib/zyphr/models/slack_message_status.rb +43 -0
  66. data/lib/zyphr/models/slack_message_summary.rb +340 -0
  67. data/lib/zyphr/models/success_result.rb +1 -1
  68. data/lib/zyphr/models/upsert_auth_email_template_request.rb +335 -0
  69. data/lib/zyphr.rb +31 -1
  70. data/spec/api/auth_email_templates_api_spec.rb +157 -0
  71. data/spec/api/slack_api_spec.rb +75 -0
  72. data/spec/models/auth_email_template_default_response_spec.rb +42 -0
  73. data/spec/models/auth_email_template_default_spec.rb +60 -0
  74. data/spec/models/{success_result_data_spec.rb → auth_email_template_delete_response_data_spec.rb} +6 -6
  75. data/spec/models/auth_email_template_delete_response_spec.rb +42 -0
  76. data/spec/models/auth_email_template_list_response_spec.rb +42 -0
  77. data/spec/models/auth_email_template_preview_draft_spec.rb +66 -0
  78. data/spec/models/auth_email_template_preview_request_spec.rb +42 -0
  79. data/spec/models/auth_email_template_preview_response_spec.rb +42 -0
  80. data/spec/models/auth_email_template_preview_result_spec.rb +60 -0
  81. data/spec/models/auth_email_template_response_spec.rb +42 -0
  82. data/spec/models/auth_email_template_spec.rb +112 -0
  83. data/spec/models/auth_email_template_test_request_spec.rb +42 -0
  84. data/spec/models/auth_email_template_test_response_spec.rb +42 -0
  85. data/spec/models/auth_email_template_test_result_spec.rb +42 -0
  86. data/spec/models/auth_email_template_version_spec.rb +100 -0
  87. data/spec/models/auth_email_template_versions_response_spec.rb +42 -0
  88. data/spec/models/auth_email_type_spec.rb +30 -0
  89. data/spec/models/bulk_upsert_auth_email_templates_request_spec.rb +48 -0
  90. data/spec/models/bulk_upsert_auth_email_templates_response_spec.rb +42 -0
  91. data/spec/models/send_slack_message_request_spec.rb +102 -0
  92. data/spec/models/send_slack_message_response_spec.rb +42 -0
  93. data/spec/models/send_slack_message_result_spec.rb +66 -0
  94. data/spec/models/slack_message_list_response_meta_spec.rb +54 -0
  95. data/spec/models/slack_message_list_response_spec.rb +42 -0
  96. data/spec/models/slack_message_response_spec.rb +42 -0
  97. data/spec/models/slack_message_spec.rb +132 -0
  98. data/spec/models/slack_message_status_spec.rb +30 -0
  99. data/spec/models/slack_message_summary_spec.rb +96 -0
  100. data/spec/models/upsert_auth_email_template_request_spec.rb +88 -0
  101. data/zyphr.gemspec +1 -1
  102. metadata +126 -6
@@ -0,0 +1,688 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zyphr
16
+ class AuthEmailTemplatesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Bulk-upsert auth email templates
23
+ # Atomic upsert of any subset of magic_link, password_reset, email_verification. Validates all inputs before any write; if any one fails validation or MJML compile, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
24
+ # @param bulk_upsert_auth_email_templates_request [BulkUpsertAuthEmailTemplatesRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [BulkUpsertAuthEmailTemplatesResponse]
27
+ def bulk_upsert_auth_email_templates(bulk_upsert_auth_email_templates_request, opts = {})
28
+ data, _status_code, _headers = bulk_upsert_auth_email_templates_with_http_info(bulk_upsert_auth_email_templates_request, opts)
29
+ data
30
+ end
31
+
32
+ # Bulk-upsert auth email templates
33
+ # Atomic upsert of any subset of magic_link, password_reset, email_verification. Validates all inputs before any write; if any one fails validation or MJML compile, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
34
+ # @param bulk_upsert_auth_email_templates_request [BulkUpsertAuthEmailTemplatesRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(BulkUpsertAuthEmailTemplatesResponse, Integer, Hash)>] BulkUpsertAuthEmailTemplatesResponse data, response status code and response headers
37
+ def bulk_upsert_auth_email_templates_with_http_info(bulk_upsert_auth_email_templates_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.bulk_upsert_auth_email_templates ...'
40
+ end
41
+ # verify the required parameter 'bulk_upsert_auth_email_templates_request' is set
42
+ if @api_client.config.client_side_validation && bulk_upsert_auth_email_templates_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'bulk_upsert_auth_email_templates_request' when calling AuthEmailTemplatesApi.bulk_upsert_auth_email_templates"
44
+ end
45
+ # resource path
46
+ local_var_path = '/auth/email-templates'
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']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(bulk_upsert_auth_email_templates_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'BulkUpsertAuthEmailTemplatesResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"AuthEmailTemplatesApi.bulk_upsert_auth_email_templates",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#bulk_upsert_auth_email_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Remove a tenant override
91
+ # Reverts the application to the system default for this type
92
+ # @param type [AuthEmailType]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [AuthEmailTemplateDeleteResponse]
95
+ def delete_auth_email_template(type, opts = {})
96
+ data, _status_code, _headers = delete_auth_email_template_with_http_info(type, opts)
97
+ data
98
+ end
99
+
100
+ # Remove a tenant override
101
+ # Reverts the application to the system default for this type
102
+ # @param type [AuthEmailType]
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(AuthEmailTemplateDeleteResponse, Integer, Hash)>] AuthEmailTemplateDeleteResponse data, response status code and response headers
105
+ def delete_auth_email_template_with_http_info(type, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.delete_auth_email_template ...'
108
+ end
109
+ # verify the required parameter 'type' is set
110
+ if @api_client.config.client_side_validation && type.nil?
111
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.delete_auth_email_template"
112
+ end
113
+ # resource path
114
+ local_var_path = '/auth/email-templates/{type}'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+
124
+ # form parameters
125
+ form_params = opts[:form_params] || {}
126
+
127
+ # http body (model)
128
+ post_body = opts[:debug_body]
129
+
130
+ # return_type
131
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateDeleteResponse'
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"AuthEmailTemplatesApi.delete_auth_email_template",
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#delete_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Get an auth email template
154
+ # Returns the override row for the given `type` if one exists, otherwise the system default. Use `is_default` to distinguish.
155
+ # @param type [AuthEmailType]
156
+ # @param [Hash] opts the optional parameters
157
+ # @return [AuthEmailTemplateResponse]
158
+ def get_auth_email_template(type, opts = {})
159
+ data, _status_code, _headers = get_auth_email_template_with_http_info(type, opts)
160
+ data
161
+ end
162
+
163
+ # Get an auth email template
164
+ # Returns the override row for the given &#x60;type&#x60; if one exists, otherwise the system default. Use &#x60;is_default&#x60; to distinguish.
165
+ # @param type [AuthEmailType]
166
+ # @param [Hash] opts the optional parameters
167
+ # @return [Array<(AuthEmailTemplateResponse, Integer, Hash)>] AuthEmailTemplateResponse data, response status code and response headers
168
+ def get_auth_email_template_with_http_info(type, opts = {})
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.get_auth_email_template ...'
171
+ end
172
+ # verify the required parameter 'type' is set
173
+ if @api_client.config.client_side_validation && type.nil?
174
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.get_auth_email_template"
175
+ end
176
+ # resource path
177
+ local_var_path = '/auth/email-templates/{type}'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
178
+
179
+ # query parameters
180
+ query_params = opts[:query_params] || {}
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']) unless header_params['Accept']
186
+
187
+ # form parameters
188
+ form_params = opts[:form_params] || {}
189
+
190
+ # http body (model)
191
+ post_body = opts[:debug_body]
192
+
193
+ # return_type
194
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateResponse'
195
+
196
+ # auth_names
197
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
198
+
199
+ new_options = opts.merge(
200
+ :operation => :"AuthEmailTemplatesApi.get_auth_email_template",
201
+ :header_params => header_params,
202
+ :query_params => query_params,
203
+ :form_params => form_params,
204
+ :body => post_body,
205
+ :auth_names => auth_names,
206
+ :return_type => return_type
207
+ )
208
+
209
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#get_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
212
+ end
213
+ return data, status_code, headers
214
+ end
215
+
216
+ # Get the system default template
217
+ # Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.
218
+ # @param type [AuthEmailType]
219
+ # @param [Hash] opts the optional parameters
220
+ # @return [AuthEmailTemplateDefaultResponse]
221
+ def get_auth_email_template_default(type, opts = {})
222
+ data, _status_code, _headers = get_auth_email_template_default_with_http_info(type, opts)
223
+ data
224
+ end
225
+
226
+ # Get the system default template
227
+ # Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.
228
+ # @param type [AuthEmailType]
229
+ # @param [Hash] opts the optional parameters
230
+ # @return [Array<(AuthEmailTemplateDefaultResponse, Integer, Hash)>] AuthEmailTemplateDefaultResponse data, response status code and response headers
231
+ def get_auth_email_template_default_with_http_info(type, opts = {})
232
+ if @api_client.config.debugging
233
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.get_auth_email_template_default ...'
234
+ end
235
+ # verify the required parameter 'type' is set
236
+ if @api_client.config.client_side_validation && type.nil?
237
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.get_auth_email_template_default"
238
+ end
239
+ # resource path
240
+ local_var_path = '/auth/email-templates/{type}/default'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
241
+
242
+ # query parameters
243
+ query_params = opts[:query_params] || {}
244
+
245
+ # header parameters
246
+ header_params = opts[:header_params] || {}
247
+ # HTTP header 'Accept' (if needed)
248
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
249
+
250
+ # form parameters
251
+ form_params = opts[:form_params] || {}
252
+
253
+ # http body (model)
254
+ post_body = opts[:debug_body]
255
+
256
+ # return_type
257
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateDefaultResponse'
258
+
259
+ # auth_names
260
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
261
+
262
+ new_options = opts.merge(
263
+ :operation => :"AuthEmailTemplatesApi.get_auth_email_template_default",
264
+ :header_params => header_params,
265
+ :query_params => query_params,
266
+ :form_params => form_params,
267
+ :body => post_body,
268
+ :auth_names => auth_names,
269
+ :return_type => return_type
270
+ )
271
+
272
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
273
+ if @api_client.config.debugging
274
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#get_auth_email_template_default\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
275
+ end
276
+ return data, status_code, headers
277
+ end
278
+
279
+ # List version history for a template
280
+ # @param type [AuthEmailType]
281
+ # @param [Hash] opts the optional parameters
282
+ # @return [AuthEmailTemplateVersionsResponse]
283
+ def list_auth_email_template_versions(type, opts = {})
284
+ data, _status_code, _headers = list_auth_email_template_versions_with_http_info(type, opts)
285
+ data
286
+ end
287
+
288
+ # List version history for a template
289
+ # @param type [AuthEmailType]
290
+ # @param [Hash] opts the optional parameters
291
+ # @return [Array<(AuthEmailTemplateVersionsResponse, Integer, Hash)>] AuthEmailTemplateVersionsResponse data, response status code and response headers
292
+ def list_auth_email_template_versions_with_http_info(type, opts = {})
293
+ if @api_client.config.debugging
294
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.list_auth_email_template_versions ...'
295
+ end
296
+ # verify the required parameter 'type' is set
297
+ if @api_client.config.client_side_validation && type.nil?
298
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.list_auth_email_template_versions"
299
+ end
300
+ # resource path
301
+ local_var_path = '/auth/email-templates/{type}/versions'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
302
+
303
+ # query parameters
304
+ query_params = opts[:query_params] || {}
305
+
306
+ # header parameters
307
+ header_params = opts[:header_params] || {}
308
+ # HTTP header 'Accept' (if needed)
309
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
310
+
311
+ # form parameters
312
+ form_params = opts[:form_params] || {}
313
+
314
+ # http body (model)
315
+ post_body = opts[:debug_body]
316
+
317
+ # return_type
318
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateVersionsResponse'
319
+
320
+ # auth_names
321
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
322
+
323
+ new_options = opts.merge(
324
+ :operation => :"AuthEmailTemplatesApi.list_auth_email_template_versions",
325
+ :header_params => header_params,
326
+ :query_params => query_params,
327
+ :form_params => form_params,
328
+ :body => post_body,
329
+ :auth_names => auth_names,
330
+ :return_type => return_type
331
+ )
332
+
333
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
334
+ if @api_client.config.debugging
335
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#list_auth_email_template_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
336
+ end
337
+ return data, status_code, headers
338
+ end
339
+
340
+ # List auth email templates
341
+ # List the application's auth email templates. Returns one entry per email type; when no override exists for a type, the system default is returned with `is_default: true`.
342
+ # @param [Hash] opts the optional parameters
343
+ # @return [AuthEmailTemplateListResponse]
344
+ def list_auth_email_templates(opts = {})
345
+ data, _status_code, _headers = list_auth_email_templates_with_http_info(opts)
346
+ data
347
+ end
348
+
349
+ # List auth email templates
350
+ # List the application&#39;s auth email templates. Returns one entry per email type; when no override exists for a type, the system default is returned with &#x60;is_default: true&#x60;.
351
+ # @param [Hash] opts the optional parameters
352
+ # @return [Array<(AuthEmailTemplateListResponse, Integer, Hash)>] AuthEmailTemplateListResponse data, response status code and response headers
353
+ def list_auth_email_templates_with_http_info(opts = {})
354
+ if @api_client.config.debugging
355
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.list_auth_email_templates ...'
356
+ end
357
+ # resource path
358
+ local_var_path = '/auth/email-templates'
359
+
360
+ # query parameters
361
+ query_params = opts[:query_params] || {}
362
+
363
+ # header parameters
364
+ header_params = opts[:header_params] || {}
365
+ # HTTP header 'Accept' (if needed)
366
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
367
+
368
+ # form parameters
369
+ form_params = opts[:form_params] || {}
370
+
371
+ # http body (model)
372
+ post_body = opts[:debug_body]
373
+
374
+ # return_type
375
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateListResponse'
376
+
377
+ # auth_names
378
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
379
+
380
+ new_options = opts.merge(
381
+ :operation => :"AuthEmailTemplatesApi.list_auth_email_templates",
382
+ :header_params => header_params,
383
+ :query_params => query_params,
384
+ :form_params => form_params,
385
+ :body => post_body,
386
+ :auth_names => auth_names,
387
+ :return_type => return_type
388
+ )
389
+
390
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
391
+ if @api_client.config.debugging
392
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#list_auth_email_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
393
+ end
394
+ return data, status_code, headers
395
+ end
396
+
397
+ # Render a template with sample variables
398
+ # Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.
399
+ # @param type [AuthEmailType]
400
+ # @param [Hash] opts the optional parameters
401
+ # @option opts [AuthEmailTemplatePreviewRequest] :auth_email_template_preview_request
402
+ # @return [AuthEmailTemplatePreviewResponse]
403
+ def preview_auth_email_template(type, opts = {})
404
+ data, _status_code, _headers = preview_auth_email_template_with_http_info(type, opts)
405
+ data
406
+ end
407
+
408
+ # Render a template with sample variables
409
+ # Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.
410
+ # @param type [AuthEmailType]
411
+ # @param [Hash] opts the optional parameters
412
+ # @option opts [AuthEmailTemplatePreviewRequest] :auth_email_template_preview_request
413
+ # @return [Array<(AuthEmailTemplatePreviewResponse, Integer, Hash)>] AuthEmailTemplatePreviewResponse data, response status code and response headers
414
+ def preview_auth_email_template_with_http_info(type, opts = {})
415
+ if @api_client.config.debugging
416
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.preview_auth_email_template ...'
417
+ end
418
+ # verify the required parameter 'type' is set
419
+ if @api_client.config.client_side_validation && type.nil?
420
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.preview_auth_email_template"
421
+ end
422
+ # resource path
423
+ local_var_path = '/auth/email-templates/{type}/preview'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
424
+
425
+ # query parameters
426
+ query_params = opts[:query_params] || {}
427
+
428
+ # header parameters
429
+ header_params = opts[:header_params] || {}
430
+ # HTTP header 'Accept' (if needed)
431
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
432
+ # HTTP header 'Content-Type'
433
+ content_type = @api_client.select_header_content_type(['application/json'])
434
+ if !content_type.nil?
435
+ header_params['Content-Type'] = content_type
436
+ end
437
+
438
+ # form parameters
439
+ form_params = opts[:form_params] || {}
440
+
441
+ # http body (model)
442
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'auth_email_template_preview_request'])
443
+
444
+ # return_type
445
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplatePreviewResponse'
446
+
447
+ # auth_names
448
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
449
+
450
+ new_options = opts.merge(
451
+ :operation => :"AuthEmailTemplatesApi.preview_auth_email_template",
452
+ :header_params => header_params,
453
+ :query_params => query_params,
454
+ :form_params => form_params,
455
+ :body => post_body,
456
+ :auth_names => auth_names,
457
+ :return_type => return_type
458
+ )
459
+
460
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
461
+ if @api_client.config.debugging
462
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#preview_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
463
+ end
464
+ return data, status_code, headers
465
+ end
466
+
467
+ # Restore a previous version
468
+ # Snapshots current state, then overwrites with the contents of the specified historical version.
469
+ # @param type [AuthEmailType]
470
+ # @param version [Integer]
471
+ # @param [Hash] opts the optional parameters
472
+ # @return [AuthEmailTemplateResponse]
473
+ def restore_auth_email_template_version(type, version, opts = {})
474
+ data, _status_code, _headers = restore_auth_email_template_version_with_http_info(type, version, opts)
475
+ data
476
+ end
477
+
478
+ # Restore a previous version
479
+ # Snapshots current state, then overwrites with the contents of the specified historical version.
480
+ # @param type [AuthEmailType]
481
+ # @param version [Integer]
482
+ # @param [Hash] opts the optional parameters
483
+ # @return [Array<(AuthEmailTemplateResponse, Integer, Hash)>] AuthEmailTemplateResponse data, response status code and response headers
484
+ def restore_auth_email_template_version_with_http_info(type, version, opts = {})
485
+ if @api_client.config.debugging
486
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.restore_auth_email_template_version ...'
487
+ end
488
+ # verify the required parameter 'type' is set
489
+ if @api_client.config.client_side_validation && type.nil?
490
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.restore_auth_email_template_version"
491
+ end
492
+ # verify the required parameter 'version' is set
493
+ if @api_client.config.client_side_validation && version.nil?
494
+ fail ArgumentError, "Missing the required parameter 'version' when calling AuthEmailTemplatesApi.restore_auth_email_template_version"
495
+ end
496
+ if @api_client.config.client_side_validation && version < 1
497
+ fail ArgumentError, 'invalid value for "version" when calling AuthEmailTemplatesApi.restore_auth_email_template_version, must be greater than or equal to 1.'
498
+ end
499
+
500
+ # resource path
501
+ local_var_path = '/auth/email-templates/{type}/versions/{version}/restore'.sub('{' + 'type' + '}', CGI.escape(type.to_s)).sub('{' + 'version' + '}', CGI.escape(version.to_s))
502
+
503
+ # query parameters
504
+ query_params = opts[:query_params] || {}
505
+
506
+ # header parameters
507
+ header_params = opts[:header_params] || {}
508
+ # HTTP header 'Accept' (if needed)
509
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
510
+
511
+ # form parameters
512
+ form_params = opts[:form_params] || {}
513
+
514
+ # http body (model)
515
+ post_body = opts[:debug_body]
516
+
517
+ # return_type
518
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateResponse'
519
+
520
+ # auth_names
521
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
522
+
523
+ new_options = opts.merge(
524
+ :operation => :"AuthEmailTemplatesApi.restore_auth_email_template_version",
525
+ :header_params => header_params,
526
+ :query_params => query_params,
527
+ :form_params => form_params,
528
+ :body => post_body,
529
+ :auth_names => auth_names,
530
+ :return_type => return_type
531
+ )
532
+
533
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
534
+ if @api_client.config.debugging
535
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#restore_auth_email_template_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
536
+ end
537
+ return data, status_code, headers
538
+ end
539
+
540
+ # Send a test render of a template
541
+ # Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
542
+ # @param type [AuthEmailType]
543
+ # @param auth_email_template_test_request [AuthEmailTemplateTestRequest]
544
+ # @param [Hash] opts the optional parameters
545
+ # @return [AuthEmailTemplateTestResponse]
546
+ def send_auth_email_template_test(type, auth_email_template_test_request, opts = {})
547
+ data, _status_code, _headers = send_auth_email_template_test_with_http_info(type, auth_email_template_test_request, opts)
548
+ data
549
+ end
550
+
551
+ # Send a test render of a template
552
+ # Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application &#x60;test_recipients&#x60; allowlist. Rate-limited.
553
+ # @param type [AuthEmailType]
554
+ # @param auth_email_template_test_request [AuthEmailTemplateTestRequest]
555
+ # @param [Hash] opts the optional parameters
556
+ # @return [Array<(AuthEmailTemplateTestResponse, Integer, Hash)>] AuthEmailTemplateTestResponse data, response status code and response headers
557
+ def send_auth_email_template_test_with_http_info(type, auth_email_template_test_request, opts = {})
558
+ if @api_client.config.debugging
559
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.send_auth_email_template_test ...'
560
+ end
561
+ # verify the required parameter 'type' is set
562
+ if @api_client.config.client_side_validation && type.nil?
563
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.send_auth_email_template_test"
564
+ end
565
+ # verify the required parameter 'auth_email_template_test_request' is set
566
+ if @api_client.config.client_side_validation && auth_email_template_test_request.nil?
567
+ fail ArgumentError, "Missing the required parameter 'auth_email_template_test_request' when calling AuthEmailTemplatesApi.send_auth_email_template_test"
568
+ end
569
+ # resource path
570
+ local_var_path = '/auth/email-templates/{type}/test'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
571
+
572
+ # query parameters
573
+ query_params = opts[:query_params] || {}
574
+
575
+ # header parameters
576
+ header_params = opts[:header_params] || {}
577
+ # HTTP header 'Accept' (if needed)
578
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
579
+ # HTTP header 'Content-Type'
580
+ content_type = @api_client.select_header_content_type(['application/json'])
581
+ if !content_type.nil?
582
+ header_params['Content-Type'] = content_type
583
+ end
584
+
585
+ # form parameters
586
+ form_params = opts[:form_params] || {}
587
+
588
+ # http body (model)
589
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(auth_email_template_test_request)
590
+
591
+ # return_type
592
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateTestResponse'
593
+
594
+ # auth_names
595
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
596
+
597
+ new_options = opts.merge(
598
+ :operation => :"AuthEmailTemplatesApi.send_auth_email_template_test",
599
+ :header_params => header_params,
600
+ :query_params => query_params,
601
+ :form_params => form_params,
602
+ :body => post_body,
603
+ :auth_names => auth_names,
604
+ :return_type => return_type
605
+ )
606
+
607
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
608
+ if @api_client.config.debugging
609
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#send_auth_email_template_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
610
+ end
611
+ return data, status_code, headers
612
+ end
613
+
614
+ # Create or update an auth email template
615
+ # Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with `details`.
616
+ # @param type [AuthEmailType]
617
+ # @param upsert_auth_email_template_request [UpsertAuthEmailTemplateRequest]
618
+ # @param [Hash] opts the optional parameters
619
+ # @return [AuthEmailTemplateResponse]
620
+ def upsert_auth_email_template(type, upsert_auth_email_template_request, opts = {})
621
+ data, _status_code, _headers = upsert_auth_email_template_with_http_info(type, upsert_auth_email_template_request, opts)
622
+ data
623
+ end
624
+
625
+ # Create or update an auth email template
626
+ # Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with &#x60;details&#x60;.
627
+ # @param type [AuthEmailType]
628
+ # @param upsert_auth_email_template_request [UpsertAuthEmailTemplateRequest]
629
+ # @param [Hash] opts the optional parameters
630
+ # @return [Array<(AuthEmailTemplateResponse, Integer, Hash)>] AuthEmailTemplateResponse data, response status code and response headers
631
+ def upsert_auth_email_template_with_http_info(type, upsert_auth_email_template_request, opts = {})
632
+ if @api_client.config.debugging
633
+ @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.upsert_auth_email_template ...'
634
+ end
635
+ # verify the required parameter 'type' is set
636
+ if @api_client.config.client_side_validation && type.nil?
637
+ fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.upsert_auth_email_template"
638
+ end
639
+ # verify the required parameter 'upsert_auth_email_template_request' is set
640
+ if @api_client.config.client_side_validation && upsert_auth_email_template_request.nil?
641
+ fail ArgumentError, "Missing the required parameter 'upsert_auth_email_template_request' when calling AuthEmailTemplatesApi.upsert_auth_email_template"
642
+ end
643
+ # resource path
644
+ local_var_path = '/auth/email-templates/{type}'.sub('{' + 'type' + '}', CGI.escape(type.to_s))
645
+
646
+ # query parameters
647
+ query_params = opts[:query_params] || {}
648
+
649
+ # header parameters
650
+ header_params = opts[:header_params] || {}
651
+ # HTTP header 'Accept' (if needed)
652
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
653
+ # HTTP header 'Content-Type'
654
+ content_type = @api_client.select_header_content_type(['application/json'])
655
+ if !content_type.nil?
656
+ header_params['Content-Type'] = content_type
657
+ end
658
+
659
+ # form parameters
660
+ form_params = opts[:form_params] || {}
661
+
662
+ # http body (model)
663
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(upsert_auth_email_template_request)
664
+
665
+ # return_type
666
+ return_type = opts[:debug_return_type] || 'AuthEmailTemplateResponse'
667
+
668
+ # auth_names
669
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
670
+
671
+ new_options = opts.merge(
672
+ :operation => :"AuthEmailTemplatesApi.upsert_auth_email_template",
673
+ :header_params => header_params,
674
+ :query_params => query_params,
675
+ :form_params => form_params,
676
+ :body => post_body,
677
+ :auth_names => auth_names,
678
+ :return_type => return_type
679
+ )
680
+
681
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
682
+ if @api_client.config.debugging
683
+ @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#upsert_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
684
+ end
685
+ return data, status_code, headers
686
+ end
687
+ end
688
+ end