zyphr 0.1.79 → 0.1.81

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/docs/AuthEmailTemplate.md +0 -2
  4. data/docs/AuthEmailTemplatePreviewDraft.md +0 -2
  5. data/docs/AuthEmailTemplateVersion.md +0 -2
  6. data/docs/AuthEmailTemplatesApi.md +2 -2
  7. data/docs/AuthEmailVerificationApi.md +12 -16
  8. data/docs/AuthMagicLinksApi.md +1 -1
  9. data/docs/AuthPasswordResetApi.md +1 -1
  10. data/docs/CreateTemplateRequest.md +12 -4
  11. data/docs/ForgotPasswordRequest.md +1 -1
  12. data/docs/MagicLinkSendRequest.md +1 -1
  13. data/docs/ResendEmailVerificationRequest.md +1 -1
  14. data/docs/SendEmailVerificationRequest.md +1 -1
  15. data/docs/Template.md +8 -0
  16. data/docs/TemplateClassification.md +15 -0
  17. data/docs/TemplateEditorType.md +15 -0
  18. data/docs/TemplatesApi.md +1 -1
  19. data/docs/UpdateTemplateRequest.md +9 -3
  20. data/docs/UpsertAuthEmailTemplateRequest.md +0 -2
  21. data/lib/zyphr/api/auth_email_templates_api.rb +4 -4
  22. data/lib/zyphr/api/auth_email_verification_api.rb +20 -12
  23. data/lib/zyphr/api/templates_api.rb +2 -2
  24. data/lib/zyphr/models/auth_email_template.rb +3 -13
  25. data/lib/zyphr/models/auth_email_template_preview_draft.rb +1 -11
  26. data/lib/zyphr/models/auth_email_template_version.rb +3 -13
  27. data/lib/zyphr/models/create_template_request.rb +87 -7
  28. data/lib/zyphr/models/forgot_password_request.rb +18 -0
  29. data/lib/zyphr/models/magic_link_send_request.rb +18 -0
  30. data/lib/zyphr/models/resend_email_verification_request.rb +18 -1
  31. data/lib/zyphr/models/send_email_verification_request.rb +18 -1
  32. data/lib/zyphr/models/template.rb +78 -1
  33. data/lib/zyphr/models/template_classification.rb +40 -0
  34. data/lib/zyphr/models/template_editor_type.rb +40 -0
  35. data/lib/zyphr/models/update_template_request.rb +62 -6
  36. data/lib/zyphr/models/upsert_auth_email_template_request.rb +4 -14
  37. data/lib/zyphr.rb +2 -0
  38. data/spec/api/auth_email_templates_api_spec.rb +2 -2
  39. data/spec/api/auth_email_verification_api_spec.rb +2 -2
  40. data/spec/api/templates_api_spec.rb +1 -1
  41. data/spec/models/auth_email_template_preview_draft_spec.rb +0 -6
  42. data/spec/models/auth_email_template_spec.rb +1 -7
  43. data/spec/models/auth_email_template_version_spec.rb +1 -7
  44. data/spec/models/create_template_request_spec.rb +28 -0
  45. data/spec/models/template_classification_spec.rb +30 -0
  46. data/spec/models/template_editor_type_spec.rb +30 -0
  47. data/spec/models/template_spec.rb +28 -0
  48. data/spec/models/update_template_request_spec.rb +18 -0
  49. data/spec/models/upsert_auth_email_template_request_spec.rb +1 -7
  50. data/zyphr.gemspec +1 -1
  51. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 630c672873231b9d5829033257022ed91aa1604f27e40bc977903d566102e8e0
4
- data.tar.gz: 381af5300b2be4e4785b9e7b23d57fb07cf8536c3f7173d18ca9c70d9d028693
3
+ metadata.gz: e8d3f67a8dc12caec47c02c3af8e1e29a02bbf361186ad8fb4d6a7c7e9fe82e6
4
+ data.tar.gz: 4d1349e5ce557e12f2923c138644cb6a67ede06c34b4243161e5fe5531774cac
5
5
  SHA512:
6
- metadata.gz: 58a5ead8088cb50ba231f2e6df44ccf9d0b73960829e68cf2edd725b717fea2bf42cf8f3b7383fc3952f0716ef58dde51524853ba38fd46368f31847c1d4b279
7
- data.tar.gz: b7f67795771a72f547e56b95ab5cdd26e5b245ade9bdfafafb3300a35e4681dc4e0705c6e5fb658ac399e54404eeadfeb868857b86be9afb6b165f0e9f3ff7f0
6
+ metadata.gz: ef7f20fc4e42980f3b7d7734d7cdcade2c83bec0efdc86670d988c409ffbd92e4880c0b19a94edc8e4256c19ee5fe429b35cd61e669ac86e22f94f11147ff81e
7
+ data.tar.gz: 371eb8c10c7cd7ca0fdb5925bbebc6deaeccbb835dde65e1c965a63f57a587370aa8733da90bfbf124494699a4e08aca767239b193f9df9968dd0bfac9429d2e
data/README.md CHANGED
@@ -802,6 +802,8 @@ Class | Method | HTTP request | Description
802
802
  - [Zyphr::SwitchOrganizationResponseDataTokens](docs/SwitchOrganizationResponseDataTokens.md)
803
803
  - [Zyphr::SwitchOrganizationResponseDataUser](docs/SwitchOrganizationResponseDataUser.md)
804
804
  - [Zyphr::Template](docs/Template.md)
805
+ - [Zyphr::TemplateClassification](docs/TemplateClassification.md)
806
+ - [Zyphr::TemplateEditorType](docs/TemplateEditorType.md)
805
807
  - [Zyphr::TemplateListResponse](docs/TemplateListResponse.md)
806
808
  - [Zyphr::TemplateRenderResponse](docs/TemplateRenderResponse.md)
807
809
  - [Zyphr::TemplateRenderedContent](docs/TemplateRenderedContent.md)
@@ -8,7 +8,6 @@
8
8
  | **subject** | **String** | | [optional] |
9
9
  | **html** | **String** | | [optional] |
10
10
  | **text** | **String** | | [optional] |
11
- | **mjml_source** | **String** | | [optional] |
12
11
  | **design_json** | **Hash<String, Object>** | | [optional] |
13
12
  | **editor_type** | **String** | | [optional] |
14
13
  | **from_name** | **String** | | [optional] |
@@ -28,7 +27,6 @@ instance = Zyphr::AuthEmailTemplate.new(
28
27
  subject: null,
29
28
  html: null,
30
29
  text: null,
31
- mjml_source: null,
32
30
  design_json: null,
33
31
  editor_type: null,
34
32
  from_name: null,
@@ -7,7 +7,6 @@
7
7
  | **subject** | **String** | | [optional] |
8
8
  | **html** | **String** | | [optional] |
9
9
  | **text** | **String** | | [optional] |
10
- | **mjml_source** | **String** | | [optional] |
11
10
  | **from_name** | **String** | | [optional] |
12
11
  | **reply_to** | **String** | | [optional] |
13
12
 
@@ -20,7 +19,6 @@ instance = Zyphr::AuthEmailTemplatePreviewDraft.new(
20
19
  subject: null,
21
20
  html: null,
22
21
  text: null,
23
- mjml_source: null,
24
22
  from_name: null,
25
23
  reply_to: null
26
24
  )
@@ -8,7 +8,6 @@
8
8
  | **subject** | **String** | | [optional] |
9
9
  | **html** | **String** | | [optional] |
10
10
  | **text** | **String** | | [optional] |
11
- | **mjml_source** | **String** | | [optional] |
12
11
  | **design_json** | **Hash<String, Object>** | | [optional] |
13
12
  | **editor_type** | **String** | | [optional] |
14
13
  | **from_name** | **String** | | [optional] |
@@ -26,7 +25,6 @@ instance = Zyphr::AuthEmailTemplateVersion.new(
26
25
  subject: null,
27
26
  html: null,
28
27
  text: null,
29
- mjml_source: null,
30
28
  design_json: null,
31
29
  editor_type: null,
32
30
  from_name: null,
@@ -22,7 +22,7 @@ All URIs are relative to *https://api.zyphr.dev/v1*
22
22
 
23
23
  Bulk-upsert auth email templates
24
24
 
25
- Atomic upsert of any subset of magic_link, password_reset, email_verification, email_otp, invitation. 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.
25
+ Atomic upsert of any subset of magic_link, password_reset, email_verification, email_otp, invitation. Validates all inputs before any write; if any one fails validation or design export, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
26
26
 
27
27
  ### Examples
28
28
 
@@ -709,7 +709,7 @@ end
709
709
 
710
710
  Create or update an auth email template
711
711
 
712
- Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with `details`.
712
+ Idempotent upsert keyed by application + type. A visual editor `design_json` (`format: zyphr-email/1`) is exported to `html` on save; a design that can't be exported returns 400.
713
713
 
714
714
  ### Examples
715
715
 
@@ -87,7 +87,7 @@ end
87
87
 
88
88
  ## resend_email_verification
89
89
 
90
- > <SuccessResult> resend_email_verification(opts)
90
+ > <SuccessResult> resend_email_verification(resend_email_verification_request)
91
91
 
92
92
  Resend email verification
93
93
 
@@ -115,13 +115,11 @@ Zyphr.configure do |config|
115
115
  end
116
116
 
117
117
  api_instance = Zyphr::AuthEmailVerificationApi.new
118
- opts = {
119
- resend_email_verification_request: Zyphr::ResendEmailVerificationRequest.new # ResendEmailVerificationRequest |
120
- }
118
+ resend_email_verification_request = Zyphr::ResendEmailVerificationRequest.new({redirect_url: 'redirect_url_example'}) # ResendEmailVerificationRequest |
121
119
 
122
120
  begin
123
121
  # Resend email verification
124
- result = api_instance.resend_email_verification(opts)
122
+ result = api_instance.resend_email_verification(resend_email_verification_request)
125
123
  p result
126
124
  rescue Zyphr::ApiError => e
127
125
  puts "Error when calling AuthEmailVerificationApi->resend_email_verification: #{e}"
@@ -132,12 +130,12 @@ end
132
130
 
133
131
  This returns an Array which contains the response data, status code and headers.
134
132
 
135
- > <Array(<SuccessResult>, Integer, Hash)> resend_email_verification_with_http_info(opts)
133
+ > <Array(<SuccessResult>, Integer, Hash)> resend_email_verification_with_http_info(resend_email_verification_request)
136
134
 
137
135
  ```ruby
138
136
  begin
139
137
  # Resend email verification
140
- data, status_code, headers = api_instance.resend_email_verification_with_http_info(opts)
138
+ data, status_code, headers = api_instance.resend_email_verification_with_http_info(resend_email_verification_request)
141
139
  p status_code # => 2xx
142
140
  p headers # => { ... }
143
141
  p data # => <SuccessResult>
@@ -150,7 +148,7 @@ end
150
148
 
151
149
  | Name | Type | Description | Notes |
152
150
  | ---- | ---- | ----------- | ----- |
153
- | **resend_email_verification_request** | [**ResendEmailVerificationRequest**](ResendEmailVerificationRequest.md) | | [optional] |
151
+ | **resend_email_verification_request** | [**ResendEmailVerificationRequest**](ResendEmailVerificationRequest.md) | | |
154
152
 
155
153
  ### Return type
156
154
 
@@ -168,7 +166,7 @@ end
168
166
 
169
167
  ## send_email_verification
170
168
 
171
- > <SuccessResult> send_email_verification(opts)
169
+ > <SuccessResult> send_email_verification(send_email_verification_request)
172
170
 
173
171
  Send email verification
174
172
 
@@ -196,13 +194,11 @@ Zyphr.configure do |config|
196
194
  end
197
195
 
198
196
  api_instance = Zyphr::AuthEmailVerificationApi.new
199
- opts = {
200
- send_email_verification_request: Zyphr::SendEmailVerificationRequest.new # SendEmailVerificationRequest |
201
- }
197
+ send_email_verification_request = Zyphr::SendEmailVerificationRequest.new({redirect_url: 'redirect_url_example'}) # SendEmailVerificationRequest |
202
198
 
203
199
  begin
204
200
  # Send email verification
205
- result = api_instance.send_email_verification(opts)
201
+ result = api_instance.send_email_verification(send_email_verification_request)
206
202
  p result
207
203
  rescue Zyphr::ApiError => e
208
204
  puts "Error when calling AuthEmailVerificationApi->send_email_verification: #{e}"
@@ -213,12 +209,12 @@ end
213
209
 
214
210
  This returns an Array which contains the response data, status code and headers.
215
211
 
216
- > <Array(<SuccessResult>, Integer, Hash)> send_email_verification_with_http_info(opts)
212
+ > <Array(<SuccessResult>, Integer, Hash)> send_email_verification_with_http_info(send_email_verification_request)
217
213
 
218
214
  ```ruby
219
215
  begin
220
216
  # Send email verification
221
- data, status_code, headers = api_instance.send_email_verification_with_http_info(opts)
217
+ data, status_code, headers = api_instance.send_email_verification_with_http_info(send_email_verification_request)
222
218
  p status_code # => 2xx
223
219
  p headers # => { ... }
224
220
  p data # => <SuccessResult>
@@ -231,7 +227,7 @@ end
231
227
 
232
228
  | Name | Type | Description | Notes |
233
229
  | ---- | ---- | ----------- | ----- |
234
- | **send_email_verification_request** | [**SendEmailVerificationRequest**](SendEmailVerificationRequest.md) | | [optional] |
230
+ | **send_email_verification_request** | [**SendEmailVerificationRequest**](SendEmailVerificationRequest.md) | | |
235
231
 
236
232
  ### Return type
237
233
 
@@ -35,7 +35,7 @@ Zyphr.configure do |config|
35
35
  end
36
36
 
37
37
  api_instance = Zyphr::AuthMagicLinksApi.new
38
- magic_link_send_request = Zyphr::MagicLinkSendRequest.new({email: 'email_example'}) # MagicLinkSendRequest |
38
+ magic_link_send_request = Zyphr::MagicLinkSendRequest.new({email: 'email_example', redirect_url: 'redirect_url_example'}) # MagicLinkSendRequest |
39
39
 
40
40
  begin
41
41
  # Send a magic link
@@ -36,7 +36,7 @@ Zyphr.configure do |config|
36
36
  end
37
37
 
38
38
  api_instance = Zyphr::AuthPasswordResetApi.new
39
- forgot_password_request = Zyphr::ForgotPasswordRequest.new({email: 'email_example'}) # ForgotPasswordRequest |
39
+ forgot_password_request = Zyphr::ForgotPasswordRequest.new({email: 'email_example', redirect_url: 'redirect_url_example'}) # ForgotPasswordRequest |
40
40
 
41
41
  begin
42
42
  # Request a password reset
@@ -6,9 +6,13 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **name** | **String** | Template name (letters, numbers, underscores, hyphens) | |
8
8
  | **description** | **String** | | [optional] |
9
- | **subject** | **String** | Email subject line. Supports Handlebars &#x60;{{var}}&#x60; interpolation; values are HTML-escaped on render (see &#x60;html&#x60; field for the full escape policy). | [optional] |
10
- | **html** | **String** | HTML body. Supports Handlebars &#x60;{{var}}&#x60; interpolation; values are always HTML-escaped on render. **Triple-brace &#x60;{{{var}}}&#x60; (raw HTML output) is not supported** for XSS-prevention reasons — input containing &#x60;{{{var}}}&#x60; is rewritten to &#x60;{{var}}&#x60; on save and the response includes a top-level &#x60;warnings&#x60; array describing what changed. To inject pre-rendered HTML, render the entire &#x60;html&#x60; field outside Zyphr and POST it to &#x60;/v1/email/send&#x60; directly without &#x60;template_id&#x60;. | [optional] |
11
- | **text** | **String** | Plain text body. Supports Handlebars &#x60;{{var}}&#x60; interpolation; triple-brace syntax is rewritten to double-brace on save (same policy as the &#x60;html&#x60; field). | [optional] |
9
+ | **channel** | **String** | Channel the template is for. Set on create only; it cannot be changed later. Names are unique per channel within a project. | [optional][default to &#39;email&#39;] |
10
+ | **subject** | **String** | Email subject line (push: the notification title). Supports Handlebars &#x60;{{var}}&#x60; interpolation. Values are inserted as written, not HTML-escaped: the subject is not HTML. | [optional] |
11
+ | **html** | **String** | HTML body. Supports Handlebars &#x60;{{var}}&#x60; interpolation; values are always HTML-escaped on render (the subject and text are not). **Triple-brace &#x60;{{{var}}}&#x60; (raw HTML output) is not supported** for XSS-prevention reasons — input containing &#x60;{{{var}}}&#x60; is rewritten to &#x60;{{var}}&#x60; on save and the response includes a top-level &#x60;warnings&#x60; array describing what changed. To inject pre-rendered HTML, render the entire &#x60;html&#x60; field outside Zyphr and POST it to &#x60;/v1/email/send&#x60; directly without &#x60;template_id&#x60;. | [optional] |
12
+ | **text** | **String** | Plain text body (SMS and push: the message body). Supports Handlebars &#x60;{{var}}&#x60; interpolation. Values are inserted as written, not HTML-escaped. Triple-brace syntax is rewritten to double-brace on save (same policy as the &#x60;html&#x60; field). | [optional] |
13
+ | **design_json** | **Hash&lt;String, Object&gt;** | The visual editor&#39;s document, stored so the template can be reopened in the editor. At most 1 MB. Sending always uses &#x60;html&#x60;. A document with &#x60;\&quot;format\&quot;: \&quot;zyphr-email/1\&quot;&#x60; (from the current visual editor) is exported to &#x60;html&#x60; by the API when it is saved, replacing any &#x60;html&#x60; sent with it, and a document that can&#39;t be exported is rejected with 400. Other documents are stored as given and never rendered. | [optional] |
14
+ | **editor_type** | [**TemplateEditorType**](TemplateEditorType.md) | | [optional][default to &#39;code&#39;] |
15
+ | **classification** | [**TemplateClassification**](TemplateClassification.md) | | [optional] |
12
16
 
13
17
  ## Example
14
18
 
@@ -18,9 +22,13 @@ require 'zyphr'
18
22
  instance = Zyphr::CreateTemplateRequest.new(
19
23
  name: welcome_email,
20
24
  description: null,
25
+ channel: null,
21
26
  subject: Welcome to {{company_name}}!,
22
27
  html: null,
23
- text: null
28
+ text: null,
29
+ design_json: null,
30
+ editor_type: null,
31
+ classification: null
24
32
  )
25
33
  ```
26
34
 
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **email** | **String** | | |
8
- | **redirect_url** | **String** | | [optional] |
8
+ | **redirect_url** | **String** | Where the emailed link points (&#x60;?token&#x3D;&lt;raw&gt;&#x60; is appended). Required: Zyphr does not host auth pages. Must match the application&#39;s redirect_uris when any are registered. | |
9
9
  | **return_link** | **Boolean** | When true, Zyphr mints the token but sends no email, and returns the link in &#x60;data.link&#x60; so you can render and send the email yourself (for example through &#x60;POST /v1/emails&#x60;). Requires &#x60;redirect_url&#x60;. | [optional][default to false] |
10
10
 
11
11
  ## Example
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **email** | **String** | | |
8
- | **redirect_url** | **String** | | [optional] |
8
+ | **redirect_url** | **String** | Where the emailed link points (&#x60;?token&#x3D;&lt;raw&gt;&#x60; is appended). Required: Zyphr does not host auth pages. Must match the application&#39;s redirect_uris when any are registered. | |
9
9
  | **return_link** | **Boolean** | When true, Zyphr mints the token but sends no email, and returns the link in &#x60;data.link&#x60; so you can render and send the email yourself (for example through &#x60;POST /v1/emails&#x60;). Requires &#x60;redirect_url&#x60;. | [optional][default to false] |
10
10
 
11
11
  ## Example
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **redirect_url** | **String** | URL to redirect to after verification. Same rules as &#x60;POST /auth/verify-email/send&#x60;. | [optional] |
7
+ | **redirect_url** | **String** | Required. URL to redirect to after verification. Same rules as &#x60;POST /auth/verify-email/send&#x60;. | |
8
8
 
9
9
  ## Example
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **redirect_url** | **String** | URL to redirect to after verification. Must be snake_case &#x60;redirect_url&#x60;: a camelCase &#x60;redirectUrl&#x60; is rejected with 400, since Zyphr hosts no fallback page. Must match one of the application&#39;s configured redirect URIs. | [optional] |
7
+ | **redirect_url** | **String** | Required. URL to redirect to after verification. Must be snake_case &#x60;redirect_url&#x60;: a camelCase &#x60;redirectUrl&#x60; is rejected with 400, since Zyphr hosts no fallback page. Must match one of the application&#39;s configured redirect URIs. | |
8
8
 
9
9
  ## Example
10
10
 
data/docs/Template.md CHANGED
@@ -6,12 +6,16 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **id** | **String** | | [optional] |
8
8
  | **name** | **String** | | [optional] |
9
+ | **channel** | **String** | | [optional] |
9
10
  | **description** | **String** | | [optional] |
10
11
  | **subject** | **String** | | [optional] |
11
12
  | **html** | **String** | | [optional] |
12
13
  | **text** | **String** | | [optional] |
13
14
  | **variables** | **Array&lt;String&gt;** | Variable names auto-detected from &#x60;{{var}}&#x60; placeholders in subject, html, and text. Server-derived; ignored if supplied on create/update. | [optional][readonly] |
14
15
  | **version** | **Integer** | | [optional] |
16
+ | **design_json** | **Hash&lt;String, Object&gt;** | Omitted from list responses, which also omit &#x60;html&#x60; and &#x60;text&#x60;. | [optional] |
17
+ | **editor_type** | [**TemplateEditorType**](TemplateEditorType.md) | | [optional][default to &#39;code&#39;] |
18
+ | **classification** | [**TemplateClassification**](TemplateClassification.md) | | [optional] |
15
19
  | **created_at** | **Time** | | [optional] |
16
20
  | **updated_at** | **Time** | | [optional] |
17
21
 
@@ -23,12 +27,16 @@ require 'zyphr'
23
27
  instance = Zyphr::Template.new(
24
28
  id: null,
25
29
  name: null,
30
+ channel: null,
26
31
  description: null,
27
32
  subject: null,
28
33
  html: null,
29
34
  text: null,
30
35
  variables: null,
31
36
  version: null,
37
+ design_json: null,
38
+ editor_type: null,
39
+ classification: null,
32
40
  created_at: null,
33
41
  updated_at: null
34
42
  )
@@ -0,0 +1,15 @@
1
+ # Zyphr::TemplateClassification
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'zyphr'
12
+
13
+ instance = Zyphr::TemplateClassification.new()
14
+ ```
15
+
@@ -0,0 +1,15 @@
1
+ # Zyphr::TemplateEditorType
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'zyphr'
12
+
13
+ instance = Zyphr::TemplateEditorType.new()
14
+ ```
15
+
data/docs/TemplatesApi.md CHANGED
@@ -19,7 +19,7 @@ All URIs are relative to *https://api.zyphr.dev/v1*
19
19
 
20
20
  Create template
21
21
 
22
- Create a new email template. Name must be unique within the account.
22
+ Create an email, SMS or push template. The name must be unique per channel within the project.
23
23
 
24
24
  ### Examples
25
25
 
@@ -6,9 +6,12 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **name** | **String** | | [optional] |
8
8
  | **description** | **String** | | [optional] |
9
- | **subject** | **String** | Email subject line. Supports Handlebars &#x60;{{var}}&#x60; interpolation (HTML-escaped on render). | [optional] |
9
+ | **subject** | **String** | Email subject line (push: the notification title). Supports Handlebars &#x60;{{var}}&#x60; interpolation; values are not HTML-escaped. | [optional] |
10
10
  | **html** | **String** | HTML body. Supports Handlebars &#x60;{{var}}&#x60; interpolation; values are always HTML-escaped on render. Triple-brace &#x60;{{{var}}}&#x60; is not supported — input is rewritten to &#x60;{{var}}&#x60; on save and the response includes a top-level &#x60;warnings&#x60; array describing the rewrite. See &#x60;CreateTemplateRequest.html&#x60; for full rationale. | [optional] |
11
- | **text** | **String** | Plain text body. Supports Handlebars &#x60;{{var}}&#x60; interpolation; same triple-brace rewrite policy as &#x60;html&#x60;. | [optional] |
11
+ | **text** | **String** | Plain text body. Supports Handlebars &#x60;{{var}}&#x60; interpolation; values are not HTML-escaped. Same triple-brace rewrite policy as &#x60;html&#x60;. | [optional] |
12
+ | **design_json** | **Hash&lt;String, Object&gt;** | The visual editor&#39;s document, stored so the template can be reopened in the editor. At most 1 MB. Sending always uses &#x60;html&#x60;. A document with &#x60;\&quot;format\&quot;: \&quot;zyphr-email/1\&quot;&#x60; (from the current visual editor) is exported to &#x60;html&#x60; by the API when it is saved, replacing any &#x60;html&#x60; sent with it, and a document that can&#39;t be exported is rejected with 400. Other documents are stored as given and never rendered. | [optional] |
13
+ | **editor_type** | [**TemplateEditorType**](TemplateEditorType.md) | | [optional][default to &#39;code&#39;] |
14
+ | **classification** | [**TemplateClassification**](TemplateClassification.md) | | [optional] |
12
15
 
13
16
  ## Example
14
17
 
@@ -20,7 +23,10 @@ instance = Zyphr::UpdateTemplateRequest.new(
20
23
  description: null,
21
24
  subject: null,
22
25
  html: null,
23
- text: null
26
+ text: null,
27
+ design_json: null,
28
+ editor_type: null,
29
+ classification: null
24
30
  )
25
31
  ```
26
32
 
@@ -7,7 +7,6 @@
7
7
  | **subject** | **String** | | [optional] |
8
8
  | **html** | **String** | | [optional] |
9
9
  | **text** | **String** | | [optional] |
10
- | **mjml_source** | **String** | | [optional] |
11
10
  | **design_json** | **Hash&lt;String, Object&gt;** | | [optional] |
12
11
  | **editor_type** | **String** | | [optional] |
13
12
  | **from_name** | **String** | | [optional] |
@@ -23,7 +22,6 @@ instance = Zyphr::UpsertAuthEmailTemplateRequest.new(
23
22
  subject: null,
24
23
  html: null,
25
24
  text: null,
26
- mjml_source: null,
27
25
  design_json: null,
28
26
  editor_type: null,
29
27
  from_name: null,
@@ -20,7 +20,7 @@ module Zyphr
20
20
  @api_client = api_client
21
21
  end
22
22
  # Bulk-upsert auth email templates
23
- # Atomic upsert of any subset of magic_link, password_reset, email_verification, email_otp, invitation. 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.
23
+ # Atomic upsert of any subset of magic_link, password_reset, email_verification, email_otp, invitation. Validates all inputs before any write; if any one fails validation or design export, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
24
24
  # @param bulk_upsert_auth_email_templates_request [BulkUpsertAuthEmailTemplatesRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [BulkUpsertAuthEmailTemplatesResponse]
@@ -30,7 +30,7 @@ module Zyphr
30
30
  end
31
31
 
32
32
  # Bulk-upsert auth email templates
33
- # Atomic upsert of any subset of magic_link, password_reset, email_verification, email_otp, invitation. 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.
33
+ # Atomic upsert of any subset of magic_link, password_reset, email_verification, email_otp, invitation. Validates all inputs before any write; if any one fails validation or design export, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
34
34
  # @param bulk_upsert_auth_email_templates_request [BulkUpsertAuthEmailTemplatesRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(BulkUpsertAuthEmailTemplatesResponse, Integer, Hash)>] BulkUpsertAuthEmailTemplatesResponse data, response status code and response headers
@@ -612,7 +612,7 @@ module Zyphr
612
612
  end
613
613
 
614
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`.
615
+ # Idempotent upsert keyed by application + type. A visual editor `design_json` (`format: zyphr-email/1`) is exported to `html` on save; a design that can't be exported returns 400.
616
616
  # @param type [AuthEmailType]
617
617
  # @param upsert_auth_email_template_request [UpsertAuthEmailTemplateRequest]
618
618
  # @param [Hash] opts the optional parameters
@@ -623,7 +623,7 @@ module Zyphr
623
623
  end
624
624
 
625
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;.
626
+ # Idempotent upsert keyed by application + type. A visual editor &#x60;design_json&#x60; (&#x60;format: zyphr-email/1&#x60;) is exported to &#x60;html&#x60; on save; a design that can&#39;t be exported returns 400.
627
627
  # @param type [AuthEmailType]
628
628
  # @param upsert_auth_email_template_request [UpsertAuthEmailTemplateRequest]
629
629
  # @param [Hash] opts the optional parameters
@@ -89,23 +89,27 @@ module Zyphr
89
89
 
90
90
  # Resend email verification
91
91
  # Resend the verification email to the authenticated user. Rate limited to once per 60 seconds. Requires all three credentials simultaneously: the application key (`X-Application-Key`), the application secret (`X-Application-Secret`), and the end user's `Authorization: Bearer` token. Failures behave as on `POST /auth/verify-email/send`, including the 200 accepted-and-suppressed response for a recipient outside the application allowlist.
92
+ # @param resend_email_verification_request [ResendEmailVerificationRequest]
92
93
  # @param [Hash] opts the optional parameters
93
- # @option opts [ResendEmailVerificationRequest] :resend_email_verification_request
94
94
  # @return [SuccessResult]
95
- def resend_email_verification(opts = {})
96
- data, _status_code, _headers = resend_email_verification_with_http_info(opts)
95
+ def resend_email_verification(resend_email_verification_request, opts = {})
96
+ data, _status_code, _headers = resend_email_verification_with_http_info(resend_email_verification_request, opts)
97
97
  data
98
98
  end
99
99
 
100
100
  # Resend email verification
101
101
  # Resend the verification email to the authenticated user. Rate limited to once per 60 seconds. Requires all three credentials simultaneously: the application key (&#x60;X-Application-Key&#x60;), the application secret (&#x60;X-Application-Secret&#x60;), and the end user&#39;s &#x60;Authorization: Bearer&#x60; token. Failures behave as on &#x60;POST /auth/verify-email/send&#x60;, including the 200 accepted-and-suppressed response for a recipient outside the application allowlist.
102
+ # @param resend_email_verification_request [ResendEmailVerificationRequest]
102
103
  # @param [Hash] opts the optional parameters
103
- # @option opts [ResendEmailVerificationRequest] :resend_email_verification_request
104
104
  # @return [Array<(SuccessResult, Integer, Hash)>] SuccessResult data, response status code and response headers
105
- def resend_email_verification_with_http_info(opts = {})
105
+ def resend_email_verification_with_http_info(resend_email_verification_request, opts = {})
106
106
  if @api_client.config.debugging
107
107
  @api_client.config.logger.debug 'Calling API: AuthEmailVerificationApi.resend_email_verification ...'
108
108
  end
109
+ # verify the required parameter 'resend_email_verification_request' is set
110
+ if @api_client.config.client_side_validation && resend_email_verification_request.nil?
111
+ fail ArgumentError, "Missing the required parameter 'resend_email_verification_request' when calling AuthEmailVerificationApi.resend_email_verification"
112
+ end
109
113
  # resource path
110
114
  local_var_path = '/auth/verify-email/resend'
111
115
 
@@ -126,7 +130,7 @@ module Zyphr
126
130
  form_params = opts[:form_params] || {}
127
131
 
128
132
  # http body (model)
129
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'resend_email_verification_request'])
133
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(resend_email_verification_request)
130
134
 
131
135
  # return_type
132
136
  return_type = opts[:debug_return_type] || 'SuccessResult'
@@ -153,23 +157,27 @@ module Zyphr
153
157
 
154
158
  # Send email verification
155
159
  # Send an email verification link to the authenticated user. Requires all three credentials simultaneously: the application key (`X-Application-Key`), the application secret (`X-Application-Secret`), and the end user's `Authorization: Bearer` token. If the recipient is blocked by the application's `auth_email_mode=allowlist` gate, the request is still **accepted with 200** (mirroring `POST /auth/forgot-password`): no email is sent, and the suppression is recorded as a `messages` row (`status=suppressed`, `status_reason=recipient_not_allowlisted`) and an `email.suppressed` webhook. It is NOT a 500.
160
+ # @param send_email_verification_request [SendEmailVerificationRequest]
156
161
  # @param [Hash] opts the optional parameters
157
- # @option opts [SendEmailVerificationRequest] :send_email_verification_request
158
162
  # @return [SuccessResult]
159
- def send_email_verification(opts = {})
160
- data, _status_code, _headers = send_email_verification_with_http_info(opts)
163
+ def send_email_verification(send_email_verification_request, opts = {})
164
+ data, _status_code, _headers = send_email_verification_with_http_info(send_email_verification_request, opts)
161
165
  data
162
166
  end
163
167
 
164
168
  # Send email verification
165
169
  # Send an email verification link to the authenticated user. Requires all three credentials simultaneously: the application key (&#x60;X-Application-Key&#x60;), the application secret (&#x60;X-Application-Secret&#x60;), and the end user&#39;s &#x60;Authorization: Bearer&#x60; token. If the recipient is blocked by the application&#39;s &#x60;auth_email_mode&#x3D;allowlist&#x60; gate, the request is still **accepted with 200** (mirroring &#x60;POST /auth/forgot-password&#x60;): no email is sent, and the suppression is recorded as a &#x60;messages&#x60; row (&#x60;status&#x3D;suppressed&#x60;, &#x60;status_reason&#x3D;recipient_not_allowlisted&#x60;) and an &#x60;email.suppressed&#x60; webhook. It is NOT a 500.
170
+ # @param send_email_verification_request [SendEmailVerificationRequest]
166
171
  # @param [Hash] opts the optional parameters
167
- # @option opts [SendEmailVerificationRequest] :send_email_verification_request
168
172
  # @return [Array<(SuccessResult, Integer, Hash)>] SuccessResult data, response status code and response headers
169
- def send_email_verification_with_http_info(opts = {})
173
+ def send_email_verification_with_http_info(send_email_verification_request, opts = {})
170
174
  if @api_client.config.debugging
171
175
  @api_client.config.logger.debug 'Calling API: AuthEmailVerificationApi.send_email_verification ...'
172
176
  end
177
+ # verify the required parameter 'send_email_verification_request' is set
178
+ if @api_client.config.client_side_validation && send_email_verification_request.nil?
179
+ fail ArgumentError, "Missing the required parameter 'send_email_verification_request' when calling AuthEmailVerificationApi.send_email_verification"
180
+ end
173
181
  # resource path
174
182
  local_var_path = '/auth/verify-email/send'
175
183
 
@@ -190,7 +198,7 @@ module Zyphr
190
198
  form_params = opts[:form_params] || {}
191
199
 
192
200
  # http body (model)
193
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'send_email_verification_request'])
201
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(send_email_verification_request)
194
202
 
195
203
  # return_type
196
204
  return_type = opts[:debug_return_type] || 'SuccessResult'
@@ -20,7 +20,7 @@ module Zyphr
20
20
  @api_client = api_client
21
21
  end
22
22
  # Create template
23
- # Create a new email template. Name must be unique within the account.
23
+ # Create an email, SMS or push template. The name must be unique per channel within the project.
24
24
  # @param create_template_request [CreateTemplateRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [TemplateResponse]
@@ -30,7 +30,7 @@ module Zyphr
30
30
  end
31
31
 
32
32
  # Create template
33
- # Create a new email template. Name must be unique within the account.
33
+ # Create an email, SMS or push template. The name must be unique per channel within the project.
34
34
  # @param create_template_request [CreateTemplateRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(TemplateResponse, Integer, Hash)>] TemplateResponse data, response status code and response headers
@@ -23,8 +23,6 @@ module Zyphr
23
23
 
24
24
  attr_accessor :text
25
25
 
26
- attr_accessor :mjml_source
27
-
28
26
  attr_accessor :design_json
29
27
 
30
28
  attr_accessor :editor_type
@@ -71,7 +69,6 @@ module Zyphr
71
69
  :'subject' => :'subject',
72
70
  :'html' => :'html',
73
71
  :'text' => :'text',
74
- :'mjml_source' => :'mjml_source',
75
72
  :'design_json' => :'design_json',
76
73
  :'editor_type' => :'editor_type',
77
74
  :'from_name' => :'from_name',
@@ -100,7 +97,6 @@ module Zyphr
100
97
  :'subject' => :'String',
101
98
  :'html' => :'String',
102
99
  :'text' => :'String',
103
- :'mjml_source' => :'String',
104
100
  :'design_json' => :'Hash<String, Object>',
105
101
  :'editor_type' => :'String',
106
102
  :'from_name' => :'String',
@@ -116,7 +112,6 @@ module Zyphr
116
112
  def self.openapi_nullable
117
113
  Set.new([
118
114
  :'text',
119
- :'mjml_source',
120
115
  :'design_json',
121
116
  :'editor_type',
122
117
  :'from_name',
@@ -157,10 +152,6 @@ module Zyphr
157
152
  self.text = attributes[:'text']
158
153
  end
159
154
 
160
- if attributes.key?(:'mjml_source')
161
- self.mjml_source = attributes[:'mjml_source']
162
- end
163
-
164
155
  if attributes.key?(:'design_json')
165
156
  if (value = attributes[:'design_json']).is_a?(Hash)
166
157
  self.design_json = value
@@ -208,7 +199,7 @@ module Zyphr
208
199
  # @return true if the model is valid
209
200
  def valid?
210
201
  warn '[DEPRECATED] the `valid?` method is obsolete'
211
- editor_type_validator = EnumAttributeValidator.new('String', ["code", "mjml", "design"])
202
+ editor_type_validator = EnumAttributeValidator.new('String', ["code", "visual"])
212
203
  return false unless editor_type_validator.valid?(@editor_type)
213
204
  true
214
205
  end
@@ -216,7 +207,7 @@ module Zyphr
216
207
  # Custom attribute writer method checking allowed values (enum).
217
208
  # @param [Object] editor_type Object to be assigned
218
209
  def editor_type=(editor_type)
219
- validator = EnumAttributeValidator.new('String', ["code", "mjml", "design"])
210
+ validator = EnumAttributeValidator.new('String', ["code", "visual"])
220
211
  unless validator.valid?(editor_type)
221
212
  fail ArgumentError, "invalid value for \"editor_type\", must be one of #{validator.allowable_values}."
222
213
  end
@@ -232,7 +223,6 @@ module Zyphr
232
223
  subject == o.subject &&
233
224
  html == o.html &&
234
225
  text == o.text &&
235
- mjml_source == o.mjml_source &&
236
226
  design_json == o.design_json &&
237
227
  editor_type == o.editor_type &&
238
228
  from_name == o.from_name &&
@@ -252,7 +242,7 @@ module Zyphr
252
242
  # Calculates hash code according to all attributes.
253
243
  # @return [Integer] Hash code
254
244
  def hash
255
- [email_type, subject, html, text, mjml_source, design_json, editor_type, from_name, reply_to, is_enabled, is_default, has_override, version].hash
245
+ [email_type, subject, html, text, design_json, editor_type, from_name, reply_to, is_enabled, is_default, has_override, version].hash
256
246
  end
257
247
 
258
248
  # Builds the object from hash