zyphr 0.1.43 → 0.1.45

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -4
  3. data/docs/ApplicationSelf.md +26 -0
  4. data/docs/ApplicationSelfResponse.md +20 -0
  5. data/docs/AuthApplicationApi.md +158 -0
  6. data/docs/AuthEmailTemplateTestRequest.md +1 -1
  7. data/docs/AuthEmailTemplatesApi.md +1 -1
  8. data/docs/AuthMethods.md +28 -0
  9. data/docs/AuthUserDirectoryApi.md +77 -0
  10. data/docs/AuthUserProfileApi.md +75 -0
  11. data/docs/ChangePasswordRequest.md +20 -0
  12. data/docs/GetEndUserAuthMethods200Response.md +20 -0
  13. data/docs/SetSelfApplicationTestRecipientsRequest.md +18 -0
  14. data/docs/WebhookDelivery.md +1 -1
  15. data/docs/WebhookDeliveryDetail.md +1 -1
  16. data/docs/WebhookEventType.md +15 -0
  17. data/docs/WebhookEventTypesResponseData.md +1 -1
  18. data/docs/WebhookTestEventResponseData.md +1 -1
  19. data/lib/zyphr/api/auth_application_api.rb +147 -0
  20. data/lib/zyphr/api/auth_email_templates_api.rb +2 -2
  21. data/lib/zyphr/api/auth_user_directory_api.rb +63 -0
  22. data/lib/zyphr/api/auth_user_profile_api.rb +68 -0
  23. data/lib/zyphr/models/application_self.rb +371 -0
  24. data/lib/zyphr/models/application_self_response.rb +229 -0
  25. data/lib/zyphr/models/auth_email_template_test_request.rb +1 -1
  26. data/lib/zyphr/models/auth_methods.rb +376 -0
  27. data/lib/zyphr/models/change_password_request.rb +265 -0
  28. data/lib/zyphr/models/get_end_user_auth_methods200_response.rb +229 -0
  29. data/lib/zyphr/models/set_self_application_test_recipients_request.rb +240 -0
  30. data/lib/zyphr/models/webhook_delivery.rb +1 -1
  31. data/lib/zyphr/models/webhook_delivery_detail.rb +1 -1
  32. data/lib/zyphr/models/webhook_event_type.rb +66 -0
  33. data/lib/zyphr/models/webhook_event_types_response_data.rb +1 -1
  34. data/lib/zyphr/models/webhook_test_event_response_data.rb +23 -1
  35. data/lib/zyphr.rb +8 -0
  36. data/spec/api/auth_application_api_spec.rb +58 -0
  37. data/spec/api/auth_email_templates_api_spec.rb +1 -1
  38. data/spec/api/auth_user_directory_api_spec.rb +12 -0
  39. data/spec/api/auth_user_profile_api_spec.rb +12 -0
  40. data/spec/models/application_self_response_spec.rb +42 -0
  41. data/spec/models/application_self_spec.rb +68 -0
  42. data/spec/models/auth_methods_spec.rb +66 -0
  43. data/spec/models/change_password_request_spec.rb +42 -0
  44. data/spec/models/get_end_user_auth_methods200_response_spec.rb +42 -0
  45. data/spec/models/set_self_application_test_recipients_request_spec.rb +36 -0
  46. data/spec/models/webhook_event_type_spec.rb +30 -0
  47. data/zyphr.gemspec +1 -1
  48. metadata +33 -1
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **delivery_id** | **String** | | [optional] |
8
- | **event_type** | **String** | | [optional] |
8
+ | **event_type** | [**WebhookEventType**](WebhookEventType.md) | | [optional] |
9
9
  | **payload** | **Object** | | [optional] |
10
10
  | **status** | **String** | | [optional] |
11
11
 
@@ -0,0 +1,147 @@
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 AuthApplicationApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get the authenticating application
23
+ # Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment's mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [ApplicationSelfResponse]
26
+ def get_self_application(opts = {})
27
+ data, _status_code, _headers = get_self_application_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Get the authenticating application
32
+ # Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment's mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(ApplicationSelfResponse, Integer, Hash)>] ApplicationSelfResponse data, response status code and response headers
35
+ def get_self_application_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: AuthApplicationApi.get_self_application ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/auth/application'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'ApplicationSelfResponse'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"AuthApplicationApi.get_self_application",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: AuthApplicationApi#get_self_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+
79
+ # Set the authenticating application's auth-email test allowlist
80
+ # Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
81
+ # @param set_self_application_test_recipients_request [SetSelfApplicationTestRecipientsRequest]
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [ApplicationSelfResponse]
84
+ def set_self_application_test_recipients(set_self_application_test_recipients_request, opts = {})
85
+ data, _status_code, _headers = set_self_application_test_recipients_with_http_info(set_self_application_test_recipients_request, opts)
86
+ data
87
+ end
88
+
89
+ # Set the authenticating application&#39;s auth-email test allowlist
90
+ # Set &#x60;test_recipients&#x60; — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
91
+ # @param set_self_application_test_recipients_request [SetSelfApplicationTestRecipientsRequest]
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [Array<(ApplicationSelfResponse, Integer, Hash)>] ApplicationSelfResponse data, response status code and response headers
94
+ def set_self_application_test_recipients_with_http_info(set_self_application_test_recipients_request, opts = {})
95
+ if @api_client.config.debugging
96
+ @api_client.config.logger.debug 'Calling API: AuthApplicationApi.set_self_application_test_recipients ...'
97
+ end
98
+ # verify the required parameter 'set_self_application_test_recipients_request' is set
99
+ if @api_client.config.client_side_validation && set_self_application_test_recipients_request.nil?
100
+ fail ArgumentError, "Missing the required parameter 'set_self_application_test_recipients_request' when calling AuthApplicationApi.set_self_application_test_recipients"
101
+ end
102
+ # resource path
103
+ local_var_path = '/auth/application'
104
+
105
+ # query parameters
106
+ query_params = opts[:query_params] || {}
107
+
108
+ # header parameters
109
+ header_params = opts[:header_params] || {}
110
+ # HTTP header 'Accept' (if needed)
111
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
112
+ # HTTP header 'Content-Type'
113
+ content_type = @api_client.select_header_content_type(['application/json'])
114
+ if !content_type.nil?
115
+ header_params['Content-Type'] = content_type
116
+ end
117
+
118
+ # form parameters
119
+ form_params = opts[:form_params] || {}
120
+
121
+ # http body (model)
122
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(set_self_application_test_recipients_request)
123
+
124
+ # return_type
125
+ return_type = opts[:debug_return_type] || 'ApplicationSelfResponse'
126
+
127
+ # auth_names
128
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
129
+
130
+ new_options = opts.merge(
131
+ :operation => :"AuthApplicationApi.set_self_application_test_recipients",
132
+ :header_params => header_params,
133
+ :query_params => query_params,
134
+ :form_params => form_params,
135
+ :body => post_body,
136
+ :auth_names => auth_names,
137
+ :return_type => return_type
138
+ )
139
+
140
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: AuthApplicationApi#set_self_application_test_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+ end
147
+ end
@@ -538,7 +538,7 @@ module Zyphr
538
538
  end
539
539
 
540
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.
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. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
542
542
  # @param type [AuthEmailType]
543
543
  # @param auth_email_template_test_request [AuthEmailTemplateTestRequest]
544
544
  # @param [Hash] opts the optional parameters
@@ -549,7 +549,7 @@ module Zyphr
549
549
  end
550
550
 
551
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.
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. When non-empty, &#x60;test_recipients&#x60; gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
553
553
  # @param type [AuthEmailType]
554
554
  # @param auth_email_template_test_request [AuthEmailTemplateTestRequest]
555
555
  # @param [Hash] opts the optional parameters
@@ -80,6 +80,69 @@ module Zyphr
80
80
  return data, status_code, headers
81
81
  end
82
82
 
83
+ # Get an end user's sign-in methods (server-side admin)
84
+ # Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
85
+ # @param user_id [String]
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [GetEndUserAuthMethods200Response]
88
+ def get_end_user_auth_methods(user_id, opts = {})
89
+ data, _status_code, _headers = get_end_user_auth_methods_with_http_info(user_id, opts)
90
+ data
91
+ end
92
+
93
+ # Get an end user&#39;s sign-in methods (server-side admin)
94
+ # Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \&quot;sign-in methods\&quot; screen. Scoped to the application — a caller can never read a user belonging to another application.
95
+ # @param user_id [String]
96
+ # @param [Hash] opts the optional parameters
97
+ # @return [Array<(GetEndUserAuthMethods200Response, Integer, Hash)>] GetEndUserAuthMethods200Response data, response status code and response headers
98
+ def get_end_user_auth_methods_with_http_info(user_id, opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.get_end_user_auth_methods ...'
101
+ end
102
+ # verify the required parameter 'user_id' is set
103
+ if @api_client.config.client_side_validation && user_id.nil?
104
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthUserDirectoryApi.get_end_user_auth_methods"
105
+ end
106
+ # resource path
107
+ local_var_path = '/auth/users/{user_id}/auth-methods'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
108
+
109
+ # query parameters
110
+ query_params = opts[:query_params] || {}
111
+
112
+ # header parameters
113
+ header_params = opts[:header_params] || {}
114
+ # HTTP header 'Accept' (if needed)
115
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
116
+
117
+ # form parameters
118
+ form_params = opts[:form_params] || {}
119
+
120
+ # http body (model)
121
+ post_body = opts[:debug_body]
122
+
123
+ # return_type
124
+ return_type = opts[:debug_return_type] || 'GetEndUserAuthMethods200Response'
125
+
126
+ # auth_names
127
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
128
+
129
+ new_options = opts.merge(
130
+ :operation => :"AuthUserDirectoryApi.get_end_user_auth_methods",
131
+ :header_params => header_params,
132
+ :query_params => query_params,
133
+ :form_params => form_params,
134
+ :body => post_body,
135
+ :auth_names => auth_names,
136
+ :return_type => return_type
137
+ )
138
+
139
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: AuthUserDirectoryApi#get_end_user_auth_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+
83
146
  # Look up an end user by email (server-side admin)
84
147
  # Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
85
148
  # @param email [String]
@@ -19,6 +19,74 @@ module Zyphr
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Change password (authenticated session)
23
+ # Change the currently authenticated end user's password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
24
+ # @param change_password_request [ChangePasswordRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [RefreshTokenResponse]
27
+ def change_end_user_password(change_password_request, opts = {})
28
+ data, _status_code, _headers = change_end_user_password_with_http_info(change_password_request, opts)
29
+ data
30
+ end
31
+
32
+ # Change password (authenticated session)
33
+ # Change the currently authenticated end user&#39;s password from a logged-in session. The caller must prove possession of the CURRENT password (&#x60;current_password&#x60;); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the &#x60;user.password_changed&#x60; webhook.
34
+ # @param change_password_request [ChangePasswordRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(RefreshTokenResponse, Integer, Hash)>] RefreshTokenResponse data, response status code and response headers
37
+ def change_end_user_password_with_http_info(change_password_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AuthUserProfileApi.change_end_user_password ...'
40
+ end
41
+ # verify the required parameter 'change_password_request' is set
42
+ if @api_client.config.client_side_validation && change_password_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'change_password_request' when calling AuthUserProfileApi.change_end_user_password"
44
+ end
45
+ # resource path
46
+ local_var_path = '/auth/users/change-password'
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(change_password_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'RefreshTokenResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['EndUserToken', 'ApplicationPublicKey']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"AuthUserProfileApi.change_end_user_password",
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(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: AuthUserProfileApi#change_end_user_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
22
90
  # Delete current end user account
23
91
  # Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
24
92
  # @param [Hash] opts the optional parameters