stytch 7.6.0 → 7.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20081a47ace39be10d26c1e1aa897a2dd6a92af8033e4248cb0c0b0ab8423f20
4
- data.tar.gz: e78cd3c76f31a2d7c186adbe92cc86b1aef074e8c2e054f871afe3a7fadb8087
3
+ metadata.gz: e088d563ff2befaa22cddad24209cc1bd975c5d8e129e0f6d7f05750abaa572e
4
+ data.tar.gz: 6bd6302153904ec43a6b40473dd7a364961ae31753bb9c9ab9df42466f17c211
5
5
  SHA512:
6
- metadata.gz: e3945334acf409cebd4574c3537f5db421708ccf0f4e739fce4199af0697a65ff9aad3d80f3be995d05fbaf12a49a094c04ae9221547d9b11e9bbc9db3d6ae43
7
- data.tar.gz: 61852bbbf716eb468c5cd3c222218dce2e6be285af330046e1a05b91d858660c6d7b3fbc3ee2c72984e38fbdf52742e1a3e3509c14af3b79e5943eed24d37991
6
+ metadata.gz: 264ecbaa7f87e9f7875e83af4354a867f866df8536dfb10b25dde0fd6b8415e94d64a8bb44e817c72b07962a2323eab3ab1789f4941befcf38bbbe759d796040
7
+ data.tar.gz: 2d8f8d03cfc52e902c7aa25be70c2d9b79213923a6ccc9379729a367789740d985cee75ed27c2719406780e5db67e8fbabdff30b89f41289376f4c458bdbc3d2
@@ -13,13 +13,14 @@ require_relative 'b2b_sessions'
13
13
  require_relative 'b2b_sso'
14
14
  require_relative 'b2b_totps'
15
15
  require_relative 'm2m'
16
+ require_relative 'project'
16
17
  require_relative 'rbac_local'
17
18
 
18
19
  module StytchB2B
19
20
  class Client
20
21
  ENVIRONMENTS = %i[live test].freeze
21
22
 
22
- attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
23
+ attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
23
24
 
24
25
  def initialize(project_id:, secret:, env: nil, &block)
25
26
  @api_host = api_host(env, project_id)
@@ -38,6 +39,7 @@ module StytchB2B
38
39
  @otps = StytchB2B::OTPs.new(@connection)
39
40
  @organizations = StytchB2B::Organizations.new(@connection)
40
41
  @passwords = StytchB2B::Passwords.new(@connection)
42
+ @project = Stytch::Project.new(@connection)
41
43
  @rbac = StytchB2B::RBAC.new(@connection)
42
44
  @recovery_codes = StytchB2B::RecoveryCodes.new(@connection)
43
45
  @scim = StytchB2B::SCIM.new(@connection)
@@ -500,6 +500,15 @@ module StytchB2B
500
500
  post_request('/v1/b2b/organizations/search', request, headers)
501
501
  end
502
502
 
503
+ def metrics(
504
+ organization_id:
505
+ )
506
+ headers = {}
507
+ query_params = {}
508
+ request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/metrics", query_params)
509
+ get_request(request, headers)
510
+ end
511
+
503
512
  class Members
504
513
  include Stytch::RequestHelper
505
514
  attr_reader :oauth_providers
@@ -56,14 +56,19 @@ module StytchB2B
56
56
  # connection::
57
57
  # The `SAML Connection` object affected by this API call. See the [SAML Connection Object](https://stytch.com/docs/b2b/api/saml-connection-object) for complete response field details.
58
58
  # The type of this field is nilable +SCIMConnection+ (+object+).
59
+ #
60
+ # == Method Options:
61
+ # This method supports an optional +UpdateRequestOptions+ object which will modify the headers sent in the HTTP request.
59
62
  def update(
60
63
  organization_id:,
61
64
  connection_id:,
62
65
  display_name: nil,
63
66
  identity_provider: nil,
64
- scim_group_implicit_role_assignments: nil
67
+ scim_group_implicit_role_assignments: nil,
68
+ method_options: nil
65
69
  )
66
70
  headers = {}
71
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
67
72
  request = {}
68
73
  request[:display_name] = display_name unless display_name.nil?
69
74
  request[:identity_provider] = identity_provider unless identity_provider.nil?
@@ -79,7 +84,7 @@ module StytchB2B
79
84
  # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
80
85
  # The type of this field is +String+.
81
86
  # connection_id::
82
- # Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
87
+ # The ID of the SCIM connection.
83
88
  # The type of this field is +String+.
84
89
  #
85
90
  # == Returns:
@@ -93,11 +98,16 @@ module StytchB2B
93
98
  # status_code::
94
99
  # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
95
100
  # The type of this field is +Integer+.
101
+ #
102
+ # == Method Options:
103
+ # This method supports an optional +DeleteRequestOptions+ object which will modify the headers sent in the HTTP request.
96
104
  def delete(
97
105
  organization_id:,
98
- connection_id:
106
+ connection_id:,
107
+ method_options: nil
99
108
  )
100
109
  headers = {}
110
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
101
111
  delete_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}", headers)
102
112
  end
103
113
 
@@ -122,11 +132,16 @@ module StytchB2B
122
132
  # connection::
123
133
  # The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
124
134
  # The type of this field is nilable +SCIMConnectionWithNextToken+ (+object+).
135
+ #
136
+ # == Method Options:
137
+ # This method supports an optional +RotateStartRequestOptions+ object which will modify the headers sent in the HTTP request.
125
138
  def rotate_start(
126
139
  organization_id:,
127
- connection_id:
140
+ connection_id:,
141
+ method_options: nil
128
142
  )
129
143
  headers = {}
144
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
130
145
  request = {}
131
146
 
132
147
  post_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}/rotate/start", request, headers)
@@ -153,11 +168,16 @@ module StytchB2B
153
168
  # connection::
154
169
  # The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
155
170
  # The type of this field is nilable +SCIMConnection+ (+object+).
171
+ #
172
+ # == Method Options:
173
+ # This method supports an optional +RotateCompleteRequestOptions+ object which will modify the headers sent in the HTTP request.
156
174
  def rotate_complete(
157
175
  organization_id:,
158
- connection_id:
176
+ connection_id:,
177
+ method_options: nil
159
178
  )
160
179
  headers = {}
180
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
161
181
  request = {}
162
182
 
163
183
  post_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}/rotate/complete", request, headers)
@@ -184,11 +204,16 @@ module StytchB2B
184
204
  # connection::
185
205
  # The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
186
206
  # The type of this field is nilable +SCIMConnection+ (+object+).
207
+ #
208
+ # == Method Options:
209
+ # This method supports an optional +RotateCancelRequestOptions+ object which will modify the headers sent in the HTTP request.
187
210
  def rotate_cancel(
188
211
  organization_id:,
189
- connection_id:
212
+ connection_id:,
213
+ method_options: nil
190
214
  )
191
215
  headers = {}
216
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
192
217
  request = {}
193
218
 
194
219
  post_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}/rotate/cancel", request, headers)
@@ -218,12 +243,17 @@ module StytchB2B
218
243
  # connection::
219
244
  # The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
220
245
  # The type of this field is nilable +SCIMConnectionWithToken+ (+object+).
246
+ #
247
+ # == Method Options:
248
+ # This method supports an optional +CreateRequestOptions+ object which will modify the headers sent in the HTTP request.
221
249
  def create(
222
250
  organization_id:,
223
251
  display_name: nil,
224
- identity_provider: nil
252
+ identity_provider: nil,
253
+ method_options: nil
225
254
  )
226
255
  headers = {}
256
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
227
257
  request = {}
228
258
  request[:display_name] = display_name unless display_name.nil?
229
259
  request[:identity_provider] = identity_provider unless identity_provider.nil?
@@ -249,10 +279,15 @@ module StytchB2B
249
279
  # status_code::
250
280
  # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
251
281
  # The type of this field is +Integer+.
282
+ #
283
+ # == Method Options:
284
+ # This method supports an optional +GetRequestOptions+ object which will modify the headers sent in the HTTP request.
252
285
  def get(
253
- organization_id:
286
+ organization_id:,
287
+ method_options: nil
254
288
  )
255
289
  headers = {}
290
+ headers = headers.merge(method_options.to_headers) unless method_options.nil?
256
291
  query_params = {}
257
292
  request = request_with_query_params("/v1/b2b/scim/#{organization_id}/connections", query_params)
258
293
  get_request(request, headers)
@@ -316,6 +316,77 @@ module StytchB2B
316
316
  post_request('/v1/b2b/sessions/exchange', request, headers)
317
317
  end
318
318
 
319
+ # Migrate a session from an external endpoint. Stytch will call the UserInfo endpoint specified in your project settings, performing a lookup using the session token passed in. If the endpoint repsonds and the response contains a valid email, Stytch will attempt to match that email with a member in your organization, and create a Stytch Session for you.
320
+ #
321
+ # == Parameters:
322
+ # session_token::
323
+ # The authorization token Stytch will pass in to the external userinfo endpoint.
324
+ # The type of this field is +String+.
325
+ # organization_id::
326
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
327
+ # The type of this field is +String+.
328
+ # session_duration_minutes::
329
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
330
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
331
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
332
+ #
333
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
334
+ #
335
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
336
+ #
337
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration. If you don't want
338
+ # to use the Stytch session product, you can ignore the session fields in the response.
339
+ # The type of this field is nilable +Integer+.
340
+ # session_custom_claims::
341
+ # Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in
342
+ # `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To
343
+ # delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
344
+ # Total custom claims size cannot exceed four kilobytes.
345
+ # The type of this field is nilable +object+.
346
+ #
347
+ # == Returns:
348
+ # An object with the following fields:
349
+ # request_id::
350
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
351
+ # The type of this field is +String+.
352
+ # member_id::
353
+ # Globally unique UUID that identifies a specific Member.
354
+ # The type of this field is +String+.
355
+ # session_token::
356
+ # A secret token for a given Stytch Session.
357
+ # The type of this field is +String+.
358
+ # session_jwt::
359
+ # The JSON Web Token (JWT) for a given Stytch Session.
360
+ # The type of this field is +String+.
361
+ # member::
362
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object)
363
+ # The type of this field is +Member+ (+object+).
364
+ # organization::
365
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
366
+ # The type of this field is +Organization+ (+object+).
367
+ # status_code::
368
+ # (no documentation yet)
369
+ # The type of this field is +Integer+.
370
+ # member_session::
371
+ # The [Session object](https://stytch.com/docs/b2b/api/session-object).
372
+ # The type of this field is nilable +MemberSession+ (+object+).
373
+ def migrate(
374
+ session_token:,
375
+ organization_id:,
376
+ session_duration_minutes: nil,
377
+ session_custom_claims: nil
378
+ )
379
+ headers = {}
380
+ request = {
381
+ session_token: session_token,
382
+ organization_id: organization_id
383
+ }
384
+ request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
385
+ request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
386
+
387
+ post_request('/v1/b2b/sessions/migrate', request, headers)
388
+ end
389
+
319
390
  # Get the JSON Web Key Set (JWKS) for a project.
320
391
  #
321
392
  # JWKS are rotated every ~6 months. Upon rotation, new JWTs will be signed using the new key set, and both key sets will be returned by this endpoint for a period of 1 month.
data/lib/stytch/client.rb CHANGED
@@ -6,6 +6,7 @@ require_relative 'magic_links'
6
6
  require_relative 'oauth'
7
7
  require_relative 'otps'
8
8
  require_relative 'passwords'
9
+ require_relative 'project'
9
10
  require_relative 'sessions'
10
11
  require_relative 'totps'
11
12
  require_relative 'users'
@@ -15,7 +16,7 @@ module Stytch
15
16
  class Client
16
17
  ENVIRONMENTS = %i[live test].freeze
17
18
 
18
- attr_reader :crypto_wallets, :m2m, :magic_links, :oauth, :otps, :passwords, :sessions, :totps, :users, :webauthn
19
+ attr_reader :crypto_wallets, :m2m, :magic_links, :oauth, :otps, :passwords, :project, :sessions, :totps, :users, :webauthn
19
20
 
20
21
  def initialize(project_id:, secret:, env: nil, &block)
21
22
  @api_host = api_host(env, project_id)
@@ -30,6 +31,7 @@ module Stytch
30
31
  @oauth = Stytch::OAuth.new(@connection)
31
32
  @otps = Stytch::OTPs.new(@connection)
32
33
  @passwords = Stytch::Passwords.new(@connection)
34
+ @project = Stytch::Project.new(@connection)
33
35
  @sessions = Stytch::Sessions.new(@connection, @project_id)
34
36
  @totps = Stytch::TOTPs.new(@connection)
35
37
  @users = Stytch::Users.new(@connection)
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # !!!
4
+ # WARNING: This file is autogenerated
5
+ # Only modify code within MANUAL() sections
6
+ # or your changes may be overwritten later!
7
+ # !!!
8
+
9
+ require_relative 'request_helper'
10
+
11
+ module Stytch
12
+ class Project
13
+ include Stytch::RequestHelper
14
+
15
+ def initialize(connection)
16
+ @connection = connection
17
+ end
18
+
19
+ def metrics
20
+ headers = {}
21
+ query_params = {}
22
+ request = request_with_query_params('/v1/projects/metrics', query_params)
23
+ get_request(request, headers)
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '7.6.0'
4
+ VERSION = '7.8.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.0
4
+ version: 7.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-01 00:00:00.000000000 Z
11
+ date: 2024-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -147,6 +147,7 @@ files:
147
147
  - lib/stytch/oauth.rb
148
148
  - lib/stytch/otps.rb
149
149
  - lib/stytch/passwords.rb
150
+ - lib/stytch/project.rb
150
151
  - lib/stytch/rbac_local.rb
151
152
  - lib/stytch/request_helper.rb
152
153
  - lib/stytch/sessions.rb