zyphr 0.1.24 → 0.1.25

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/docs/AuthRegistrationApi.md +137 -0
  4. data/docs/AuthUser.md +6 -0
  5. data/docs/ConvertAnonymousUserRequest.md +49 -0
  6. data/docs/ConvertAnonymousUserRequestOneOf.md +24 -0
  7. data/docs/ConvertAnonymousUserRequestOneOf1.md +24 -0
  8. data/docs/ConvertAnonymousUserRequestOneOf1AppleUser.md +18 -0
  9. data/docs/ConvertAnonymousUserRequestOneOf1AppleUserName.md +20 -0
  10. data/docs/SignInAnonymouslyRequest.md +22 -0
  11. data/lib/zyphr/api/auth_registration_api.rb +136 -0
  12. data/lib/zyphr/models/auth_user.rb +33 -1
  13. data/lib/zyphr/models/convert_anonymous_user_request.rb +105 -0
  14. data/lib/zyphr/models/convert_anonymous_user_request_one_of.rb +323 -0
  15. data/lib/zyphr/models/convert_anonymous_user_request_one_of1.rb +324 -0
  16. data/lib/zyphr/models/convert_anonymous_user_request_one_of1_apple_user.rb +221 -0
  17. data/lib/zyphr/models/convert_anonymous_user_request_one_of1_apple_user_name.rb +229 -0
  18. data/lib/zyphr/models/sign_in_anonymously_request.rb +296 -0
  19. data/lib/zyphr.rb +6 -0
  20. data/spec/api/auth_registration_api_spec.rb +24 -0
  21. data/spec/models/auth_user_spec.rb +18 -0
  22. data/spec/models/convert_anonymous_user_request_one_of1_apple_user_name_spec.rb +42 -0
  23. data/spec/models/convert_anonymous_user_request_one_of1_apple_user_spec.rb +36 -0
  24. data/spec/models/convert_anonymous_user_request_one_of1_spec.rb +58 -0
  25. data/spec/models/convert_anonymous_user_request_one_of_spec.rb +58 -0
  26. data/spec/models/convert_anonymous_user_request_spec.rb +32 -0
  27. data/spec/models/sign_in_anonymously_request_spec.rb +48 -0
  28. data/zyphr.gemspec +1 -1
  29. metadata +388 -364
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a85b93ca7e767d1fbf04d38ecc50cd06a6b8f9cac57cb476c4598d8354f46ba9
4
- data.tar.gz: 99e51428224ef0af2ede43492c38cba07d3cff36682b7562fe6477b8978e58f5
3
+ metadata.gz: 37ff4cedd6136ea114aba25062df659b06561fcab18d579300e661716f4327f9
4
+ data.tar.gz: f6061fb34c72ddbf525aa75137bd9e942cc6106bbbfaed5d537fc49f583aea30
5
5
  SHA512:
6
- metadata.gz: e8279a0d3c548f33c49d1fffdc0a7a93648da88d5afa7b2c1072076fdfa62b1170bb94ee1d104aead0d401b97bd818fca0db49e21c210bfad496beef441a0dba
7
- data.tar.gz: 5635eea6e8c0de46184f8cd1d66204a360a9752347870730756d48de04b32f60be6171bbc857e4d9c94d9da3a3ae246c0cee96f807c27f53cd3c98cb4783fed9
6
+ metadata.gz: ebc454dee8dc25cc88cedf2941541db3f8d3d0e3e3a0be1083141cd48eb2cd690b83aa746734f519628100701837fd7032b8f41117c557dba0eac757752433f0
7
+ data.tar.gz: a804ea5e68f648595eaa178741e4ab8872b49a4778f3e7ebd503b3b81e37e484be90075cf4abab45e5ea358539c6fda6de305d20ca5bbd8c79cb2648acccca7b
data/README.md CHANGED
@@ -168,7 +168,9 @@ Class | Method | HTTP request | Description
168
168
  *Zyphr::AuthPhoneApi* | [**send_phone_registration_otp**](docs/AuthPhoneApi.md#send_phone_registration_otp) | **POST** /auth/phone/register/send | Send phone registration OTP
169
169
  *Zyphr::AuthPhoneApi* | [**verify_phone_login**](docs/AuthPhoneApi.md#verify_phone_login) | **POST** /auth/phone/login/verify | Verify phone login OTP
170
170
  *Zyphr::AuthPhoneApi* | [**verify_phone_registration**](docs/AuthPhoneApi.md#verify_phone_registration) | **POST** /auth/phone/register/verify | Verify phone registration OTP
171
+ *Zyphr::AuthRegistrationApi* | [**convert_anonymous_user**](docs/AuthRegistrationApi.md#convert_anonymous_user) | **POST** /auth/users/convert | Convert anonymous account to a full account
171
172
  *Zyphr::AuthRegistrationApi* | [**register_end_user**](docs/AuthRegistrationApi.md#register_end_user) | **POST** /auth/users/register | Register a new end user
173
+ *Zyphr::AuthRegistrationApi* | [**sign_in_anonymously**](docs/AuthRegistrationApi.md#sign_in_anonymously) | **POST** /auth/users/anonymous | Sign in anonymously
172
174
  *Zyphr::AuthSessionsApi* | [**list_end_user_sessions**](docs/AuthSessionsApi.md#list_end_user_sessions) | **GET** /auth/sessions | List active sessions
173
175
  *Zyphr::AuthSessionsApi* | [**refresh_end_user_token**](docs/AuthSessionsApi.md#refresh_end_user_token) | **POST** /auth/sessions/refresh | Refresh access token
174
176
  *Zyphr::AuthSessionsApi* | [**revoke_all_end_user_sessions**](docs/AuthSessionsApi.md#revoke_all_end_user_sessions) | **POST** /auth/sessions/revoke-all | Revoke all sessions
@@ -380,6 +382,11 @@ Class | Method | HTTP request | Description
380
382
  - [Zyphr::ConsentStatus](docs/ConsentStatus.md)
381
383
  - [Zyphr::ConsentStatusResponse](docs/ConsentStatusResponse.md)
382
384
  - [Zyphr::ConsentWithdrawResponse](docs/ConsentWithdrawResponse.md)
385
+ - [Zyphr::ConvertAnonymousUserRequest](docs/ConvertAnonymousUserRequest.md)
386
+ - [Zyphr::ConvertAnonymousUserRequestOneOf](docs/ConvertAnonymousUserRequestOneOf.md)
387
+ - [Zyphr::ConvertAnonymousUserRequestOneOf1](docs/ConvertAnonymousUserRequestOneOf1.md)
388
+ - [Zyphr::ConvertAnonymousUserRequestOneOf1AppleUser](docs/ConvertAnonymousUserRequestOneOf1AppleUser.md)
389
+ - [Zyphr::ConvertAnonymousUserRequestOneOf1AppleUserName](docs/ConvertAnonymousUserRequestOneOf1AppleUserName.md)
383
390
  - [Zyphr::CreateCategoryRequest](docs/CreateCategoryRequest.md)
384
391
  - [Zyphr::CreateSubscriberRequest](docs/CreateSubscriberRequest.md)
385
392
  - [Zyphr::CreateTemplateRequest](docs/CreateTemplateRequest.md)
@@ -567,6 +574,7 @@ Class | Method | HTTP request | Description
567
574
  - [Zyphr::SessionListResponseDataSessionInfo](docs/SessionListResponseDataSessionInfo.md)
568
575
  - [Zyphr::SetPreferencesRequest](docs/SetPreferencesRequest.md)
569
576
  - [Zyphr::SetPreferencesRequestPreferencesInner](docs/SetPreferencesRequestPreferencesInner.md)
577
+ - [Zyphr::SignInAnonymouslyRequest](docs/SignInAnonymouslyRequest.md)
570
578
  - [Zyphr::SlackMessage](docs/SlackMessage.md)
571
579
  - [Zyphr::SlackMessageListResponse](docs/SlackMessageListResponse.md)
572
580
  - [Zyphr::SlackMessageListResponseMeta](docs/SlackMessageListResponseMeta.md)
@@ -4,7 +4,73 @@ All URIs are relative to *https://api.zyphr.dev/v1*
4
4
 
5
5
  | Method | HTTP request | Description |
6
6
  | ------ | ------------ | ----------- |
7
+ | [**convert_anonymous_user**](AuthRegistrationApi.md#convert_anonymous_user) | **POST** /auth/users/convert | Convert anonymous account to a full account |
7
8
  | [**register_end_user**](AuthRegistrationApi.md#register_end_user) | **POST** /auth/users/register | Register a new end user |
9
+ | [**sign_in_anonymously**](AuthRegistrationApi.md#sign_in_anonymously) | **POST** /auth/users/anonymous | Sign in anonymously |
10
+
11
+
12
+ ## convert_anonymous_user
13
+
14
+ > <AuthResultResponse> convert_anonymous_user(convert_anonymous_user_request)
15
+
16
+ Convert anonymous account to a full account
17
+
18
+ Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
19
+
20
+ ### Examples
21
+
22
+ ```ruby
23
+ require 'time'
24
+ require 'zyphr'
25
+
26
+ api_instance = Zyphr::AuthRegistrationApi.new
27
+ convert_anonymous_user_request = Zyphr::ConvertAnonymousUserRequestOneOf.new({method: 'password', email: 'email_example', password: 'password_example'}) # ConvertAnonymousUserRequest |
28
+
29
+ begin
30
+ # Convert anonymous account to a full account
31
+ result = api_instance.convert_anonymous_user(convert_anonymous_user_request)
32
+ p result
33
+ rescue Zyphr::ApiError => e
34
+ puts "Error when calling AuthRegistrationApi->convert_anonymous_user: #{e}"
35
+ end
36
+ ```
37
+
38
+ #### Using the convert_anonymous_user_with_http_info variant
39
+
40
+ This returns an Array which contains the response data, status code and headers.
41
+
42
+ > <Array(<AuthResultResponse>, Integer, Hash)> convert_anonymous_user_with_http_info(convert_anonymous_user_request)
43
+
44
+ ```ruby
45
+ begin
46
+ # Convert anonymous account to a full account
47
+ data, status_code, headers = api_instance.convert_anonymous_user_with_http_info(convert_anonymous_user_request)
48
+ p status_code # => 2xx
49
+ p headers # => { ... }
50
+ p data # => <AuthResultResponse>
51
+ rescue Zyphr::ApiError => e
52
+ puts "Error when calling AuthRegistrationApi->convert_anonymous_user_with_http_info: #{e}"
53
+ end
54
+ ```
55
+
56
+ ### Parameters
57
+
58
+ | Name | Type | Description | Notes |
59
+ | ---- | ---- | ----------- | ----- |
60
+ | **convert_anonymous_user_request** | [**ConvertAnonymousUserRequest**](ConvertAnonymousUserRequest.md) | | |
61
+
62
+ ### Return type
63
+
64
+ [**AuthResultResponse**](AuthResultResponse.md)
65
+
66
+ ### Authorization
67
+
68
+ No authorization required
69
+
70
+ ### HTTP request headers
71
+
72
+ - **Content-Type**: application/json
73
+ - **Accept**: application/json
8
74
 
9
75
 
10
76
  ## register_end_user
@@ -82,3 +148,74 @@ end
82
148
  - **Content-Type**: application/json
83
149
  - **Accept**: application/json
84
150
 
151
+
152
+ ## sign_in_anonymously
153
+
154
+ > <AuthResultResponse> sign_in_anonymously(sign_in_anonymously_request)
155
+
156
+ Sign in anonymously
157
+
158
+ Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
159
+
160
+ ### Examples
161
+
162
+ ```ruby
163
+ require 'time'
164
+ require 'zyphr'
165
+ # setup authorization
166
+ Zyphr.configure do |config|
167
+ # Configure API key authorization: ApplicationPublicKey
168
+ config.api_key['X-Application-Key'] = 'YOUR API KEY'
169
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
170
+ # config.api_key_prefix['X-Application-Key'] = 'Bearer'
171
+ end
172
+
173
+ api_instance = Zyphr::AuthRegistrationApi.new
174
+ sign_in_anonymously_request = Zyphr::SignInAnonymouslyRequest.new({device_id: 'device_id_example'}) # SignInAnonymouslyRequest |
175
+
176
+ begin
177
+ # Sign in anonymously
178
+ result = api_instance.sign_in_anonymously(sign_in_anonymously_request)
179
+ p result
180
+ rescue Zyphr::ApiError => e
181
+ puts "Error when calling AuthRegistrationApi->sign_in_anonymously: #{e}"
182
+ end
183
+ ```
184
+
185
+ #### Using the sign_in_anonymously_with_http_info variant
186
+
187
+ This returns an Array which contains the response data, status code and headers.
188
+
189
+ > <Array(<AuthResultResponse>, Integer, Hash)> sign_in_anonymously_with_http_info(sign_in_anonymously_request)
190
+
191
+ ```ruby
192
+ begin
193
+ # Sign in anonymously
194
+ data, status_code, headers = api_instance.sign_in_anonymously_with_http_info(sign_in_anonymously_request)
195
+ p status_code # => 2xx
196
+ p headers # => { ... }
197
+ p data # => <AuthResultResponse>
198
+ rescue Zyphr::ApiError => e
199
+ puts "Error when calling AuthRegistrationApi->sign_in_anonymously_with_http_info: #{e}"
200
+ end
201
+ ```
202
+
203
+ ### Parameters
204
+
205
+ | Name | Type | Description | Notes |
206
+ | ---- | ---- | ----------- | ----- |
207
+ | **sign_in_anonymously_request** | [**SignInAnonymouslyRequest**](SignInAnonymouslyRequest.md) | | |
208
+
209
+ ### Return type
210
+
211
+ [**AuthResultResponse**](AuthResultResponse.md)
212
+
213
+ ### Authorization
214
+
215
+ [ApplicationPublicKey](../README.md#ApplicationPublicKey)
216
+
217
+ ### HTTP request headers
218
+
219
+ - **Content-Type**: application/json
220
+ - **Accept**: application/json
221
+
data/docs/AuthUser.md CHANGED
@@ -14,6 +14,9 @@
14
14
  | **phone_verified** | **Boolean** | | [optional] |
15
15
  | **status** | **String** | | [optional] |
16
16
  | **mfa_enabled** | **Boolean** | | [optional] |
17
+ | **is_anonymous** | **Boolean** | True if the user signed in anonymously and has not yet been converted to a full account. | [optional] |
18
+ | **anonymous_device_id** | **String** | Per-device identifier supplied at anonymous sign-in. Preserved across conversion so client-side \&quot;this device has scores from me\&quot; detection survives the upgrade. NULL for users who never signed in anonymously. | [optional] |
19
+ | **first_activity_at** | **Time** | Set on the user&#39;s first authenticated request after anonymous sign-in (excluding /auth/refresh). MAU billing for anonymous-origin users keys off this timestamp instead of created_at. | [optional] |
17
20
  | **created_at** | **Time** | | [optional] |
18
21
  | **updated_at** | **Time** | | [optional] |
19
22
  | **last_login_at** | **Time** | | [optional] |
@@ -34,6 +37,9 @@ instance = Zyphr::AuthUser.new(
34
37
  phone_verified: null,
35
38
  status: null,
36
39
  mfa_enabled: null,
40
+ is_anonymous: null,
41
+ anonymous_device_id: null,
42
+ first_activity_at: null,
37
43
  created_at: null,
38
44
  updated_at: null,
39
45
  last_login_at: null
@@ -0,0 +1,49 @@
1
+ # Zyphr::ConvertAnonymousUserRequest
2
+
3
+ ## Class instance methods
4
+
5
+ ### `openapi_one_of`
6
+
7
+ Returns the list of classes defined in oneOf.
8
+
9
+ #### Example
10
+
11
+ ```ruby
12
+ require 'zyphr'
13
+
14
+ Zyphr::ConvertAnonymousUserRequest.openapi_one_of
15
+ # =>
16
+ # [
17
+ # :'ConvertAnonymousUserRequestOneOf',
18
+ # :'ConvertAnonymousUserRequestOneOf1'
19
+ # ]
20
+ ```
21
+
22
+ ### build
23
+
24
+ Find the appropriate object from the `openapi_one_of` list and casts the data into it.
25
+
26
+ #### Example
27
+
28
+ ```ruby
29
+ require 'zyphr'
30
+
31
+ Zyphr::ConvertAnonymousUserRequest.build(data)
32
+ # => #<ConvertAnonymousUserRequestOneOf:0x00007fdd4aab02a0>
33
+
34
+ Zyphr::ConvertAnonymousUserRequest.build(data_that_doesnt_match)
35
+ # => nil
36
+ ```
37
+
38
+ #### Parameters
39
+
40
+ | Name | Type | Description |
41
+ | ---- | ---- | ----------- |
42
+ | **data** | **Mixed** | data to be matched against the list of oneOf items |
43
+
44
+ #### Return type
45
+
46
+ - `ConvertAnonymousUserRequestOneOf`
47
+ - `ConvertAnonymousUserRequestOneOf1`
48
+ - `nil` (if no type matches)
49
+
@@ -0,0 +1,24 @@
1
+ # Zyphr::ConvertAnonymousUserRequestOneOf
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **method** | **String** | | |
8
+ | **email** | **String** | | |
9
+ | **password** | **String** | | |
10
+ | **name** | **String** | Optional. Overwrites the user&#39;s existing name if provided. | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'zyphr'
16
+
17
+ instance = Zyphr::ConvertAnonymousUserRequestOneOf.new(
18
+ method: null,
19
+ email: null,
20
+ password: null,
21
+ name: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,24 @@
1
+ # Zyphr::ConvertAnonymousUserRequestOneOf1
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **method** | **String** | | |
8
+ | **code** | **String** | Authorization code returned by the OAuth provider after the user authorizes. | |
9
+ | **state** | **String** | Opaque state token previously issued by GET /v1/auth/oauth/authorize. | |
10
+ | **apple_user** | [**ConvertAnonymousUserRequestOneOf1AppleUser**](ConvertAnonymousUserRequestOneOf1AppleUser.md) | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'zyphr'
16
+
17
+ instance = Zyphr::ConvertAnonymousUserRequestOneOf1.new(
18
+ method: null,
19
+ code: null,
20
+ state: null,
21
+ apple_user: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,18 @@
1
+ # Zyphr::ConvertAnonymousUserRequestOneOf1AppleUser
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | [**ConvertAnonymousUserRequestOneOf1AppleUserName**](ConvertAnonymousUserRequestOneOf1AppleUserName.md) | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'zyphr'
13
+
14
+ instance = Zyphr::ConvertAnonymousUserRequestOneOf1AppleUser.new(
15
+ name: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Zyphr::ConvertAnonymousUserRequestOneOf1AppleUserName
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **first_name** | **String** | | [optional] |
8
+ | **last_name** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zyphr'
14
+
15
+ instance = Zyphr::ConvertAnonymousUserRequestOneOf1AppleUserName.new(
16
+ first_name: null,
17
+ last_name: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,22 @@
1
+ # Zyphr::SignInAnonymouslyRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **device_id** | **String** | Stable per-device identifier supplied by the client. Use a cryptographically-random opaque value persisted to client storage on first run. | |
8
+ | **name** | **String** | Optional display name. If omitted, the user has no name until conversion. | [optional] |
9
+ | **metadata** | **Hash&lt;String, Object&gt;** | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'zyphr'
15
+
16
+ instance = Zyphr::SignInAnonymouslyRequest.new(
17
+ device_id: null,
18
+ name: null,
19
+ metadata: null
20
+ )
21
+ ```
22
+
@@ -19,6 +19,74 @@ module Zyphr
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Convert anonymous account to a full account
23
+ # Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
24
+ # @param convert_anonymous_user_request [ConvertAnonymousUserRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [AuthResultResponse]
27
+ def convert_anonymous_user(convert_anonymous_user_request, opts = {})
28
+ data, _status_code, _headers = convert_anonymous_user_with_http_info(convert_anonymous_user_request, opts)
29
+ data
30
+ end
31
+
32
+ # Convert anonymous account to a full account
33
+ # Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
34
+ # @param convert_anonymous_user_request [ConvertAnonymousUserRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(AuthResultResponse, Integer, Hash)>] AuthResultResponse data, response status code and response headers
37
+ def convert_anonymous_user_with_http_info(convert_anonymous_user_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AuthRegistrationApi.convert_anonymous_user ...'
40
+ end
41
+ # verify the required parameter 'convert_anonymous_user_request' is set
42
+ if @api_client.config.client_side_validation && convert_anonymous_user_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'convert_anonymous_user_request' when calling AuthRegistrationApi.convert_anonymous_user"
44
+ end
45
+ # resource path
46
+ local_var_path = '/auth/users/convert'
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(convert_anonymous_user_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'AuthResultResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || []
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"AuthRegistrationApi.convert_anonymous_user",
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: AuthRegistrationApi#convert_anonymous_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
22
90
  # Register a new end user
23
91
  # Register a new end user with email and password.
24
92
  # @param register_request [RegisterRequest]
@@ -86,5 +154,73 @@ module Zyphr
86
154
  end
87
155
  return data, status_code, headers
88
156
  end
157
+
158
+ # Sign in anonymously
159
+ # Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
160
+ # @param sign_in_anonymously_request [SignInAnonymouslyRequest]
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [AuthResultResponse]
163
+ def sign_in_anonymously(sign_in_anonymously_request, opts = {})
164
+ data, _status_code, _headers = sign_in_anonymously_with_http_info(sign_in_anonymously_request, opts)
165
+ data
166
+ end
167
+
168
+ # Sign in anonymously
169
+ # Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
170
+ # @param sign_in_anonymously_request [SignInAnonymouslyRequest]
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [Array<(AuthResultResponse, Integer, Hash)>] AuthResultResponse data, response status code and response headers
173
+ def sign_in_anonymously_with_http_info(sign_in_anonymously_request, opts = {})
174
+ if @api_client.config.debugging
175
+ @api_client.config.logger.debug 'Calling API: AuthRegistrationApi.sign_in_anonymously ...'
176
+ end
177
+ # verify the required parameter 'sign_in_anonymously_request' is set
178
+ if @api_client.config.client_side_validation && sign_in_anonymously_request.nil?
179
+ fail ArgumentError, "Missing the required parameter 'sign_in_anonymously_request' when calling AuthRegistrationApi.sign_in_anonymously"
180
+ end
181
+ # resource path
182
+ local_var_path = '/auth/users/anonymous'
183
+
184
+ # query parameters
185
+ query_params = opts[:query_params] || {}
186
+
187
+ # header parameters
188
+ header_params = opts[:header_params] || {}
189
+ # HTTP header 'Accept' (if needed)
190
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
191
+ # HTTP header 'Content-Type'
192
+ content_type = @api_client.select_header_content_type(['application/json'])
193
+ if !content_type.nil?
194
+ header_params['Content-Type'] = content_type
195
+ end
196
+
197
+ # form parameters
198
+ form_params = opts[:form_params] || {}
199
+
200
+ # http body (model)
201
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(sign_in_anonymously_request)
202
+
203
+ # return_type
204
+ return_type = opts[:debug_return_type] || 'AuthResultResponse'
205
+
206
+ # auth_names
207
+ auth_names = opts[:debug_auth_names] || ['ApplicationPublicKey']
208
+
209
+ new_options = opts.merge(
210
+ :operation => :"AuthRegistrationApi.sign_in_anonymously",
211
+ :header_params => header_params,
212
+ :query_params => query_params,
213
+ :form_params => form_params,
214
+ :body => post_body,
215
+ :auth_names => auth_names,
216
+ :return_type => return_type
217
+ )
218
+
219
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
220
+ if @api_client.config.debugging
221
+ @api_client.config.logger.debug "API called: AuthRegistrationApi#sign_in_anonymously\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
222
+ end
223
+ return data, status_code, headers
224
+ end
89
225
  end
90
226
  end
@@ -35,6 +35,15 @@ module Zyphr
35
35
 
36
36
  attr_accessor :mfa_enabled
37
37
 
38
+ # True if the user signed in anonymously and has not yet been converted to a full account.
39
+ attr_accessor :is_anonymous
40
+
41
+ # Per-device identifier supplied at anonymous sign-in. Preserved across conversion so client-side \"this device has scores from me\" detection survives the upgrade. NULL for users who never signed in anonymously.
42
+ attr_accessor :anonymous_device_id
43
+
44
+ # Set on the user's first authenticated request after anonymous sign-in (excluding /auth/refresh). MAU billing for anonymous-origin users keys off this timestamp instead of created_at.
45
+ attr_accessor :first_activity_at
46
+
38
47
  attr_accessor :created_at
39
48
 
40
49
  attr_accessor :updated_at
@@ -76,6 +85,9 @@ module Zyphr
76
85
  :'phone_verified' => :'phone_verified',
77
86
  :'status' => :'status',
78
87
  :'mfa_enabled' => :'mfa_enabled',
88
+ :'is_anonymous' => :'is_anonymous',
89
+ :'anonymous_device_id' => :'anonymous_device_id',
90
+ :'first_activity_at' => :'first_activity_at',
79
91
  :'created_at' => :'created_at',
80
92
  :'updated_at' => :'updated_at',
81
93
  :'last_login_at' => :'last_login_at'
@@ -105,6 +117,9 @@ module Zyphr
105
117
  :'phone_verified' => :'Boolean',
106
118
  :'status' => :'String',
107
119
  :'mfa_enabled' => :'Boolean',
120
+ :'is_anonymous' => :'Boolean',
121
+ :'anonymous_device_id' => :'String',
122
+ :'first_activity_at' => :'Time',
108
123
  :'created_at' => :'Time',
109
124
  :'updated_at' => :'Time',
110
125
  :'last_login_at' => :'Time'
@@ -118,6 +133,8 @@ module Zyphr
118
133
  :'name',
119
134
  :'avatar_url',
120
135
  :'phone_number',
136
+ :'anonymous_device_id',
137
+ :'first_activity_at',
121
138
  :'last_login_at'
122
139
  ])
123
140
  end
@@ -180,6 +197,18 @@ module Zyphr
180
197
  self.mfa_enabled = attributes[:'mfa_enabled']
181
198
  end
182
199
 
200
+ if attributes.key?(:'is_anonymous')
201
+ self.is_anonymous = attributes[:'is_anonymous']
202
+ end
203
+
204
+ if attributes.key?(:'anonymous_device_id')
205
+ self.anonymous_device_id = attributes[:'anonymous_device_id']
206
+ end
207
+
208
+ if attributes.key?(:'first_activity_at')
209
+ self.first_activity_at = attributes[:'first_activity_at']
210
+ end
211
+
183
212
  if attributes.key?(:'created_at')
184
213
  self.created_at = attributes[:'created_at']
185
214
  end
@@ -235,6 +264,9 @@ module Zyphr
235
264
  phone_verified == o.phone_verified &&
236
265
  status == o.status &&
237
266
  mfa_enabled == o.mfa_enabled &&
267
+ is_anonymous == o.is_anonymous &&
268
+ anonymous_device_id == o.anonymous_device_id &&
269
+ first_activity_at == o.first_activity_at &&
238
270
  created_at == o.created_at &&
239
271
  updated_at == o.updated_at &&
240
272
  last_login_at == o.last_login_at
@@ -249,7 +281,7 @@ module Zyphr
249
281
  # Calculates hash code according to all attributes.
250
282
  # @return [Integer] Hash code
251
283
  def hash
252
- [id, email, name, email_verified, avatar_url, metadata, phone_number, phone_verified, status, mfa_enabled, created_at, updated_at, last_login_at].hash
284
+ [id, email, name, email_verified, avatar_url, metadata, phone_number, phone_verified, status, mfa_enabled, is_anonymous, anonymous_device_id, first_activity_at, created_at, updated_at, last_login_at].hash
253
285
  end
254
286
 
255
287
  # Builds the object from hash