auth0 2.42.0 → 2.43.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 (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +4 -6
  3. package/src/Auth0RestClient.js +32 -2
  4. package/src/management/ActionsManager.js +12 -73
  5. package/src/management/AttackProtectionManager.js +8 -37
  6. package/src/management/BaseManager.js +40 -0
  7. package/src/management/BlacklistedTokensManager.js +4 -32
  8. package/src/management/BrandingManager.js +6 -39
  9. package/src/management/ClientGrantsManager.js +4 -32
  10. package/src/management/ClientsManager.js +5 -37
  11. package/src/management/ConnectionsManager.js +6 -42
  12. package/src/management/CustomDomainsManager.js +5 -37
  13. package/src/management/DeviceCredentialsManager.js +4 -26
  14. package/src/management/EmailProviderManager.js +4 -32
  15. package/src/management/EmailTemplatesManager.js +4 -27
  16. package/src/management/GrantsManager.js +4 -32
  17. package/src/management/GuardianManager.js +13 -86
  18. package/src/management/HooksManager.js +5 -36
  19. package/src/management/JobsManager.js +6 -38
  20. package/src/management/LogStreamsManager.js +4 -31
  21. package/src/management/LogsManager.js +4 -31
  22. package/src/management/MigrationsManager.js +4 -27
  23. package/src/management/OrganizationsManager.js +14 -65
  24. package/src/management/PromptsManager.js +5 -35
  25. package/src/management/ResourceServersManager.js +4 -31
  26. package/src/management/RolesManager.js +6 -42
  27. package/src/management/RulesConfigsManager.js +4 -31
  28. package/src/management/RulesManager.js +4 -31
  29. package/src/management/StatsManager.js +4 -27
  30. package/src/management/TenantManager.js +4 -27
  31. package/src/management/TicketsManager.js +4 -27
  32. package/src/management/UserBlocksManager.js +5 -35
  33. package/src/management/UsersManager.js +16 -91
  34. package/src/management/index.js +2 -0
@@ -1,11 +1,10 @@
1
1
  const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
2
+ const BaseManager = require('./BaseManager');
4
3
 
5
4
  /**
6
5
  * Represents the relationship between Auth0 and an Identity provider.
7
6
  */
8
- class ConnectionsManager {
7
+ class ConnectionsManager extends BaseManager {
9
8
  /**
10
9
  * @param {object} options The client options.
11
10
  * @param {string} options.baseUrl The URL of the API.
@@ -13,27 +12,7 @@ class ConnectionsManager {
13
12
  * @param {object} [options.retry] Retry Policy Config
14
13
  */
15
14
  constructor(options) {
16
- if (options === null || typeof options !== 'object') {
17
- throw new ArgumentError('Must provide client options');
18
- }
19
-
20
- if (options.baseUrl === null || options.baseUrl === undefined) {
21
- throw new ArgumentError('Must provide a base URL for the API');
22
- }
23
-
24
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
25
- throw new ArgumentError('The provided base URL is invalid');
26
- }
27
-
28
- /**
29
- * Options object for the Rest Client instance.
30
- *
31
- * @type {object}
32
- */
33
- const clientOptions = {
34
- headers: options.headers,
35
- query: { repeatParams: false },
36
- };
15
+ super(options);
37
16
 
38
17
  /**
39
18
  * Provides an abstraction layer for performing CRUD operations on
@@ -42,19 +21,9 @@ class ConnectionsManager {
42
21
  *
43
22
  * @type {external:RestClient}
44
23
  */
45
- const auth0RestClient = new Auth0RestClient(
46
- `${options.baseUrl}/connections/:id`,
47
- clientOptions,
48
- options.tokenProvider
49
- );
50
- this.resource = new RetryRestClient(auth0RestClient, options.retry);
24
+ this.resource = this._getRestClient('/connections/:id');
51
25
 
52
- const statusClient = new Auth0RestClient(
53
- `${options.baseUrl}/connections/:id/status`,
54
- clientOptions,
55
- options.tokenProvider
56
- );
57
- this.status = new RetryRestClient(statusClient, options.retry);
26
+ this.status = this._getRestClient('/connections/:id/status');
58
27
 
59
28
  /**
60
29
  * Provides an abstraction layer for consuming the
@@ -63,12 +32,7 @@ class ConnectionsManager {
63
32
  *
64
33
  * @type {external:RestClient}
65
34
  */
66
- const userAuth0RestClient = new Auth0RestClient(
67
- `${options.baseUrl}/connections/:id/users`,
68
- clientOptions,
69
- options.tokenProvider
70
- );
71
- this.user = new RetryRestClient(userAuth0RestClient, options.retry);
35
+ this.user = this._getRestClient('/connections/:id/users');
72
36
  }
73
37
 
74
38
  /**
@@ -1,6 +1,5 @@
1
1
  const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
2
+ const BaseManager = require('./BaseManager');
4
3
 
5
4
  /**
6
5
  * Auth0 Custom Domains Manager.
@@ -11,7 +10,7 @@ const RetryRestClient = require('../RetryRestClient');
11
10
  * {@link https://auth0.com/docs/custom-domains CustomDomains} section of the
12
11
  * documentation.
13
12
  */
14
- class CustomDomainsManager {
13
+ class CustomDomainsManager extends BaseManager {
15
14
  /**
16
15
  * @param {object} options The client options.
17
16
  * @param {string} options.baseUrl The URL of the API.
@@ -19,28 +18,7 @@ class CustomDomainsManager {
19
18
  * @param {object} [options.retry] Retry Policy Config
20
19
  */
21
20
  constructor(options) {
22
- if (options === null || typeof options !== 'object') {
23
- throw new ArgumentError('Must provide manager options');
24
- }
25
-
26
- if (options.baseUrl === null || options.baseUrl === undefined) {
27
- throw new ArgumentError('Must provide a base URL for the API');
28
- }
29
-
30
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
31
- throw new ArgumentError('The provided base URL is invalid');
32
- }
33
-
34
- /**
35
- * Options object for the Rest Client instance.
36
- *
37
- * @type {object}
38
- */
39
- const clientOptions = {
40
- errorFormatter: { message: 'message', name: 'error' },
41
- headers: options.headers,
42
- query: { repeatParams: false },
43
- };
21
+ super(options);
44
22
 
45
23
  /**
46
24
  * Provides an abstraction layer for consuming the
@@ -48,12 +26,7 @@ class CustomDomainsManager {
48
26
  *
49
27
  * @type {external:RestClient}
50
28
  */
51
- const auth0CustomDomainsRestClient = new Auth0RestClient(
52
- `${options.baseUrl}/custom-domains/:id`,
53
- clientOptions,
54
- options.tokenProvider
55
- );
56
- this.resource = new RetryRestClient(auth0CustomDomainsRestClient, options.retry);
29
+ this.resource = this._getRestClient('/custom-domains/:id');
57
30
 
58
31
  /**
59
32
  * Provides an abstraction layer for consuming the
@@ -61,12 +34,7 @@ class CustomDomainsManager {
61
34
  *
62
35
  * @type {external:RestClient}
63
36
  */
64
- const auth0VerifyRestClient = new Auth0RestClient(
65
- `${options.baseUrl}/custom-domains/:id/verify`,
66
- clientOptions,
67
- options.tokenProvider
68
- );
69
- this.vefifyResource = new RetryRestClient(auth0VerifyRestClient, options.retry);
37
+ this.vefifyResource = this._getRestClient('/custom-domains/:id/verify');
70
38
  }
71
39
 
72
40
  /**
@@ -1,11 +1,9 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
1
+ const BaseManager = require('./BaseManager');
4
2
 
5
3
  /**
6
4
  * Manages Auth0 Device Credentials.
7
5
  */
8
- class DeviceCredentialsManager {
6
+ class DeviceCredentialsManager extends BaseManager {
9
7
  /**
10
8
  * @param {object} options The client options.
11
9
  * @param {string} options.baseUrl The URL of the API.
@@ -13,28 +11,13 @@ class DeviceCredentialsManager {
13
11
  * @param {object} [options.retry] Retry Policy Config
14
12
  */
15
13
  constructor(options) {
16
- if (options === null || typeof options !== 'object') {
17
- throw new ArgumentError('Must provide manager options');
18
- }
19
-
20
- if (options.baseUrl === null || options.baseUrl === undefined) {
21
- throw new ArgumentError('Must provide a base URL for the API');
22
- }
23
-
24
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
25
- throw new ArgumentError('The provided base URL is invalid');
26
- }
14
+ super(options);
27
15
 
28
16
  /**
29
17
  * Options object for the RestClient instance.
30
18
  *
31
19
  * @type {object}
32
20
  */
33
- const clientOptions = {
34
- errorFormatter: { message: 'message', name: 'error' },
35
- headers: options.headers,
36
- query: { repeatParams: false },
37
- };
38
21
 
39
22
  /**
40
23
  * Provides an abstraction layer for consuming the
@@ -43,12 +26,7 @@ class DeviceCredentialsManager {
43
26
  *
44
27
  * @type {external:RestClient}
45
28
  */
46
- const auth0RestClient = new Auth0RestClient(
47
- `${options.baseUrl}/device-credentials/:id`,
48
- clientOptions,
49
- options.tokenProvider
50
- );
51
- this.resource = new RetryRestClient(auth0RestClient, options.retry);
29
+ this.resource = this._getRestClient('/device-credentials/:id');
52
30
  }
53
31
 
54
32
  /**
@@ -1,11 +1,9 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
1
+ const BaseManager = require('./BaseManager');
4
2
 
5
3
  /**
6
4
  * Auth0 Email Provider.
7
5
  */
8
- class EmailProviderManager {
6
+ class EmailProviderManager extends BaseManager {
9
7
  /**
10
8
  * @param {object} options The client options.
11
9
  * @param {string} options.baseUrl The URL of the API.
@@ -13,28 +11,7 @@ class EmailProviderManager {
13
11
  * @param {object} [options.retry] Retry Policy Config
14
12
  */
15
13
  constructor(options) {
16
- if (options === null || typeof options !== 'object') {
17
- throw new ArgumentError('Must provide client options');
18
- }
19
-
20
- if (options.baseUrl === null || options.baseUrl === undefined) {
21
- throw new ArgumentError('Must provide a base URL for the API');
22
- }
23
-
24
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
25
- throw new ArgumentError('The provided base URL is invalid');
26
- }
27
-
28
- /**
29
- * Options object for the Rest Client instance.
30
- *
31
- * @type {object}
32
- */
33
- const clientOptions = {
34
- errorFormatter: { message: 'message', name: 'error' },
35
- headers: options.headers,
36
- query: { repeatParams: false },
37
- };
14
+ super(options);
38
15
 
39
16
  /**
40
17
  * Provides an abstraction layer for consuming the
@@ -42,12 +19,7 @@ class EmailProviderManager {
42
19
  *
43
20
  * @type {external:RestClient}
44
21
  */
45
- const auth0RestClient = new Auth0RestClient(
46
- `${options.baseUrl}/emails/provider`,
47
- clientOptions,
48
- options.tokenProvider
49
- );
50
- this.resource = new RetryRestClient(auth0RestClient, options.retry);
22
+ this.resource = this._getRestClient('/emails/provider');
51
23
  }
52
24
 
53
25
  /**
@@ -1,12 +1,10 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
1
+ const BaseManager = require('./BaseManager');
4
2
 
5
3
  /**
6
4
  * This class provides a simple abstraction for performing CRUD operations
7
5
  * on Auth0's Email Templates. {@link https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName}
8
6
  */
9
- class EmailTemplatesManager {
7
+ class EmailTemplatesManager extends BaseManager {
10
8
  /**
11
9
  * @param {object} options The client options.
12
10
  * @param {string} options.baseUrl The URL of the API.
@@ -14,23 +12,7 @@ class EmailTemplatesManager {
14
12
  * @param {object} [options.retry] Retry Policy Config
15
13
  */
16
14
  constructor(options) {
17
- if (!options || 'object' !== typeof options) {
18
- throw new ArgumentError('Must provide manager options');
19
- }
20
-
21
- if (!options.baseUrl || 'string' !== typeof options.baseUrl) {
22
- throw new ArgumentError('Must provide a valid string as base URL for the API');
23
- }
24
-
25
- /**
26
- * Options object for the Rest Client instance.
27
- *
28
- * @type {object}
29
- */
30
- const clientOptions = {
31
- headers: options.headers,
32
- query: { repeatParams: false },
33
- };
15
+ super(options);
34
16
 
35
17
  /**
36
18
  * Provides an abstraction layer for performing CRUD operations on
@@ -38,12 +20,7 @@ class EmailTemplatesManager {
38
20
  *
39
21
  * @type {external:RestClient}
40
22
  */
41
- const auth0RestClient = new Auth0RestClient(
42
- `${options.baseUrl}/email-templates/:name`,
43
- clientOptions,
44
- options.tokenProvider
45
- );
46
- this.resource = new RetryRestClient(auth0RestClient, options.retry);
23
+ this.resource = this._getRestClient('/email-templates/:name');
47
24
  }
48
25
 
49
26
  /**
@@ -1,13 +1,11 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
1
+ const BaseManager = require('./BaseManager');
4
2
 
5
3
  /**
6
4
  * Auth0 Grants Manager.
7
5
  *
8
6
  * See {@link https://auth0.com/docs/api/v2#!/Grants Grants}
9
7
  */
10
- class GrantsManager {
8
+ class GrantsManager extends BaseManager {
11
9
  /**
12
10
  * @param {object} options The client options.
13
11
  * @param {string} options.baseUrl The URL of the API.
@@ -15,28 +13,7 @@ class GrantsManager {
15
13
  * @param {object} [options.retry] Retry Policy Config
16
14
  */
17
15
  constructor(options) {
18
- if (options === null || typeof options !== 'object') {
19
- throw new ArgumentError('Must provide client options');
20
- }
21
-
22
- if (options.baseUrl === null || options.baseUrl === undefined) {
23
- throw new ArgumentError('Must provide a base URL for the API');
24
- }
25
-
26
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
27
- throw new ArgumentError('The provided base URL is invalid');
28
- }
29
-
30
- /**
31
- * Options object for the Rest Client instance.
32
- *
33
- * @type {object}
34
- */
35
- const clientOptions = {
36
- errorFormatter: { message: 'message', name: 'error' },
37
- headers: options.headers,
38
- query: { repeatParams: false },
39
- };
16
+ super(options);
40
17
 
41
18
  /**
42
19
  * Provides an abstraction layer for consuming the
@@ -44,12 +21,7 @@ class GrantsManager {
44
21
  *
45
22
  * @type {external:RestClient}
46
23
  */
47
- const auth0RestClient = new Auth0RestClient(
48
- `${options.baseUrl}/grants/:id`,
49
- clientOptions,
50
- options.tokenProvider
51
- );
52
- this.resource = new RetryRestClient(auth0RestClient, options.retry);
24
+ this.resource = this._getRestClient('/grants/:id');
53
25
  }
54
26
 
55
27
  /**
@@ -1,11 +1,9 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
1
+ const BaseManager = require('./BaseManager');
4
2
 
5
3
  /**
6
4
  * Abstracts interaction with the Guardian endpoint.
7
5
  */
8
- class GuardianManager {
6
+ class GuardianManager extends BaseManager {
9
7
  /**
10
8
  * @param {object} options The client options.
11
9
  * @param {string} options.baseUrl The URL of the API.
@@ -13,127 +11,64 @@ class GuardianManager {
13
11
  * @param {object} [options.retry] Retry Policy Config
14
12
  */
15
13
  constructor(options) {
16
- if (options === null || typeof options !== 'object') {
17
- throw new ArgumentError('Must provide manager options');
18
- }
19
-
20
- if (options.baseUrl === null || options.baseUrl === undefined) {
21
- throw new ArgumentError('Must provide a base URL for the API');
22
- }
23
-
24
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
25
- throw new ArgumentError('The provided base URL is invalid');
26
- }
27
-
28
- const clientOptions = {
29
- errorFormatter: { message: 'message', name: 'error' },
30
- headers: options.headers,
31
- query: { repeatParams: false },
32
- };
14
+ super(options);
33
15
 
34
16
  /**
35
17
  * Provides an abstraction layer for retrieving Guardian enrollments.
36
18
  *
37
19
  * @type {external:RestClient}
38
20
  */
39
- const guardianEnrollmentsAuth0RestClient = new Auth0RestClient(
40
- `${options.baseUrl}/guardian/enrollments/:id`,
41
- clientOptions,
42
- options.tokenProvider
43
- );
44
- this.enrollments = new RetryRestClient(guardianEnrollmentsAuth0RestClient, options.retry);
21
+ this.enrollments = this._getRestClient('/guardian/enrollments/:id');
45
22
 
46
23
  /**
47
24
  * Provides an abstraction layer for retrieving Guardian tickets.
48
25
  *
49
26
  * @type {external:RestClient}
50
27
  */
51
- const guardianTicketsAuth0RestClient = new Auth0RestClient(
52
- `${options.baseUrl}/guardian/enrollments/ticket`,
53
- clientOptions,
54
- options.tokenProvider
55
- );
56
- this.tickets = new RetryRestClient(guardianTicketsAuth0RestClient, options.retry);
28
+ this.tickets = this._getRestClient('/guardian/enrollments/ticket');
57
29
 
58
30
  /**
59
31
  * Provides an abstraction layer for retrieving Guardian factors.
60
32
  *
61
33
  * @type {external:RestClient}
62
34
  */
63
- const guardianFactorsAuth0RestClient = new Auth0RestClient(
64
- `${options.baseUrl}/guardian/factors/:name`,
65
- clientOptions,
66
- options.tokenProvider
67
- );
68
- this.factors = new RetryRestClient(guardianFactorsAuth0RestClient, options.retry);
35
+ this.factors = this._getRestClient('/guardian/factors/:name');
69
36
 
70
37
  /**
71
38
  * Provides an abstraction layer for configuring Factor settings
72
39
  *
73
40
  * @type {external:RestClient}
74
41
  */
75
- const guardianFactorSettingsAuth0RestClient = new Auth0RestClient(
76
- `${options.baseUrl}/guardian/factors/:name/settings`,
77
- clientOptions,
78
- options.tokenProvider
79
- );
80
- this.factorSettings = new RetryRestClient(guardianFactorSettingsAuth0RestClient, options.retry);
42
+ this.factorSettings = this._getRestClient('/guardian/factors/:name/settings');
81
43
 
82
44
  /**
83
45
  * Provides an abstraction layer for retrieving Guardian factor templates.
84
46
  *
85
47
  * @type {external:RestClient}
86
48
  */
87
- const guardianFactorsTemplatesAuth0RestClient = new Auth0RestClient(
88
- `${options.baseUrl}/guardian/factors/:name/templates`,
89
- clientOptions,
90
- options.tokenProvider
91
- );
92
- this.factorsTemplates = new RetryRestClient(
93
- guardianFactorsTemplatesAuth0RestClient,
94
- options.retry
95
- );
49
+ this.factorsTemplates = this._getRestClient('/guardian/factors/:name/templates');
96
50
 
97
51
  /**
98
52
  * Provides an abstraction layer for retrieving Guardian factor providers.
99
53
  *
100
54
  * @type {external:RestClient}
101
55
  */
102
- const guardianFactorsProvidersAuth0RestClient = new Auth0RestClient(
103
- `${options.baseUrl}/guardian/factors/:name/providers/:provider`,
104
- clientOptions,
105
- options.tokenProvider
106
- );
107
- this.factorsProviders = new RetryRestClient(
108
- guardianFactorsProvidersAuth0RestClient,
109
- options.retry
110
- );
56
+ this.factorsProviders = this._getRestClient('/guardian/factors/:name/providers/:provider');
111
57
 
112
58
  /**
113
59
  * Provides an abstraction layer for retrieving Guardian policies.
114
60
  *
115
61
  * @type {external:RestClient}
116
62
  */
117
- const guardianPoliciesAuth0RestClient = new Auth0RestClient(
118
- `${options.baseUrl}/guardian/policies`,
119
- clientOptions,
120
- options.tokenProvider
121
- );
122
- this.policies = new RetryRestClient(guardianPoliciesAuth0RestClient, options.retry);
63
+ this.policies = this._getRestClient('/guardian/policies');
123
64
 
124
65
  /**
125
66
  * Provides an abstraction layer for retrieving Guardian phone factor selected provider.
126
67
  *
127
68
  * @type {external:RestClient}
128
69
  */
129
- const guardianFactorsPhoneSelectedProviderAuth0RestClient = new Auth0RestClient(
130
- `${options.baseUrl}/guardian/factors/sms/selected-provider`,
131
- clientOptions,
132
- options.tokenProvider
133
- );
134
- this.factorsPhoneSelectedProvider = new RetryRestClient(
135
- guardianFactorsPhoneSelectedProviderAuth0RestClient,
136
- options.retry
70
+ this.factorsPhoneSelectedProvider = this._getRestClient(
71
+ '/guardian/factors/sms/selected-provider'
137
72
  );
138
73
 
139
74
  /**
@@ -141,15 +76,7 @@ class GuardianManager {
141
76
  *
142
77
  * @type {external:RestClient}
143
78
  */
144
- const guardianFactorsPhoneMessageTypesAuth0RestClient = new Auth0RestClient(
145
- `${options.baseUrl}/guardian/factors/phone/message-types`,
146
- clientOptions,
147
- options.tokenProvider
148
- );
149
- this.factorsPhoneMessageTypes = new RetryRestClient(
150
- guardianFactorsPhoneMessageTypesAuth0RestClient,
151
- options.retry
152
- );
79
+ this.factorsPhoneMessageTypes = this._getRestClient('/guardian/factors/phone/message-types');
153
80
  }
154
81
 
155
82
  /**
@@ -1,12 +1,11 @@
1
1
  const { ArgumentError } = require('rest-facade');
2
- const Auth0RestClient = require('../Auth0RestClient');
3
- const RetryRestClient = require('../RetryRestClient');
2
+ const BaseManager = require('./BaseManager');
4
3
 
5
4
  /**
6
5
  * The hooks manager class provides a simple abstraction for performing CRUD operations
7
6
  * on Auth0 HooksManagers.
8
7
  */
9
- class HooksManager {
8
+ class HooksManager extends BaseManager {
10
9
  /**
11
10
  * @param {object} options The client options.
12
11
  * @param {string} options.baseUrl The URL of the API.
@@ -14,27 +13,7 @@ class HooksManager {
14
13
  * @param {object} [options.retry] Retry Policy Config
15
14
  */
16
15
  constructor(options) {
17
- if (options === null || typeof options !== 'object') {
18
- throw new ArgumentError('Must provide manager options');
19
- }
20
-
21
- if (options.baseUrl === null || options.baseUrl === undefined) {
22
- throw new ArgumentError('Must provide a base URL for the API');
23
- }
24
-
25
- if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
26
- throw new ArgumentError('The provided base URL is invalid');
27
- }
28
-
29
- /**
30
- * Options object for the Rest Client instance.
31
- *
32
- * @type {object}
33
- */
34
- const clientOptions = {
35
- headers: options.headers,
36
- query: { repeatParams: false },
37
- };
16
+ super(options);
38
17
 
39
18
  /**
40
19
  * Provides an abstraction layer for performing CRUD operations on
@@ -42,19 +21,9 @@ class HooksManager {
42
21
  *
43
22
  * @type {external:RestClient}
44
23
  */
45
- const auth0RestClient = new Auth0RestClient(
46
- `${options.baseUrl}/hooks/:id`,
47
- clientOptions,
48
- options.tokenProvider
49
- );
50
- this.resource = new RetryRestClient(auth0RestClient, options.retry);
24
+ this.resource = this._getRestClient('/hooks/:id');
51
25
 
52
- const hookSecretsClient = new Auth0RestClient(
53
- `${options.baseUrl}/hooks/:id/secrets`,
54
- clientOptions,
55
- options.tokenProvider
56
- );
57
- this.secrets = new RetryRestClient(hookSecretsClient, options.retry);
26
+ this.secrets = this._getRestClient('/hooks/:id/secrets');
58
27
  }
59
28
 
60
29
  /**