clerk-sdk-ruby 5.1.2 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clerk/actortokens.rb +11 -3
- data/lib/clerk/agenttasks.rb +335 -0
- data/lib/clerk/allowlistidentifiers.rb +15 -4
- data/lib/clerk/api_keys.rb +35 -9
- data/lib/clerk/betafeatures.rb +11 -3
- data/lib/clerk/billing.rb +43 -11
- data/lib/clerk/blocklistidentifiers.rb +15 -4
- data/lib/clerk/clients.rb +15 -4
- data/lib/clerk/domains.rb +19 -5
- data/lib/clerk/emailaddresses.rb +21 -7
- data/lib/clerk/emailandsmstemplates.rb +7 -2
- data/lib/clerk/emailsmstemplates.rb +19 -5
- data/lib/clerk/instancesettings.rb +299 -8
- data/lib/clerk/invitations.rb +19 -5
- data/lib/clerk/jwks.rb +7 -2
- data/lib/clerk/jwttemplates.rb +23 -6
- data/lib/clerk/m2m.rb +23 -5
- data/lib/clerk/machines.rb +39 -10
- data/lib/clerk/miscellaneous.rb +7 -2
- data/lib/clerk/models/components/action.rb +20 -0
- data/lib/clerk/models/components/action.rbi +11 -0
- data/lib/clerk/models/components/adjustcreditbalancerequest.rb +48 -0
- data/lib/clerk/models/components/adjustcreditbalancerequest.rbi +21 -0
- data/lib/clerk/models/components/agenttask.rb +47 -0
- data/lib/clerk/models/components/agenttask.rbi +19 -0
- data/lib/clerk/models/components/agenttask_object.rb +19 -0
- data/lib/clerk/models/components/agenttask_object.rbi +11 -0
- data/lib/clerk/models/components/balance.rb +44 -0
- data/lib/clerk/models/components/balance.rbi +19 -0
- data/lib/clerk/models/components/billingpaymentattempt.rb +5 -1
- data/lib/clerk/models/components/billingpaymentattempt.rbi +2 -0
- data/lib/clerk/models/components/billingpaymentattempt_credits.rb +40 -0
- data/lib/clerk/models/components/billingpaymentattempt_credits.rbi +17 -0
- data/lib/clerk/models/components/billingpaymentattempt_payer.rb +36 -0
- data/lib/clerk/models/components/billingpaymentattempt_payer.rbi +15 -0
- data/lib/clerk/models/components/billingpaymentattempt_proration.rb +44 -0
- data/lib/clerk/models/components/billingpaymentattempt_proration.rbi +19 -0
- data/lib/clerk/models/components/billingpaymentattempt_totals.rb +52 -0
- data/lib/clerk/models/components/billingpaymentattempt_totals.rbi +23 -0
- data/lib/clerk/models/components/billingpriceresponse.rb +5 -1
- data/lib/clerk/models/components/billingpriceresponse.rbi +2 -0
- data/lib/clerk/models/components/billingstatement.rb +1 -1
- data/lib/clerk/models/components/{totals.rb → billingstatement_totals.rb} +6 -2
- data/lib/clerk/models/components/{totals.rbi → billingstatement_totals.rbi} +4 -2
- data/lib/clerk/models/components/commercecreditbalanceresponse.rb +36 -0
- data/lib/clerk/models/components/commercecreditbalanceresponse.rbi +15 -0
- data/lib/clerk/models/components/commercecreditledgerresponse.rb +64 -0
- data/lib/clerk/models/components/commercecreditledgerresponse.rbi +29 -0
- data/lib/clerk/models/components/commerceperunittotal.rb +40 -0
- data/lib/clerk/models/components/commerceperunittotal.rbi +17 -0
- data/lib/clerk/models/components/commerceperunittotaltier.rb +40 -0
- data/lib/clerk/models/components/commerceperunittotaltier.rbi +17 -0
- data/lib/clerk/models/components/commerceplan.rb +5 -1
- data/lib/clerk/models/components/commerceplan.rbi +2 -0
- data/lib/clerk/models/components/commerceplanunitprice.rb +40 -0
- data/lib/clerk/models/components/commerceplanunitprice.rbi +17 -0
- data/lib/clerk/models/components/commerceplanunitpricetier.rb +40 -0
- data/lib/clerk/models/components/commerceplanunitpricetier.rbi +17 -0
- data/lib/clerk/models/components/commercesubscriptionitem.rb +13 -1
- data/lib/clerk/models/components/commercesubscriptionitem.rbi +6 -0
- data/lib/clerk/models/components/commercesubscriptionitem_credits.rb +40 -0
- data/lib/clerk/models/components/commercesubscriptionitem_credits.rbi +17 -0
- data/lib/clerk/models/components/commercesubscriptionitem_payer.rb +36 -0
- data/lib/clerk/models/components/commercesubscriptionitem_payer.rbi +15 -0
- data/lib/clerk/models/components/commercesubscriptionitem_plan.rb +5 -1
- data/lib/clerk/models/components/commercesubscriptionitem_plan.rbi +2 -0
- data/lib/clerk/models/components/commercesubscriptionitem_proration.rb +44 -0
- data/lib/clerk/models/components/commercesubscriptionitem_proration.rbi +19 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals.rb +52 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals.rbi +23 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals_credits.rb +40 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals_credits.rbi +17 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals_payer.rb +36 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals_payer.rbi +15 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals_proration.rb +44 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals_proration.rbi +19 -0
- data/lib/clerk/models/components/oauthapplicationsettings.rb +40 -0
- data/lib/clerk/models/components/oauthapplicationsettings.rbi +17 -0
- data/lib/clerk/models/components/oauthapplicationsettings_object.rb +19 -0
- data/lib/clerk/models/components/oauthapplicationsettings_object.rbi +11 -0
- data/lib/clerk/models/components/schemas_commercesubscriptionitem.rb +1 -1
- data/lib/clerk/models/components/{payer.rb → schemas_commercesubscriptionitem_payer.rb} +1 -1
- data/lib/clerk/models/components/{payer.rbi → schemas_commercesubscriptionitem_payer.rbi} +2 -2
- data/lib/clerk/models/components/seats.rb +32 -0
- data/lib/clerk/models/components/seats.rbi +13 -0
- data/lib/clerk/models/components.rb +27 -2
- data/lib/clerk/models/operations/adjustorganizationbillingcreditbalance_request.rb +36 -0
- data/lib/clerk/models/operations/adjustorganizationbillingcreditbalance_request.rbi +15 -0
- data/lib/clerk/models/operations/adjustorganizationbillingcreditbalance_response.rb +44 -0
- data/lib/clerk/models/operations/adjustorganizationbillingcreditbalance_response.rbi +19 -0
- data/lib/clerk/models/operations/adjustuserbillingcreditbalance_request.rb +36 -0
- data/lib/clerk/models/operations/adjustuserbillingcreditbalance_request.rbi +15 -0
- data/lib/clerk/models/operations/adjustuserbillingcreditbalance_response.rb +44 -0
- data/lib/clerk/models/operations/adjustuserbillingcreditbalance_response.rbi +19 -0
- data/lib/clerk/models/operations/createagenttask_request.rb +60 -0
- data/lib/clerk/models/operations/createagenttask_request.rbi +23 -0
- data/lib/clerk/models/operations/createagenttask_response.rb +44 -0
- data/lib/clerk/models/operations/createagenttask_response.rbi +19 -0
- data/lib/clerk/models/operations/createm2mtoken_request.rb +5 -1
- data/lib/clerk/models/operations/createm2mtoken_request.rbi +2 -0
- data/lib/clerk/models/operations/getinstanceoauthapplicationsettings_response.rb +44 -0
- data/lib/clerk/models/operations/getinstanceoauthapplicationsettings_response.rbi +19 -0
- data/lib/clerk/models/operations/getorganizationbillingcreditbalance_request.rb +32 -0
- data/lib/clerk/models/operations/getorganizationbillingcreditbalance_request.rbi +13 -0
- data/lib/clerk/models/operations/getorganizationbillingcreditbalance_response.rb +44 -0
- data/lib/clerk/models/operations/getorganizationbillingcreditbalance_response.rbi +19 -0
- data/lib/clerk/models/operations/getuserbillingcreditbalance_request.rb +32 -0
- data/lib/clerk/models/operations/getuserbillingcreditbalance_request.rbi +13 -0
- data/lib/clerk/models/operations/getuserbillingcreditbalance_response.rb +44 -0
- data/lib/clerk/models/operations/getuserbillingcreditbalance_response.rbi +19 -0
- data/lib/clerk/models/operations/listinstanceorganizationinvitations_status.rb +1 -0
- data/lib/clerk/models/operations/listorganizationinvitations_status.rb +1 -0
- data/lib/clerk/models/operations/on_behalf_of.rb +37 -0
- data/lib/clerk/models/operations/on_behalf_of.rbi +15 -0
- data/lib/clerk/models/operations/permissions.rb +19 -0
- data/lib/clerk/models/operations/permissions.rbi +11 -0
- data/lib/clerk/models/operations/revokeagenttask_request.rb +32 -0
- data/lib/clerk/models/operations/revokeagenttask_request.rbi +13 -0
- data/lib/clerk/models/operations/revokeagenttask_response.rb +44 -0
- data/lib/clerk/models/operations/revokeagenttask_response.rbi +19 -0
- data/lib/clerk/models/operations/token_format.rb +20 -0
- data/lib/clerk/models/operations/token_format.rbi +11 -0
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rb +36 -0
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rbi +15 -0
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_response.rb +44 -0
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_response.rbi +19 -0
- data/lib/clerk/models/operations/usersgetorganizationinvitations_status.rb +1 -0
- data/lib/clerk/models/operations.rb +18 -0
- data/lib/clerk/oauthaccesstokens.rb +7 -2
- data/lib/clerk/oauthapplications.rb +27 -7
- data/lib/clerk/openapiclient.rb +4 -2
- data/lib/clerk/organizationdomains.rb +23 -6
- data/lib/clerk/organizationinvitations.rb +32 -9
- data/lib/clerk/organizationmemberships.rb +23 -6
- data/lib/clerk/organizationpermissions.rb +23 -6
- data/lib/clerk/organizationroles.rb +31 -8
- data/lib/clerk/organizations.rb +374 -11
- data/lib/clerk/phonenumbers.rb +19 -5
- data/lib/clerk/proxychecks.rb +7 -2
- data/lib/clerk/redirecturls.rb +19 -5
- data/lib/clerk/rolesets.rb +31 -8
- data/lib/clerk/samlconnections.rb +23 -6
- data/lib/clerk/sdkconfiguration.rb +3 -3
- data/lib/clerk/sessions.rb +35 -9
- data/lib/clerk/signintokens.rb +11 -3
- data/lib/clerk/signups.rb +11 -3
- data/lib/clerk/templates.rb +7 -2
- data/lib/clerk/testingtokens.rb +7 -2
- data/lib/clerk/users.rb +458 -32
- data/lib/clerk/waitlistentries.rb +27 -7
- data/lib/clerk/webhooks.rb +15 -4
- data/lib/clerk_sdk_ruby.rb +1 -0
- data/lib/crystalline/types.rb +11 -3
- metadata +107 -6
data/lib/clerk/users.rb
CHANGED
|
@@ -38,8 +38,10 @@ module Clerk
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
|
|
42
|
+
|
|
41
43
|
|
|
42
|
-
def list(request:, retries: nil, timeout_ms: nil)
|
|
44
|
+
def list(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
43
45
|
# list - List all users
|
|
44
46
|
# Returns a list of all users.
|
|
45
47
|
# The users are returned sorted by creation date, with the newest users appearing first.
|
|
@@ -92,6 +94,9 @@ module Clerk
|
|
|
92
94
|
req.options.timeout = timeout unless timeout.nil?
|
|
93
95
|
req.params = query_params
|
|
94
96
|
Utils.configure_request_security(req, security)
|
|
97
|
+
http_headers&.each do |key, value|
|
|
98
|
+
req.headers[key.to_s] = value
|
|
99
|
+
end
|
|
95
100
|
|
|
96
101
|
@sdk_configuration.hooks.before_request(
|
|
97
102
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -175,7 +180,7 @@ module Clerk
|
|
|
175
180
|
|
|
176
181
|
|
|
177
182
|
|
|
178
|
-
def create(request:, retries: nil, timeout_ms: nil)
|
|
183
|
+
def create(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
179
184
|
# create - Create a new user
|
|
180
185
|
# Creates a new user. Your user management settings determine how you should setup your user model.
|
|
181
186
|
#
|
|
@@ -243,6 +248,9 @@ module Clerk
|
|
|
243
248
|
req.headers.merge!(headers)
|
|
244
249
|
req.options.timeout = timeout unless timeout.nil?
|
|
245
250
|
Utils.configure_request_security(req, security)
|
|
251
|
+
http_headers&.each do |key, value|
|
|
252
|
+
req.headers[key.to_s] = value
|
|
253
|
+
end
|
|
246
254
|
|
|
247
255
|
@sdk_configuration.hooks.before_request(
|
|
248
256
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -326,7 +334,7 @@ module Clerk
|
|
|
326
334
|
|
|
327
335
|
|
|
328
336
|
|
|
329
|
-
def count(request:, retries: nil, timeout_ms: nil)
|
|
337
|
+
def count(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
330
338
|
# count - Count users
|
|
331
339
|
# Returns a total count of all users that match the given filtering criteria.
|
|
332
340
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -378,6 +386,9 @@ module Clerk
|
|
|
378
386
|
req.options.timeout = timeout unless timeout.nil?
|
|
379
387
|
req.params = query_params
|
|
380
388
|
Utils.configure_request_security(req, security)
|
|
389
|
+
http_headers&.each do |key, value|
|
|
390
|
+
req.headers[key.to_s] = value
|
|
391
|
+
end
|
|
381
392
|
|
|
382
393
|
@sdk_configuration.hooks.before_request(
|
|
383
394
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -461,7 +472,7 @@ module Clerk
|
|
|
461
472
|
|
|
462
473
|
|
|
463
474
|
|
|
464
|
-
def get(user_id:, retries: nil, timeout_ms: nil)
|
|
475
|
+
def get(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
465
476
|
# get - Retrieve a user
|
|
466
477
|
# Retrieve the details of a user
|
|
467
478
|
request = Models::Operations::GetUserRequest.new(
|
|
@@ -519,6 +530,9 @@ module Clerk
|
|
|
519
530
|
req.headers.merge!(headers)
|
|
520
531
|
req.options.timeout = timeout unless timeout.nil?
|
|
521
532
|
Utils.configure_request_security(req, security)
|
|
533
|
+
http_headers&.each do |key, value|
|
|
534
|
+
req.headers[key.to_s] = value
|
|
535
|
+
end
|
|
522
536
|
|
|
523
537
|
@sdk_configuration.hooks.before_request(
|
|
524
538
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -602,7 +616,7 @@ module Clerk
|
|
|
602
616
|
|
|
603
617
|
|
|
604
618
|
|
|
605
|
-
def update(body:, user_id:, retries: nil, timeout_ms: nil)
|
|
619
|
+
def update(body:, user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
606
620
|
# update - Update a user
|
|
607
621
|
# Update a user's attributes.
|
|
608
622
|
#
|
|
@@ -684,6 +698,9 @@ module Clerk
|
|
|
684
698
|
req.headers.merge!(headers)
|
|
685
699
|
req.options.timeout = timeout unless timeout.nil?
|
|
686
700
|
Utils.configure_request_security(req, security)
|
|
701
|
+
http_headers&.each do |key, value|
|
|
702
|
+
req.headers[key.to_s] = value
|
|
703
|
+
end
|
|
687
704
|
|
|
688
705
|
@sdk_configuration.hooks.before_request(
|
|
689
706
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -740,7 +757,7 @@ module Clerk
|
|
|
740
757
|
else
|
|
741
758
|
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
742
759
|
end
|
|
743
|
-
elsif Utils.match_status_code(http_response.status, ['400', '401', '404', '422'])
|
|
760
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '404', '409', '422'])
|
|
744
761
|
if Utils.match_content_type(content_type, 'application/json')
|
|
745
762
|
http_response = @sdk_configuration.hooks.after_success(
|
|
746
763
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
@@ -767,7 +784,7 @@ module Clerk
|
|
|
767
784
|
|
|
768
785
|
|
|
769
786
|
|
|
770
|
-
def delete(user_id:, retries: nil, timeout_ms: nil)
|
|
787
|
+
def delete(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
771
788
|
# delete - Delete a user
|
|
772
789
|
# Delete the specified user
|
|
773
790
|
request = Models::Operations::DeleteUserRequest.new(
|
|
@@ -825,6 +842,9 @@ module Clerk
|
|
|
825
842
|
req.headers.merge!(headers)
|
|
826
843
|
req.options.timeout = timeout unless timeout.nil?
|
|
827
844
|
Utils.configure_request_security(req, security)
|
|
845
|
+
http_headers&.each do |key, value|
|
|
846
|
+
req.headers[key.to_s] = value
|
|
847
|
+
end
|
|
828
848
|
|
|
829
849
|
@sdk_configuration.hooks.before_request(
|
|
830
850
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -908,7 +928,7 @@ module Clerk
|
|
|
908
928
|
|
|
909
929
|
|
|
910
930
|
|
|
911
|
-
def ban(user_id:, retries: nil, timeout_ms: nil)
|
|
931
|
+
def ban(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
912
932
|
# ban - Ban a user
|
|
913
933
|
# Marks the given user as banned, which means that all their sessions are revoked and they are not allowed to sign in again.
|
|
914
934
|
request = Models::Operations::BanUserRequest.new(
|
|
@@ -966,6 +986,9 @@ module Clerk
|
|
|
966
986
|
req.headers.merge!(headers)
|
|
967
987
|
req.options.timeout = timeout unless timeout.nil?
|
|
968
988
|
Utils.configure_request_security(req, security)
|
|
989
|
+
http_headers&.each do |key, value|
|
|
990
|
+
req.headers[key.to_s] = value
|
|
991
|
+
end
|
|
969
992
|
|
|
970
993
|
@sdk_configuration.hooks.before_request(
|
|
971
994
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1049,7 +1072,7 @@ module Clerk
|
|
|
1049
1072
|
|
|
1050
1073
|
|
|
1051
1074
|
|
|
1052
|
-
def unban(user_id:, retries: nil, timeout_ms: nil)
|
|
1075
|
+
def unban(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1053
1076
|
# unban - Unban a user
|
|
1054
1077
|
# Removes the ban mark from the given user.
|
|
1055
1078
|
request = Models::Operations::UnbanUserRequest.new(
|
|
@@ -1107,6 +1130,9 @@ module Clerk
|
|
|
1107
1130
|
req.headers.merge!(headers)
|
|
1108
1131
|
req.options.timeout = timeout unless timeout.nil?
|
|
1109
1132
|
Utils.configure_request_security(req, security)
|
|
1133
|
+
http_headers&.each do |key, value|
|
|
1134
|
+
req.headers[key.to_s] = value
|
|
1135
|
+
end
|
|
1110
1136
|
|
|
1111
1137
|
@sdk_configuration.hooks.before_request(
|
|
1112
1138
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1190,7 +1216,7 @@ module Clerk
|
|
|
1190
1216
|
|
|
1191
1217
|
|
|
1192
1218
|
|
|
1193
|
-
def bulk_ban(request:, retries: nil, timeout_ms: nil)
|
|
1219
|
+
def bulk_ban(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1194
1220
|
# bulk_ban - Ban multiple users
|
|
1195
1221
|
# Marks multiple users as banned, which means that all their sessions are revoked and they are not allowed to sign in again.
|
|
1196
1222
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -1252,6 +1278,9 @@ module Clerk
|
|
|
1252
1278
|
req.headers.merge!(headers)
|
|
1253
1279
|
req.options.timeout = timeout unless timeout.nil?
|
|
1254
1280
|
Utils.configure_request_security(req, security)
|
|
1281
|
+
http_headers&.each do |key, value|
|
|
1282
|
+
req.headers[key.to_s] = value
|
|
1283
|
+
end
|
|
1255
1284
|
|
|
1256
1285
|
@sdk_configuration.hooks.before_request(
|
|
1257
1286
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1335,7 +1364,7 @@ module Clerk
|
|
|
1335
1364
|
|
|
1336
1365
|
|
|
1337
1366
|
|
|
1338
|
-
def bulk_unban(request:, retries: nil, timeout_ms: nil)
|
|
1367
|
+
def bulk_unban(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1339
1368
|
# bulk_unban - Unban multiple users
|
|
1340
1369
|
# Removes the ban mark from multiple users.
|
|
1341
1370
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -1397,6 +1426,9 @@ module Clerk
|
|
|
1397
1426
|
req.headers.merge!(headers)
|
|
1398
1427
|
req.options.timeout = timeout unless timeout.nil?
|
|
1399
1428
|
Utils.configure_request_security(req, security)
|
|
1429
|
+
http_headers&.each do |key, value|
|
|
1430
|
+
req.headers[key.to_s] = value
|
|
1431
|
+
end
|
|
1400
1432
|
|
|
1401
1433
|
@sdk_configuration.hooks.before_request(
|
|
1402
1434
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1480,7 +1512,7 @@ module Clerk
|
|
|
1480
1512
|
|
|
1481
1513
|
|
|
1482
1514
|
|
|
1483
|
-
def lock(user_id:, retries: nil, timeout_ms: nil)
|
|
1515
|
+
def lock(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1484
1516
|
# lock - Lock a user
|
|
1485
1517
|
# Marks the given user as locked, which means they are not allowed to sign in again until the lock expires.
|
|
1486
1518
|
# Lock duration can be configured in the instance's restrictions settings.
|
|
@@ -1539,6 +1571,9 @@ module Clerk
|
|
|
1539
1571
|
req.headers.merge!(headers)
|
|
1540
1572
|
req.options.timeout = timeout unless timeout.nil?
|
|
1541
1573
|
Utils.configure_request_security(req, security)
|
|
1574
|
+
http_headers&.each do |key, value|
|
|
1575
|
+
req.headers[key.to_s] = value
|
|
1576
|
+
end
|
|
1542
1577
|
|
|
1543
1578
|
@sdk_configuration.hooks.before_request(
|
|
1544
1579
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1622,7 +1657,7 @@ module Clerk
|
|
|
1622
1657
|
|
|
1623
1658
|
|
|
1624
1659
|
|
|
1625
|
-
def unlock(user_id:, retries: nil, timeout_ms: nil)
|
|
1660
|
+
def unlock(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1626
1661
|
# unlock - Unlock a user
|
|
1627
1662
|
# Removes the lock from the given user.
|
|
1628
1663
|
request = Models::Operations::UnlockUserRequest.new(
|
|
@@ -1680,6 +1715,9 @@ module Clerk
|
|
|
1680
1715
|
req.headers.merge!(headers)
|
|
1681
1716
|
req.options.timeout = timeout unless timeout.nil?
|
|
1682
1717
|
Utils.configure_request_security(req, security)
|
|
1718
|
+
http_headers&.each do |key, value|
|
|
1719
|
+
req.headers[key.to_s] = value
|
|
1720
|
+
end
|
|
1683
1721
|
|
|
1684
1722
|
@sdk_configuration.hooks.before_request(
|
|
1685
1723
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1763,7 +1801,7 @@ module Clerk
|
|
|
1763
1801
|
|
|
1764
1802
|
|
|
1765
1803
|
|
|
1766
|
-
def set_profile_image(body:, user_id:, retries: nil, timeout_ms: nil)
|
|
1804
|
+
def set_profile_image(body:, user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1767
1805
|
# set_profile_image - Set user profile image
|
|
1768
1806
|
# Update a user's profile image
|
|
1769
1807
|
request = Models::Operations::SetUserProfileImageRequest.new(
|
|
@@ -1834,6 +1872,9 @@ module Clerk
|
|
|
1834
1872
|
req.headers.merge!(headers)
|
|
1835
1873
|
req.options.timeout = timeout unless timeout.nil?
|
|
1836
1874
|
Utils.configure_request_security(req, security)
|
|
1875
|
+
http_headers&.each do |key, value|
|
|
1876
|
+
req.headers[key.to_s] = value
|
|
1877
|
+
end
|
|
1837
1878
|
|
|
1838
1879
|
@sdk_configuration.hooks.before_request(
|
|
1839
1880
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -1917,7 +1958,7 @@ module Clerk
|
|
|
1917
1958
|
|
|
1918
1959
|
|
|
1919
1960
|
|
|
1920
|
-
def delete_profile_image(user_id:, retries: nil, timeout_ms: nil)
|
|
1961
|
+
def delete_profile_image(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1921
1962
|
# delete_profile_image - Delete user profile image
|
|
1922
1963
|
# Delete a user's profile image
|
|
1923
1964
|
request = Models::Operations::DeleteUserProfileImageRequest.new(
|
|
@@ -1975,6 +2016,9 @@ module Clerk
|
|
|
1975
2016
|
req.headers.merge!(headers)
|
|
1976
2017
|
req.options.timeout = timeout unless timeout.nil?
|
|
1977
2018
|
Utils.configure_request_security(req, security)
|
|
2019
|
+
http_headers&.each do |key, value|
|
|
2020
|
+
req.headers[key.to_s] = value
|
|
2021
|
+
end
|
|
1978
2022
|
|
|
1979
2023
|
@sdk_configuration.hooks.before_request(
|
|
1980
2024
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2058,7 +2102,7 @@ module Clerk
|
|
|
2058
2102
|
|
|
2059
2103
|
|
|
2060
2104
|
|
|
2061
|
-
def update_metadata(user_id:, body: nil, retries: nil, timeout_ms: nil)
|
|
2105
|
+
def update_metadata(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2062
2106
|
# update_metadata - Merge and update a user's metadata
|
|
2063
2107
|
# Update a user's metadata attributes by merging existing values with the provided parameters.
|
|
2064
2108
|
#
|
|
@@ -2135,6 +2179,9 @@ module Clerk
|
|
|
2135
2179
|
req.headers.merge!(headers)
|
|
2136
2180
|
req.options.timeout = timeout unless timeout.nil?
|
|
2137
2181
|
Utils.configure_request_security(req, security)
|
|
2182
|
+
http_headers&.each do |key, value|
|
|
2183
|
+
req.headers[key.to_s] = value
|
|
2184
|
+
end
|
|
2138
2185
|
|
|
2139
2186
|
@sdk_configuration.hooks.before_request(
|
|
2140
2187
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2218,7 +2265,7 @@ module Clerk
|
|
|
2218
2265
|
|
|
2219
2266
|
|
|
2220
2267
|
|
|
2221
|
-
def get_billing_subscription(user_id:, retries: nil, timeout_ms: nil)
|
|
2268
|
+
def get_billing_subscription(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2222
2269
|
# get_billing_subscription - Retrieve a user's billing subscription
|
|
2223
2270
|
# Retrieves the billing subscription for the specified user.
|
|
2224
2271
|
# This includes subscription details, active plans, billing information, and payment status.
|
|
@@ -2278,6 +2325,9 @@ module Clerk
|
|
|
2278
2325
|
req.headers.merge!(headers)
|
|
2279
2326
|
req.options.timeout = timeout unless timeout.nil?
|
|
2280
2327
|
Utils.configure_request_security(req, security)
|
|
2328
|
+
http_headers&.each do |key, value|
|
|
2329
|
+
req.headers[key.to_s] = value
|
|
2330
|
+
end
|
|
2281
2331
|
|
|
2282
2332
|
@sdk_configuration.hooks.before_request(
|
|
2283
2333
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2376,7 +2426,341 @@ module Clerk
|
|
|
2376
2426
|
|
|
2377
2427
|
|
|
2378
2428
|
|
|
2379
|
-
def
|
|
2429
|
+
def get_billing_credit_balance(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2430
|
+
# get_billing_credit_balance - Retrieve a user's credit balance
|
|
2431
|
+
# Retrieves the current credit balance for the specified user.
|
|
2432
|
+
# Credits can be applied during checkout to reduce the charge or automatically applied to upcoming recurring charges
|
|
2433
|
+
request = Models::Operations::GetUserBillingCreditBalanceRequest.new(
|
|
2434
|
+
user_id: user_id
|
|
2435
|
+
)
|
|
2436
|
+
url, params = @sdk_configuration.get_server_details
|
|
2437
|
+
base_url = Utils.template_url(url, params)
|
|
2438
|
+
url = Utils.generate_url(
|
|
2439
|
+
Models::Operations::GetUserBillingCreditBalanceRequest,
|
|
2440
|
+
base_url,
|
|
2441
|
+
'/users/{user_id}/billing/credits',
|
|
2442
|
+
request
|
|
2443
|
+
)
|
|
2444
|
+
headers = {}
|
|
2445
|
+
|
|
2446
|
+
headers['Accept'] = 'application/json'
|
|
2447
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
2448
|
+
retries ||= @sdk_configuration.retry_config
|
|
2449
|
+
retries ||= Utils::RetryConfig.new(
|
|
2450
|
+
backoff: Utils::BackoffStrategy.new(
|
|
2451
|
+
exponent: 1.5,
|
|
2452
|
+
initial_interval: 500,
|
|
2453
|
+
max_elapsed_time: 3_600_000,
|
|
2454
|
+
max_interval: 60_000
|
|
2455
|
+
),
|
|
2456
|
+
retry_connection_errors: true,
|
|
2457
|
+
strategy: 'backoff'
|
|
2458
|
+
)
|
|
2459
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
2460
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
2461
|
+
|
|
2462
|
+
security = @sdk_configuration.security_source&.call
|
|
2463
|
+
|
|
2464
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
2465
|
+
timeout ||= @sdk_configuration.timeout
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
connection = @sdk_configuration.client.dup
|
|
2469
|
+
connection.request :retry, retry_options
|
|
2470
|
+
|
|
2471
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
2472
|
+
config: @sdk_configuration,
|
|
2473
|
+
base_url: base_url,
|
|
2474
|
+
oauth2_scopes: nil,
|
|
2475
|
+
operation_id: 'GetUserBillingCreditBalance',
|
|
2476
|
+
security_source: @sdk_configuration.security_source
|
|
2477
|
+
)
|
|
2478
|
+
|
|
2479
|
+
error = nil
|
|
2480
|
+
http_response = nil
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
begin
|
|
2484
|
+
http_response = connection.get(url) do |req|
|
|
2485
|
+
req.headers.merge!(headers)
|
|
2486
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
2487
|
+
Utils.configure_request_security(req, security)
|
|
2488
|
+
http_headers&.each do |key, value|
|
|
2489
|
+
req.headers[key.to_s] = value
|
|
2490
|
+
end
|
|
2491
|
+
|
|
2492
|
+
@sdk_configuration.hooks.before_request(
|
|
2493
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
2494
|
+
hook_ctx: hook_ctx
|
|
2495
|
+
),
|
|
2496
|
+
request: req
|
|
2497
|
+
)
|
|
2498
|
+
end
|
|
2499
|
+
rescue StandardError => e
|
|
2500
|
+
error = e
|
|
2501
|
+
ensure
|
|
2502
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
2503
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
2504
|
+
error: error,
|
|
2505
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
2506
|
+
hook_ctx: hook_ctx
|
|
2507
|
+
),
|
|
2508
|
+
response: http_response
|
|
2509
|
+
)
|
|
2510
|
+
else
|
|
2511
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2512
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2513
|
+
hook_ctx: hook_ctx
|
|
2514
|
+
),
|
|
2515
|
+
response: http_response
|
|
2516
|
+
)
|
|
2517
|
+
end
|
|
2518
|
+
|
|
2519
|
+
if http_response.nil?
|
|
2520
|
+
raise error if !error.nil?
|
|
2521
|
+
raise 'no response'
|
|
2522
|
+
end
|
|
2523
|
+
end
|
|
2524
|
+
|
|
2525
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
2526
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
2527
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
2528
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2529
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2530
|
+
hook_ctx: hook_ctx
|
|
2531
|
+
),
|
|
2532
|
+
response: http_response
|
|
2533
|
+
)
|
|
2534
|
+
response_data = http_response.env.response_body
|
|
2535
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::CommerceCreditBalanceResponse)
|
|
2536
|
+
response = Models::Operations::GetUserBillingCreditBalanceResponse.new(
|
|
2537
|
+
status_code: http_response.status,
|
|
2538
|
+
content_type: content_type,
|
|
2539
|
+
raw_response: http_response,
|
|
2540
|
+
commerce_credit_balance_response: obj
|
|
2541
|
+
)
|
|
2542
|
+
|
|
2543
|
+
return response
|
|
2544
|
+
else
|
|
2545
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
2546
|
+
end
|
|
2547
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '403', '404', '422'])
|
|
2548
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
2549
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2550
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2551
|
+
hook_ctx: hook_ctx
|
|
2552
|
+
),
|
|
2553
|
+
response: http_response
|
|
2554
|
+
)
|
|
2555
|
+
response_data = http_response.env.response_body
|
|
2556
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
2557
|
+
obj.raw_response = http_response
|
|
2558
|
+
raise obj
|
|
2559
|
+
else
|
|
2560
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
2561
|
+
end
|
|
2562
|
+
elsif Utils.match_status_code(http_response.status, ['500'])
|
|
2563
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
2564
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2565
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2566
|
+
hook_ctx: hook_ctx
|
|
2567
|
+
),
|
|
2568
|
+
response: http_response
|
|
2569
|
+
)
|
|
2570
|
+
response_data = http_response.env.response_body
|
|
2571
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
2572
|
+
obj.raw_response = http_response
|
|
2573
|
+
raise obj
|
|
2574
|
+
else
|
|
2575
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
2576
|
+
end
|
|
2577
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
2578
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
2579
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
2580
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
2581
|
+
else
|
|
2582
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
2583
|
+
|
|
2584
|
+
end
|
|
2585
|
+
end
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
|
|
2589
|
+
def adjust_billing_credit_balance(body:, user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2590
|
+
# adjust_billing_credit_balance - Adjust a user's credit balance
|
|
2591
|
+
# Increases or decreases the credit balance for the specified user.
|
|
2592
|
+
# Each adjustment is recorded as a ledger entry. The idempotency_key parameter
|
|
2593
|
+
# ensures that duplicate requests are safely handled.
|
|
2594
|
+
request = Models::Operations::AdjustUserBillingCreditBalanceRequest.new(
|
|
2595
|
+
user_id: user_id,
|
|
2596
|
+
body: body
|
|
2597
|
+
)
|
|
2598
|
+
url, params = @sdk_configuration.get_server_details
|
|
2599
|
+
base_url = Utils.template_url(url, params)
|
|
2600
|
+
url = Utils.generate_url(
|
|
2601
|
+
Models::Operations::AdjustUserBillingCreditBalanceRequest,
|
|
2602
|
+
base_url,
|
|
2603
|
+
'/users/{user_id}/billing/credits',
|
|
2604
|
+
request
|
|
2605
|
+
)
|
|
2606
|
+
headers = {}
|
|
2607
|
+
|
|
2608
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
2609
|
+
headers['content-type'] = req_content_type
|
|
2610
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
2611
|
+
|
|
2612
|
+
if form && !form.empty?
|
|
2613
|
+
body = Utils.encode_form(form)
|
|
2614
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
2615
|
+
body = URI.encode_www_form(data)
|
|
2616
|
+
else
|
|
2617
|
+
body = data
|
|
2618
|
+
end
|
|
2619
|
+
headers['Accept'] = 'application/json'
|
|
2620
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
2621
|
+
retries ||= @sdk_configuration.retry_config
|
|
2622
|
+
retries ||= Utils::RetryConfig.new(
|
|
2623
|
+
backoff: Utils::BackoffStrategy.new(
|
|
2624
|
+
exponent: 1.5,
|
|
2625
|
+
initial_interval: 500,
|
|
2626
|
+
max_elapsed_time: 3_600_000,
|
|
2627
|
+
max_interval: 60_000
|
|
2628
|
+
),
|
|
2629
|
+
retry_connection_errors: true,
|
|
2630
|
+
strategy: 'backoff'
|
|
2631
|
+
)
|
|
2632
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
2633
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
2634
|
+
|
|
2635
|
+
security = @sdk_configuration.security_source&.call
|
|
2636
|
+
|
|
2637
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
2638
|
+
timeout ||= @sdk_configuration.timeout
|
|
2639
|
+
|
|
2640
|
+
|
|
2641
|
+
connection = @sdk_configuration.client.dup
|
|
2642
|
+
connection.request :retry, retry_options
|
|
2643
|
+
|
|
2644
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
2645
|
+
config: @sdk_configuration,
|
|
2646
|
+
base_url: base_url,
|
|
2647
|
+
oauth2_scopes: nil,
|
|
2648
|
+
operation_id: 'AdjustUserBillingCreditBalance',
|
|
2649
|
+
security_source: @sdk_configuration.security_source
|
|
2650
|
+
)
|
|
2651
|
+
|
|
2652
|
+
error = nil
|
|
2653
|
+
http_response = nil
|
|
2654
|
+
|
|
2655
|
+
|
|
2656
|
+
begin
|
|
2657
|
+
http_response = connection.post(url) do |req|
|
|
2658
|
+
req.body = body
|
|
2659
|
+
req.headers.merge!(headers)
|
|
2660
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
2661
|
+
Utils.configure_request_security(req, security)
|
|
2662
|
+
http_headers&.each do |key, value|
|
|
2663
|
+
req.headers[key.to_s] = value
|
|
2664
|
+
end
|
|
2665
|
+
|
|
2666
|
+
@sdk_configuration.hooks.before_request(
|
|
2667
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
2668
|
+
hook_ctx: hook_ctx
|
|
2669
|
+
),
|
|
2670
|
+
request: req
|
|
2671
|
+
)
|
|
2672
|
+
end
|
|
2673
|
+
rescue StandardError => e
|
|
2674
|
+
error = e
|
|
2675
|
+
ensure
|
|
2676
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
2677
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
2678
|
+
error: error,
|
|
2679
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
2680
|
+
hook_ctx: hook_ctx
|
|
2681
|
+
),
|
|
2682
|
+
response: http_response
|
|
2683
|
+
)
|
|
2684
|
+
else
|
|
2685
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2686
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2687
|
+
hook_ctx: hook_ctx
|
|
2688
|
+
),
|
|
2689
|
+
response: http_response
|
|
2690
|
+
)
|
|
2691
|
+
end
|
|
2692
|
+
|
|
2693
|
+
if http_response.nil?
|
|
2694
|
+
raise error if !error.nil?
|
|
2695
|
+
raise 'no response'
|
|
2696
|
+
end
|
|
2697
|
+
end
|
|
2698
|
+
|
|
2699
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
2700
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
2701
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
2702
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2703
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2704
|
+
hook_ctx: hook_ctx
|
|
2705
|
+
),
|
|
2706
|
+
response: http_response
|
|
2707
|
+
)
|
|
2708
|
+
response_data = http_response.env.response_body
|
|
2709
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::CommerceCreditLedgerResponse)
|
|
2710
|
+
response = Models::Operations::AdjustUserBillingCreditBalanceResponse.new(
|
|
2711
|
+
status_code: http_response.status,
|
|
2712
|
+
content_type: content_type,
|
|
2713
|
+
raw_response: http_response,
|
|
2714
|
+
commerce_credit_ledger_response: obj
|
|
2715
|
+
)
|
|
2716
|
+
|
|
2717
|
+
return response
|
|
2718
|
+
else
|
|
2719
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
2720
|
+
end
|
|
2721
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '403', '404', '409', '422'])
|
|
2722
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
2723
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2724
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2725
|
+
hook_ctx: hook_ctx
|
|
2726
|
+
),
|
|
2727
|
+
response: http_response
|
|
2728
|
+
)
|
|
2729
|
+
response_data = http_response.env.response_body
|
|
2730
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
2731
|
+
obj.raw_response = http_response
|
|
2732
|
+
raise obj
|
|
2733
|
+
else
|
|
2734
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
2735
|
+
end
|
|
2736
|
+
elsif Utils.match_status_code(http_response.status, ['500'])
|
|
2737
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
2738
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
2739
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
2740
|
+
hook_ctx: hook_ctx
|
|
2741
|
+
),
|
|
2742
|
+
response: http_response
|
|
2743
|
+
)
|
|
2744
|
+
response_data = http_response.env.response_body
|
|
2745
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
2746
|
+
obj.raw_response = http_response
|
|
2747
|
+
raise obj
|
|
2748
|
+
else
|
|
2749
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
2750
|
+
end
|
|
2751
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
2752
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
2753
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
2754
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
2755
|
+
else
|
|
2756
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
2757
|
+
|
|
2758
|
+
end
|
|
2759
|
+
end
|
|
2760
|
+
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
def get_o_auth_access_token(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2380
2764
|
# get_o_auth_access_token - Retrieve the OAuth access token of a user
|
|
2381
2765
|
# Fetch the corresponding OAuth access token for a user that has previously authenticated with a particular OAuth provider.
|
|
2382
2766
|
# For OAuth 2.0, if the access token has expired and we have a corresponding refresh token, the access token will be refreshed transparently the new one will be returned.
|
|
@@ -2434,6 +2818,9 @@ module Clerk
|
|
|
2434
2818
|
req.options.timeout = timeout unless timeout.nil?
|
|
2435
2819
|
req.params = query_params
|
|
2436
2820
|
Utils.configure_request_security(req, security)
|
|
2821
|
+
http_headers&.each do |key, value|
|
|
2822
|
+
req.headers[key.to_s] = value
|
|
2823
|
+
end
|
|
2437
2824
|
|
|
2438
2825
|
@sdk_configuration.hooks.before_request(
|
|
2439
2826
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2517,7 +2904,7 @@ module Clerk
|
|
|
2517
2904
|
|
|
2518
2905
|
|
|
2519
2906
|
|
|
2520
|
-
def get_organization_memberships(user_id:, limit: nil, offset: nil, retries: nil, timeout_ms: nil)
|
|
2907
|
+
def get_organization_memberships(user_id:, limit: nil, offset: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2521
2908
|
# get_organization_memberships - Retrieve all memberships for a user
|
|
2522
2909
|
# Retrieve a paginated list of the user's organization memberships
|
|
2523
2910
|
request = Models::Operations::UsersGetOrganizationMembershipsRequest.new(
|
|
@@ -2579,6 +2966,9 @@ module Clerk
|
|
|
2579
2966
|
req.options.timeout = timeout unless timeout.nil?
|
|
2580
2967
|
req.params = query_params
|
|
2581
2968
|
Utils.configure_request_security(req, security)
|
|
2969
|
+
http_headers&.each do |key, value|
|
|
2970
|
+
req.headers[key.to_s] = value
|
|
2971
|
+
end
|
|
2582
2972
|
|
|
2583
2973
|
@sdk_configuration.hooks.before_request(
|
|
2584
2974
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2662,7 +3052,7 @@ module Clerk
|
|
|
2662
3052
|
|
|
2663
3053
|
|
|
2664
3054
|
|
|
2665
|
-
def get_organization_invitations(user_id:, limit: nil, offset: nil, status: nil, retries: nil, timeout_ms: nil)
|
|
3055
|
+
def get_organization_invitations(user_id:, limit: nil, offset: nil, status: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2666
3056
|
# get_organization_invitations - Retrieve all invitations for a user
|
|
2667
3057
|
# Retrieve a paginated list of the user's organization invitations
|
|
2668
3058
|
request = Models::Operations::UsersGetOrganizationInvitationsRequest.new(
|
|
@@ -2725,6 +3115,9 @@ module Clerk
|
|
|
2725
3115
|
req.options.timeout = timeout unless timeout.nil?
|
|
2726
3116
|
req.params = query_params
|
|
2727
3117
|
Utils.configure_request_security(req, security)
|
|
3118
|
+
http_headers&.each do |key, value|
|
|
3119
|
+
req.headers[key.to_s] = value
|
|
3120
|
+
end
|
|
2728
3121
|
|
|
2729
3122
|
@sdk_configuration.hooks.before_request(
|
|
2730
3123
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2808,7 +3201,7 @@ module Clerk
|
|
|
2808
3201
|
|
|
2809
3202
|
|
|
2810
3203
|
|
|
2811
|
-
def verify_password(user_id:, body: nil, retries: nil, timeout_ms: nil)
|
|
3204
|
+
def verify_password(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2812
3205
|
# verify_password - Verify the password of a user
|
|
2813
3206
|
# Check that the user's password matches the supplied input.
|
|
2814
3207
|
# Useful for custom auth flows and re-verification.
|
|
@@ -2879,6 +3272,9 @@ module Clerk
|
|
|
2879
3272
|
req.headers.merge!(headers)
|
|
2880
3273
|
req.options.timeout = timeout unless timeout.nil?
|
|
2881
3274
|
Utils.configure_request_security(req, security)
|
|
3275
|
+
http_headers&.each do |key, value|
|
|
3276
|
+
req.headers[key.to_s] = value
|
|
3277
|
+
end
|
|
2882
3278
|
|
|
2883
3279
|
@sdk_configuration.hooks.before_request(
|
|
2884
3280
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -2962,7 +3358,7 @@ module Clerk
|
|
|
2962
3358
|
|
|
2963
3359
|
|
|
2964
3360
|
|
|
2965
|
-
def verify_totp(user_id:, body: nil, retries: nil, timeout_ms: nil)
|
|
3361
|
+
def verify_totp(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
2966
3362
|
# verify_totp - Verify a TOTP or backup code for a user
|
|
2967
3363
|
# Verify that the provided TOTP or backup code is valid for the user.
|
|
2968
3364
|
# Verifying a backup code will result it in being consumed (i.e. it will
|
|
@@ -3035,6 +3431,9 @@ module Clerk
|
|
|
3035
3431
|
req.headers.merge!(headers)
|
|
3036
3432
|
req.options.timeout = timeout unless timeout.nil?
|
|
3037
3433
|
Utils.configure_request_security(req, security)
|
|
3434
|
+
http_headers&.each do |key, value|
|
|
3435
|
+
req.headers[key.to_s] = value
|
|
3436
|
+
end
|
|
3038
3437
|
|
|
3039
3438
|
@sdk_configuration.hooks.before_request(
|
|
3040
3439
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -3118,7 +3517,7 @@ module Clerk
|
|
|
3118
3517
|
|
|
3119
3518
|
|
|
3120
3519
|
|
|
3121
|
-
def disable_mfa(user_id:, retries: nil, timeout_ms: nil)
|
|
3520
|
+
def disable_mfa(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
3122
3521
|
# disable_mfa - Disable a user's MFA methods
|
|
3123
3522
|
# Disable all of a user's MFA methods (e.g. OTP sent via SMS, TOTP on their authenticator app) at once.
|
|
3124
3523
|
request = Models::Operations::DisableMFARequest.new(
|
|
@@ -3176,6 +3575,9 @@ module Clerk
|
|
|
3176
3575
|
req.headers.merge!(headers)
|
|
3177
3576
|
req.options.timeout = timeout unless timeout.nil?
|
|
3178
3577
|
Utils.configure_request_security(req, security)
|
|
3578
|
+
http_headers&.each do |key, value|
|
|
3579
|
+
req.headers[key.to_s] = value
|
|
3580
|
+
end
|
|
3179
3581
|
|
|
3180
3582
|
@sdk_configuration.hooks.before_request(
|
|
3181
3583
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -3274,7 +3676,7 @@ module Clerk
|
|
|
3274
3676
|
|
|
3275
3677
|
|
|
3276
3678
|
|
|
3277
|
-
def delete_backup_codes(user_id:, retries: nil, timeout_ms: nil)
|
|
3679
|
+
def delete_backup_codes(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
3278
3680
|
# delete_backup_codes - Disable all user's Backup codes
|
|
3279
3681
|
# Disable all of a user's backup codes.
|
|
3280
3682
|
request = Models::Operations::DeleteBackupCodeRequest.new(
|
|
@@ -3332,6 +3734,9 @@ module Clerk
|
|
|
3332
3734
|
req.headers.merge!(headers)
|
|
3333
3735
|
req.options.timeout = timeout unless timeout.nil?
|
|
3334
3736
|
Utils.configure_request_security(req, security)
|
|
3737
|
+
http_headers&.each do |key, value|
|
|
3738
|
+
req.headers[key.to_s] = value
|
|
3739
|
+
end
|
|
3335
3740
|
|
|
3336
3741
|
@sdk_configuration.hooks.before_request(
|
|
3337
3742
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -3430,7 +3835,7 @@ module Clerk
|
|
|
3430
3835
|
|
|
3431
3836
|
|
|
3432
3837
|
|
|
3433
|
-
def delete_passkey(user_id:, passkey_identification_id:, retries: nil, timeout_ms: nil)
|
|
3838
|
+
def delete_passkey(user_id:, passkey_identification_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
3434
3839
|
# delete_passkey - Delete a user passkey
|
|
3435
3840
|
# Delete the passkey identification for a given user and notify them through email.
|
|
3436
3841
|
request = Models::Operations::UserPasskeyDeleteRequest.new(
|
|
@@ -3489,6 +3894,9 @@ module Clerk
|
|
|
3489
3894
|
req.headers.merge!(headers)
|
|
3490
3895
|
req.options.timeout = timeout unless timeout.nil?
|
|
3491
3896
|
Utils.configure_request_security(req, security)
|
|
3897
|
+
http_headers&.each do |key, value|
|
|
3898
|
+
req.headers[key.to_s] = value
|
|
3899
|
+
end
|
|
3492
3900
|
|
|
3493
3901
|
@sdk_configuration.hooks.before_request(
|
|
3494
3902
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -3587,7 +3995,7 @@ module Clerk
|
|
|
3587
3995
|
|
|
3588
3996
|
|
|
3589
3997
|
|
|
3590
|
-
def delete_web3_wallet(user_id:, web3_wallet_identification_id:, retries: nil, timeout_ms: nil)
|
|
3998
|
+
def delete_web3_wallet(user_id:, web3_wallet_identification_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
3591
3999
|
# delete_web3_wallet - Delete a user web3 wallet
|
|
3592
4000
|
# Delete the web3 wallet identification for a given user.
|
|
3593
4001
|
request = Models::Operations::UserWeb3WalletDeleteRequest.new(
|
|
@@ -3646,6 +4054,9 @@ module Clerk
|
|
|
3646
4054
|
req.headers.merge!(headers)
|
|
3647
4055
|
req.options.timeout = timeout unless timeout.nil?
|
|
3648
4056
|
Utils.configure_request_security(req, security)
|
|
4057
|
+
http_headers&.each do |key, value|
|
|
4058
|
+
req.headers[key.to_s] = value
|
|
4059
|
+
end
|
|
3649
4060
|
|
|
3650
4061
|
@sdk_configuration.hooks.before_request(
|
|
3651
4062
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -3744,7 +4155,7 @@ module Clerk
|
|
|
3744
4155
|
|
|
3745
4156
|
|
|
3746
4157
|
|
|
3747
|
-
def delete_totp(user_id:, retries: nil, timeout_ms: nil)
|
|
4158
|
+
def delete_totp(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
3748
4159
|
# delete_totp - Delete all the user's TOTPs
|
|
3749
4160
|
# Deletes all of the user's TOTPs.
|
|
3750
4161
|
request = Models::Operations::DeleteTOTPRequest.new(
|
|
@@ -3802,6 +4213,9 @@ module Clerk
|
|
|
3802
4213
|
req.headers.merge!(headers)
|
|
3803
4214
|
req.options.timeout = timeout unless timeout.nil?
|
|
3804
4215
|
Utils.configure_request_security(req, security)
|
|
4216
|
+
http_headers&.each do |key, value|
|
|
4217
|
+
req.headers[key.to_s] = value
|
|
4218
|
+
end
|
|
3805
4219
|
|
|
3806
4220
|
@sdk_configuration.hooks.before_request(
|
|
3807
4221
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -3900,7 +4314,7 @@ module Clerk
|
|
|
3900
4314
|
|
|
3901
4315
|
|
|
3902
4316
|
|
|
3903
|
-
def delete_external_account(user_id:, external_account_id:, retries: nil, timeout_ms: nil)
|
|
4317
|
+
def delete_external_account(user_id:, external_account_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
3904
4318
|
# delete_external_account - Delete External Account
|
|
3905
4319
|
# Delete an external account by ID.
|
|
3906
4320
|
request = Models::Operations::DeleteExternalAccountRequest.new(
|
|
@@ -3959,6 +4373,9 @@ module Clerk
|
|
|
3959
4373
|
req.headers.merge!(headers)
|
|
3960
4374
|
req.options.timeout = timeout unless timeout.nil?
|
|
3961
4375
|
Utils.configure_request_security(req, security)
|
|
4376
|
+
http_headers&.each do |key, value|
|
|
4377
|
+
req.headers[key.to_s] = value
|
|
4378
|
+
end
|
|
3962
4379
|
|
|
3963
4380
|
@sdk_configuration.hooks.before_request(
|
|
3964
4381
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -4057,7 +4474,7 @@ module Clerk
|
|
|
4057
4474
|
|
|
4058
4475
|
|
|
4059
4476
|
|
|
4060
|
-
def set_password_compromised(user_id:, body: nil, retries: nil, timeout_ms: nil)
|
|
4477
|
+
def set_password_compromised(user_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
4061
4478
|
# set_password_compromised - Set a user's password as compromised
|
|
4062
4479
|
# Sets the given user's password as compromised. The user will be prompted to reset their password on their next sign-in.
|
|
4063
4480
|
request = Models::Operations::SetUserPasswordCompromisedRequest.new(
|
|
@@ -4127,6 +4544,9 @@ module Clerk
|
|
|
4127
4544
|
req.headers.merge!(headers)
|
|
4128
4545
|
req.options.timeout = timeout unless timeout.nil?
|
|
4129
4546
|
Utils.configure_request_security(req, security)
|
|
4547
|
+
http_headers&.each do |key, value|
|
|
4548
|
+
req.headers[key.to_s] = value
|
|
4549
|
+
end
|
|
4130
4550
|
|
|
4131
4551
|
@sdk_configuration.hooks.before_request(
|
|
4132
4552
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -4210,7 +4630,7 @@ module Clerk
|
|
|
4210
4630
|
|
|
4211
4631
|
|
|
4212
4632
|
|
|
4213
|
-
def unset_password_compromised(user_id:, retries: nil, timeout_ms: nil)
|
|
4633
|
+
def unset_password_compromised(user_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
4214
4634
|
# unset_password_compromised - Unset a user's password as compromised
|
|
4215
4635
|
# Sets the given user's password as no longer compromised. The user will no longer be prompted to reset their password on their next sign-in.
|
|
4216
4636
|
request = Models::Operations::UnsetUserPasswordCompromisedRequest.new(
|
|
@@ -4268,6 +4688,9 @@ module Clerk
|
|
|
4268
4688
|
req.headers.merge!(headers)
|
|
4269
4689
|
req.options.timeout = timeout unless timeout.nil?
|
|
4270
4690
|
Utils.configure_request_security(req, security)
|
|
4691
|
+
http_headers&.each do |key, value|
|
|
4692
|
+
req.headers[key.to_s] = value
|
|
4693
|
+
end
|
|
4271
4694
|
|
|
4272
4695
|
@sdk_configuration.hooks.before_request(
|
|
4273
4696
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -4351,7 +4774,7 @@ module Clerk
|
|
|
4351
4774
|
|
|
4352
4775
|
|
|
4353
4776
|
|
|
4354
|
-
def get_instance_organization_memberships(order_by: nil, limit: nil, offset: nil, retries: nil, timeout_ms: nil)
|
|
4777
|
+
def get_instance_organization_memberships(order_by: nil, limit: nil, offset: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
4355
4778
|
# get_instance_organization_memberships - Get a list of all organization memberships within an instance.
|
|
4356
4779
|
# Retrieves all organization user memberships for the given instance.
|
|
4357
4780
|
request = Models::Operations::InstanceGetOrganizationMembershipsRequest.new(
|
|
@@ -4408,6 +4831,9 @@ module Clerk
|
|
|
4408
4831
|
req.options.timeout = timeout unless timeout.nil?
|
|
4409
4832
|
req.params = query_params
|
|
4410
4833
|
Utils.configure_request_security(req, security)
|
|
4834
|
+
http_headers&.each do |key, value|
|
|
4835
|
+
req.headers[key.to_s] = value
|
|
4836
|
+
end
|
|
4411
4837
|
|
|
4412
4838
|
@sdk_configuration.hooks.before_request(
|
|
4413
4839
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -4503,5 +4929,5 @@ module Clerk
|
|
|
4503
4929
|
|
|
4504
4930
|
end
|
|
4505
4931
|
end
|
|
4506
|
-
|
|
4932
|
+
end
|
|
4507
4933
|
end
|