auth0 7.1.0 → 7.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 (93) hide show
  1. package/dist/cjs/management/api/requests/requests.d.ts +213 -4
  2. package/dist/cjs/management/api/resources/experimentation/client/Client.d.ts +6 -0
  3. package/dist/cjs/management/api/resources/experimentation/client/Client.js +10 -0
  4. package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.d.ts +133 -0
  5. package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.js +485 -0
  6. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/client/Client.d.ts +126 -0
  7. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/client/Client.js +471 -0
  8. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/exports.d.ts +3 -0
  9. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/exports.js +22 -0
  10. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/index.d.ts +2 -0
  11. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/index.js +18 -0
  12. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/index.d.ts +1 -0
  13. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/index.js +37 -0
  14. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.d.ts +109 -0
  15. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.js +390 -0
  16. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.js +2 -0
  17. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/exports.d.ts +2 -0
  18. package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/exports.js +2 -2
  19. package/dist/cjs/management/api/resources/experimentation/resources/index.d.ts +2 -0
  20. package/dist/cjs/management/api/resources/experimentation/resources/index.js +3 -1
  21. package/dist/cjs/management/api/resources/experimentation/resources/segments/client/Client.d.ts +104 -0
  22. package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/segments}/client/Client.js +205 -39
  23. package/dist/cjs/management/api/resources/experimentation/resources/segments/client/index.js +2 -0
  24. package/dist/cjs/management/api/resources/experimentation/resources/segments/exports.d.ts +2 -0
  25. package/dist/cjs/management/api/resources/experimentation/resources/segments/exports.js +21 -0
  26. package/dist/cjs/management/api/resources/experimentation/resources/segments/index.d.ts +1 -0
  27. package/dist/cjs/management/api/resources/experimentation/resources/segments/index.js +17 -0
  28. package/dist/cjs/management/api/resources/organizations/client/Client.d.ts +0 -3
  29. package/dist/cjs/management/api/resources/organizations/client/Client.js +2 -7
  30. package/dist/cjs/management/api/resources/organizations/resources/index.d.ts +0 -1
  31. package/dist/cjs/management/api/resources/organizations/resources/index.js +1 -2
  32. package/dist/cjs/management/api/resources/users/client/Client.d.ts +8 -10
  33. package/dist/cjs/management/api/resources/users/client/Client.js +8 -10
  34. package/dist/cjs/management/api/types/types.d.ts +568 -91
  35. package/dist/cjs/management/api/types/types.js +113 -50
  36. package/dist/cjs/management/version.d.ts +1 -1
  37. package/dist/cjs/management/version.js +1 -1
  38. package/dist/esm/management/api/requests/requests.d.mts +213 -4
  39. package/dist/esm/management/api/resources/experimentation/client/Client.d.mts +6 -0
  40. package/dist/esm/management/api/resources/experimentation/client/Client.mjs +10 -0
  41. package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.d.mts +133 -0
  42. package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.mjs +485 -0
  43. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/Client.d.mts +126 -0
  44. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/Client.mjs +434 -0
  45. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/index.d.mts +1 -0
  46. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/index.mjs +1 -0
  47. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/exports.d.mts +3 -0
  48. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/exports.mjs +4 -0
  49. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/index.d.mts +2 -0
  50. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/index.mjs +2 -0
  51. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/index.d.mts +1 -0
  52. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/index.mjs +1 -0
  53. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.d.mts +109 -0
  54. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.mjs +353 -0
  55. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.d.mts +1 -0
  56. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.mjs +1 -0
  57. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/exports.d.mts +2 -0
  58. package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/exports.mjs +1 -1
  59. package/dist/esm/management/api/resources/experimentation/resources/index.d.mts +2 -0
  60. package/dist/esm/management/api/resources/experimentation/resources/index.mjs +2 -0
  61. package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.d.mts +104 -0
  62. package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.mjs +361 -0
  63. package/dist/esm/management/api/resources/experimentation/resources/segments/client/index.d.mts +1 -0
  64. package/dist/esm/management/api/resources/experimentation/resources/segments/client/index.mjs +1 -0
  65. package/dist/esm/management/api/resources/experimentation/resources/segments/exports.d.mts +2 -0
  66. package/dist/esm/management/api/resources/experimentation/resources/segments/exports.mjs +3 -0
  67. package/dist/esm/management/api/resources/experimentation/resources/segments/index.d.mts +1 -0
  68. package/dist/esm/management/api/resources/experimentation/resources/segments/index.mjs +1 -0
  69. package/dist/esm/management/api/resources/organizations/client/Client.d.mts +0 -3
  70. package/dist/esm/management/api/resources/organizations/client/Client.mjs +0 -5
  71. package/dist/esm/management/api/resources/organizations/resources/index.d.mts +0 -1
  72. package/dist/esm/management/api/resources/organizations/resources/index.mjs +0 -1
  73. package/dist/esm/management/api/resources/users/client/Client.d.mts +8 -10
  74. package/dist/esm/management/api/resources/users/client/Client.mjs +8 -10
  75. package/dist/esm/management/api/types/types.d.mts +568 -91
  76. package/dist/esm/management/api/types/types.mjs +92 -29
  77. package/dist/esm/management/version.d.mts +1 -1
  78. package/dist/esm/management/version.mjs +1 -1
  79. package/package.json +34 -12
  80. package/reference.md +1635 -220
  81. package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.ts +0 -63
  82. package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.d.ts +0 -2
  83. package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.mts +0 -63
  84. package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.mjs +0 -195
  85. package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.d.mts +0 -2
  86. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags}/client/index.d.ts +0 -0
  87. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags}/client/index.js +0 -0
  88. /package/dist/{esm/management/api/resources/organizations/resources/organizationTemplate/client/index.d.mts → cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.d.ts} +0 -0
  89. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.d.ts +0 -0
  90. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.js +0 -0
  91. /package/dist/{esm/management/api/resources/organizations/resources/organizationTemplate/client/index.mjs → cjs/management/api/resources/experimentation/resources/segments/client/index.d.ts} +0 -0
  92. /package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.d.mts +0 -0
  93. /package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.mjs +0 -0
@@ -0,0 +1,353 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth, } from "../../../../../../../../BaseClient.mjs";
12
+ import * as core from "../../../../../../../../core/index.mjs";
13
+ import { mergeHeaders } from "../../../../../../../../core/headers.mjs";
14
+ import * as environments from "../../../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../../../errors/index.mjs";
17
+ import * as Management from "../../../../../../../index.mjs";
18
+ export class VariationsClient {
19
+ constructor(options) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * Retrieve all variations defined for a specific feature flag.
24
+ *
25
+ * @param {string} id - The ID of the parent feature flag.
26
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link Management.BadRequestError}
29
+ * @throws {@link Management.UnauthorizedError}
30
+ * @throws {@link Management.ForbiddenError}
31
+ * @throws {@link Management.NotFoundError}
32
+ * @throws {@link Management.TooManyRequestsError}
33
+ *
34
+ * @example
35
+ * await client.experimentation.featureFlags.variations.list("id")
36
+ */
37
+ list(id, requestOptions) {
38
+ return core.HttpResponsePromise.fromPromise(this.__list(id, requestOptions));
39
+ }
40
+ __list(id, requestOptions) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
43
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
44
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
45
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
46
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/feature-flags/${core.url.encodePathParam(id)}/variations`),
47
+ method: "GET",
48
+ headers: _headers,
49
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
50
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
51
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
52
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
53
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
54
+ logging: this._options.logging,
55
+ });
56
+ if (_response.ok) {
57
+ return {
58
+ data: _response.body,
59
+ rawResponse: _response.rawResponse,
60
+ };
61
+ }
62
+ if (_response.error.reason === "status-code") {
63
+ switch (_response.error.statusCode) {
64
+ case 400:
65
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
66
+ case 401:
67
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
68
+ case 403:
69
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
70
+ case 404:
71
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
72
+ case 429:
73
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
74
+ default:
75
+ throw new errors.ManagementError({
76
+ statusCode: _response.error.statusCode,
77
+ body: _response.error.body,
78
+ rawResponse: _response.rawResponse,
79
+ });
80
+ }
81
+ }
82
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/experimentation/feature-flags/{id}/variations");
83
+ });
84
+ }
85
+ /**
86
+ * Create a new variation with parameter overrides for a specific feature flag.
87
+ *
88
+ * @param {string} id - The ID of the parent feature flag.
89
+ * @param {Management.CreateVariationRequestContent} request
90
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
91
+ *
92
+ * @throws {@link Management.BadRequestError}
93
+ * @throws {@link Management.UnauthorizedError}
94
+ * @throws {@link Management.ForbiddenError}
95
+ * @throws {@link Management.NotFoundError}
96
+ * @throws {@link Management.ConflictError}
97
+ * @throws {@link Management.TooManyRequestsError}
98
+ *
99
+ * @example
100
+ * await client.experimentation.featureFlags.variations.create("id", {
101
+ * name: "name",
102
+ * overrides: {
103
+ * "key": "value"
104
+ * }
105
+ * })
106
+ */
107
+ create(id, request, requestOptions) {
108
+ return core.HttpResponsePromise.fromPromise(this.__create(id, request, requestOptions));
109
+ }
110
+ __create(id, request, requestOptions) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
113
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
114
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
115
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
116
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/feature-flags/${core.url.encodePathParam(id)}/variations`),
117
+ method: "POST",
118
+ headers: _headers,
119
+ contentType: "application/json",
120
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
121
+ requestType: "json",
122
+ body: request,
123
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
124
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
125
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
126
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
127
+ logging: this._options.logging,
128
+ });
129
+ if (_response.ok) {
130
+ return {
131
+ data: _response.body,
132
+ rawResponse: _response.rawResponse,
133
+ };
134
+ }
135
+ if (_response.error.reason === "status-code") {
136
+ switch (_response.error.statusCode) {
137
+ case 400:
138
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
139
+ case 401:
140
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
141
+ case 403:
142
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
143
+ case 404:
144
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
145
+ case 409:
146
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
147
+ case 429:
148
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
149
+ default:
150
+ throw new errors.ManagementError({
151
+ statusCode: _response.error.statusCode,
152
+ body: _response.error.body,
153
+ rawResponse: _response.rawResponse,
154
+ });
155
+ }
156
+ }
157
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/feature-flags/{id}/variations");
158
+ });
159
+ }
160
+ /**
161
+ * Retrieve a single variation by its ID.
162
+ *
163
+ * @param {string} id - The ID of the parent feature flag.
164
+ * @param {string} vid - The ID of the variation to retrieve.
165
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
166
+ *
167
+ * @throws {@link Management.UnauthorizedError}
168
+ * @throws {@link Management.ForbiddenError}
169
+ * @throws {@link Management.NotFoundError}
170
+ * @throws {@link Management.TooManyRequestsError}
171
+ *
172
+ * @example
173
+ * await client.experimentation.featureFlags.variations.get("id", "vid")
174
+ */
175
+ get(id, vid, requestOptions) {
176
+ return core.HttpResponsePromise.fromPromise(this.__get(id, vid, requestOptions));
177
+ }
178
+ __get(id, vid, requestOptions) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
181
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
182
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
183
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
184
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/feature-flags/${core.url.encodePathParam(id)}/variations/${core.url.encodePathParam(vid)}`),
185
+ method: "GET",
186
+ headers: _headers,
187
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
188
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
189
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
190
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
191
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
192
+ logging: this._options.logging,
193
+ });
194
+ if (_response.ok) {
195
+ return {
196
+ data: _response.body,
197
+ rawResponse: _response.rawResponse,
198
+ };
199
+ }
200
+ if (_response.error.reason === "status-code") {
201
+ switch (_response.error.statusCode) {
202
+ case 401:
203
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
204
+ case 403:
205
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
206
+ case 404:
207
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
208
+ case 429:
209
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
210
+ default:
211
+ throw new errors.ManagementError({
212
+ statusCode: _response.error.statusCode,
213
+ body: _response.error.body,
214
+ rawResponse: _response.rawResponse,
215
+ });
216
+ }
217
+ }
218
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/experimentation/feature-flags/{id}/variations/{vid}");
219
+ });
220
+ }
221
+ /**
222
+ * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist.
223
+ *
224
+ * @param {string} id - The ID of the parent feature flag.
225
+ * @param {string} vid - The ID of the variation to delete.
226
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
227
+ *
228
+ * @throws {@link Management.BadRequestError}
229
+ * @throws {@link Management.ForbiddenError}
230
+ * @throws {@link Management.NotFoundError}
231
+ * @throws {@link Management.ConflictError}
232
+ * @throws {@link Management.TooManyRequestsError}
233
+ *
234
+ * @example
235
+ * await client.experimentation.featureFlags.variations.delete("id", "vid")
236
+ */
237
+ delete(id, vid, requestOptions) {
238
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, vid, requestOptions));
239
+ }
240
+ __delete(id, vid, requestOptions) {
241
+ return __awaiter(this, void 0, void 0, function* () {
242
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
243
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
244
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
245
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
246
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/feature-flags/${core.url.encodePathParam(id)}/variations/${core.url.encodePathParam(vid)}`),
247
+ method: "DELETE",
248
+ headers: _headers,
249
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
250
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
251
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
252
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
253
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
254
+ logging: this._options.logging,
255
+ });
256
+ if (_response.ok) {
257
+ return { data: undefined, rawResponse: _response.rawResponse };
258
+ }
259
+ if (_response.error.reason === "status-code") {
260
+ switch (_response.error.statusCode) {
261
+ case 400:
262
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
263
+ case 403:
264
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
265
+ case 404:
266
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
267
+ case 409:
268
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
269
+ case 429:
270
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
271
+ default:
272
+ throw new errors.ManagementError({
273
+ statusCode: _response.error.statusCode,
274
+ body: _response.error.body,
275
+ rawResponse: _response.rawResponse,
276
+ });
277
+ }
278
+ }
279
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/experimentation/feature-flags/{id}/variations/{vid}");
280
+ });
281
+ }
282
+ /**
283
+ * Partially update a variation by ID. Only provided fields are updated.
284
+ *
285
+ * @param {string} id - The ID of the parent feature flag.
286
+ * @param {string} vid - The ID of the variation to update.
287
+ * @param {Management.UpdateVariationRequestContent} request
288
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
289
+ *
290
+ * @throws {@link Management.BadRequestError}
291
+ * @throws {@link Management.UnauthorizedError}
292
+ * @throws {@link Management.ForbiddenError}
293
+ * @throws {@link Management.NotFoundError}
294
+ * @throws {@link Management.ConflictError}
295
+ * @throws {@link Management.TooManyRequestsError}
296
+ *
297
+ * @example
298
+ * await client.experimentation.featureFlags.variations.update("id", "vid")
299
+ */
300
+ update(id, vid, request = {}, requestOptions) {
301
+ return core.HttpResponsePromise.fromPromise(this.__update(id, vid, request, requestOptions));
302
+ }
303
+ __update(id_1, vid_1) {
304
+ return __awaiter(this, arguments, void 0, function* (id, vid, request = {}, requestOptions) {
305
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
306
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
307
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
308
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
309
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/feature-flags/${core.url.encodePathParam(id)}/variations/${core.url.encodePathParam(vid)}`),
310
+ method: "PATCH",
311
+ headers: _headers,
312
+ contentType: "application/json",
313
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
314
+ requestType: "json",
315
+ body: request,
316
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
317
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
318
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
319
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
320
+ logging: this._options.logging,
321
+ });
322
+ if (_response.ok) {
323
+ return {
324
+ data: _response.body,
325
+ rawResponse: _response.rawResponse,
326
+ };
327
+ }
328
+ if (_response.error.reason === "status-code") {
329
+ switch (_response.error.statusCode) {
330
+ case 400:
331
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
332
+ case 401:
333
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
334
+ case 403:
335
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
336
+ case 404:
337
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
338
+ case 409:
339
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
340
+ case 429:
341
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
342
+ default:
343
+ throw new errors.ManagementError({
344
+ statusCode: _response.error.statusCode,
345
+ body: _response.error.body,
346
+ rawResponse: _response.rawResponse,
347
+ });
348
+ }
349
+ }
350
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/experimentation/feature-flags/{id}/variations/{vid}");
351
+ });
352
+ }
353
+ }
@@ -0,0 +1,2 @@
1
+ export { VariationsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -1,3 +1,3 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export { OrganizationTemplateClient } from "./client/Client.mjs";
2
+ export { VariationsClient } from "./client/Client.mjs";
3
3
  export * from "./client/index.mjs";
@@ -1 +1,3 @@
1
1
  export * as experiments from "./experiments/index.mjs";
2
+ export * as featureFlags from "./featureFlags/index.mjs";
3
+ export * as segments from "./segments/index.mjs";
@@ -1 +1,3 @@
1
1
  export * as experiments from "./experiments/index.mjs";
2
+ export * as featureFlags from "./featureFlags/index.mjs";
3
+ export * as segments from "./segments/index.mjs";
@@ -0,0 +1,104 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../core/index.mjs";
4
+ import * as Management from "../../../../../index.mjs";
5
+ export declare namespace SegmentsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class SegmentsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<SegmentsClient.Options>;
12
+ constructor(options: SegmentsClient.Options);
13
+ /**
14
+ * Retrieve a paginated list of segments for the tenant.
15
+ *
16
+ * @param {Management.ListSegmentsRequestParameters} request
17
+ * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Management.BadRequestError}
20
+ * @throws {@link Management.UnauthorizedError}
21
+ * @throws {@link Management.ForbiddenError}
22
+ * @throws {@link Management.TooManyRequestsError}
23
+ *
24
+ * @example
25
+ * await client.experimentation.segments.list({
26
+ * from: "from",
27
+ * take: 1,
28
+ * type: "auth0"
29
+ * })
30
+ */
31
+ list(request?: Management.ListSegmentsRequestParameters, requestOptions?: SegmentsClient.RequestOptions): Promise<core.Page<Management.Segment, Management.ListSegmentsResponseContent>>;
32
+ /**
33
+ * Create a new segment with rule-based membership criteria for use in experiments.
34
+ *
35
+ * @param {Management.CreateSegmentRequestContent} request
36
+ * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration.
37
+ *
38
+ * @throws {@link Management.BadRequestError}
39
+ * @throws {@link Management.UnauthorizedError}
40
+ * @throws {@link Management.ForbiddenError}
41
+ * @throws {@link Management.ConflictError}
42
+ * @throws {@link Management.UnprocessableEntityError}
43
+ * @throws {@link Management.TooManyRequestsError}
44
+ *
45
+ * @example
46
+ * await client.experimentation.segments.create({
47
+ * name: "name",
48
+ * rules: [{}]
49
+ * })
50
+ */
51
+ create(request: Management.CreateSegmentRequestContent, requestOptions?: SegmentsClient.RequestOptions): core.HttpResponsePromise<Management.CreateSegmentResponseContent>;
52
+ private __create;
53
+ /**
54
+ * Retrieve a single segment by its ID.
55
+ *
56
+ * @param {string} id - The ID of the segment to retrieve.
57
+ * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration.
58
+ *
59
+ * @throws {@link Management.UnauthorizedError}
60
+ * @throws {@link Management.ForbiddenError}
61
+ * @throws {@link Management.NotFoundError}
62
+ * @throws {@link Management.TooManyRequestsError}
63
+ *
64
+ * @example
65
+ * await client.experimentation.segments.get("id")
66
+ */
67
+ get(id: string, requestOptions?: SegmentsClient.RequestOptions): core.HttpResponsePromise<Management.GetSegmentResponseContent>;
68
+ private __get;
69
+ /**
70
+ * Delete a segment by ID. Idempotent: returns 204 even if segment does not exist.
71
+ *
72
+ * @param {string} id - The ID of the segment to delete.
73
+ * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link Management.ForbiddenError}
76
+ * @throws {@link Management.ConflictError}
77
+ * @throws {@link Management.TooManyRequestsError}
78
+ *
79
+ * @example
80
+ * await client.experimentation.segments.delete("id")
81
+ */
82
+ delete(id: string, requestOptions?: SegmentsClient.RequestOptions): core.HttpResponsePromise<void>;
83
+ private __delete;
84
+ /**
85
+ * Partially update a segment by ID. Only provided fields are updated. Sending rules replaces the entire rules array.
86
+ *
87
+ * @param {string} id - The ID of the segment to update.
88
+ * @param {Management.UpdateSegmentRequestContent} request
89
+ * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration.
90
+ *
91
+ * @throws {@link Management.BadRequestError}
92
+ * @throws {@link Management.UnauthorizedError}
93
+ * @throws {@link Management.ForbiddenError}
94
+ * @throws {@link Management.NotFoundError}
95
+ * @throws {@link Management.ConflictError}
96
+ * @throws {@link Management.UnprocessableEntityError}
97
+ * @throws {@link Management.TooManyRequestsError}
98
+ *
99
+ * @example
100
+ * await client.experimentation.segments.update("id")
101
+ */
102
+ update(id: string, request?: Management.UpdateSegmentRequestContent, requestOptions?: SegmentsClient.RequestOptions): core.HttpResponsePromise<Management.UpdateSegmentResponseContent>;
103
+ private __update;
104
+ }