Class: Zyphr::AuthEmailTemplatesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zyphr/api/auth_email_templates_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AuthEmailTemplatesApi

Returns a new instance of AuthEmailTemplatesApi.



19
20
21
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#bulk_upsert_auth_email_templates(bulk_upsert_auth_email_templates_request, opts = {}) ⇒ BulkUpsertAuthEmailTemplatesResponse

Bulk-upsert auth email templates 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.

Parameters:

Returns:



27
28
29
30
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 27

def bulk_upsert_auth_email_templates(bulk_upsert_auth_email_templates_request, opts = {})
  data, _status_code, _headers = bulk_upsert_auth_email_templates_with_http_info(bulk_upsert_auth_email_templates_request, opts)
  data
end

#bulk_upsert_auth_email_templates_with_http_info(bulk_upsert_auth_email_templates_request, opts = {}) ⇒ Array<(BulkUpsertAuthEmailTemplatesResponse, Integer, Hash)>

Bulk-upsert auth email templates 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.

Parameters:

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 37

def bulk_upsert_auth_email_templates_with_http_info(bulk_upsert_auth_email_templates_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.bulk_upsert_auth_email_templates ...'
  end
  # verify the required parameter 'bulk_upsert_auth_email_templates_request' is set
  if @api_client.config.client_side_validation && bulk_upsert_auth_email_templates_request.nil?
    fail ArgumentError, "Missing the required parameter 'bulk_upsert_auth_email_templates_request' when calling AuthEmailTemplatesApi.bulk_upsert_auth_email_templates"
  end
  # resource path
  local_var_path = '/auth/email-templates'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(bulk_upsert_auth_email_templates_request)

  # return_type
  return_type = opts[:debug_return_type] || 'BulkUpsertAuthEmailTemplatesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.bulk_upsert_auth_email_templates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#bulk_upsert_auth_email_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_auth_email_template(type, opts = {}) ⇒ AuthEmailTemplateDeleteResponse

Remove a tenant override Reverts the application to the system default for this type

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



95
96
97
98
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 95

def delete_auth_email_template(type, opts = {})
  data, _status_code, _headers = delete_auth_email_template_with_http_info(type, opts)
  data
end

#delete_auth_email_template_with_http_info(type, opts = {}) ⇒ Array<(AuthEmailTemplateDeleteResponse, Integer, Hash)>

Remove a tenant override Reverts the application to the system default for this type

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 105

def delete_auth_email_template_with_http_info(type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.delete_auth_email_template ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.delete_auth_email_template"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateDeleteResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.delete_auth_email_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#delete_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_auth_email_template(type, opts = {}) ⇒ AuthEmailTemplateResponse

Get an auth email template Returns the override row for the given ‘type` if one exists, otherwise the system default. Use `is_default` to distinguish.

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



158
159
160
161
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 158

def get_auth_email_template(type, opts = {})
  data, _status_code, _headers = get_auth_email_template_with_http_info(type, opts)
  data
end

#get_auth_email_template_default(type, opts = {}) ⇒ AuthEmailTemplateDefaultResponse

Get the system default template Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



221
222
223
224
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 221

def get_auth_email_template_default(type, opts = {})
  data, _status_code, _headers = get_auth_email_template_default_with_http_info(type, opts)
  data
end

#get_auth_email_template_default_with_http_info(type, opts = {}) ⇒ Array<(AuthEmailTemplateDefaultResponse, Integer, Hash)>

Get the system default template Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 231

def get_auth_email_template_default_with_http_info(type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.get_auth_email_template_default ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.get_auth_email_template_default"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}/default'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateDefaultResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.get_auth_email_template_default",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#get_auth_email_template_default\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_auth_email_template_with_http_info(type, opts = {}) ⇒ Array<(AuthEmailTemplateResponse, Integer, Hash)>

Get an auth email template Returns the override row for the given &#x60;type&#x60; if one exists, otherwise the system default. Use &#x60;is_default&#x60; to distinguish.

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthEmailTemplateResponse, Integer, Hash)>)

    AuthEmailTemplateResponse data, response status code and response headers



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 168

def get_auth_email_template_with_http_info(type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.get_auth_email_template ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.get_auth_email_template"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.get_auth_email_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#get_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_auth_email_template_versions(type, opts = {}) ⇒ AuthEmailTemplateVersionsResponse

List version history for a template

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



283
284
285
286
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 283

def list_auth_email_template_versions(type, opts = {})
  data, _status_code, _headers = list_auth_email_template_versions_with_http_info(type, opts)
  data
end

#list_auth_email_template_versions_with_http_info(type, opts = {}) ⇒ Array<(AuthEmailTemplateVersionsResponse, Integer, Hash)>

List version history for a template

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 292

def list_auth_email_template_versions_with_http_info(type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.list_auth_email_template_versions ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.list_auth_email_template_versions"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}/versions'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateVersionsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.list_auth_email_template_versions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#list_auth_email_template_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_auth_email_templates(opts = {}) ⇒ AuthEmailTemplateListResponse

List auth email templates 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`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



344
345
346
347
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 344

def list_auth_email_templates(opts = {})
  data, _status_code, _headers = list_auth_email_templates_with_http_info(opts)
  data
end

#list_auth_email_templates_with_http_info(opts = {}) ⇒ Array<(AuthEmailTemplateListResponse, Integer, Hash)>

List auth email templates 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;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 353

def list_auth_email_templates_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.list_auth_email_templates ...'
  end
  # resource path
  local_var_path = '/auth/email-templates'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.list_auth_email_templates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#list_auth_email_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#preview_auth_email_template(type, opts = {}) ⇒ AuthEmailTemplatePreviewResponse

Render a template with sample variables Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



403
404
405
406
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 403

def preview_auth_email_template(type, opts = {})
  data, _status_code, _headers = preview_auth_email_template_with_http_info(type, opts)
  data
end

#preview_auth_email_template_with_http_info(type, opts = {}) ⇒ Array<(AuthEmailTemplatePreviewResponse, Integer, Hash)>

Render a template with sample variables Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.

Parameters:

  • type (AuthEmailType)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 414

def preview_auth_email_template_with_http_info(type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.preview_auth_email_template ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.preview_auth_email_template"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}/preview'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'auth_email_template_preview_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplatePreviewResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.preview_auth_email_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#preview_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#restore_auth_email_template_version(type, version, opts = {}) ⇒ AuthEmailTemplateResponse

Restore a previous version Snapshots current state, then overwrites with the contents of the specified historical version.

Parameters:

  • type (AuthEmailType)
  • version (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



473
474
475
476
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 473

def restore_auth_email_template_version(type, version, opts = {})
  data, _status_code, _headers = restore_auth_email_template_version_with_http_info(type, version, opts)
  data
end

#restore_auth_email_template_version_with_http_info(type, version, opts = {}) ⇒ Array<(AuthEmailTemplateResponse, Integer, Hash)>

Restore a previous version Snapshots current state, then overwrites with the contents of the specified historical version.

Parameters:

  • type (AuthEmailType)
  • version (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthEmailTemplateResponse, Integer, Hash)>)

    AuthEmailTemplateResponse data, response status code and response headers



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 484

def restore_auth_email_template_version_with_http_info(type, version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.restore_auth_email_template_version ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.restore_auth_email_template_version"
  end
  # verify the required parameter 'version' is set
  if @api_client.config.client_side_validation && version.nil?
    fail ArgumentError, "Missing the required parameter 'version' when calling AuthEmailTemplatesApi.restore_auth_email_template_version"
  end
  if @api_client.config.client_side_validation && version < 1
    fail ArgumentError, 'invalid value for "version" when calling AuthEmailTemplatesApi.restore_auth_email_template_version, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/auth/email-templates/{type}/versions/{version}/restore'.sub('{' + 'type' + '}', CGI.escape(type.to_s)).sub('{' + 'version' + '}', CGI.escape(version.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.restore_auth_email_template_version",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#restore_auth_email_template_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_auth_email_template_test(type, auth_email_template_test_request, opts = {}) ⇒ AuthEmailTemplateTestResponse

Send a test render of a template 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.

Parameters:

Returns:



546
547
548
549
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 546

def send_auth_email_template_test(type, auth_email_template_test_request, opts = {})
  data, _status_code, _headers = send_auth_email_template_test_with_http_info(type, auth_email_template_test_request, opts)
  data
end

#send_auth_email_template_test_with_http_info(type, auth_email_template_test_request, opts = {}) ⇒ Array<(AuthEmailTemplateTestResponse, Integer, Hash)>

Send a test render of a template 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.

Parameters:

Returns:



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 557

def send_auth_email_template_test_with_http_info(type, auth_email_template_test_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.send_auth_email_template_test ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.send_auth_email_template_test"
  end
  # verify the required parameter 'auth_email_template_test_request' is set
  if @api_client.config.client_side_validation && auth_email_template_test_request.nil?
    fail ArgumentError, "Missing the required parameter 'auth_email_template_test_request' when calling AuthEmailTemplatesApi.send_auth_email_template_test"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}/test'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(auth_email_template_test_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateTestResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.send_auth_email_template_test",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#send_auth_email_template_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upsert_auth_email_template(type, upsert_auth_email_template_request, opts = {}) ⇒ AuthEmailTemplateResponse

Create or update an auth email template Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with ‘details`.

Parameters:

Returns:



620
621
622
623
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 620

def upsert_auth_email_template(type, upsert_auth_email_template_request, opts = {})
  data, _status_code, _headers = upsert_auth_email_template_with_http_info(type, upsert_auth_email_template_request, opts)
  data
end

#upsert_auth_email_template_with_http_info(type, upsert_auth_email_template_request, opts = {}) ⇒ Array<(AuthEmailTemplateResponse, Integer, Hash)>

Create or update an auth email template Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with &#x60;details&#x60;.

Parameters:

Returns:

  • (Array<(AuthEmailTemplateResponse, Integer, Hash)>)

    AuthEmailTemplateResponse data, response status code and response headers



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/zyphr/api/auth_email_templates_api.rb', line 631

def upsert_auth_email_template_with_http_info(type, upsert_auth_email_template_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthEmailTemplatesApi.upsert_auth_email_template ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling AuthEmailTemplatesApi.upsert_auth_email_template"
  end
  # verify the required parameter 'upsert_auth_email_template_request' is set
  if @api_client.config.client_side_validation && upsert_auth_email_template_request.nil?
    fail ArgumentError, "Missing the required parameter 'upsert_auth_email_template_request' when calling AuthEmailTemplatesApi.upsert_auth_email_template"
  end
  # resource path
  local_var_path = '/auth/email-templates/{type}'.sub('{' + 'type' + '}', CGI.escape(type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(upsert_auth_email_template_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AuthEmailTemplateResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthEmailTemplatesApi.upsert_auth_email_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthEmailTemplatesApi#upsert_auth_email_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end