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
|
@@ -38,8 +38,10 @@ module Clerk
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
|
|
42
|
+
|
|
41
43
|
|
|
42
|
-
def get(retries: nil, timeout_ms: nil)
|
|
44
|
+
def get(retries: nil, timeout_ms: nil, http_headers: nil)
|
|
43
45
|
# get - Fetch the current instance
|
|
44
46
|
# Fetches the current instance
|
|
45
47
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -89,6 +91,9 @@ module Clerk
|
|
|
89
91
|
req.headers.merge!(headers)
|
|
90
92
|
req.options.timeout = timeout unless timeout.nil?
|
|
91
93
|
Utils.configure_request_security(req, security)
|
|
94
|
+
http_headers&.each do |key, value|
|
|
95
|
+
req.headers[key.to_s] = value
|
|
96
|
+
end
|
|
92
97
|
|
|
93
98
|
@sdk_configuration.hooks.before_request(
|
|
94
99
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -157,7 +162,7 @@ module Clerk
|
|
|
157
162
|
|
|
158
163
|
|
|
159
164
|
|
|
160
|
-
def update(request: nil, retries: nil, timeout_ms: nil)
|
|
165
|
+
def update(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
161
166
|
# update - Update instance settings
|
|
162
167
|
# Updates the settings of an instance
|
|
163
168
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -218,6 +223,9 @@ module Clerk
|
|
|
218
223
|
req.headers.merge!(headers)
|
|
219
224
|
req.options.timeout = timeout unless timeout.nil?
|
|
220
225
|
Utils.configure_request_security(req, security)
|
|
226
|
+
http_headers&.each do |key, value|
|
|
227
|
+
req.headers[key.to_s] = value
|
|
228
|
+
end
|
|
221
229
|
|
|
222
230
|
@sdk_configuration.hooks.before_request(
|
|
223
231
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -292,7 +300,7 @@ module Clerk
|
|
|
292
300
|
|
|
293
301
|
|
|
294
302
|
|
|
295
|
-
def update_restrictions(request: nil, retries: nil, timeout_ms: nil)
|
|
303
|
+
def update_restrictions(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
296
304
|
# update_restrictions - Update instance restrictions
|
|
297
305
|
# Updates the restriction settings of an instance
|
|
298
306
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -353,6 +361,9 @@ module Clerk
|
|
|
353
361
|
req.headers.merge!(headers)
|
|
354
362
|
req.options.timeout = timeout unless timeout.nil?
|
|
355
363
|
Utils.configure_request_security(req, security)
|
|
364
|
+
http_headers&.each do |key, value|
|
|
365
|
+
req.headers[key.to_s] = value
|
|
366
|
+
end
|
|
356
367
|
|
|
357
368
|
@sdk_configuration.hooks.before_request(
|
|
358
369
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -436,7 +447,275 @@ module Clerk
|
|
|
436
447
|
|
|
437
448
|
|
|
438
449
|
|
|
439
|
-
def
|
|
450
|
+
def get_o_auth_application_settings(retries: nil, timeout_ms: nil, http_headers: nil)
|
|
451
|
+
# get_o_auth_application_settings - Get OAuth application settings
|
|
452
|
+
# Retrieves the settings for OAuth applications for the instance (dynamic client registration, JWT access tokens, etc.).
|
|
453
|
+
url, params = @sdk_configuration.get_server_details
|
|
454
|
+
base_url = Utils.template_url(url, params)
|
|
455
|
+
url = "#{base_url}/instance/oauth_application_settings"
|
|
456
|
+
headers = {}
|
|
457
|
+
|
|
458
|
+
headers['Accept'] = 'application/json'
|
|
459
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
460
|
+
retries ||= @sdk_configuration.retry_config
|
|
461
|
+
retries ||= Utils::RetryConfig.new(
|
|
462
|
+
backoff: Utils::BackoffStrategy.new(
|
|
463
|
+
exponent: 1.5,
|
|
464
|
+
initial_interval: 500,
|
|
465
|
+
max_elapsed_time: 3_600_000,
|
|
466
|
+
max_interval: 60_000
|
|
467
|
+
),
|
|
468
|
+
retry_connection_errors: true,
|
|
469
|
+
strategy: 'backoff'
|
|
470
|
+
)
|
|
471
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
472
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
473
|
+
|
|
474
|
+
security = @sdk_configuration.security_source&.call
|
|
475
|
+
|
|
476
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
477
|
+
timeout ||= @sdk_configuration.timeout
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
connection = @sdk_configuration.client.dup
|
|
481
|
+
connection.request :retry, retry_options
|
|
482
|
+
|
|
483
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
484
|
+
config: @sdk_configuration,
|
|
485
|
+
base_url: base_url,
|
|
486
|
+
oauth2_scopes: nil,
|
|
487
|
+
operation_id: 'GetInstanceOAuthApplicationSettings',
|
|
488
|
+
security_source: @sdk_configuration.security_source
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
error = nil
|
|
492
|
+
http_response = nil
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
begin
|
|
496
|
+
http_response = connection.get(url) do |req|
|
|
497
|
+
req.headers.merge!(headers)
|
|
498
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
499
|
+
Utils.configure_request_security(req, security)
|
|
500
|
+
http_headers&.each do |key, value|
|
|
501
|
+
req.headers[key.to_s] = value
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
@sdk_configuration.hooks.before_request(
|
|
505
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
506
|
+
hook_ctx: hook_ctx
|
|
507
|
+
),
|
|
508
|
+
request: req
|
|
509
|
+
)
|
|
510
|
+
end
|
|
511
|
+
rescue StandardError => e
|
|
512
|
+
error = e
|
|
513
|
+
ensure
|
|
514
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
515
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
516
|
+
error: error,
|
|
517
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
518
|
+
hook_ctx: hook_ctx
|
|
519
|
+
),
|
|
520
|
+
response: http_response
|
|
521
|
+
)
|
|
522
|
+
else
|
|
523
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
524
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
525
|
+
hook_ctx: hook_ctx
|
|
526
|
+
),
|
|
527
|
+
response: http_response
|
|
528
|
+
)
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
if http_response.nil?
|
|
532
|
+
raise error if !error.nil?
|
|
533
|
+
raise 'no response'
|
|
534
|
+
end
|
|
535
|
+
end
|
|
536
|
+
|
|
537
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
538
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
539
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
540
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
541
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
542
|
+
hook_ctx: hook_ctx
|
|
543
|
+
),
|
|
544
|
+
response: http_response
|
|
545
|
+
)
|
|
546
|
+
response_data = http_response.env.response_body
|
|
547
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::OAuthApplicationSettings)
|
|
548
|
+
response = Models::Operations::GetInstanceOAuthApplicationSettingsResponse.new(
|
|
549
|
+
status_code: http_response.status,
|
|
550
|
+
content_type: content_type,
|
|
551
|
+
raw_response: http_response,
|
|
552
|
+
o_auth_application_settings: obj
|
|
553
|
+
)
|
|
554
|
+
|
|
555
|
+
return response
|
|
556
|
+
else
|
|
557
|
+
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'
|
|
558
|
+
end
|
|
559
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
560
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
561
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
562
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
563
|
+
else
|
|
564
|
+
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'
|
|
565
|
+
|
|
566
|
+
end
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
def update_o_auth_application_settings(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
572
|
+
# update_o_auth_application_settings - Update OAuth application settings
|
|
573
|
+
# Updates the OAuth application settings for the instance.
|
|
574
|
+
url, params = @sdk_configuration.get_server_details
|
|
575
|
+
base_url = Utils.template_url(url, params)
|
|
576
|
+
url = "#{base_url}/instance/oauth_application_settings"
|
|
577
|
+
headers = {}
|
|
578
|
+
|
|
579
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, true, :request, :json)
|
|
580
|
+
headers['content-type'] = req_content_type
|
|
581
|
+
|
|
582
|
+
if form && !form.empty?
|
|
583
|
+
body = Utils.encode_form(form)
|
|
584
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
585
|
+
body = URI.encode_www_form(data)
|
|
586
|
+
else
|
|
587
|
+
body = data
|
|
588
|
+
end
|
|
589
|
+
headers['Accept'] = 'application/json'
|
|
590
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
591
|
+
retries ||= @sdk_configuration.retry_config
|
|
592
|
+
retries ||= Utils::RetryConfig.new(
|
|
593
|
+
backoff: Utils::BackoffStrategy.new(
|
|
594
|
+
exponent: 1.5,
|
|
595
|
+
initial_interval: 500,
|
|
596
|
+
max_elapsed_time: 3_600_000,
|
|
597
|
+
max_interval: 60_000
|
|
598
|
+
),
|
|
599
|
+
retry_connection_errors: true,
|
|
600
|
+
strategy: 'backoff'
|
|
601
|
+
)
|
|
602
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
603
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
604
|
+
|
|
605
|
+
security = @sdk_configuration.security_source&.call
|
|
606
|
+
|
|
607
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
608
|
+
timeout ||= @sdk_configuration.timeout
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
connection = @sdk_configuration.client.dup
|
|
612
|
+
connection.request :retry, retry_options
|
|
613
|
+
|
|
614
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
615
|
+
config: @sdk_configuration,
|
|
616
|
+
base_url: base_url,
|
|
617
|
+
oauth2_scopes: nil,
|
|
618
|
+
operation_id: 'UpdateInstanceOAuthApplicationSettings',
|
|
619
|
+
security_source: @sdk_configuration.security_source
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
error = nil
|
|
623
|
+
http_response = nil
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
begin
|
|
627
|
+
http_response = connection.patch(url) do |req|
|
|
628
|
+
req.body = body
|
|
629
|
+
req.headers.merge!(headers)
|
|
630
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
631
|
+
Utils.configure_request_security(req, security)
|
|
632
|
+
http_headers&.each do |key, value|
|
|
633
|
+
req.headers[key.to_s] = value
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
@sdk_configuration.hooks.before_request(
|
|
637
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
638
|
+
hook_ctx: hook_ctx
|
|
639
|
+
),
|
|
640
|
+
request: req
|
|
641
|
+
)
|
|
642
|
+
end
|
|
643
|
+
rescue StandardError => e
|
|
644
|
+
error = e
|
|
645
|
+
ensure
|
|
646
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
647
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
648
|
+
error: error,
|
|
649
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
650
|
+
hook_ctx: hook_ctx
|
|
651
|
+
),
|
|
652
|
+
response: http_response
|
|
653
|
+
)
|
|
654
|
+
else
|
|
655
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
656
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
657
|
+
hook_ctx: hook_ctx
|
|
658
|
+
),
|
|
659
|
+
response: http_response
|
|
660
|
+
)
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
if http_response.nil?
|
|
664
|
+
raise error if !error.nil?
|
|
665
|
+
raise 'no response'
|
|
666
|
+
end
|
|
667
|
+
end
|
|
668
|
+
|
|
669
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
670
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
671
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
672
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
673
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
674
|
+
hook_ctx: hook_ctx
|
|
675
|
+
),
|
|
676
|
+
response: http_response
|
|
677
|
+
)
|
|
678
|
+
response_data = http_response.env.response_body
|
|
679
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::OAuthApplicationSettings)
|
|
680
|
+
response = Models::Operations::UpdateInstanceOAuthApplicationSettingsResponse.new(
|
|
681
|
+
status_code: http_response.status,
|
|
682
|
+
content_type: content_type,
|
|
683
|
+
raw_response: http_response,
|
|
684
|
+
o_auth_application_settings: obj
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
return response
|
|
688
|
+
else
|
|
689
|
+
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'
|
|
690
|
+
end
|
|
691
|
+
elsif Utils.match_status_code(http_response.status, ['422'])
|
|
692
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
693
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
694
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
695
|
+
hook_ctx: hook_ctx
|
|
696
|
+
),
|
|
697
|
+
response: http_response
|
|
698
|
+
)
|
|
699
|
+
response_data = http_response.env.response_body
|
|
700
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
701
|
+
obj.raw_response = http_response
|
|
702
|
+
raise obj
|
|
703
|
+
else
|
|
704
|
+
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'
|
|
705
|
+
end
|
|
706
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
707
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
708
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
709
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
710
|
+
else
|
|
711
|
+
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'
|
|
712
|
+
|
|
713
|
+
end
|
|
714
|
+
end
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
def change_domain(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
440
719
|
# change_domain - Update production instance domain
|
|
441
720
|
# Change the domain of a production instance.
|
|
442
721
|
#
|
|
@@ -501,6 +780,9 @@ module Clerk
|
|
|
501
780
|
req.headers.merge!(headers)
|
|
502
781
|
req.options.timeout = timeout unless timeout.nil?
|
|
503
782
|
Utils.configure_request_security(req, security)
|
|
783
|
+
http_headers&.each do |key, value|
|
|
784
|
+
req.headers[key.to_s] = value
|
|
785
|
+
end
|
|
504
786
|
|
|
505
787
|
@sdk_configuration.hooks.before_request(
|
|
506
788
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -575,7 +857,7 @@ module Clerk
|
|
|
575
857
|
|
|
576
858
|
|
|
577
859
|
|
|
578
|
-
def update_organization_settings(request: nil, retries: nil, timeout_ms: nil)
|
|
860
|
+
def update_organization_settings(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
579
861
|
# update_organization_settings - Update instance organization settings
|
|
580
862
|
# Updates the organization settings of the instance
|
|
581
863
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -636,6 +918,9 @@ module Clerk
|
|
|
636
918
|
req.headers.merge!(headers)
|
|
637
919
|
req.options.timeout = timeout unless timeout.nil?
|
|
638
920
|
Utils.configure_request_security(req, security)
|
|
921
|
+
http_headers&.each do |key, value|
|
|
922
|
+
req.headers[key.to_s] = value
|
|
923
|
+
end
|
|
639
924
|
|
|
640
925
|
@sdk_configuration.hooks.before_request(
|
|
641
926
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -719,7 +1004,7 @@ module Clerk
|
|
|
719
1004
|
|
|
720
1005
|
|
|
721
1006
|
|
|
722
|
-
def get_instance_protect(retries: nil, timeout_ms: nil)
|
|
1007
|
+
def get_instance_protect(retries: nil, timeout_ms: nil, http_headers: nil)
|
|
723
1008
|
# get_instance_protect - Get instance protect settings
|
|
724
1009
|
url, params = @sdk_configuration.get_server_details
|
|
725
1010
|
base_url = Utils.template_url(url, params)
|
|
@@ -768,6 +1053,9 @@ module Clerk
|
|
|
768
1053
|
req.headers.merge!(headers)
|
|
769
1054
|
req.options.timeout = timeout unless timeout.nil?
|
|
770
1055
|
Utils.configure_request_security(req, security)
|
|
1056
|
+
http_headers&.each do |key, value|
|
|
1057
|
+
req.headers[key.to_s] = value
|
|
1058
|
+
end
|
|
771
1059
|
|
|
772
1060
|
@sdk_configuration.hooks.before_request(
|
|
773
1061
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -836,7 +1124,7 @@ module Clerk
|
|
|
836
1124
|
|
|
837
1125
|
|
|
838
1126
|
|
|
839
|
-
def update_instance_protect(request: nil, retries: nil, timeout_ms: nil)
|
|
1127
|
+
def update_instance_protect(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
840
1128
|
# update_instance_protect - Update instance protect settings
|
|
841
1129
|
url, params = @sdk_configuration.get_server_details
|
|
842
1130
|
base_url = Utils.template_url(url, params)
|
|
@@ -896,6 +1184,9 @@ module Clerk
|
|
|
896
1184
|
req.headers.merge!(headers)
|
|
897
1185
|
req.options.timeout = timeout unless timeout.nil?
|
|
898
1186
|
Utils.configure_request_security(req, security)
|
|
1187
|
+
http_headers&.each do |key, value|
|
|
1188
|
+
req.headers[key.to_s] = value
|
|
1189
|
+
end
|
|
899
1190
|
|
|
900
1191
|
@sdk_configuration.hooks.before_request(
|
|
901
1192
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -976,5 +1267,5 @@ module Clerk
|
|
|
976
1267
|
|
|
977
1268
|
end
|
|
978
1269
|
end
|
|
979
|
-
|
|
1270
|
+
end
|
|
980
1271
|
end
|
data/lib/clerk/invitations.rb
CHANGED
|
@@ -38,8 +38,10 @@ module Clerk
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
|
|
42
|
+
|
|
41
43
|
|
|
42
|
-
def create(request: nil, retries: nil, timeout_ms: nil)
|
|
44
|
+
def create(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
43
45
|
# create - Create an invitation
|
|
44
46
|
# Creates a new invitation for the given email address and sends the invitation email.
|
|
45
47
|
# Keep in mind that you cannot create an invitation if there is already one for the given email address.
|
|
@@ -102,6 +104,9 @@ module Clerk
|
|
|
102
104
|
req.headers.merge!(headers)
|
|
103
105
|
req.options.timeout = timeout unless timeout.nil?
|
|
104
106
|
Utils.configure_request_security(req, security)
|
|
107
|
+
http_headers&.each do |key, value|
|
|
108
|
+
req.headers[key.to_s] = value
|
|
109
|
+
end
|
|
105
110
|
|
|
106
111
|
@sdk_configuration.hooks.before_request(
|
|
107
112
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -185,7 +190,7 @@ module Clerk
|
|
|
185
190
|
|
|
186
191
|
|
|
187
192
|
|
|
188
|
-
def list(request:, retries: nil, timeout_ms: nil)
|
|
193
|
+
def list(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
189
194
|
# list - List all invitations
|
|
190
195
|
# Returns all non-revoked invitations for your application, sorted by creation date
|
|
191
196
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -237,6 +242,9 @@ module Clerk
|
|
|
237
242
|
req.options.timeout = timeout unless timeout.nil?
|
|
238
243
|
req.params = query_params
|
|
239
244
|
Utils.configure_request_security(req, security)
|
|
245
|
+
http_headers&.each do |key, value|
|
|
246
|
+
req.headers[key.to_s] = value
|
|
247
|
+
end
|
|
240
248
|
|
|
241
249
|
@sdk_configuration.hooks.before_request(
|
|
242
250
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -305,7 +313,7 @@ module Clerk
|
|
|
305
313
|
|
|
306
314
|
|
|
307
315
|
|
|
308
|
-
def bulk_create(request: nil, retries: nil, timeout_ms: nil)
|
|
316
|
+
def bulk_create(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
309
317
|
# bulk_create - Create multiple invitations
|
|
310
318
|
# Use this API operation to create multiple invitations for the provided email addresses. You can choose to send the
|
|
311
319
|
# invitations as emails by setting the `notify` parameter to `true`. There cannot be an existing invitation for any
|
|
@@ -371,6 +379,9 @@ module Clerk
|
|
|
371
379
|
req.headers.merge!(headers)
|
|
372
380
|
req.options.timeout = timeout unless timeout.nil?
|
|
373
381
|
Utils.configure_request_security(req, security)
|
|
382
|
+
http_headers&.each do |key, value|
|
|
383
|
+
req.headers[key.to_s] = value
|
|
384
|
+
end
|
|
374
385
|
|
|
375
386
|
@sdk_configuration.hooks.before_request(
|
|
376
387
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -454,7 +465,7 @@ module Clerk
|
|
|
454
465
|
|
|
455
466
|
|
|
456
467
|
|
|
457
|
-
def revoke(invitation_id:, retries: nil, timeout_ms: nil)
|
|
468
|
+
def revoke(invitation_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
458
469
|
# revoke - Revokes an invitation
|
|
459
470
|
# Revokes the given invitation.
|
|
460
471
|
# Revoking an invitation will prevent the user from using the invitation link that was sent to them.
|
|
@@ -515,6 +526,9 @@ module Clerk
|
|
|
515
526
|
req.headers.merge!(headers)
|
|
516
527
|
req.options.timeout = timeout unless timeout.nil?
|
|
517
528
|
Utils.configure_request_security(req, security)
|
|
529
|
+
http_headers&.each do |key, value|
|
|
530
|
+
req.headers[key.to_s] = value
|
|
531
|
+
end
|
|
518
532
|
|
|
519
533
|
@sdk_configuration.hooks.before_request(
|
|
520
534
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -595,5 +609,5 @@ module Clerk
|
|
|
595
609
|
|
|
596
610
|
end
|
|
597
611
|
end
|
|
598
|
-
|
|
612
|
+
end
|
|
599
613
|
end
|
data/lib/clerk/jwks.rb
CHANGED
|
@@ -38,8 +38,10 @@ module Clerk
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
|
|
42
|
+
|
|
41
43
|
|
|
42
|
-
def get_jwks(retries: nil, timeout_ms: nil)
|
|
44
|
+
def get_jwks(retries: nil, timeout_ms: nil, http_headers: nil)
|
|
43
45
|
# get_jwks - Retrieve the JSON Web Key Set of the instance
|
|
44
46
|
# Retrieve the JSON Web Key Set of the instance
|
|
45
47
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -89,6 +91,9 @@ module Clerk
|
|
|
89
91
|
req.headers.merge!(headers)
|
|
90
92
|
req.options.timeout = timeout unless timeout.nil?
|
|
91
93
|
Utils.configure_request_security(req, security)
|
|
94
|
+
http_headers&.each do |key, value|
|
|
95
|
+
req.headers[key.to_s] = value
|
|
96
|
+
end
|
|
92
97
|
|
|
93
98
|
@sdk_configuration.hooks.before_request(
|
|
94
99
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -154,5 +159,5 @@ module Clerk
|
|
|
154
159
|
|
|
155
160
|
end
|
|
156
161
|
end
|
|
157
|
-
|
|
162
|
+
end
|
|
158
163
|
end
|
data/lib/clerk/jwttemplates.rb
CHANGED
|
@@ -38,8 +38,10 @@ module Clerk
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
|
|
42
|
+
|
|
41
43
|
|
|
42
|
-
def list(paginated: nil, limit: nil, offset: nil, retries: nil, timeout_ms: nil)
|
|
44
|
+
def list(paginated: nil, limit: nil, offset: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
43
45
|
# list - List all templates
|
|
44
46
|
request = Models::Operations::ListJWTTemplatesRequest.new(
|
|
45
47
|
paginated: paginated,
|
|
@@ -95,6 +97,9 @@ module Clerk
|
|
|
95
97
|
req.options.timeout = timeout unless timeout.nil?
|
|
96
98
|
req.params = query_params
|
|
97
99
|
Utils.configure_request_security(req, security)
|
|
100
|
+
http_headers&.each do |key, value|
|
|
101
|
+
req.headers[key.to_s] = value
|
|
102
|
+
end
|
|
98
103
|
|
|
99
104
|
@sdk_configuration.hooks.before_request(
|
|
100
105
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -163,7 +168,7 @@ module Clerk
|
|
|
163
168
|
|
|
164
169
|
|
|
165
170
|
|
|
166
|
-
def create(request: nil, retries: nil, timeout_ms: nil)
|
|
171
|
+
def create(request: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
167
172
|
# create - Create a JWT template
|
|
168
173
|
# Create a new JWT template
|
|
169
174
|
url, params = @sdk_configuration.get_server_details
|
|
@@ -224,6 +229,9 @@ module Clerk
|
|
|
224
229
|
req.headers.merge!(headers)
|
|
225
230
|
req.options.timeout = timeout unless timeout.nil?
|
|
226
231
|
Utils.configure_request_security(req, security)
|
|
232
|
+
http_headers&.each do |key, value|
|
|
233
|
+
req.headers[key.to_s] = value
|
|
234
|
+
end
|
|
227
235
|
|
|
228
236
|
@sdk_configuration.hooks.before_request(
|
|
229
237
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -307,7 +315,7 @@ module Clerk
|
|
|
307
315
|
|
|
308
316
|
|
|
309
317
|
|
|
310
|
-
def get(template_id:, retries: nil, timeout_ms: nil)
|
|
318
|
+
def get(template_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
311
319
|
# get - Retrieve a template
|
|
312
320
|
# Retrieve the details of a given JWT template
|
|
313
321
|
request = Models::Operations::GetJWTTemplateRequest.new(
|
|
@@ -365,6 +373,9 @@ module Clerk
|
|
|
365
373
|
req.headers.merge!(headers)
|
|
366
374
|
req.options.timeout = timeout unless timeout.nil?
|
|
367
375
|
Utils.configure_request_security(req, security)
|
|
376
|
+
http_headers&.each do |key, value|
|
|
377
|
+
req.headers[key.to_s] = value
|
|
378
|
+
end
|
|
368
379
|
|
|
369
380
|
@sdk_configuration.hooks.before_request(
|
|
370
381
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -448,7 +459,7 @@ module Clerk
|
|
|
448
459
|
|
|
449
460
|
|
|
450
461
|
|
|
451
|
-
def update(template_id:, body: nil, retries: nil, timeout_ms: nil)
|
|
462
|
+
def update(template_id:, body: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
452
463
|
# update - Update a JWT template
|
|
453
464
|
# Updates an existing JWT template
|
|
454
465
|
request = Models::Operations::UpdateJWTTemplateRequest.new(
|
|
@@ -518,6 +529,9 @@ module Clerk
|
|
|
518
529
|
req.headers.merge!(headers)
|
|
519
530
|
req.options.timeout = timeout unless timeout.nil?
|
|
520
531
|
Utils.configure_request_security(req, security)
|
|
532
|
+
http_headers&.each do |key, value|
|
|
533
|
+
req.headers[key.to_s] = value
|
|
534
|
+
end
|
|
521
535
|
|
|
522
536
|
@sdk_configuration.hooks.before_request(
|
|
523
537
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -601,7 +615,7 @@ module Clerk
|
|
|
601
615
|
|
|
602
616
|
|
|
603
617
|
|
|
604
|
-
def delete(template_id:, retries: nil, timeout_ms: nil)
|
|
618
|
+
def delete(template_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
605
619
|
# delete - Delete a Template
|
|
606
620
|
request = Models::Operations::DeleteJWTTemplateRequest.new(
|
|
607
621
|
template_id: template_id
|
|
@@ -658,6 +672,9 @@ module Clerk
|
|
|
658
672
|
req.headers.merge!(headers)
|
|
659
673
|
req.options.timeout = timeout unless timeout.nil?
|
|
660
674
|
Utils.configure_request_security(req, security)
|
|
675
|
+
http_headers&.each do |key, value|
|
|
676
|
+
req.headers[key.to_s] = value
|
|
677
|
+
end
|
|
661
678
|
|
|
662
679
|
@sdk_configuration.hooks.before_request(
|
|
663
680
|
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
@@ -738,5 +755,5 @@ module Clerk
|
|
|
738
755
|
|
|
739
756
|
end
|
|
740
757
|
end
|
|
741
|
-
|
|
758
|
+
end
|
|
742
759
|
end
|