auth0 6.2.0 → 6.3.0

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.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +3 -3
  3. data/.fern/replay.lock +7 -1
  4. data/.version +1 -1
  5. data/CHANGELOG.md +7 -0
  6. data/EXAMPLES.md +44 -0
  7. data/examples/ruby-api/Gemfile.lock +1 -1
  8. data/lib/auth0/actions/client.rb +47 -6
  9. data/lib/auth0/actions/executions/client.rb +4 -1
  10. data/lib/auth0/actions/modules/client.rb +40 -6
  11. data/lib/auth0/actions/modules/versions/client.rb +19 -3
  12. data/lib/auth0/actions/triggers/bindings/client.rb +12 -2
  13. data/lib/auth0/actions/triggers/client.rb +4 -1
  14. data/lib/auth0/actions/versions/client.rb +27 -4
  15. data/lib/auth0/agents/client.rb +22 -4
  16. data/lib/auth0/anomaly/blocks/client.rb +6 -0
  17. data/lib/auth0/api/authentication_endpoints.rb +40 -0
  18. data/lib/auth0/attack_protection/bot_detection/client.rb +8 -2
  19. data/lib/auth0/attack_protection/breached_password_detection/client.rb +8 -2
  20. data/lib/auth0/attack_protection/brute_force_protection/client.rb +8 -2
  21. data/lib/auth0/attack_protection/captcha/client.rb +8 -2
  22. data/lib/auth0/attack_protection/phone_provider_protection/client.rb +8 -2
  23. data/lib/auth0/attack_protection/suspicious_ip_throttling/client.rb +8 -2
  24. data/lib/auth0/branding/client.rb +8 -2
  25. data/lib/auth0/branding/phone/providers/client.rb +31 -5
  26. data/lib/auth0/branding/phone/templates/client.rb +39 -7
  27. data/lib/auth0/branding/templates/client.rb +10 -1
  28. data/lib/auth0/branding/themes/client.rb +162 -4
  29. data/lib/auth0/client.rb +8 -8
  30. data/lib/auth0/client_grants/client.rb +28 -4
  31. data/lib/auth0/client_grants/organizations/client.rb +9 -1
  32. data/lib/auth0/clients/client.rb +46 -7
  33. data/lib/auth0/clients/connections/client.rb +11 -1
  34. data/lib/auth0/clients/credentials/client.rb +36 -7
  35. data/lib/auth0/clients/types/create_client_request_content.rb +2 -0
  36. data/lib/auth0/clients/types/update_client_request_content.rb +2 -0
  37. data/lib/auth0/connection_profiles/client.rb +30 -6
  38. data/lib/auth0/connections/client.rb +37 -4
  39. data/lib/auth0/connections/clients/client.rb +21 -2
  40. data/lib/auth0/connections/directory_provisioning/client.rb +73 -8
  41. data/lib/auth0/connections/directory_provisioning/synchronizations/client.rb +4 -1
  42. data/lib/auth0/connections/keys/client.rb +31 -8
  43. data/lib/auth0/connections/scim_configuration/client.rb +37 -6
  44. data/lib/auth0/connections/scim_configuration/tokens/client.rb +14 -2
  45. data/lib/auth0/connections/users/client.rb +6 -0
  46. data/lib/auth0/custom_domains/client.rb +43 -8
  47. data/lib/auth0/device_credentials/client.rb +25 -2
  48. data/lib/auth0/email_templates/client.rb +19 -4
  49. data/lib/auth0/emails/provider/client.rb +23 -3
  50. data/lib/auth0/event_streams/client.rb +38 -5
  51. data/lib/auth0/event_streams/deliveries/client.rb +19 -2
  52. data/lib/auth0/event_streams/redeliveries/client.rb +10 -1
  53. data/lib/auth0/events/client.rb +7 -0
  54. data/lib/auth0/experimentation/client.rb +19 -0
  55. data/lib/auth0/experimentation/experiments/client.rb +63 -0
  56. data/lib/auth0/experimentation/experiments/types/advance_ramp_request_content.rb +15 -0
  57. data/lib/auth0/flows/client.rb +28 -4
  58. data/lib/auth0/flows/executions/client.rb +23 -2
  59. data/lib/auth0/flows/vault/connections/client.rb +31 -4
  60. data/lib/auth0/forms/client.rb +27 -4
  61. data/lib/auth0/groups/client.rb +21 -2
  62. data/lib/auth0/groups/members/client.rb +10 -1
  63. data/lib/auth0/groups/roles/client.rb +20 -1
  64. data/lib/auth0/guardian/client.rb +77 -0
  65. data/lib/auth0/guardian/enrollments/client.rb +11 -2
  66. data/lib/auth0/guardian/factors/client.rb +21 -5
  67. data/lib/auth0/guardian/factors/duo/settings/client.rb +12 -3
  68. data/lib/auth0/guardian/factors/email/client.rb +93 -0
  69. data/lib/auth0/guardian/factors/email/types/set_email_factor_settings_request_content.rb +17 -0
  70. data/lib/auth0/guardian/factors/phone/client.rb +110 -8
  71. data/lib/auth0/guardian/factors/phone/types/set_phone_factor_settings_request_content.rb +17 -0
  72. data/lib/auth0/guardian/factors/push_notification/client.rb +48 -12
  73. data/lib/auth0/guardian/factors/sms/client.rb +32 -9
  74. data/lib/auth0/guardian/policies/client.rb +8 -2
  75. data/lib/auth0/guardian/types/set_guardian_settings_request_content.rb +17 -0
  76. data/lib/auth0/hooks/client.rb +33 -4
  77. data/lib/auth0/hooks/secrets/client.rb +38 -4
  78. data/lib/auth0/jobs/client.rb +4 -1
  79. data/lib/auth0/jobs/errors/client.rb +9 -4
  80. data/lib/auth0/jobs/users_exports/client.rb +4 -1
  81. data/lib/auth0/jobs/users_imports/client.rb +14 -6
  82. data/lib/auth0/jobs/verification_email/client.rb +4 -1
  83. data/lib/auth0/keys/custom_signing/client.rb +13 -2
  84. data/lib/auth0/keys/encryption/client.rb +33 -5
  85. data/lib/auth0/keys/network_acls/client.rb +19 -3
  86. data/lib/auth0/keys/signing/client.rb +21 -7
  87. data/lib/auth0/log_streams/client.rb +29 -7
  88. data/lib/auth0/logs/client.rb +16 -2
  89. data/lib/auth0/network_acls/client.rb +41 -4
  90. data/lib/auth0/organizations/client.rb +109 -5
  91. data/lib/auth0/organizations/client_grants/client.rb +25 -2
  92. data/lib/auth0/organizations/clients/client.rb +38 -4
  93. data/lib/auth0/organizations/connections/client.rb +37 -4
  94. data/lib/auth0/organizations/connections/types/create_organization_all_connection_request_parameters.rb +2 -0
  95. data/lib/auth0/organizations/connections/types/update_organization_connection_request_parameters.rb +2 -0
  96. data/lib/auth0/organizations/discovery_domains/client.rb +42 -5
  97. data/lib/auth0/organizations/enabled_connections/client.rb +36 -4
  98. data/lib/auth0/organizations/groups/client.rb +8 -1
  99. data/lib/auth0/organizations/groups/roles/client.rb +23 -1
  100. data/lib/auth0/organizations/invitations/client.rb +40 -3
  101. data/lib/auth0/organizations/members/client.rb +23 -1
  102. data/lib/auth0/organizations/members/effective_roles/client.rb +9 -1
  103. data/lib/auth0/organizations/members/effective_roles/sources/groups/client.rb +10 -1
  104. data/lib/auth0/organizations/members/roles/client.rb +24 -1
  105. data/lib/auth0/organizations/organization_template/client.rb +16 -1
  106. data/lib/auth0/organizations/roles/groups/client.rb +9 -1
  107. data/lib/auth0/organizations/roles/members/client.rb +11 -1
  108. data/lib/auth0/organizations/types/search_organizations_request_parameters.rb +19 -0
  109. data/lib/auth0/prompts/client.rb +8 -2
  110. data/lib/auth0/prompts/custom_text/client.rb +20 -2
  111. data/lib/auth0/prompts/partials/client.rb +16 -2
  112. data/lib/auth0/prompts/rendering/client.rb +34 -4
  113. data/lib/auth0/rate_limit_policies/client.rb +37 -4
  114. data/lib/auth0/refresh_tokens/client.rb +25 -3
  115. data/lib/auth0/resource_servers/client.rb +102 -4
  116. data/lib/auth0/resource_servers/types/create_resource_server_request_content.rb +4 -0
  117. data/lib/auth0/resource_servers/types/search_resource_servers_request_parameters.rb +23 -0
  118. data/lib/auth0/resource_servers/types/update_resource_server_request_content.rb +4 -0
  119. data/lib/auth0/risk_assessments/settings/client.rb +8 -2
  120. data/lib/auth0/risk_assessments/settings/new_device/client.rb +8 -2
  121. data/lib/auth0/roles/client.rb +26 -4
  122. data/lib/auth0/roles/groups/client.rb +20 -1
  123. data/lib/auth0/roles/permissions/client.rb +27 -1
  124. data/lib/auth0/roles/users/client.rb +15 -1
  125. data/lib/auth0/rules/client.rb +33 -4
  126. data/lib/auth0/rules_configs/client.rb +19 -5
  127. data/lib/auth0/self_service_profiles/client.rb +23 -4
  128. data/lib/auth0/self_service_profiles/custom_text/client.rb +23 -3
  129. data/lib/auth0/self_service_profiles/sso_ticket/client.rb +10 -1
  130. data/lib/auth0/sessions/client.rb +14 -2
  131. data/lib/auth0/stats/client.rb +16 -5
  132. data/lib/auth0/supplemental_signals/client.rb +8 -2
  133. data/lib/auth0/tenants/settings/client.rb +11 -2
  134. data/lib/auth0/tenants/settings/types/update_tenant_settings_request_content.rb +2 -0
  135. data/lib/auth0/tickets/client.rb +8 -2
  136. data/lib/auth0/token_exchange_profiles/client.rb +26 -3
  137. data/lib/auth0/types/advance_ramp_response_content.rb +15 -0
  138. data/lib/auth0/types/anonymous_sessions.rb +10 -0
  139. data/lib/auth0/types/client.rb +6 -0
  140. data/lib/auth0/types/client_my_organization_patch_configuration.rb +4 -0
  141. data/lib/auth0/types/client_my_organization_post_configuration.rb +4 -0
  142. data/lib/auth0/types/client_my_organization_response_configuration.rb +4 -0
  143. data/lib/auth0/types/connection_identity_provider_enum.rb +4 -13
  144. data/lib/auth0/types/connection_options_ad.rb +2 -0
  145. data/lib/auth0/types/connection_options_adfs.rb +2 -0
  146. data/lib/auth0/types/connection_options_azure_ad.rb +2 -0
  147. data/lib/auth0/types/connection_options_common_saml.rb +2 -0
  148. data/lib/auth0/types/connection_options_ping_federate.rb +2 -0
  149. data/lib/auth0/types/connection_options_saml.rb +2 -0
  150. data/lib/auth0/types/connection_properties_options.rb +4 -0
  151. data/lib/auth0/types/connection_strategy_enum.rb +4 -13
  152. data/lib/auth0/types/connection_thumbprints_sha384.rb +23 -0
  153. data/lib/auth0/types/connection_thumbprints_sha384ad.rb +23 -0
  154. data/lib/auth0/types/connection_thumbprints_sha384saml.rb +23 -0
  155. data/lib/auth0/types/create_anonymous_sessions.rb +10 -0
  156. data/lib/auth0/types/create_client_response_content.rb +6 -0
  157. data/lib/auth0/types/create_organization_all_connection_response_content.rb +2 -0
  158. data/lib/auth0/types/create_resource_server_response_content.rb +4 -0
  159. data/lib/auth0/types/get_client_response_content.rb +6 -0
  160. data/lib/auth0/types/get_email_factor_settings_response_content.rb +11 -0
  161. data/lib/auth0/types/get_guardian_settings_response_content.rb +15 -0
  162. data/lib/auth0/types/get_organization_all_connection_response_content.rb +2 -0
  163. data/lib/auth0/types/get_phone_factor_settings_response_content.rb +11 -0
  164. data/lib/auth0/types/get_resource_server_response_content.rb +4 -0
  165. data/lib/auth0/types/get_tenant_settings_response_content.rb +2 -0
  166. data/lib/auth0/types/oauth_scope.rb +1 -2
  167. data/lib/auth0/types/organization_all_connection_post.rb +2 -0
  168. data/lib/auth0/types/organization_member_access_level_enum.rb +14 -0
  169. data/lib/auth0/types/organization_member_access_level_enum_with_null.rb +14 -0
  170. data/lib/auth0/types/organization_sort_field_enum.rb +13 -0
  171. data/lib/auth0/types/resource_server.rb +4 -0
  172. data/lib/auth0/types/resource_server_access_token.rb +10 -0
  173. data/lib/auth0/types/resource_server_access_token_claims_mapping.rb +10 -0
  174. data/lib/auth0/types/resource_server_access_token_custom_claims_mapping.rb +23 -0
  175. data/lib/auth0/types/resource_server_access_token_custom_claims_mapping_rule.rb +11 -0
  176. data/lib/auth0/types/resource_server_search_response.rb +53 -0
  177. data/lib/auth0/types/resource_server_sort_field_enum.rb +13 -0
  178. data/lib/auth0/types/resource_server_subject_type_authorization.rb +2 -0
  179. data/lib/auth0/types/resource_server_subject_type_authorization_anonymous_user.rb +10 -0
  180. data/lib/auth0/types/resource_server_subject_type_authorization_anonymous_user_policy_enum.rb +12 -0
  181. data/lib/auth0/types/rotate_client_secret_response_content.rb +6 -0
  182. data/lib/auth0/types/search_organization.rb +23 -0
  183. data/lib/auth0/types/{list_template_organizations_paginated_response_content.rb → search_organizations_paginated_response_content.rb} +3 -3
  184. data/lib/auth0/types/search_parser_enum.rb +12 -0
  185. data/lib/auth0/types/search_resource_servers_response_content.rb +11 -0
  186. data/lib/auth0/types/set_email_factor_settings_response_content.rb +11 -0
  187. data/lib/auth0/types/set_guardian_settings_response_content.rb +15 -0
  188. data/lib/auth0/types/set_phone_factor_settings_response_content.rb +11 -0
  189. data/lib/auth0/types/tenant_settings_sessions.rb +2 -0
  190. data/lib/auth0/types/tenant_settings_sessions_anonymous.rb +12 -0
  191. data/lib/auth0/types/update_anonymous_sessions.rb +10 -0
  192. data/lib/auth0/types/update_client_response_content.rb +6 -0
  193. data/lib/auth0/types/update_connection_options.rb +4 -0
  194. data/lib/auth0/types/update_organization_all_connection_response_content.rb +2 -0
  195. data/lib/auth0/types/update_resource_server_response_content.rb +4 -0
  196. data/lib/auth0/types/update_tenant_settings_response_content.rb +2 -0
  197. data/lib/auth0/user_attribute_profiles/client.rb +40 -6
  198. data/lib/auth0/user_blocks/client.rb +20 -2
  199. data/lib/auth0/user_grants/client.rb +17 -1
  200. data/lib/auth0/users/authentication_methods/client.rb +57 -9
  201. data/lib/auth0/users/authenticators/client.rb +3 -0
  202. data/lib/auth0/users/client.rb +54 -9
  203. data/lib/auth0/users/connected_accounts/client.rb +8 -1
  204. data/lib/auth0/users/effective_permissions/client.rb +9 -1
  205. data/lib/auth0/users/effective_permissions/sources/roles/client.rb +10 -1
  206. data/lib/auth0/users/effective_roles/client.rb +8 -1
  207. data/lib/auth0/users/effective_roles/sources/groups/client.rb +9 -1
  208. data/lib/auth0/users/enrollments/client.rb +9 -4
  209. data/lib/auth0/users/groups/client.rb +11 -1
  210. data/lib/auth0/users/identities/client.rb +17 -5
  211. data/lib/auth0/users/logs/client.rb +10 -1
  212. data/lib/auth0/users/multifactor/client.rb +9 -0
  213. data/lib/auth0/users/organizations/client.rb +9 -1
  214. data/lib/auth0/users/permissions/client.rb +27 -1
  215. data/lib/auth0/users/refresh_token/client.rb +12 -1
  216. data/lib/auth0/users/risk_assessments/client.rb +7 -0
  217. data/lib/auth0/users/roles/client.rb +21 -1
  218. data/lib/auth0/users/sessions/client.rb +12 -1
  219. data/lib/auth0/verifiable_credentials/verification/templates/client.rb +32 -4
  220. data/lib/auth0/version.rb +1 -1
  221. data/lib/auth0.rb +46 -16
  222. data/wiremock/wiremock-mappings.json +333 -191
  223. metadata +40 -10
  224. data/lib/auth0/organization_templates/client.rb +0 -220
  225. data/lib/auth0/organization_templates/types/create_organization_template_request_content.rb +0 -35
  226. data/lib/auth0/organization_templates/types/list_organization_templates_request_parameters.rb +0 -13
  227. data/lib/auth0/organization_templates/types/list_template_organizations_request_parameters.rb +0 -15
  228. data/lib/auth0/organization_templates/types/update_organization_template_request_content.rb +0 -37
  229. data/lib/auth0/types/list_organization_templates_paginated_response_content.rb +0 -11
  230. data/lib/auth0/types/organization_template_assigned_organization.rb +0 -10
@@ -29,6 +29,19 @@ module Auth0
29
29
  # @option params [String, nil] :from
30
30
  # @option params [Integer, nil] :take
31
31
  #
32
+ # @example
33
+ # client.groups.list(
34
+ # connection_id: "connection_id",
35
+ # name: "name",
36
+ # external_id: "external_id",
37
+ # search: "search",
38
+ # fields: "fields",
39
+ # include_fields: true,
40
+ # include_totals: true,
41
+ # from: "from",
42
+ # take: 1
43
+ # )
44
+ #
32
45
  # @return [Auth0::Types::ListGroupsPaginatedResponseContent]
33
46
  def list(request_options: {}, **params)
34
47
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -63,7 +76,7 @@ module Auth0
63
76
  end
64
77
  code = response.code.to_i
65
78
  if code.between?(200, 299)
66
- parsed_response = Auth0::Types::ListGroupsPaginatedResponseContent.load(response.body)
79
+ parsed_response = (response.body.to_s.empty? ? nil : Auth0::Types::ListGroupsPaginatedResponseContent.load(response.body))
67
80
  [parsed_response, response]
68
81
  else
69
82
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
@@ -83,6 +96,9 @@ module Auth0
83
96
  # @option request_options [Integer] :timeout_in_seconds
84
97
  # @option params [String] :id
85
98
  #
99
+ # @example
100
+ # client.groups.get(id: "id")
101
+ #
86
102
  # @return [Auth0::Types::GetGroupResponseContent]
87
103
  def get(request_options: {}, **params)
88
104
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -99,7 +115,7 @@ module Auth0
99
115
  end
100
116
  code = response.code.to_i
101
117
  if code.between?(200, 299)
102
- Auth0::Types::GetGroupResponseContent.load(response.body)
118
+ (response.body.to_s.empty? ? nil : Auth0::Types::GetGroupResponseContent.load(response.body))
103
119
  else
104
120
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
105
121
  raise error_class.new(response.body, code: code)
@@ -117,6 +133,9 @@ module Auth0
117
133
  # @option request_options [Integer] :timeout_in_seconds
118
134
  # @option params [String] :id
119
135
  #
136
+ # @example
137
+ # client.groups.delete(id: "id")
138
+ #
120
139
  # @return [untyped]
121
140
  def delete(request_options: {}, **params)
122
141
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -26,6 +26,15 @@ module Auth0
26
26
  # @option params [String, nil] :from
27
27
  # @option params [Integer, nil] :take
28
28
  #
29
+ # @example
30
+ # client.groups.members.get(
31
+ # id: "id",
32
+ # fields: "fields",
33
+ # include_fields: true,
34
+ # from: "from",
35
+ # take: 1
36
+ # )
37
+ #
29
38
  # @return [Auth0::Types::GetGroupMembersResponseContent]
30
39
  def get(request_options: {}, **params)
31
40
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -55,7 +64,7 @@ module Auth0
55
64
  end
56
65
  code = response.code.to_i
57
66
  if code.between?(200, 299)
58
- parsed_response = Auth0::Types::GetGroupMembersResponseContent.load(response.body)
67
+ parsed_response = (response.body.to_s.empty? ? nil : Auth0::Types::GetGroupMembersResponseContent.load(response.body))
59
68
  [parsed_response, response]
60
69
  else
61
70
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
@@ -24,6 +24,13 @@ module Auth0
24
24
  # @option params [String, nil] :from
25
25
  # @option params [Integer, nil] :take
26
26
  #
27
+ # @example
28
+ # client.groups.roles.list(
29
+ # id: "id",
30
+ # from: "from",
31
+ # take: 1
32
+ # )
33
+ #
27
34
  # @return [Auth0::Types::ListGroupRolesResponseContent]
28
35
  def list(request_options: {}, **params)
29
36
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -51,7 +58,7 @@ module Auth0
51
58
  end
52
59
  code = response.code.to_i
53
60
  if code.between?(200, 299)
54
- parsed_response = Auth0::Types::ListGroupRolesResponseContent.load(response.body)
61
+ parsed_response = (response.body.to_s.empty? ? nil : Auth0::Types::ListGroupRolesResponseContent.load(response.body))
55
62
  [parsed_response, response]
56
63
  else
57
64
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
@@ -71,6 +78,12 @@ module Auth0
71
78
  # @option request_options [Integer] :timeout_in_seconds
72
79
  # @option params [String] :id
73
80
  #
81
+ # @example
82
+ # client.groups.roles.create(
83
+ # id: "id",
84
+ # roles: ["roles"]
85
+ # )
86
+ #
74
87
  # @return [untyped]
75
88
  def create(request_options: {}, **params)
76
89
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -108,6 +121,12 @@ module Auth0
108
121
  # @option request_options [Integer] :timeout_in_seconds
109
122
  # @option params [String] :id
110
123
  #
124
+ # @example
125
+ # client.groups.roles.delete(
126
+ # id: "id",
127
+ # roles: ["roles"]
128
+ # )
129
+ #
111
130
  # @return [untyped]
112
131
  def delete(request_options: {}, **params)
113
132
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -10,6 +10,83 @@ module Auth0
10
10
  @client = client
11
11
  end
12
12
 
13
+ # TODO: Link this endpoint to relevant documentation when available.
14
+ #
15
+ # @param request_options [Hash]
16
+ # @param _params [Hash]
17
+ # @option request_options [String] :base_url
18
+ # @option request_options [Hash{String => Object}] :additional_headers
19
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
20
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
21
+ # @option request_options [Integer] :timeout_in_seconds
22
+ #
23
+ # @example
24
+ # client.guardian.get
25
+ #
26
+ # @return [Auth0::Types::GetGuardianSettingsResponseContent]
27
+ def get(request_options: {}, **_params)
28
+ request = Auth0::Internal::JSON::Request.new(
29
+ base_url: request_options[:base_url],
30
+ method: "GET",
31
+ path: "guardian/settings",
32
+ request_options: request_options
33
+ )
34
+ begin
35
+ response = @client.send(request)
36
+ rescue Net::HTTPRequestTimeout
37
+ raise Auth0::Errors::TimeoutError
38
+ end
39
+ code = response.code.to_i
40
+ if code.between?(200, 299)
41
+ (response.body.to_s.empty? ? nil : Auth0::Types::GetGuardianSettingsResponseContent.load(response.body))
42
+ else
43
+ error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
44
+ raise error_class.new(response.body, code: code)
45
+ end
46
+ end
47
+
48
+ # Update a tenant's guardian settings such as Remember Me
49
+ #
50
+ # @param request_options [Hash]
51
+ # @param params [Auth0::Guardian::Types::SetGuardianSettingsRequestContent]
52
+ # @option request_options [String] :base_url
53
+ # @option request_options [Hash{String => Object}] :additional_headers
54
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
55
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
56
+ # @option request_options [Integer] :timeout_in_seconds
57
+ #
58
+ # @example
59
+ # client.guardian.set(
60
+ # display_remember_me_checkbox: true,
61
+ # remember_me_default_value: true,
62
+ # mfa_session_inactivity_timeout: 1,
63
+ # mfa_session_overall_timeout: 1
64
+ # )
65
+ #
66
+ # @return [Auth0::Types::SetGuardianSettingsResponseContent]
67
+ def set(request_options: {}, **params)
68
+ params = Auth0::Internal::Types::Utils.normalize_keys(params)
69
+ request = Auth0::Internal::JSON::Request.new(
70
+ base_url: request_options[:base_url],
71
+ method: "PUT",
72
+ path: "guardian/settings",
73
+ body: Auth0::Guardian::Types::SetGuardianSettingsRequestContent.new(params).to_h,
74
+ request_options: request_options
75
+ )
76
+ begin
77
+ response = @client.send(request)
78
+ rescue Net::HTTPRequestTimeout
79
+ raise Auth0::Errors::TimeoutError
80
+ end
81
+ code = response.code.to_i
82
+ if code.between?(200, 299)
83
+ (response.body.to_s.empty? ? nil : Auth0::Types::SetGuardianSettingsResponseContent.load(response.body))
84
+ else
85
+ error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
86
+ raise error_class.new(response.body, code: code)
87
+ end
88
+ end
89
+
13
90
  # @return [Auth0::Enrollments::Client]
14
91
  def enrollments
15
92
  @enrollments ||= Auth0::Guardian::Enrollments::Client.new(client: @client)
@@ -24,6 +24,9 @@ module Auth0
24
24
  # @option request_options [Hash{String => Object}] :additional_body_parameters
25
25
  # @option request_options [Integer] :timeout_in_seconds
26
26
  #
27
+ # @example
28
+ # client.guardian.enrollments.create_ticket(user_id: "user_id")
29
+ #
27
30
  # @return [Auth0::Types::CreateGuardianEnrollmentTicketResponseContent]
28
31
  def create_ticket(request_options: {}, **params)
29
32
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -41,7 +44,7 @@ module Auth0
41
44
  end
42
45
  code = response.code.to_i
43
46
  if code.between?(200, 299)
44
- Auth0::Types::CreateGuardianEnrollmentTicketResponseContent.load(response.body)
47
+ (response.body.to_s.empty? ? nil : Auth0::Types::CreateGuardianEnrollmentTicketResponseContent.load(response.body))
45
48
  else
46
49
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
47
50
  raise error_class.new(response.body, code: code)
@@ -60,6 +63,9 @@ module Auth0
60
63
  # @option request_options [Integer] :timeout_in_seconds
61
64
  # @option params [String] :id
62
65
  #
66
+ # @example
67
+ # client.guardian.enrollments.get(id: "id")
68
+ #
63
69
  # @return [Auth0::Types::GetGuardianEnrollmentResponseContent]
64
70
  def get(request_options: {}, **params)
65
71
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -76,7 +82,7 @@ module Auth0
76
82
  end
77
83
  code = response.code.to_i
78
84
  if code.between?(200, 299)
79
- Auth0::Types::GetGuardianEnrollmentResponseContent.load(response.body)
85
+ (response.body.to_s.empty? ? nil : Auth0::Types::GetGuardianEnrollmentResponseContent.load(response.body))
80
86
  else
81
87
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
82
88
  raise error_class.new(response.body, code: code)
@@ -96,6 +102,9 @@ module Auth0
96
102
  # @option request_options [Integer] :timeout_in_seconds
97
103
  # @option params [String] :id
98
104
  #
105
+ # @example
106
+ # client.guardian.enrollments.delete(id: "id")
107
+ #
99
108
  # @return [untyped]
100
109
  def delete(request_options: {}, **params)
101
110
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -23,6 +23,9 @@ module Auth0
23
23
  # @option request_options [Hash{String => Object}] :additional_body_parameters
24
24
  # @option request_options [Integer] :timeout_in_seconds
25
25
  #
26
+ # @example
27
+ # client.guardian.factors.list
28
+ #
26
29
  # @return [Array[Auth0::Types::GuardianFactor]]
27
30
  def list(request_options: {}, **_params)
28
31
  request = Auth0::Internal::JSON::Request.new(
@@ -37,10 +40,12 @@ module Auth0
37
40
  raise Auth0::Errors::TimeoutError
38
41
  end
39
42
  code = response.code.to_i
40
- return if code.between?(200, 299)
41
-
42
- error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
43
- raise error_class.new(response.body, code: code)
43
+ if code.between?(200, 299)
44
+ Auth0::Internal::Types::Utils.coerce(Internal::Types::Array[Auth0::Types::GuardianFactor], (response.body.to_s.empty? ? nil : JSON.parse(response.body, symbolize_names: true)))
45
+ else
46
+ error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
47
+ raise error_class.new(response.body, code: code)
48
+ end
44
49
  end
45
50
 
46
51
  # Update the status (i.e., enabled or disabled) of a specific multi-factor authentication factor.
@@ -54,6 +59,12 @@ module Auth0
54
59
  # @option request_options [Integer] :timeout_in_seconds
55
60
  # @option params [Auth0::Types::GuardianFactorNameEnum] :name
56
61
  #
62
+ # @example
63
+ # client.guardian.factors.set(
64
+ # name: "push-notification",
65
+ # enabled: true
66
+ # )
67
+ #
57
68
  # @return [Auth0::Types::SetGuardianFactorResponseContent]
58
69
  def set(request_options: {}, **params)
59
70
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -75,13 +86,18 @@ module Auth0
75
86
  end
76
87
  code = response.code.to_i
77
88
  if code.between?(200, 299)
78
- Auth0::Types::SetGuardianFactorResponseContent.load(response.body)
89
+ (response.body.to_s.empty? ? nil : Auth0::Types::SetGuardianFactorResponseContent.load(response.body))
79
90
  else
80
91
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
81
92
  raise error_class.new(response.body, code: code)
82
93
  end
83
94
  end
84
95
 
96
+ # @return [Auth0::Email::Client]
97
+ def email
98
+ @email ||= Auth0::Guardian::Factors::Email::Client.new(client: @client)
99
+ end
100
+
85
101
  # @return [Auth0::Phone::Client]
86
102
  def phone
87
103
  @phone ||= Auth0::Guardian::Factors::Phone::Client.new(client: @client)
@@ -23,6 +23,9 @@ module Auth0
23
23
  # @option request_options [Hash{String => Object}] :additional_body_parameters
24
24
  # @option request_options [Integer] :timeout_in_seconds
25
25
  #
26
+ # @example
27
+ # client.guardian.factors.duo.settings.get
28
+ #
26
29
  # @return [Auth0::Types::GetGuardianFactorDuoSettingsResponseContent]
27
30
  def get(request_options: {}, **_params)
28
31
  request = Auth0::Internal::JSON::Request.new(
@@ -38,7 +41,7 @@ module Auth0
38
41
  end
39
42
  code = response.code.to_i
40
43
  if code.between?(200, 299)
41
- Auth0::Types::GetGuardianFactorDuoSettingsResponseContent.load(response.body)
44
+ (response.body.to_s.empty? ? nil : Auth0::Types::GetGuardianFactorDuoSettingsResponseContent.load(response.body))
42
45
  else
43
46
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
44
47
  raise error_class.new(response.body, code: code)
@@ -55,6 +58,9 @@ module Auth0
55
58
  # @option request_options [Hash{String => Object}] :additional_body_parameters
56
59
  # @option request_options [Integer] :timeout_in_seconds
57
60
  #
61
+ # @example
62
+ # client.guardian.factors.duo.settings.set
63
+ #
58
64
  # @return [Auth0::Types::SetGuardianFactorDuoSettingsResponseContent]
59
65
  def set(request_options: {}, **params)
60
66
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -72,7 +78,7 @@ module Auth0
72
78
  end
73
79
  code = response.code.to_i
74
80
  if code.between?(200, 299)
75
- Auth0::Types::SetGuardianFactorDuoSettingsResponseContent.load(response.body)
81
+ (response.body.to_s.empty? ? nil : Auth0::Types::SetGuardianFactorDuoSettingsResponseContent.load(response.body))
76
82
  else
77
83
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
78
84
  raise error_class.new(response.body, code: code)
@@ -87,6 +93,9 @@ module Auth0
87
93
  # @option request_options [Hash{String => Object}] :additional_body_parameters
88
94
  # @option request_options [Integer] :timeout_in_seconds
89
95
  #
96
+ # @example
97
+ # client.guardian.factors.duo.settings.update
98
+ #
90
99
  # @return [Auth0::Types::UpdateGuardianFactorDuoSettingsResponseContent]
91
100
  def update(request_options: {}, **params)
92
101
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
@@ -104,7 +113,7 @@ module Auth0
104
113
  end
105
114
  code = response.code.to_i
106
115
  if code.between?(200, 299)
107
- Auth0::Types::UpdateGuardianFactorDuoSettingsResponseContent.load(response.body)
116
+ (response.body.to_s.empty? ? nil : Auth0::Types::UpdateGuardianFactorDuoSettingsResponseContent.load(response.body))
108
117
  else
109
118
  error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
110
119
  raise error_class.new(response.body, code: code)
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Auth0
4
+ module Guardian
5
+ module Factors
6
+ module Email
7
+ class Client
8
+ # @param client [Auth0::Internal::Http::RawClient]
9
+ #
10
+ # @return [void]
11
+ def initialize(client:)
12
+ @client = client
13
+ end
14
+
15
+ # TODO: Link this endpoint to relevant documentation when available.
16
+ #
17
+ # @param request_options [Hash]
18
+ # @param _params [Hash]
19
+ # @option request_options [String] :base_url
20
+ # @option request_options [Hash{String => Object}] :additional_headers
21
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
22
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
23
+ # @option request_options [Integer] :timeout_in_seconds
24
+ #
25
+ # @example
26
+ # client.guardian.factors.email.get
27
+ #
28
+ # @return [Auth0::Types::GetEmailFactorSettingsResponseContent]
29
+ def get(request_options: {}, **_params)
30
+ request = Auth0::Internal::JSON::Request.new(
31
+ base_url: request_options[:base_url],
32
+ method: "GET",
33
+ path: "guardian/factors/email/settings",
34
+ request_options: request_options
35
+ )
36
+ begin
37
+ response = @client.send(request)
38
+ rescue Net::HTTPRequestTimeout
39
+ raise Auth0::Errors::TimeoutError
40
+ end
41
+ code = response.code.to_i
42
+ if code.between?(200, 299)
43
+ (response.body.to_s.empty? ? nil : Auth0::Types::GetEmailFactorSettingsResponseContent.load(response.body))
44
+ else
45
+ error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
46
+ raise error_class.new(response.body, code: code)
47
+ end
48
+ end
49
+
50
+ # TODO: Link this endpoint to relevant documentation when available.
51
+ #
52
+ # @param request_options [Hash]
53
+ # @param params [Auth0::Guardian::Factors::Email::Types::SetEmailFactorSettingsRequestContent]
54
+ # @option request_options [String] :base_url
55
+ # @option request_options [Hash{String => Object}] :additional_headers
56
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
57
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
58
+ # @option request_options [Integer] :timeout_in_seconds
59
+ #
60
+ # @example
61
+ # client.guardian.factors.email.set(
62
+ # otp_length: 1,
63
+ # otp_expiration_time: 1
64
+ # )
65
+ #
66
+ # @return [Auth0::Types::SetEmailFactorSettingsResponseContent]
67
+ def set(request_options: {}, **params)
68
+ params = Auth0::Internal::Types::Utils.normalize_keys(params)
69
+ request = Auth0::Internal::JSON::Request.new(
70
+ base_url: request_options[:base_url],
71
+ method: "PUT",
72
+ path: "guardian/factors/email/settings",
73
+ body: Auth0::Guardian::Factors::Email::Types::SetEmailFactorSettingsRequestContent.new(params).to_h,
74
+ request_options: request_options
75
+ )
76
+ begin
77
+ response = @client.send(request)
78
+ rescue Net::HTTPRequestTimeout
79
+ raise Auth0::Errors::TimeoutError
80
+ end
81
+ code = response.code.to_i
82
+ if code.between?(200, 299)
83
+ (response.body.to_s.empty? ? nil : Auth0::Types::SetEmailFactorSettingsResponseContent.load(response.body))
84
+ else
85
+ error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
86
+ raise error_class.new(response.body, code: code)
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Auth0
4
+ module Guardian
5
+ module Factors
6
+ module Email
7
+ module Types
8
+ class SetEmailFactorSettingsRequestContent < Internal::Types::Model
9
+ field :otp_length, -> { Integer }, optional: false, nullable: false
10
+
11
+ field :otp_expiration_time, -> { Integer }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end