zyphr 0.1.40 → 0.1.42

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 955eb06e49c1b00cef4b369a618572360989321e4fa6b3e2e263038b39dd533a
4
- data.tar.gz: bebb75c0a3bdf78029fac2e47e60893eb74b930a2c3f0ccd2a86d3b33424c520
3
+ metadata.gz: 6cb0a8537c63656fd45e496b199c8cb2250befd736dda868cea8b281aedf9166
4
+ data.tar.gz: ac3965efb59990ba1c3ea00e71c34c58b734dad43bcccc018d0c1940be4b340c
5
5
  SHA512:
6
- metadata.gz: 8fdbcadf17903d8128b8455e0ce94ca7c08f505ef24ef3ea714208927578f7bc045706efe9841a95a2e4e19f8cee1e0b1cf424f8f2fe44a4c80a0f14718f957c
7
- data.tar.gz: 60a3fa5fdded26f7097702bab309e7c2493d0ccf583949be3869f7f230d1a2e45f1febfd86f14bf6e67df0e9b2722a4900231a40b6a7300eaecd5628716afdd6
6
+ metadata.gz: fed4fac9fadfcce07fd077131fab2c7dc95ec623d974157c4bef8c387e3b4629ba3355155c0013637c18b5101c059735f946b22f9ae9902303304420c0835d2d
7
+ data.tar.gz: 3a5684aff5a94c217b225f1a73113d58f2b777fcf7a9cce393729befc7b855f695b3cdcdcf74abbc1d49e1daaade748b171de886449062efda7e4a97610ee6fe
data/README.md CHANGED
@@ -672,6 +672,8 @@ Class | Method | HTTP request | Description
672
672
  - [Zyphr::SessionListResponseData](docs/SessionListResponseData.md)
673
673
  - [Zyphr::SessionListResponseDataSessionInfo](docs/SessionListResponseDataSessionInfo.md)
674
674
  - [Zyphr::SetDomainInboundRequest](docs/SetDomainInboundRequest.md)
675
+ - [Zyphr::SetEndUserClaims200Response](docs/SetEndUserClaims200Response.md)
676
+ - [Zyphr::SetEndUserClaims200ResponseData](docs/SetEndUserClaims200ResponseData.md)
675
677
  - [Zyphr::SetEndUserClaimsRequest](docs/SetEndUserClaimsRequest.md)
676
678
  - [Zyphr::SetPreferencesRequest](docs/SetPreferencesRequest.md)
677
679
  - [Zyphr::SetPreferencesRequestPreferencesInner](docs/SetPreferencesRequestPreferencesInner.md)
@@ -474,11 +474,11 @@ nil (empty response body)
474
474
 
475
475
  ## set_end_user_claims
476
476
 
477
- > set_end_user_claims(user_id, set_end_user_claims_request)
477
+ > <SetEndUserClaims200Response> set_end_user_claims(user_id, set_end_user_claims_request)
478
478
 
479
479
  Set an end user's stored custom claims (server-side admin)
480
480
 
481
- Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user's JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
481
+ Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user's JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. Each write bumps a monotonic `claims_version` (returned in the response). The change applies seamlessly on the user's next login or token refresh — a token carrying an older `claims_version` is rejected on verification and the client silently re-mints with the new claims, without a forced logout. For a hard cut-off (log the user out of all sessions immediately), call POST /auth/sessions/revoke-all after updating claims.
482
482
 
483
483
  ### Examples
484
484
 
@@ -504,7 +504,8 @@ set_end_user_claims_request = Zyphr::SetEndUserClaimsRequest.new # SetEndUserCla
504
504
 
505
505
  begin
506
506
  # Set an end user's stored custom claims (server-side admin)
507
- api_instance.set_end_user_claims(user_id, set_end_user_claims_request)
507
+ result = api_instance.set_end_user_claims(user_id, set_end_user_claims_request)
508
+ p result
508
509
  rescue Zyphr::ApiError => e
509
510
  puts "Error when calling AuthUserDirectoryApi->set_end_user_claims: #{e}"
510
511
  end
@@ -512,9 +513,9 @@ end
512
513
 
513
514
  #### Using the set_end_user_claims_with_http_info variant
514
515
 
515
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
516
+ This returns an Array which contains the response data, status code and headers.
516
517
 
517
- > <Array(nil, Integer, Hash)> set_end_user_claims_with_http_info(user_id, set_end_user_claims_request)
518
+ > <Array(<SetEndUserClaims200Response>, Integer, Hash)> set_end_user_claims_with_http_info(user_id, set_end_user_claims_request)
518
519
 
519
520
  ```ruby
520
521
  begin
@@ -522,7 +523,7 @@ begin
522
523
  data, status_code, headers = api_instance.set_end_user_claims_with_http_info(user_id, set_end_user_claims_request)
523
524
  p status_code # => 2xx
524
525
  p headers # => { ... }
525
- p data # => nil
526
+ p data # => <SetEndUserClaims200Response>
526
527
  rescue Zyphr::ApiError => e
527
528
  puts "Error when calling AuthUserDirectoryApi->set_end_user_claims_with_http_info: #{e}"
528
529
  end
@@ -537,7 +538,7 @@ end
537
538
 
538
539
  ### Return type
539
540
 
540
- nil (empty response body)
541
+ [**SetEndUserClaims200Response**](SetEndUserClaims200Response.md)
541
542
 
542
543
  ### Authorization
543
544
 
@@ -546,7 +547,7 @@ nil (empty response body)
546
547
  ### HTTP request headers
547
548
 
548
549
  - **Content-Type**: application/json
549
- - **Accept**: Not defined
550
+ - **Accept**: application/json
550
551
 
551
552
 
552
553
  ## update_end_user_by_application
data/docs/InboxApi.md CHANGED
@@ -315,7 +315,7 @@ nil (empty response body)
315
315
 
316
316
  Generate a subscriber token
317
317
 
318
- Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
318
+ Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr-dev/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
319
319
 
320
320
  ### Examples
321
321
 
@@ -0,0 +1,18 @@
1
+ # Zyphr::SetEndUserClaims200Response
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **data** | [**SetEndUserClaims200ResponseData**](SetEndUserClaims200ResponseData.md) | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'zyphr'
13
+
14
+ instance = Zyphr::SetEndUserClaims200Response.new(
15
+ data: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Zyphr::SetEndUserClaims200ResponseData
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **claims** | **Object** | | [optional] |
8
+ | **claims_version** | **Integer** | Monotonic version bumped on each write; embedded in issued tokens. | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zyphr'
14
+
15
+ instance = Zyphr::SetEndUserClaims200ResponseData.new(
16
+ claims: null,
17
+ claims_version: null
18
+ )
19
+ ```
20
+
@@ -414,22 +414,22 @@ module Zyphr
414
414
  end
415
415
 
416
416
  # Set an end user's stored custom claims (server-side admin)
417
- # Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user's JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
417
+ # Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user's JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. Each write bumps a monotonic `claims_version` (returned in the response). The change applies seamlessly on the user's next login or token refresh — a token carrying an older `claims_version` is rejected on verification and the client silently re-mints with the new claims, without a forced logout. For a hard cut-off (log the user out of all sessions immediately), call POST /auth/sessions/revoke-all after updating claims.
418
418
  # @param user_id [String]
419
419
  # @param set_end_user_claims_request [SetEndUserClaimsRequest]
420
420
  # @param [Hash] opts the optional parameters
421
- # @return [nil]
421
+ # @return [SetEndUserClaims200Response]
422
422
  def set_end_user_claims(user_id, set_end_user_claims_request, opts = {})
423
- set_end_user_claims_with_http_info(user_id, set_end_user_claims_request, opts)
424
- nil
423
+ data, _status_code, _headers = set_end_user_claims_with_http_info(user_id, set_end_user_claims_request, opts)
424
+ data
425
425
  end
426
426
 
427
427
  # Set an end user&#39;s stored custom claims (server-side admin)
428
- # Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user&#39;s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
428
+ # Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user&#39;s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. Each write bumps a monotonic &#x60;claims_version&#x60; (returned in the response). The change applies seamlessly on the user&#39;s next login or token refresh — a token carrying an older &#x60;claims_version&#x60; is rejected on verification and the client silently re-mints with the new claims, without a forced logout. For a hard cut-off (log the user out of all sessions immediately), call POST /auth/sessions/revoke-all after updating claims.
429
429
  # @param user_id [String]
430
430
  # @param set_end_user_claims_request [SetEndUserClaimsRequest]
431
431
  # @param [Hash] opts the optional parameters
432
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
432
+ # @return [Array<(SetEndUserClaims200Response, Integer, Hash)>] SetEndUserClaims200Response data, response status code and response headers
433
433
  def set_end_user_claims_with_http_info(user_id, set_end_user_claims_request, opts = {})
434
434
  if @api_client.config.debugging
435
435
  @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.set_end_user_claims ...'
@@ -450,6 +450,8 @@ module Zyphr
450
450
 
451
451
  # header parameters
452
452
  header_params = opts[:header_params] || {}
453
+ # HTTP header 'Accept' (if needed)
454
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
453
455
  # HTTP header 'Content-Type'
454
456
  content_type = @api_client.select_header_content_type(['application/json'])
455
457
  if !content_type.nil?
@@ -463,7 +465,7 @@ module Zyphr
463
465
  post_body = opts[:debug_body] || @api_client.object_to_http_body(set_end_user_claims_request)
464
466
 
465
467
  # return_type
466
- return_type = opts[:debug_return_type]
468
+ return_type = opts[:debug_return_type] || 'SetEndUserClaims200Response'
467
469
 
468
470
  # auth_names
469
471
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
@@ -275,7 +275,7 @@ module Zyphr
275
275
  end
276
276
 
277
277
  # Generate a subscriber token
278
- # Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
278
+ # Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr-dev/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
279
279
  # @param generate_subscriber_token_request [GenerateSubscriberTokenRequest]
280
280
  # @param [Hash] opts the optional parameters
281
281
  # @return [GenerateSubscriberToken200Response]
@@ -285,7 +285,7 @@ module Zyphr
285
285
  end
286
286
 
287
287
  # Generate a subscriber token
288
- # Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to &#x60;@zyphr/inbox-react&#x60;&#39;s &#x60;&lt;ZyphrProvider subscriberToken&#x3D;\&quot;...\&quot;&gt;&#x60; or use it as &#x60;Authorization: Bearer &lt;token&gt;&#x60; for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
288
+ # Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to &#x60;@zyphr-dev/inbox-react&#x60;&#39;s &#x60;&lt;ZyphrProvider subscriberToken&#x3D;\&quot;...\&quot;&gt;&#x60; or use it as &#x60;Authorization: Bearer &lt;token&gt;&#x60; for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
289
289
  # @param generate_subscriber_token_request [GenerateSubscriberTokenRequest]
290
290
  # @param [Hash] opts the optional parameters
291
291
  # @return [Array<(GenerateSubscriberToken200Response, Integer, Hash)>] GenerateSubscriberToken200Response data, response status code and response headers
@@ -0,0 +1,220 @@
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 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class SetEndUserClaims200Response
18
+ attr_accessor :data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'data' => :'SetEndUserClaims200ResponseData'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::SetEndUserClaims200Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::SetEndUserClaims200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'data')
67
+ self.data = attributes[:'data']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ data == o.data
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [data].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ openapi_types.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash["#{key}"] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+ new(transformed_hash)
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def self._deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = Zyphr.const_get(type)
168
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end
@@ -0,0 +1,230 @@
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 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class SetEndUserClaims200ResponseData
18
+ attr_accessor :claims
19
+
20
+ # Monotonic version bumped on each write; embedded in issued tokens.
21
+ attr_accessor :claims_version
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'claims' => :'claims',
27
+ :'claims_version' => :'claims_version'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'claims' => :'Object',
45
+ :'claims_version' => :'Integer'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::SetEndUserClaims200ResponseData` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::SetEndUserClaims200ResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'claims')
72
+ self.claims = attributes[:'claims']
73
+ end
74
+
75
+ if attributes.key?(:'claims_version')
76
+ self.claims_version = attributes[:'claims_version']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ warn '[DEPRECATED] the `valid?` method is obsolete'
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ claims == o.claims &&
101
+ claims_version == o.claims_version
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [claims, claims_version].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ transformed_hash = {}
123
+ openapi_types.each_pair do |key, type|
124
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = nil
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[attribute_map[key]].is_a?(Array)
130
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
131
+ end
132
+ elsif !attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
134
+ end
135
+ end
136
+ new(transformed_hash)
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def self._deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ # models (e.g. Pet) or oneOf
177
+ klass = Zyphr.const_get(type)
178
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
data/lib/zyphr.rb CHANGED
@@ -306,6 +306,8 @@ require 'zyphr/models/session_list_response'
306
306
  require 'zyphr/models/session_list_response_data'
307
307
  require 'zyphr/models/session_list_response_data_session_info'
308
308
  require 'zyphr/models/set_domain_inbound_request'
309
+ require 'zyphr/models/set_end_user_claims200_response'
310
+ require 'zyphr/models/set_end_user_claims200_response_data'
309
311
  require 'zyphr/models/set_end_user_claims_request'
310
312
  require 'zyphr/models/set_preferences_request'
311
313
  require 'zyphr/models/set_preferences_request_preferences_inner'
@@ -109,11 +109,11 @@ describe 'AuthUserDirectoryApi' do
109
109
 
110
110
  # unit tests for set_end_user_claims
111
111
  # Set an end user&#39;s stored custom claims (server-side admin)
112
- # Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user&#39;s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. To make a change take effect immediately on already-issued tokens (e.g. revoking admin), call POST /auth/sessions/revoke-all for the user after updating claims — that bumps the revocation epoch so outstanding access tokens stop verifying.
112
+ # Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user&#39;s JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. Each write bumps a monotonic &#x60;claims_version&#x60; (returned in the response). The change applies seamlessly on the user&#39;s next login or token refresh — a token carrying an older &#x60;claims_version&#x60; is rejected on verification and the client silently re-mints with the new claims, without a forced logout. For a hard cut-off (log the user out of all sessions immediately), call POST /auth/sessions/revoke-all after updating claims.
113
113
  # @param user_id
114
114
  # @param set_end_user_claims_request
115
115
  # @param [Hash] opts the optional parameters
116
- # @return [nil]
116
+ # @return [SetEndUserClaims200Response]
117
117
  describe 'set_end_user_claims test' do
118
118
  it 'should work' do
119
119
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -83,7 +83,7 @@ describe 'InboxApi' do
83
83
 
84
84
  # unit tests for generate_subscriber_token
85
85
  # Generate a subscriber token
86
- # Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to &#x60;@zyphr/inbox-react&#x60;&#39;s &#x60;&lt;ZyphrProvider subscriberToken&#x3D;\&quot;...\&quot;&gt;&#x60; or use it as &#x60;Authorization: Bearer &lt;token&gt;&#x60; for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
86
+ # Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to &#x60;@zyphr-dev/inbox-react&#x60;&#39;s &#x60;&lt;ZyphrProvider subscriberToken&#x3D;\&quot;...\&quot;&gt;&#x60; or use it as &#x60;Authorization: Bearer &lt;token&gt;&#x60; for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
87
87
  # @param generate_subscriber_token_request
88
88
  # @param [Hash] opts the optional parameters
89
89
  # @return [GenerateSubscriberToken200Response]
@@ -0,0 +1,42 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for Zyphr::SetEndUserClaims200ResponseData
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Zyphr::SetEndUserClaims200ResponseData do
21
+ let(:instance) { Zyphr::SetEndUserClaims200ResponseData.new }
22
+
23
+ describe 'test an instance of SetEndUserClaims200ResponseData' do
24
+ it 'should create an instance of SetEndUserClaims200ResponseData' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(Zyphr::SetEndUserClaims200ResponseData)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "claims"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "claims_version"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,36 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for Zyphr::SetEndUserClaims200Response
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Zyphr::SetEndUserClaims200Response do
21
+ let(:instance) { Zyphr::SetEndUserClaims200Response.new }
22
+
23
+ describe 'test an instance of SetEndUserClaims200Response' do
24
+ it 'should create an instance of SetEndUserClaims200Response' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(Zyphr::SetEndUserClaims200Response)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "data"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ end
data/zyphr.gemspec CHANGED
@@ -17,7 +17,7 @@ require "zyphr/version"
17
17
 
18
18
  Gem::Specification.new do |s|
19
19
  s.name = "zyphr"
20
- s.version = '0.1.40'
20
+ s.version = '0.1.42'
21
21
  s.platform = Gem::Platform::RUBY
22
22
  s.authors = ["Zyphr"]
23
23
  s.email = ["support@zyphr.dev"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zyphr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.40
4
+ version: 0.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zyphr
@@ -400,6 +400,8 @@ files:
400
400
  - docs/SessionListResponseData.md
401
401
  - docs/SessionListResponseDataSessionInfo.md
402
402
  - docs/SetDomainInboundRequest.md
403
+ - docs/SetEndUserClaims200Response.md
404
+ - docs/SetEndUserClaims200ResponseData.md
403
405
  - docs/SetEndUserClaimsRequest.md
404
406
  - docs/SetPreferencesRequest.md
405
407
  - docs/SetPreferencesRequestPreferencesInner.md
@@ -908,6 +910,8 @@ files:
908
910
  - lib/zyphr/models/session_list_response_data.rb
909
911
  - lib/zyphr/models/session_list_response_data_session_info.rb
910
912
  - lib/zyphr/models/set_domain_inbound_request.rb
913
+ - lib/zyphr/models/set_end_user_claims200_response.rb
914
+ - lib/zyphr/models/set_end_user_claims200_response_data.rb
911
915
  - lib/zyphr/models/set_end_user_claims_request.rb
912
916
  - lib/zyphr/models/set_preferences_request.rb
913
917
  - lib/zyphr/models/set_preferences_request_preferences_inner.rb
@@ -1399,6 +1403,8 @@ files:
1399
1403
  - spec/models/session_list_response_data_spec.rb
1400
1404
  - spec/models/session_list_response_spec.rb
1401
1405
  - spec/models/set_domain_inbound_request_spec.rb
1406
+ - spec/models/set_end_user_claims200_response_data_spec.rb
1407
+ - spec/models/set_end_user_claims200_response_spec.rb
1402
1408
  - spec/models/set_end_user_claims_request_spec.rb
1403
1409
  - spec/models/set_preferences_request_preferences_inner_spec.rb
1404
1410
  - spec/models/set_preferences_request_spec.rb
@@ -1739,6 +1745,7 @@ test_files:
1739
1745
  - spec/models/refresh_session_request_spec.rb
1740
1746
  - spec/models/topic_subscribers_add_response_spec.rb
1741
1747
  - spec/models/webhook_versions_response_spec.rb
1748
+ - spec/models/set_end_user_claims200_response_spec.rb
1742
1749
  - spec/models/api_error_error_spec.rb
1743
1750
  - spec/models/webhook_metrics_response_spec.rb
1744
1751
  - spec/models/waa_s_publish_event_response_spec.rb
@@ -1911,6 +1918,7 @@ test_files:
1911
1918
  - spec/models/slack_message_status_spec.rb
1912
1919
  - spec/models/workflow_status_spec.rb
1913
1920
  - spec/models/o_auth_tokens_response_spec.rb
1921
+ - spec/models/set_end_user_claims200_response_data_spec.rb
1914
1922
  - spec/models/switch_organization_response_data_tokens_spec.rb
1915
1923
  - spec/models/validate_reset_token_response_spec.rb
1916
1924
  - spec/models/payload_too_large_error_spec.rb