stytch 5.0.2 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,159 +1,453 @@
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 Stytch
6
12
  class MagicLinks
7
13
  include Stytch::RequestHelper
8
-
9
14
  attr_reader :email
10
15
 
11
- PATH = '/v1/magic_links'
12
-
13
16
  def initialize(connection)
14
17
  @connection = connection
15
18
 
16
19
  @email = Stytch::MagicLinks::Email.new(@connection)
17
20
  end
18
21
 
19
- def create(
20
- user_id:,
21
- expiration_minutes: nil,
22
- attributes: {}
23
- )
24
- request = {
25
- user_id: user_id
26
- }
27
-
28
- request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
29
- request[:attributes] = attributes if attributes != {}
30
-
31
- post_request(PATH, request)
32
- end
33
-
22
+ # Authenticate a User given a Magic Link. This endpoint verifies that the Magic Link token is valid, hasn't expired or been previously used, and any optional security settings such as IP match or user agent match are satisfied.
23
+ #
24
+ # == Parameters:
25
+ # token::
26
+ # The token to authenticate.
27
+ # The type of this field is +String+.
28
+ # attributes::
29
+ # Provided attributes help with fraud detection.
30
+ # The type of this field is nilable +Attributes+ (+object+).
31
+ # options::
32
+ # Specify optional security settings.
33
+ # The type of this field is nilable +Options+ (+object+).
34
+ # session_token::
35
+ # The `session_token` associated with a User's existing Session.
36
+ # The type of this field is nilable +String+.
37
+ # session_duration_minutes::
38
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
39
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
40
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
41
+ #
42
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
43
+ #
44
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
45
+ #
46
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will not be created.
47
+ # The type of this field is nilable +Integer+.
48
+ # session_jwt::
49
+ # The `session_jwt` associated with a User's existing Session.
50
+ # The type of this field is nilable +String+.
51
+ # session_custom_claims::
52
+ # Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in `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 delete a key, supply a null value.
53
+ #
54
+ # Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
55
+ # The type of this field is nilable +object+.
56
+ # code_verifier::
57
+ # A base64url encoded one time secret used to validate that the request starts and ends on the same device.
58
+ # The type of this field is nilable +String+.
59
+ #
60
+ # == Returns:
61
+ # An object with the following fields:
62
+ # request_id::
63
+ # 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.
64
+ # The type of this field is +String+.
65
+ # user_id::
66
+ # The unique ID of the affected User.
67
+ # The type of this field is +String+.
68
+ # method_id::
69
+ # The `email_id` or `phone_id` involved in the given authentication.
70
+ # The type of this field is +String+.
71
+ # session_token::
72
+ # A secret token for a given Stytch Session.
73
+ # The type of this field is +String+.
74
+ # session_jwt::
75
+ # The JSON Web Token (JWT) for a given Stytch Session.
76
+ # The type of this field is +String+.
77
+ # user::
78
+ # The `user` object affected by this API call. See the [Get user endpoint](https://stytch.com/docs/api/get-user) for complete response field details.
79
+ # The type of this field is +User+ (+object+).
80
+ # reset_sessions::
81
+ # Indicates if all other of the User's Sessions need to be reset. You should check this field if you aren't using Stytch's Session product. If you are using Stytch's Session product, we revoke the User's other sessions for you.
82
+ # The type of this field is +Boolean+.
83
+ # status_code::
84
+ # 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.
85
+ # The type of this field is +Integer+.
86
+ # session::
87
+ # If you initiate a Session, by including `session_duration_minutes` in your authenticate call, you'll receive a full Session object in the response.
88
+ #
89
+ # See [GET sessions](https://stytch.com/docs/api/session-get) for complete response fields.
90
+ #
91
+ # The type of this field is nilable +Session+ (+object+).
34
92
  def authenticate(
35
93
  token:,
36
- attributes: {},
37
- options: {},
94
+ attributes: nil,
95
+ options: nil,
38
96
  session_token: nil,
39
- session_jwt: nil,
40
97
  session_duration_minutes: nil,
98
+ session_jwt: nil,
41
99
  session_custom_claims: nil,
42
100
  code_verifier: nil
43
101
  )
44
102
  request = {
45
103
  token: token
46
104
  }
47
-
48
- request[:attributes] = attributes if attributes != {}
49
- request[:options] = options if options != {}
105
+ request[:attributes] = attributes unless attributes.nil?
106
+ request[:options] = options unless options.nil?
50
107
  request[:session_token] = session_token unless session_token.nil?
51
- request[:session_jwt] = session_jwt unless session_jwt.nil?
52
108
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
109
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
53
110
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
54
111
  request[:code_verifier] = code_verifier unless code_verifier.nil?
55
112
 
56
- post_request("#{PATH}/authenticate", request)
113
+ post_request('/v1/magic_links/authenticate', request)
114
+ end
115
+
116
+ # Create an embeddable Magic Link token for a User. Access to this endpoint is restricted. To enable it, please send us a note at support@stytch.com.
117
+ #
118
+ # ### Next steps
119
+ # Send the returned `token` value to the end user in a link which directs to your application. When the end user follows your link, collect the token, and call [Authenticate Magic Link](https://stytch.com/docs/api/authenticate-magic-link) to complete authentication.
120
+ #
121
+ # == Parameters:
122
+ # user_id::
123
+ # The unique ID of a specific User.
124
+ # The type of this field is +String+.
125
+ # expiration_minutes::
126
+ # Set the expiration for the Magic Link `token` in minutes. By default, it expires in 1 hour. The minimum expiration is 5 minutes and the maximum is 7 days (10080 mins).
127
+ # The type of this field is nilable +Integer+.
128
+ # attributes::
129
+ # Provided attributes help with fraud detection.
130
+ # The type of this field is nilable +Attributes+ (+object+).
131
+ #
132
+ # == Returns:
133
+ # An object with the following fields:
134
+ # request_id::
135
+ # 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.
136
+ # The type of this field is +String+.
137
+ # user_id::
138
+ # The unique ID of the affected User.
139
+ # The type of this field is +String+.
140
+ # token::
141
+ # The Magic Link `token` that you'll include in your contact method of choice, e.g. email or SMS.
142
+ # The type of this field is +String+.
143
+ # status_code::
144
+ # 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.
145
+ # The type of this field is +Integer+.
146
+ def create(
147
+ user_id:,
148
+ expiration_minutes: nil,
149
+ attributes: nil
150
+ )
151
+ request = {
152
+ user_id: user_id
153
+ }
154
+ request[:expiration_minutes] = expiration_minutes unless expiration_minutes.nil?
155
+ request[:attributes] = attributes unless attributes.nil?
156
+
157
+ post_request('/v1/magic_links', request)
57
158
  end
58
159
 
59
160
  class Email
60
161
  include Stytch::RequestHelper
61
162
 
62
- PATH = "#{Stytch::MagicLinks::PATH}/email"
63
-
64
163
  def initialize(connection)
65
164
  @connection = connection
66
165
  end
67
166
 
167
+ # Send a magic link to an existing Stytch user using their email address. If you'd like to create a user and send them a magic link by email with one request, use our [log in or create endpoint](https://stytch.com/docs/api/log-in-or-create-user-by-email).
168
+ #
169
+ # ### Add an email to an existing user
170
+ # This endpoint also allows you to add a new email to an existing Stytch User. Including a `user_id`, `session_token`, or `session_jwt` in the request will add the email to the pre-existing Stytch User upon successful authentication.
171
+ #
172
+ # Adding a new email to an existing Stytch User requires the user to be present and validate the email via magic link. This requirement is in place to prevent account takeover attacks.
173
+ #
174
+ # ### Next steps
175
+ # The user is emailed a magic link which redirects them to the provided [redirect URL](https://stytch.com/docs/magic-links#email-magic-links_redirect-routing). Collect the `token` from the URL query parameters, and call [Authenticate magic link](https://stytch.com/docs/api/authenticate-magic-link) to complete authentication.
176
+ #
177
+ # == Parameters:
178
+ # email::
179
+ # The email address of the User to send the Magic Link to.
180
+ # The type of this field is +String+.
181
+ # login_template_id::
182
+ # Use a custom template for login emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Magic links - Login.
183
+ # The type of this field is nilable +String+.
184
+ # attributes::
185
+ # Provided attributes help with fraud detection.
186
+ # The type of this field is nilable +Attributes+ (+object+).
187
+ # login_magic_link_url::
188
+ # The URL the end user clicks from the login Email Magic Link. This should be a URL that your app receives and parses and subsequently send an API request to authenticate the Magic Link and log in the User. If this value is not passed, the default login redirect URL that you set in your Dashboard is used. If you have not set a default login redirect URL, an error is returned.
189
+ # The type of this field is nilable +String+.
190
+ # signup_magic_link_url::
191
+ # The URL the end user clicks from the sign-up Email Magic Link. This should be a URL that your app receives and parses and subsequently send an API request to authenticate the Magic Link and sign-up the User. If this value is not passed, the default sign-up redirect URL that you set in your Dashboard is used. If you have not set a default sign-up redirect URL, an error is returned.
192
+ # The type of this field is nilable +String+.
193
+ # login_expiration_minutes::
194
+ # Set the expiration for the login email magic link, in minutes. By default, it expires in 1 hour. The minimum expiration is 5 minutes and the maximum is 7 days (10080 mins).
195
+ # The type of this field is nilable +Integer+.
196
+ # signup_expiration_minutes::
197
+ # Set the expiration for the sign-up email magic link, in minutes. By default, it expires in 1 week. The minimum expiration is 5 minutes and the maximum is 7 days (10080 mins).
198
+ # The type of this field is nilable +Integer+.
199
+ # code_challenge::
200
+ # A base64url encoded SHA256 hash of a one time secret used to validate that the request starts and ends on the same device.
201
+ # The type of this field is nilable +String+.
202
+ # user_id::
203
+ # The unique ID of a specific User.
204
+ # The type of this field is nilable +String+.
205
+ # session_token::
206
+ # The `session_token` of the user to associate the email with.
207
+ # The type of this field is nilable +String+.
208
+ # session_jwt::
209
+ # The `session_jwt` of the user to associate the email with.
210
+ # The type of this field is nilable +String+.
211
+ # locale::
212
+ # Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
213
+ #
214
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
215
+ #
216
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
217
+ #
218
+ # The type of this field is nilable +SendRequestLocale+ (string enum).
219
+ # signup_template_id::
220
+ # Use a custom template for sign-up emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Magic links - Sign-up.
221
+ # The type of this field is nilable +String+.
222
+ #
223
+ # == Returns:
224
+ # An object with the following fields:
225
+ # request_id::
226
+ # 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.
227
+ # The type of this field is +String+.
228
+ # user_id::
229
+ # The unique ID of the affected User.
230
+ # The type of this field is +String+.
231
+ # email_id::
232
+ # The unique ID of a specific email address.
233
+ # The type of this field is +String+.
234
+ # status_code::
235
+ # 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.
236
+ # The type of this field is +Integer+.
68
237
  def send(
69
238
  email:,
239
+ login_template_id: nil,
240
+ attributes: nil,
70
241
  login_magic_link_url: nil,
71
242
  signup_magic_link_url: nil,
72
243
  login_expiration_minutes: nil,
73
244
  signup_expiration_minutes: nil,
74
- attributes: {},
75
245
  code_challenge: nil,
76
246
  user_id: nil,
77
247
  session_token: nil,
78
248
  session_jwt: nil,
79
249
  locale: nil,
80
- login_template_id: nil,
81
250
  signup_template_id: nil
82
251
  )
83
252
  request = {
84
253
  email: email
85
254
  }
86
-
255
+ request[:login_template_id] = login_template_id unless login_template_id.nil?
256
+ request[:attributes] = attributes unless attributes.nil?
87
257
  request[:login_magic_link_url] = login_magic_link_url unless login_magic_link_url.nil?
88
258
  request[:signup_magic_link_url] = signup_magic_link_url unless signup_magic_link_url.nil?
89
259
  request[:login_expiration_minutes] = login_expiration_minutes unless login_expiration_minutes.nil?
90
260
  request[:signup_expiration_minutes] = signup_expiration_minutes unless signup_expiration_minutes.nil?
91
- request[:attributes] = attributes if attributes != {}
92
261
  request[:code_challenge] = code_challenge unless code_challenge.nil?
93
262
  request[:user_id] = user_id unless user_id.nil?
94
263
  request[:session_token] = session_token unless session_token.nil?
95
264
  request[:session_jwt] = session_jwt unless session_jwt.nil?
96
265
  request[:locale] = locale unless locale.nil?
97
- request[:login_template_id] = login_template_id unless login_template_id.nil?
98
266
  request[:signup_template_id] = signup_template_id unless signup_template_id.nil?
99
267
 
100
- post_request("#{PATH}/send", request)
268
+ post_request('/v1/magic_links/email/send', request)
101
269
  end
102
270
 
271
+ # Send either a login or signup Magic Link to the User based on if the email is associated with a User already. A new or pending User will receive a signup Magic Link. An active User will receive a login Magic Link. For more information on how to control the status your Users are created in see the `create_user_as_pending` flag.
272
+ #
273
+ # ### Next steps
274
+ # The User is emailed a Magic Link which redirects them to the provided [redirect URL](https://stytch.com/docs/magic-links#email-magic-links_redirect-routing). Collect the `token` from the URL query parameters and call [Authenticate Magic Link](https://stytch.com/docs/api/authenticate-magic-link) to complete authentication.
275
+ #
276
+ # == Parameters:
277
+ # email::
278
+ # The email address of the end user.
279
+ # The type of this field is +String+.
280
+ # login_magic_link_url::
281
+ # The URL the end user clicks from the login Email Magic Link. This should be a URL that your app receives and parses and subsequently send an API request to authenticate the Magic Link and log in the User. If this value is not passed, the default login redirect URL that you set in your Dashboard is used. If you have not set a default login redirect URL, an error is returned.
282
+ # The type of this field is nilable +String+.
283
+ # signup_magic_link_url::
284
+ # The URL the end user clicks from the sign-up Email Magic Link. This should be a URL that your app receives and parses and subsequently send an API request to authenticate the Magic Link and sign-up the User. If this value is not passed, the default sign-up redirect URL that you set in your Dashboard is used. If you have not set a default sign-up redirect URL, an error is returned.
285
+ # The type of this field is nilable +String+.
286
+ # login_expiration_minutes::
287
+ # Set the expiration for the login email magic link, in minutes. By default, it expires in 1 hour. The minimum expiration is 5 minutes and the maximum is 7 days (10080 mins).
288
+ # The type of this field is nilable +Integer+.
289
+ # signup_expiration_minutes::
290
+ # Set the expiration for the sign-up email magic link, in minutes. By default, it expires in 1 week. The minimum expiration is 5 minutes and the maximum is 7 days (10080 mins).
291
+ # The type of this field is nilable +Integer+.
292
+ # login_template_id::
293
+ # Use a custom template for login emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Magic links - Login.
294
+ # The type of this field is nilable +String+.
295
+ # signup_template_id::
296
+ # Use a custom template for sign-up emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Magic links - Sign-up.
297
+ # The type of this field is nilable +String+.
298
+ # attributes::
299
+ # Provided attributes help with fraud detection.
300
+ # The type of this field is nilable +Attributes+ (+object+).
301
+ # create_user_as_pending::
302
+ # Flag for whether or not to save a user as pending vs active in Stytch. Defaults to false.
303
+ # If true, users will be saved with status pending in Stytch's backend until authenticated.
304
+ # If false, users will be created as active. An example usage of
305
+ # a true flag would be to require users to verify their phone by entering the OTP code before creating
306
+ # an account for them.
307
+ # The type of this field is nilable +Boolean+.
308
+ # code_challenge::
309
+ # A base64url encoded SHA256 hash of a one time secret used to validate that the request starts and ends on the same device.
310
+ # The type of this field is nilable +String+.
311
+ # locale::
312
+ # Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
313
+ #
314
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
315
+ #
316
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
317
+ #
318
+ # The type of this field is nilable +LoginOrCreateRequestLocale+ (string enum).
319
+ #
320
+ # == Returns:
321
+ # An object with the following fields:
322
+ # request_id::
323
+ # 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.
324
+ # The type of this field is +String+.
325
+ # user_id::
326
+ # The unique ID of the affected User.
327
+ # The type of this field is +String+.
328
+ # email_id::
329
+ # The unique ID of a specific email address.
330
+ # The type of this field is +String+.
331
+ # user_created::
332
+ # In `login_or_create` endpoints, this field indicates whether or not a User was just created.
333
+ # The type of this field is +Boolean+.
334
+ # status_code::
335
+ # 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.
336
+ # The type of this field is +Integer+.
103
337
  def login_or_create(
104
338
  email:,
105
339
  login_magic_link_url: nil,
106
340
  signup_magic_link_url: nil,
107
341
  login_expiration_minutes: nil,
108
342
  signup_expiration_minutes: nil,
109
- attributes: {},
110
- create_user_as_pending: false,
111
- code_challenge: nil,
112
- locale: nil,
113
343
  login_template_id: nil,
114
- signup_template_id: nil
344
+ signup_template_id: nil,
345
+ attributes: nil,
346
+ create_user_as_pending: nil,
347
+ code_challenge: nil,
348
+ locale: nil
115
349
  )
116
350
  request = {
117
- email: email,
118
- create_user_as_pending: create_user_as_pending
351
+ email: email
119
352
  }
120
-
121
353
  request[:login_magic_link_url] = login_magic_link_url unless login_magic_link_url.nil?
122
354
  request[:signup_magic_link_url] = signup_magic_link_url unless signup_magic_link_url.nil?
123
355
  request[:login_expiration_minutes] = login_expiration_minutes unless login_expiration_minutes.nil?
124
356
  request[:signup_expiration_minutes] = signup_expiration_minutes unless signup_expiration_minutes.nil?
125
- request[:attributes] = attributes if attributes != {}
126
- request[:code_challenge] = code_challenge unless code_challenge.nil?
127
- request[:locale] = locale unless locale.nil?
128
357
  request[:login_template_id] = login_template_id unless login_template_id.nil?
129
358
  request[:signup_template_id] = signup_template_id unless signup_template_id.nil?
359
+ request[:attributes] = attributes unless attributes.nil?
360
+ request[:create_user_as_pending] = create_user_as_pending unless create_user_as_pending.nil?
361
+ request[:code_challenge] = code_challenge unless code_challenge.nil?
362
+ request[:locale] = locale unless locale.nil?
130
363
 
131
- post_request("#{PATH}/login_or_create", request)
364
+ post_request('/v1/magic_links/email/login_or_create', request)
132
365
  end
133
366
 
367
+ # Create a User and send an invite Magic Link to the provided `email`. The User will be created with a `pending` status until they click the Magic Link in the invite email.
368
+ #
369
+ # ### Next steps
370
+ # The User is emailed a Magic Link which redirects them to the provided [redirect URL](https://stytch.com/docs/magic-links#email-magic-links_redirect-routing). Collect the `token` from the URL query parameters and call [Authenticate Magic Link](https://stytch.com/docs/api/authenticate-magic-link) to complete authentication.
371
+ #
372
+ # == Parameters:
373
+ # email::
374
+ # The email address of the User to send the invite Magic Link to.
375
+ # The type of this field is +String+.
376
+ # invite_template_id::
377
+ # Use a custom template for invite emails. By default, it will use your default email template. The template must be a template using our built-in customizations or a custom HTML email for Magic links - Invite.
378
+ # The type of this field is nilable +String+.
379
+ # attributes::
380
+ # Provided attributes help with fraud detection.
381
+ # The type of this field is nilable +Attributes+ (+object+).
382
+ # name::
383
+ # The name of the user. Each field in the name object is optional.
384
+ # The type of this field is nilable +Name+ (+object+).
385
+ # invite_magic_link_url::
386
+ # The URL the end user clicks from the Email Magic Link. This should be a URL that your app receives and parses and subsequently sends an API request to authenticate the Magic Link and log in the User. If this value is not passed, the default invite redirect URL that you set in your Dashboard is used. If you have not set a default sign-up redirect URL, an error is returned.
387
+ # The type of this field is nilable +String+.
388
+ # invite_expiration_minutes::
389
+ # Set the expiration for the email magic link, in minutes. By default, it expires in 1 hour. The minimum expiration is 5 minutes and the maximum is 7 days (10080 mins).
390
+ # The type of this field is nilable +Integer+.
391
+ # locale::
392
+ # Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
393
+ #
394
+ # Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.
395
+ #
396
+ # Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!
397
+ #
398
+ # The type of this field is nilable +InviteRequestLocale+ (string enum).
399
+ #
400
+ # == Returns:
401
+ # An object with the following fields:
402
+ # request_id::
403
+ # 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.
404
+ # The type of this field is +String+.
405
+ # user_id::
406
+ # The unique ID of the affected User.
407
+ # The type of this field is +String+.
408
+ # email_id::
409
+ # The unique ID of a specific email address.
410
+ # The type of this field is +String+.
411
+ # status_code::
412
+ # 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.
413
+ # The type of this field is +Integer+.
134
414
  def invite(
135
415
  email:,
416
+ invite_template_id: nil,
417
+ attributes: nil,
418
+ name: nil,
136
419
  invite_magic_link_url: nil,
137
420
  invite_expiration_minutes: nil,
138
- attributes: {},
139
- name: {},
140
- locale: nil,
141
- invite_template_id: nil
421
+ locale: nil
142
422
  )
143
423
  request = {
144
424
  email: email
145
425
  }
146
-
426
+ request[:invite_template_id] = invite_template_id unless invite_template_id.nil?
427
+ request[:attributes] = attributes unless attributes.nil?
428
+ request[:name] = name unless name.nil?
147
429
  request[:invite_magic_link_url] = invite_magic_link_url unless invite_magic_link_url.nil?
148
430
  request[:invite_expiration_minutes] = invite_expiration_minutes unless invite_expiration_minutes.nil?
149
- request[:attributes] = attributes if attributes != {}
150
- request[:name] = name if name != {}
151
431
  request[:locale] = locale unless locale.nil?
152
- request[:invite_template_id] = invite_template_id unless invite_template_id.nil?
153
432
 
154
- post_request("#{PATH}/invite", request)
433
+ post_request('/v1/magic_links/email/invite', request)
155
434
  end
156
435
 
436
+ # Revoke a pending invite based on the `email` provided.
437
+ #
438
+ # == Parameters:
439
+ # email::
440
+ # The email of the user.
441
+ # The type of this field is +String+.
442
+ #
443
+ # == Returns:
444
+ # An object with the following fields:
445
+ # request_id::
446
+ # 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.
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+.
157
451
  def revoke_invite(
158
452
  email:
159
453
  )
@@ -161,7 +455,7 @@ module Stytch
161
455
  email: email
162
456
  }
163
457
 
164
- post_request("#{PATH}/revoke_invite", request)
458
+ post_request('/v1/magic_links/email/revoke_invite', request)
165
459
  end
166
460
  end
167
461
  end