stytch 5.0.2 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/stytch/b2b_client.rb +7 -1
- data/lib/stytch/b2b_discovery.rb +243 -3
- data/lib/stytch/b2b_magic_links.rb +276 -1
- data/lib/stytch/b2b_oauth.rb +202 -0
- data/lib/stytch/b2b_organizations.rb +513 -48
- data/lib/stytch/b2b_otp.rb +72 -0
- data/lib/stytch/b2b_passwords.rb +453 -3
- data/lib/stytch/b2b_sessions.rb +192 -5
- data/lib/stytch/b2b_sso.rb +302 -8
- data/lib/stytch/client.rb +9 -9
- data/lib/stytch/crypto_wallets.rb +112 -13
- data/lib/stytch/errors.rb +16 -16
- data/lib/stytch/magic_links.rb +350 -56
- data/lib/stytch/oauth.rb +129 -22
- data/lib/stytch/otps.rb +454 -71
- data/lib/stytch/passwords.rb +513 -67
- data/lib/stytch/sessions.rb +152 -40
- data/lib/stytch/totps.rb +193 -13
- data/lib/stytch/users.rb +427 -96
- data/lib/stytch/version.rb +1 -1
- data/lib/stytch/webauthn.rb +156 -10
- data/lib/stytch.rb +1 -0
- metadata +4 -2
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
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
|
+
|
3
9
|
require_relative 'request_helper'
|
4
10
|
|
5
11
|
module StytchB2B
|
@@ -13,9 +19,91 @@ module StytchB2B
|
|
13
19
|
@members = StytchB2B::Organizations::Members.new(@connection)
|
14
20
|
end
|
15
21
|
|
22
|
+
# Creates an Organization. An `organization_name` and a unique `organization_slug` are required.
|
23
|
+
#
|
24
|
+
# By default, `email_invites` and `sso_jit_provisioning` will be set to `ALL_ALLOWED` if no Organization authentication settings are explicitly defined in the request.
|
25
|
+
#
|
26
|
+
# *See the [Organization authentication settings](https://stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like `email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.
|
27
|
+
#
|
28
|
+
# == Parameters:
|
29
|
+
# organization_name::
|
30
|
+
# The name of the Organization.
|
31
|
+
# The type of this field is +String+.
|
32
|
+
# organization_slug::
|
33
|
+
# The unique URL slug of the Organization. A minimum of two characters is required. The slug only accepts alphanumeric characters and the following reserved characters: `-` `.` `_` `~`.
|
34
|
+
# The type of this field is nilable +String+.
|
35
|
+
# organization_logo_url::
|
36
|
+
# The image URL of the Organization logo.
|
37
|
+
# The type of this field is nilable +String+.
|
38
|
+
# trusted_metadata::
|
39
|
+
# An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
|
40
|
+
# The type of this field is nilable +object+.
|
41
|
+
# sso_jit_provisioning::
|
42
|
+
# The authentication setting that controls the JIT provisioning of Members when authenticating via SSO. The accepted values are:
|
43
|
+
#
|
44
|
+
# `ALL_ALLOWED` – new Members will be automatically provisioned upon successful authentication via any of the Organization's `sso_active_connections`.
|
45
|
+
#
|
46
|
+
# `RESTRICTED` – only new Members with SSO logins that comply with `sso_jit_provisioning_allowed_connections` can be provisioned upon authentication.
|
47
|
+
#
|
48
|
+
# `NOT_ALLOWED` – disable JIT provisioning via SSO.
|
49
|
+
#
|
50
|
+
# The type of this field is nilable +String+.
|
51
|
+
# email_allowed_domains::
|
52
|
+
# An array of email domains that allow invites or JIT provisioning for new Members. This list is enforced when either `email_invites` or `email_jit_provisioning` is set to `RESTRICTED`.
|
53
|
+
#
|
54
|
+
#
|
55
|
+
# Common domains such as `gmail.com` are not allowed. See the [common email domains resource](https://stytch.com/docs/b2b/api/common-email-domains) for the full list.
|
56
|
+
# The type of this field is nilable list of +String+.
|
57
|
+
# email_jit_provisioning::
|
58
|
+
# The authentication setting that controls how a new Member can be provisioned by authenticating via Email Magic Link. The accepted values are:
|
59
|
+
#
|
60
|
+
# `RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be provisioned upon authentication via Email Magic Link.
|
61
|
+
#
|
62
|
+
# `NOT_ALLOWED` – disable JIT provisioning via Email Magic Link.
|
63
|
+
#
|
64
|
+
# The type of this field is nilable +String+.
|
65
|
+
# email_invites::
|
66
|
+
# The authentication setting that controls how a new Member can be invited to an organization by email. The accepted values are:
|
67
|
+
#
|
68
|
+
# `ALL_ALLOWED` – any new Member can be invited to join via email.
|
69
|
+
#
|
70
|
+
# `RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be invited via email.
|
71
|
+
#
|
72
|
+
# `NOT_ALLOWED` – disable email invites.
|
73
|
+
#
|
74
|
+
# The type of this field is nilable +String+.
|
75
|
+
# auth_methods::
|
76
|
+
# The setting that controls which authentication methods can be used by Members of an Organization. The accepted values are:
|
77
|
+
#
|
78
|
+
# `ALL_ALLOWED` – the default setting which allows all authentication methods to be used.
|
79
|
+
#
|
80
|
+
# `RESTRICTED` – only methods that comply with `allowed_auth_methods` can be used for authentication. This setting does not apply to Members with `is_breakglass` set to `true`.
|
81
|
+
#
|
82
|
+
# The type of this field is nilable +String+.
|
83
|
+
# allowed_auth_methods::
|
84
|
+
#
|
85
|
+
# An array of allowed authentication methods. This list is enforced when `auth_methods` is set to `RESTRICTED`.
|
86
|
+
# The list's accepted values are: `sso`, `magic_link`, `password`, `google_oauth`, and `microsoft_oauth`.
|
87
|
+
#
|
88
|
+
# The type of this field is nilable list of +String+.
|
89
|
+
# mfa_policy::
|
90
|
+
# (no documentation yet)
|
91
|
+
# The type of this field is nilable +String+.
|
92
|
+
#
|
93
|
+
# == Returns:
|
94
|
+
# An object with the following fields:
|
95
|
+
# request_id::
|
96
|
+
# 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.
|
97
|
+
# The type of this field is +String+.
|
98
|
+
# organization::
|
99
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
100
|
+
# The type of this field is +Organization+ (+object+).
|
101
|
+
# status_code::
|
102
|
+
# 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.
|
103
|
+
# The type of this field is +Integer+.
|
16
104
|
def create(
|
17
105
|
organization_name:,
|
18
|
-
organization_slug
|
106
|
+
organization_slug: nil,
|
19
107
|
organization_logo_url: nil,
|
20
108
|
trusted_metadata: nil,
|
21
109
|
sso_jit_provisioning: nil,
|
@@ -23,12 +111,13 @@ module StytchB2B
|
|
23
111
|
email_jit_provisioning: nil,
|
24
112
|
email_invites: nil,
|
25
113
|
auth_methods: nil,
|
26
|
-
allowed_auth_methods: nil
|
114
|
+
allowed_auth_methods: nil,
|
115
|
+
mfa_policy: nil
|
27
116
|
)
|
28
117
|
request = {
|
29
|
-
organization_name: organization_name
|
30
|
-
organization_slug: organization_slug
|
118
|
+
organization_name: organization_name
|
31
119
|
}
|
120
|
+
request[:organization_slug] = organization_slug unless organization_slug.nil?
|
32
121
|
request[:organization_logo_url] = organization_logo_url unless organization_logo_url.nil?
|
33
122
|
request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
|
34
123
|
request[:sso_jit_provisioning] = sso_jit_provisioning unless sso_jit_provisioning.nil?
|
@@ -37,20 +126,128 @@ module StytchB2B
|
|
37
126
|
request[:email_invites] = email_invites unless email_invites.nil?
|
38
127
|
request[:auth_methods] = auth_methods unless auth_methods.nil?
|
39
128
|
request[:allowed_auth_methods] = allowed_auth_methods unless allowed_auth_methods.nil?
|
129
|
+
request[:mfa_policy] = mfa_policy unless mfa_policy.nil?
|
40
130
|
|
41
131
|
post_request('/v1/b2b/organizations', request)
|
42
132
|
end
|
43
133
|
|
134
|
+
# Returns an Organization specified by `organization_id`.
|
135
|
+
#
|
136
|
+
# == Parameters:
|
137
|
+
# organization_id::
|
138
|
+
# 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.
|
139
|
+
# The type of this field is +String+.
|
140
|
+
#
|
141
|
+
# == Returns:
|
142
|
+
# An object with the following fields:
|
143
|
+
# request_id::
|
144
|
+
# 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.
|
145
|
+
# The type of this field is +String+.
|
146
|
+
# organization::
|
147
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
148
|
+
# The type of this field is +Organization+ (+object+).
|
149
|
+
# status_code::
|
150
|
+
# 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.
|
151
|
+
# The type of this field is +Integer+.
|
44
152
|
def get(
|
45
153
|
organization_id:
|
46
154
|
)
|
47
155
|
query_params = {
|
48
|
-
organization_id: organization_id
|
49
156
|
}
|
50
157
|
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}", query_params)
|
51
158
|
get_request(request)
|
52
159
|
end
|
53
160
|
|
161
|
+
# Updates an Organization specified by `organization_id`. An Organization must always have at least one auth setting set to either `RESTRICTED` or `ALL_ALLOWED` in order to provision new Members. test
|
162
|
+
#
|
163
|
+
# *See the [Organization authentication settings](https://stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like `email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.
|
164
|
+
#
|
165
|
+
# == Parameters:
|
166
|
+
# organization_id::
|
167
|
+
# 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.
|
168
|
+
# The type of this field is +String+.
|
169
|
+
# organization_name::
|
170
|
+
# The name of the Organization.
|
171
|
+
# The type of this field is nilable +String+.
|
172
|
+
# organization_slug::
|
173
|
+
# The unique URL slug of the Organization. A minimum of two characters is required. The slug only accepts alphanumeric characters and the following reserved characters: `-` `.` `_` `~`.
|
174
|
+
# The type of this field is nilable +String+.
|
175
|
+
# organization_logo_url::
|
176
|
+
# The image URL of the Organization logo.
|
177
|
+
# The type of this field is nilable +String+.
|
178
|
+
# trusted_metadata::
|
179
|
+
# An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
|
180
|
+
# The type of this field is nilable +object+.
|
181
|
+
# sso_default_connection_id::
|
182
|
+
# The default connection used for SSO when there are multiple active connections.
|
183
|
+
# The type of this field is nilable +String+.
|
184
|
+
# sso_jit_provisioning::
|
185
|
+
# The authentication setting that controls the JIT provisioning of Members when authenticating via SSO. The accepted values are:
|
186
|
+
#
|
187
|
+
# `ALL_ALLOWED` – new Members will be automatically provisioned upon successful authentication via any of the Organization's `sso_active_connections`.
|
188
|
+
#
|
189
|
+
# `RESTRICTED` – only new Members with SSO logins that comply with `sso_jit_provisioning_allowed_connections` can be provisioned upon authentication.
|
190
|
+
#
|
191
|
+
# `NOT_ALLOWED` – disable JIT provisioning via SSO.
|
192
|
+
#
|
193
|
+
# The type of this field is nilable +String+.
|
194
|
+
# sso_jit_provisioning_allowed_connections::
|
195
|
+
# An array of `connection_id`s that reference [SAML Connection objects](https://stytch.com/docs/b2b/api/saml-connection-object).
|
196
|
+
# Only these connections will be allowed to JIT provision Members via SSO when `sso_jit_provisioning` is set to `RESTRICTED`.
|
197
|
+
# The type of this field is nilable list of +String+.
|
198
|
+
# email_allowed_domains::
|
199
|
+
# An array of email domains that allow invites or JIT provisioning for new Members. This list is enforced when either `email_invites` or `email_jit_provisioning` is set to `RESTRICTED`.
|
200
|
+
#
|
201
|
+
#
|
202
|
+
# Common domains such as `gmail.com` are not allowed. See the [common email domains resource](https://stytch.com/docs/b2b/api/common-email-domains) for the full list.
|
203
|
+
# The type of this field is nilable list of +String+.
|
204
|
+
# email_jit_provisioning::
|
205
|
+
# The authentication setting that controls how a new Member can be provisioned by authenticating via Email Magic Link. The accepted values are:
|
206
|
+
#
|
207
|
+
# `RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be provisioned upon authentication via Email Magic Link.
|
208
|
+
#
|
209
|
+
# `NOT_ALLOWED` – disable JIT provisioning via Email Magic Link.
|
210
|
+
#
|
211
|
+
# The type of this field is nilable +String+.
|
212
|
+
# email_invites::
|
213
|
+
# The authentication setting that controls how a new Member can be invited to an organization by email. The accepted values are:
|
214
|
+
#
|
215
|
+
# `ALL_ALLOWED` – any new Member can be invited to join via email.
|
216
|
+
#
|
217
|
+
# `RESTRICTED` – only new Members with verified emails that comply with `email_allowed_domains` can be invited via email.
|
218
|
+
#
|
219
|
+
# `NOT_ALLOWED` – disable email invites.
|
220
|
+
#
|
221
|
+
# The type of this field is nilable +String+.
|
222
|
+
# auth_methods::
|
223
|
+
# The setting that controls which authentication methods can be used by Members of an Organization. The accepted values are:
|
224
|
+
#
|
225
|
+
# `ALL_ALLOWED` – the default setting which allows all authentication methods to be used.
|
226
|
+
#
|
227
|
+
# `RESTRICTED` – only methods that comply with `allowed_auth_methods` can be used for authentication. This setting does not apply to Members with `is_breakglass` set to `true`.
|
228
|
+
#
|
229
|
+
# The type of this field is nilable +String+.
|
230
|
+
# allowed_auth_methods::
|
231
|
+
#
|
232
|
+
# An array of allowed authentication methods. This list is enforced when `auth_methods` is set to `RESTRICTED`.
|
233
|
+
# The list's accepted values are: `sso`, `magic_link`, `password`, `google_oauth`, and `microsoft_oauth`.
|
234
|
+
#
|
235
|
+
# The type of this field is nilable list of +String+.
|
236
|
+
# mfa_policy::
|
237
|
+
# (no documentation yet)
|
238
|
+
# The type of this field is nilable +String+.
|
239
|
+
#
|
240
|
+
# == Returns:
|
241
|
+
# An object with the following fields:
|
242
|
+
# request_id::
|
243
|
+
# 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.
|
244
|
+
# The type of this field is +String+.
|
245
|
+
# organization::
|
246
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
247
|
+
# The type of this field is +Organization+ (+object+).
|
248
|
+
# status_code::
|
249
|
+
# 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.
|
250
|
+
# The type of this field is +Integer+.
|
54
251
|
def update(
|
55
252
|
organization_id:,
|
56
253
|
organization_name: nil,
|
@@ -64,10 +261,10 @@ module StytchB2B
|
|
64
261
|
email_jit_provisioning: nil,
|
65
262
|
email_invites: nil,
|
66
263
|
auth_methods: nil,
|
67
|
-
allowed_auth_methods: nil
|
264
|
+
allowed_auth_methods: nil,
|
265
|
+
mfa_policy: nil
|
68
266
|
)
|
69
267
|
request = {
|
70
|
-
organization_id: organization_id
|
71
268
|
}
|
72
269
|
request[:organization_name] = organization_name unless organization_name.nil?
|
73
270
|
request[:organization_slug] = organization_slug unless organization_slug.nil?
|
@@ -84,22 +281,69 @@ module StytchB2B
|
|
84
281
|
request[:email_invites] = email_invites unless email_invites.nil?
|
85
282
|
request[:auth_methods] = auth_methods unless auth_methods.nil?
|
86
283
|
request[:allowed_auth_methods] = allowed_auth_methods unless allowed_auth_methods.nil?
|
284
|
+
request[:mfa_policy] = mfa_policy unless mfa_policy.nil?
|
87
285
|
|
88
286
|
put_request("/v1/b2b/organizations/#{organization_id}", request)
|
89
287
|
end
|
90
288
|
|
289
|
+
# Deletes an Organization specified by `organization_id`. All Members of the Organization will also be deleted.
|
290
|
+
#
|
291
|
+
# == Parameters:
|
292
|
+
# organization_id::
|
293
|
+
# 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.
|
294
|
+
# The type of this field is +String+.
|
295
|
+
#
|
296
|
+
# == Returns:
|
297
|
+
# An object with the following fields:
|
298
|
+
# request_id::
|
299
|
+
# 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.
|
300
|
+
# The type of this field is +String+.
|
301
|
+
# organization_id::
|
302
|
+
# 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.
|
303
|
+
# The type of this field is +String+.
|
304
|
+
# status_code::
|
305
|
+
# 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.
|
306
|
+
# The type of this field is +Integer+.
|
91
307
|
def delete(
|
92
308
|
organization_id:
|
93
309
|
)
|
94
310
|
delete_request("/v1/b2b/organizations/#{organization_id}")
|
95
311
|
end
|
96
312
|
|
313
|
+
# Search for Organizations. If you send a request with no body params, no filtering will be applied and the endpoint will return all Organizations. All fuzzy search filters require a minimum of three characters.
|
314
|
+
#
|
315
|
+
# == Parameters:
|
316
|
+
# cursor::
|
317
|
+
# The `cursor` field allows you to paginate through your results. Each result array is limited to 1000 results. If your query returns more than 1000 results, you will need to paginate the responses using the `cursor`. If you receive a response that includes a non-null `next_cursor` in the `results_metadata` object, repeat the search call with the `next_cursor` value set to the `cursor` field to retrieve the next page of results. Continue to make search calls until the `next_cursor` in the response is null.
|
318
|
+
# The type of this field is nilable +String+.
|
319
|
+
# limit::
|
320
|
+
# The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the `cursor` field.
|
321
|
+
# The type of this field is nilable +Integer+.
|
322
|
+
# query::
|
323
|
+
# The optional query object contains the operator, i.e. `AND` or `OR`, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all Organizations with no filtering applied.
|
324
|
+
# The type of this field is nilable +SearchQuery+ (+object+).
|
325
|
+
#
|
326
|
+
# == Returns:
|
327
|
+
# An object with the following fields:
|
328
|
+
# request_id::
|
329
|
+
# 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.
|
330
|
+
# The type of this field is +String+.
|
331
|
+
# organizations::
|
332
|
+
# An array of [Organization objects](https://stytch.com/docs/b2b/api/organization-object).
|
333
|
+
# The type of this field is list of +Organization+ (+object+).
|
334
|
+
# results_metadata::
|
335
|
+
# The search `results_metadata` object contains metadata relevant to your specific query like `total` and `next_cursor`.
|
336
|
+
# The type of this field is +ResultsMetadata+ (+object+).
|
337
|
+
# status_code::
|
338
|
+
# 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.
|
339
|
+
# The type of this field is +Integer+.
|
97
340
|
def search(
|
98
341
|
cursor: nil,
|
99
342
|
limit: nil,
|
100
343
|
query: nil
|
101
344
|
)
|
102
|
-
request = {
|
345
|
+
request = {
|
346
|
+
}
|
103
347
|
request[:cursor] = cursor unless cursor.nil?
|
104
348
|
request[:limit] = limit unless limit.nil?
|
105
349
|
request[:query] = query unless query.nil?
|
@@ -114,62 +358,96 @@ module StytchB2B
|
|
114
358
|
@connection = connection
|
115
359
|
end
|
116
360
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
361
|
+
# Updates a Member specified by `organization_id` and `member_id`.
|
362
|
+
#
|
363
|
+
# == Parameters:
|
364
|
+
# organization_id::
|
365
|
+
# 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.
|
366
|
+
# The type of this field is +String+.
|
367
|
+
# member_id::
|
368
|
+
# Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
|
369
|
+
# The type of this field is +String+.
|
370
|
+
# name::
|
371
|
+
# The name of the Member.
|
372
|
+
# The type of this field is nilable +String+.
|
373
|
+
# trusted_metadata::
|
374
|
+
# An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
|
375
|
+
# The type of this field is nilable +object+.
|
376
|
+
# untrusted_metadata::
|
377
|
+
# An arbitrary JSON object of application-specific data. These fields can be edited directly by the
|
378
|
+
# frontend SDK, and should not be used to store critical information. See the [Metadata resource](https://stytch.com/docs/b2b/api/metadata)
|
379
|
+
# for complete field behavior details.
|
380
|
+
# The type of this field is nilable +object+.
|
381
|
+
# is_breakglass::
|
382
|
+
# Identifies the Member as a break glass user - someone who has permissions to authenticate into an Organization by bypassing the Organization's settings. A break glass account is typically used for emergency purposes to gain access outside of normal authentication procedures. Refer to the [Organization object](organization-object) and its `auth_methods` and `allowed_auth_methods` fields for more details.
|
383
|
+
# The type of this field is nilable +Boolean+.
|
384
|
+
# phone_number::
|
385
|
+
# (no documentation yet)
|
386
|
+
# The type of this field is nilable +String+.
|
387
|
+
# mfa_enrolled::
|
388
|
+
# (no documentation yet)
|
389
|
+
# The type of this field is nilable +Boolean+.
|
390
|
+
#
|
391
|
+
# == Returns:
|
392
|
+
# An object with the following fields:
|
393
|
+
# request_id::
|
394
|
+
# 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.
|
395
|
+
# The type of this field is +String+.
|
396
|
+
# member_id::
|
397
|
+
# Globally unique UUID that identifies a specific Member.
|
398
|
+
# The type of this field is +String+.
|
399
|
+
# member::
|
400
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object).
|
401
|
+
# The type of this field is +Member+ (+object+).
|
402
|
+
# organization::
|
403
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
404
|
+
# The type of this field is +Organization+ (+object+).
|
405
|
+
# status_code::
|
406
|
+
# 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.
|
407
|
+
# The type of this field is +Integer+.
|
153
408
|
def update(
|
154
409
|
organization_id:,
|
155
410
|
member_id:,
|
156
411
|
name: nil,
|
157
412
|
trusted_metadata: nil,
|
158
413
|
untrusted_metadata: nil,
|
159
|
-
is_breakglass: nil
|
414
|
+
is_breakglass: nil,
|
415
|
+
phone_number: nil,
|
416
|
+
mfa_enrolled: nil
|
160
417
|
)
|
161
418
|
request = {
|
162
|
-
organization_id: organization_id,
|
163
|
-
member_id: member_id
|
164
419
|
}
|
165
420
|
request[:name] = name unless name.nil?
|
166
421
|
request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
|
167
422
|
request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
|
168
423
|
request[:is_breakglass] = is_breakglass unless is_breakglass.nil?
|
424
|
+
request[:phone_number] = phone_number unless phone_number.nil?
|
425
|
+
request[:mfa_enrolled] = mfa_enrolled unless mfa_enrolled.nil?
|
169
426
|
|
170
427
|
put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", request)
|
171
428
|
end
|
172
429
|
|
430
|
+
# Deletes a Member specified by `organization_id` and `member_id`.
|
431
|
+
#
|
432
|
+
# == Parameters:
|
433
|
+
# organization_id::
|
434
|
+
# 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.
|
435
|
+
# The type of this field is +String+.
|
436
|
+
# member_id::
|
437
|
+
# Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
|
438
|
+
# The type of this field is +String+.
|
439
|
+
#
|
440
|
+
# == Returns:
|
441
|
+
# An object with the following fields:
|
442
|
+
# request_id::
|
443
|
+
# 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.
|
444
|
+
# The type of this field is +String+.
|
445
|
+
# member_id::
|
446
|
+
# Globally unique UUID that identifies a specific Member.
|
447
|
+
# The type of this field is +String+.
|
448
|
+
# status_code::
|
449
|
+
# 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.
|
450
|
+
# The type of this field is +Integer+.
|
173
451
|
def delete(
|
174
452
|
organization_id:,
|
175
453
|
member_id:
|
@@ -177,6 +455,48 @@ module StytchB2B
|
|
177
455
|
delete_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}")
|
178
456
|
end
|
179
457
|
|
458
|
+
def delete_phone_number(
|
459
|
+
organization_id:,
|
460
|
+
member_id:
|
461
|
+
)
|
462
|
+
delete_request("/v1/b2b/organizations/#{organization_id}/members/phone_numbers/#{member_id}")
|
463
|
+
end
|
464
|
+
|
465
|
+
# Search for Members within specified Organizations. An array with at least one `organization_id` is required. Submitting an empty `query` returns all Members within the specified Organizations.
|
466
|
+
#
|
467
|
+
# *All fuzzy search filters require a minimum of three characters.
|
468
|
+
#
|
469
|
+
# == Parameters:
|
470
|
+
# organization_ids::
|
471
|
+
# An array of organization_ids. At least one value is required.
|
472
|
+
# The type of this field is list of +String+.
|
473
|
+
# cursor::
|
474
|
+
# The `cursor` field allows you to paginate through your results. Each result array is limited to 1000 results. If your query returns more than 1000 results, you will need to paginate the responses using the `cursor`. If you receive a response that includes a non-null `next_cursor` in the `results_metadata` object, repeat the search call with the `next_cursor` value set to the `cursor` field to retrieve the next page of results. Continue to make search calls until the `next_cursor` in the response is null.
|
475
|
+
# The type of this field is nilable +String+.
|
476
|
+
# limit::
|
477
|
+
# The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the `cursor` field.
|
478
|
+
# The type of this field is nilable +Integer+.
|
479
|
+
# query::
|
480
|
+
# The optional query object contains the operator, i.e. `AND` or `OR`, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all Organizations with no filtering applied.
|
481
|
+
# The type of this field is nilable +SearchQuery+ (+object+).
|
482
|
+
#
|
483
|
+
# == Returns:
|
484
|
+
# An object with the following fields:
|
485
|
+
# request_id::
|
486
|
+
# 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.
|
487
|
+
# The type of this field is +String+.
|
488
|
+
# members::
|
489
|
+
# An array of [Member objects](member-object).
|
490
|
+
# The type of this field is list of +Member+ (+object+).
|
491
|
+
# results_metadata::
|
492
|
+
# The search `results_metadata` object contains metadata relevant to your specific query like `total` and `next_cursor`.
|
493
|
+
# The type of this field is +ResultsMetadata+ (+object+).
|
494
|
+
# organizations::
|
495
|
+
# A map from `organization_id` to [Organization object](https://stytch.com/docs/b2b/api/organization-object). The map only contains the Organizations that the Members belongs to.
|
496
|
+
# The type of this field is map of +String+ to +Organization+ (+object+).
|
497
|
+
# status_code::
|
498
|
+
# 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.
|
499
|
+
# The type of this field is +Integer+.
|
180
500
|
def search(
|
181
501
|
organization_ids:,
|
182
502
|
cursor: nil,
|
@@ -193,12 +513,157 @@ module StytchB2B
|
|
193
513
|
post_request('/v1/b2b/organizations/members/search', request)
|
194
514
|
end
|
195
515
|
|
196
|
-
|
516
|
+
# Delete a Member's password.
|
517
|
+
#
|
518
|
+
# == Parameters:
|
519
|
+
# organization_id::
|
520
|
+
# 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.
|
521
|
+
# The type of this field is +String+.
|
522
|
+
# member_password_id::
|
523
|
+
# Globally unique UUID that identifies a Member's password.
|
524
|
+
# The type of this field is +String+.
|
525
|
+
#
|
526
|
+
# == Returns:
|
527
|
+
# An object with the following fields:
|
528
|
+
# request_id::
|
529
|
+
# 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.
|
530
|
+
# The type of this field is +String+.
|
531
|
+
# member_id::
|
532
|
+
# Globally unique UUID that identifies a specific Member.
|
533
|
+
# The type of this field is +String+.
|
534
|
+
# member::
|
535
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object).
|
536
|
+
# The type of this field is +Member+ (+object+).
|
537
|
+
# organization::
|
538
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
539
|
+
# The type of this field is +Organization+ (+object+).
|
540
|
+
# status_code::
|
541
|
+
# 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.
|
542
|
+
# The type of this field is +Integer+.
|
543
|
+
def delete_password(
|
197
544
|
organization_id:,
|
198
545
|
member_password_id:
|
199
546
|
)
|
200
547
|
delete_request("/v1/b2b/organizations/#{organization_id}/members/passwords/#{member_password_id}")
|
201
548
|
end
|
549
|
+
|
550
|
+
# Creates a Member. An `organization_id` and `email_address` are required.
|
551
|
+
#
|
552
|
+
# == Parameters:
|
553
|
+
# organization_id::
|
554
|
+
# 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.
|
555
|
+
# The type of this field is +String+.
|
556
|
+
# email_address::
|
557
|
+
# The email address of the Member.
|
558
|
+
# The type of this field is +String+.
|
559
|
+
# name::
|
560
|
+
# The name of the Member.
|
561
|
+
# The type of this field is nilable +String+.
|
562
|
+
# trusted_metadata::
|
563
|
+
# An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
|
564
|
+
# The type of this field is nilable +object+.
|
565
|
+
# untrusted_metadata::
|
566
|
+
# An arbitrary JSON object of application-specific data. These fields can be edited directly by the
|
567
|
+
# frontend SDK, and should not be used to store critical information. See the [Metadata resource](https://stytch.com/docs/b2b/api/metadata)
|
568
|
+
# for complete field behavior details.
|
569
|
+
# The type of this field is nilable +object+.
|
570
|
+
# create_member_as_pending::
|
571
|
+
# Flag for whether or not to save a Member as `pending` or `active` in Stytch. It defaults to false. If true, new Members will be created with status `pending` in Stytch's backend. Their status will remain `pending` and they will continue to receive signup email templates for every Email Magic Link until that Member authenticates and becomes `active`. If false, new Members will be created with status `active`.
|
572
|
+
# The type of this field is nilable +Boolean+.
|
573
|
+
# is_breakglass::
|
574
|
+
# Identifies the Member as a break glass user - someone who has permissions to authenticate into an Organization by bypassing the Organization's settings. A break glass account is typically used for emergency purposes to gain access outside of normal authentication procedures. Refer to the [Organization object](organization-object) and its `auth_methods` and `allowed_auth_methods` fields for more details.
|
575
|
+
# The type of this field is nilable +Boolean+.
|
576
|
+
# phone_number::
|
577
|
+
# (no documentation yet)
|
578
|
+
# The type of this field is nilable +String+.
|
579
|
+
# mfa_enrolled::
|
580
|
+
# (no documentation yet)
|
581
|
+
# The type of this field is nilable +Boolean+.
|
582
|
+
#
|
583
|
+
# == Returns:
|
584
|
+
# An object with the following fields:
|
585
|
+
# request_id::
|
586
|
+
# 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.
|
587
|
+
# The type of this field is +String+.
|
588
|
+
# member_id::
|
589
|
+
# Globally unique UUID that identifies a specific Member.
|
590
|
+
# The type of this field is +String+.
|
591
|
+
# member::
|
592
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object).
|
593
|
+
# The type of this field is +Member+ (+object+).
|
594
|
+
# organization::
|
595
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
596
|
+
# The type of this field is +Organization+ (+object+).
|
597
|
+
# status_code::
|
598
|
+
# 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.
|
599
|
+
# The type of this field is +Integer+.
|
600
|
+
def create(
|
601
|
+
organization_id:,
|
602
|
+
email_address:,
|
603
|
+
name: nil,
|
604
|
+
trusted_metadata: nil,
|
605
|
+
untrusted_metadata: nil,
|
606
|
+
create_member_as_pending: nil,
|
607
|
+
is_breakglass: nil,
|
608
|
+
phone_number: nil,
|
609
|
+
mfa_enrolled: nil
|
610
|
+
)
|
611
|
+
request = {
|
612
|
+
email_address: email_address
|
613
|
+
}
|
614
|
+
request[:name] = name unless name.nil?
|
615
|
+
request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
|
616
|
+
request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
|
617
|
+
request[:create_member_as_pending] = create_member_as_pending unless create_member_as_pending.nil?
|
618
|
+
request[:is_breakglass] = is_breakglass unless is_breakglass.nil?
|
619
|
+
request[:phone_number] = phone_number unless phone_number.nil?
|
620
|
+
request[:mfa_enrolled] = mfa_enrolled unless mfa_enrolled.nil?
|
621
|
+
|
622
|
+
post_request("/v1/b2b/organizations/#{organization_id}/members", request)
|
623
|
+
end
|
624
|
+
|
625
|
+
# Get a Member by `member_id` or `email_address`.
|
626
|
+
#
|
627
|
+
# == Parameters:
|
628
|
+
# organization_id::
|
629
|
+
# 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.
|
630
|
+
# The type of this field is +String+.
|
631
|
+
# member_id::
|
632
|
+
# Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
|
633
|
+
# The type of this field is nilable +String+.
|
634
|
+
# email_address::
|
635
|
+
# The email address of the Member.
|
636
|
+
# The type of this field is nilable +String+.
|
637
|
+
#
|
638
|
+
# == Returns:
|
639
|
+
# An object with the following fields:
|
640
|
+
# request_id::
|
641
|
+
# 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.
|
642
|
+
# The type of this field is +String+.
|
643
|
+
# member_id::
|
644
|
+
# Globally unique UUID that identifies a specific Member.
|
645
|
+
# The type of this field is +String+.
|
646
|
+
# member::
|
647
|
+
# The [Member object](https://stytch.com/docs/b2b/api/member-object).
|
648
|
+
# The type of this field is +Member+ (+object+).
|
649
|
+
# organization::
|
650
|
+
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
651
|
+
# The type of this field is +Organization+ (+object+).
|
652
|
+
# status_code::
|
653
|
+
# 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.
|
654
|
+
# The type of this field is +Integer+.
|
655
|
+
def get(
|
656
|
+
organization_id:,
|
657
|
+
member_id: nil,
|
658
|
+
email_address: nil
|
659
|
+
)
|
660
|
+
query_params = {
|
661
|
+
member_id: member_id,
|
662
|
+
email_address: email_address
|
663
|
+
}
|
664
|
+
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/member", query_params)
|
665
|
+
get_request(request)
|
666
|
+
end
|
202
667
|
end
|
203
668
|
end
|
204
669
|
end
|