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,434 @@
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
+ import { VariationsClient } from "../resources/variations/client/Client.mjs";
19
+ export class FeatureFlagsClient {
20
+ constructor(options) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ get variations() {
24
+ var _a;
25
+ return ((_a = this._variations) !== null && _a !== void 0 ? _a : (this._variations = new VariationsClient(this._options)));
26
+ }
27
+ /**
28
+ * Retrieve a paginated list of feature flags for the tenant.
29
+ *
30
+ * @param {Management.ListFeatureFlagsRequestParameters} request
31
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @throws {@link Management.BadRequestError}
34
+ * @throws {@link Management.UnauthorizedError}
35
+ * @throws {@link Management.ForbiddenError}
36
+ * @throws {@link Management.TooManyRequestsError}
37
+ *
38
+ * @example
39
+ * await client.experimentation.featureFlags.list({
40
+ * from: "from",
41
+ * take: 1,
42
+ * type: "auth0",
43
+ * status: "draft"
44
+ * })
45
+ */
46
+ list() {
47
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
48
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
50
+ const { from: from_, take = 50, type: type_, status } = request;
51
+ const _queryParams = {
52
+ from: from_,
53
+ take,
54
+ type: type_ !== undefined ? type_ : undefined,
55
+ status: status !== undefined ? status : undefined,
56
+ };
57
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
58
+ 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);
59
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
60
+ 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"),
61
+ method: "GET",
62
+ headers: _headers,
63
+ queryString: core.url
64
+ .queryBuilder()
65
+ .addMany(_queryParams)
66
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
67
+ .build(),
68
+ 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,
69
+ 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,
70
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
71
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
72
+ logging: this._options.logging,
73
+ });
74
+ if (_response.ok) {
75
+ return {
76
+ data: _response.body,
77
+ rawResponse: _response.rawResponse,
78
+ };
79
+ }
80
+ if (_response.error.reason === "status-code") {
81
+ switch (_response.error.statusCode) {
82
+ case 400:
83
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
84
+ case 401:
85
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
86
+ case 403:
87
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
88
+ case 429:
89
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
90
+ default:
91
+ throw new errors.ManagementError({
92
+ statusCode: _response.error.statusCode,
93
+ body: _response.error.body,
94
+ rawResponse: _response.rawResponse,
95
+ });
96
+ }
97
+ }
98
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/experimentation/feature-flags");
99
+ }));
100
+ const dataWithRawResponse = yield list(request).withRawResponse();
101
+ return new core.Page({
102
+ response: dataWithRawResponse.data,
103
+ rawResponse: dataWithRawResponse.rawResponse,
104
+ hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.next) != null && !(typeof (response === null || response === void 0 ? void 0 : response.next) === "string" && (response === null || response === void 0 ? void 0 : response.next) === ""),
105
+ getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.feature_flags) !== null && _a !== void 0 ? _a : []; },
106
+ loadPage: (response) => {
107
+ return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next));
108
+ },
109
+ });
110
+ });
111
+ }
112
+ /**
113
+ * Create a new feature flag with parameters for use in experiments.
114
+ *
115
+ * @param {Management.CreateFeatureFlagRequestContent} request
116
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
117
+ *
118
+ * @throws {@link Management.BadRequestError}
119
+ * @throws {@link Management.UnauthorizedError}
120
+ * @throws {@link Management.ForbiddenError}
121
+ * @throws {@link Management.ConflictError}
122
+ * @throws {@link Management.TooManyRequestsError}
123
+ *
124
+ * @example
125
+ * await client.experimentation.featureFlags.create({
126
+ * name: "name",
127
+ * parameters: {}
128
+ * })
129
+ */
130
+ create(request, requestOptions) {
131
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
132
+ }
133
+ __create(request, requestOptions) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
136
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
137
+ 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);
138
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
139
+ 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"),
140
+ method: "POST",
141
+ headers: _headers,
142
+ contentType: "application/json",
143
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
144
+ requestType: "json",
145
+ body: request,
146
+ 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,
147
+ 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,
148
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
149
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
150
+ logging: this._options.logging,
151
+ });
152
+ if (_response.ok) {
153
+ return {
154
+ data: _response.body,
155
+ rawResponse: _response.rawResponse,
156
+ };
157
+ }
158
+ if (_response.error.reason === "status-code") {
159
+ switch (_response.error.statusCode) {
160
+ case 400:
161
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
162
+ case 401:
163
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
164
+ case 403:
165
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
166
+ case 409:
167
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
168
+ case 429:
169
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
170
+ default:
171
+ throw new errors.ManagementError({
172
+ statusCode: _response.error.statusCode,
173
+ body: _response.error.body,
174
+ rawResponse: _response.rawResponse,
175
+ });
176
+ }
177
+ }
178
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/feature-flags");
179
+ });
180
+ }
181
+ /**
182
+ * Retrieve a single feature flag by its ID.
183
+ *
184
+ * @param {string} id - The ID of the feature flag to retrieve.
185
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
186
+ *
187
+ * @throws {@link Management.UnauthorizedError}
188
+ * @throws {@link Management.ForbiddenError}
189
+ * @throws {@link Management.NotFoundError}
190
+ * @throws {@link Management.TooManyRequestsError}
191
+ *
192
+ * @example
193
+ * await client.experimentation.featureFlags.get("id")
194
+ */
195
+ get(id, requestOptions) {
196
+ return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
197
+ }
198
+ __get(id, requestOptions) {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
201
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
202
+ 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);
203
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
204
+ 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)}`),
205
+ method: "GET",
206
+ headers: _headers,
207
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
208
+ 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,
209
+ 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,
210
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
211
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
212
+ logging: this._options.logging,
213
+ });
214
+ if (_response.ok) {
215
+ return {
216
+ data: _response.body,
217
+ rawResponse: _response.rawResponse,
218
+ };
219
+ }
220
+ if (_response.error.reason === "status-code") {
221
+ switch (_response.error.statusCode) {
222
+ case 401:
223
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
224
+ case 403:
225
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
226
+ case 404:
227
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
228
+ case 429:
229
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
230
+ default:
231
+ throw new errors.ManagementError({
232
+ statusCode: _response.error.statusCode,
233
+ body: _response.error.body,
234
+ rawResponse: _response.rawResponse,
235
+ });
236
+ }
237
+ }
238
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/experimentation/feature-flags/{id}");
239
+ });
240
+ }
241
+ /**
242
+ * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist.
243
+ *
244
+ * @param {string} id - The ID of the feature flag to delete.
245
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
246
+ *
247
+ * @throws {@link Management.ForbiddenError}
248
+ * @throws {@link Management.ConflictError}
249
+ * @throws {@link Management.TooManyRequestsError}
250
+ *
251
+ * @example
252
+ * await client.experimentation.featureFlags.delete("id")
253
+ */
254
+ delete(id, requestOptions) {
255
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
256
+ }
257
+ __delete(id, requestOptions) {
258
+ return __awaiter(this, void 0, void 0, function* () {
259
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
260
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
261
+ 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);
262
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
263
+ 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)}`),
264
+ method: "DELETE",
265
+ headers: _headers,
266
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
267
+ 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,
268
+ 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,
269
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
270
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
271
+ logging: this._options.logging,
272
+ });
273
+ if (_response.ok) {
274
+ return { data: undefined, rawResponse: _response.rawResponse };
275
+ }
276
+ if (_response.error.reason === "status-code") {
277
+ switch (_response.error.statusCode) {
278
+ case 403:
279
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
280
+ case 409:
281
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
282
+ case 429:
283
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
284
+ default:
285
+ throw new errors.ManagementError({
286
+ statusCode: _response.error.statusCode,
287
+ body: _response.error.body,
288
+ rawResponse: _response.rawResponse,
289
+ });
290
+ }
291
+ }
292
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/experimentation/feature-flags/{id}");
293
+ });
294
+ }
295
+ /**
296
+ * Partially update a feature flag by ID. Only provided fields are updated.
297
+ *
298
+ * @param {string} id - The ID of the feature flag to update.
299
+ * @param {Management.UpdateFeatureFlagRequestContent} request
300
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
301
+ *
302
+ * @throws {@link Management.BadRequestError}
303
+ * @throws {@link Management.UnauthorizedError}
304
+ * @throws {@link Management.ForbiddenError}
305
+ * @throws {@link Management.NotFoundError}
306
+ * @throws {@link Management.ConflictError}
307
+ * @throws {@link Management.TooManyRequestsError}
308
+ *
309
+ * @example
310
+ * await client.experimentation.featureFlags.update("id")
311
+ */
312
+ update(id, request = {}, requestOptions) {
313
+ return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
314
+ }
315
+ __update(id_1) {
316
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
317
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
318
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
319
+ 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);
320
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
321
+ 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)}`),
322
+ method: "PATCH",
323
+ headers: _headers,
324
+ contentType: "application/json",
325
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
326
+ requestType: "json",
327
+ body: request,
328
+ 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,
329
+ 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,
330
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
331
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
332
+ logging: this._options.logging,
333
+ });
334
+ if (_response.ok) {
335
+ return {
336
+ data: _response.body,
337
+ rawResponse: _response.rawResponse,
338
+ };
339
+ }
340
+ if (_response.error.reason === "status-code") {
341
+ switch (_response.error.statusCode) {
342
+ case 400:
343
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
344
+ case 401:
345
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
346
+ case 403:
347
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
348
+ case 404:
349
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
350
+ case 409:
351
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
352
+ case 429:
353
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
354
+ default:
355
+ throw new errors.ManagementError({
356
+ statusCode: _response.error.statusCode,
357
+ body: _response.error.body,
358
+ rawResponse: _response.rawResponse,
359
+ });
360
+ }
361
+ }
362
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/experimentation/feature-flags/{id}");
363
+ });
364
+ }
365
+ /**
366
+ * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived.
367
+ *
368
+ * @param {string} id - The ID of the feature flag to transition.
369
+ * @param {Management.UpdateFeatureFlagStatusRequestContent} request
370
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
371
+ *
372
+ * @throws {@link Management.BadRequestError}
373
+ * @throws {@link Management.UnauthorizedError}
374
+ * @throws {@link Management.ForbiddenError}
375
+ * @throws {@link Management.NotFoundError}
376
+ * @throws {@link Management.TooManyRequestsError}
377
+ *
378
+ * @example
379
+ * await client.experimentation.featureFlags.updateStatus("id", {
380
+ * status: "draft"
381
+ * })
382
+ */
383
+ updateStatus(id, request, requestOptions) {
384
+ return core.HttpResponsePromise.fromPromise(this.__updateStatus(id, request, requestOptions));
385
+ }
386
+ __updateStatus(id, request, requestOptions) {
387
+ return __awaiter(this, void 0, void 0, function* () {
388
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
389
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
390
+ 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);
391
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
392
+ 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)}/status`),
393
+ method: "POST",
394
+ headers: _headers,
395
+ contentType: "application/json",
396
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
397
+ requestType: "json",
398
+ body: request,
399
+ 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,
400
+ 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,
401
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
402
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
403
+ logging: this._options.logging,
404
+ });
405
+ if (_response.ok) {
406
+ return {
407
+ data: _response.body,
408
+ rawResponse: _response.rawResponse,
409
+ };
410
+ }
411
+ if (_response.error.reason === "status-code") {
412
+ switch (_response.error.statusCode) {
413
+ case 400:
414
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
415
+ case 401:
416
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
417
+ case 403:
418
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
419
+ case 404:
420
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
421
+ case 429:
422
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
423
+ default:
424
+ throw new errors.ManagementError({
425
+ statusCode: _response.error.statusCode,
426
+ body: _response.error.body,
427
+ rawResponse: _response.rawResponse,
428
+ });
429
+ }
430
+ }
431
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/feature-flags/{id}/status");
432
+ });
433
+ }
434
+ }
@@ -0,0 +1,3 @@
1
+ export { FeatureFlagsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
3
+ export * from "./resources/index.mjs";
@@ -0,0 +1,4 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { FeatureFlagsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
4
+ export * from "./resources/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./resources/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./resources/index.mjs";
@@ -0,0 +1 @@
1
+ export * as variations from "./variations/index.mjs";
@@ -0,0 +1 @@
1
+ export * as variations from "./variations/index.mjs";
@@ -0,0 +1,109 @@
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 VariationsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class VariationsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<VariationsClient.Options>;
12
+ constructor(options: VariationsClient.Options);
13
+ /**
14
+ * Retrieve all variations defined for a specific feature flag.
15
+ *
16
+ * @param {string} id - The ID of the parent feature flag.
17
+ * @param {VariationsClient.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.NotFoundError}
23
+ * @throws {@link Management.TooManyRequestsError}
24
+ *
25
+ * @example
26
+ * await client.experimentation.featureFlags.variations.list("id")
27
+ */
28
+ list(id: string, requestOptions?: VariationsClient.RequestOptions): core.HttpResponsePromise<Management.ListVariationsResponseContent>;
29
+ private __list;
30
+ /**
31
+ * Create a new variation with parameter overrides for a specific feature flag.
32
+ *
33
+ * @param {string} id - The ID of the parent feature flag.
34
+ * @param {Management.CreateVariationRequestContent} request
35
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Management.BadRequestError}
38
+ * @throws {@link Management.UnauthorizedError}
39
+ * @throws {@link Management.ForbiddenError}
40
+ * @throws {@link Management.NotFoundError}
41
+ * @throws {@link Management.ConflictError}
42
+ * @throws {@link Management.TooManyRequestsError}
43
+ *
44
+ * @example
45
+ * await client.experimentation.featureFlags.variations.create("id", {
46
+ * name: "name",
47
+ * overrides: {
48
+ * "key": "value"
49
+ * }
50
+ * })
51
+ */
52
+ create(id: string, request: Management.CreateVariationRequestContent, requestOptions?: VariationsClient.RequestOptions): core.HttpResponsePromise<Management.CreateVariationResponseContent>;
53
+ private __create;
54
+ /**
55
+ * Retrieve a single variation by its ID.
56
+ *
57
+ * @param {string} id - The ID of the parent feature flag.
58
+ * @param {string} vid - The ID of the variation to retrieve.
59
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
60
+ *
61
+ * @throws {@link Management.UnauthorizedError}
62
+ * @throws {@link Management.ForbiddenError}
63
+ * @throws {@link Management.NotFoundError}
64
+ * @throws {@link Management.TooManyRequestsError}
65
+ *
66
+ * @example
67
+ * await client.experimentation.featureFlags.variations.get("id", "vid")
68
+ */
69
+ get(id: string, vid: string, requestOptions?: VariationsClient.RequestOptions): core.HttpResponsePromise<Management.GetVariationResponseContent>;
70
+ private __get;
71
+ /**
72
+ * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist.
73
+ *
74
+ * @param {string} id - The ID of the parent feature flag.
75
+ * @param {string} vid - The ID of the variation to delete.
76
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
77
+ *
78
+ * @throws {@link Management.BadRequestError}
79
+ * @throws {@link Management.ForbiddenError}
80
+ * @throws {@link Management.NotFoundError}
81
+ * @throws {@link Management.ConflictError}
82
+ * @throws {@link Management.TooManyRequestsError}
83
+ *
84
+ * @example
85
+ * await client.experimentation.featureFlags.variations.delete("id", "vid")
86
+ */
87
+ delete(id: string, vid: string, requestOptions?: VariationsClient.RequestOptions): core.HttpResponsePromise<void>;
88
+ private __delete;
89
+ /**
90
+ * Partially update a variation by ID. Only provided fields are updated.
91
+ *
92
+ * @param {string} id - The ID of the parent feature flag.
93
+ * @param {string} vid - The ID of the variation to update.
94
+ * @param {Management.UpdateVariationRequestContent} request
95
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
96
+ *
97
+ * @throws {@link Management.BadRequestError}
98
+ * @throws {@link Management.UnauthorizedError}
99
+ * @throws {@link Management.ForbiddenError}
100
+ * @throws {@link Management.NotFoundError}
101
+ * @throws {@link Management.ConflictError}
102
+ * @throws {@link Management.TooManyRequestsError}
103
+ *
104
+ * @example
105
+ * await client.experimentation.featureFlags.variations.update("id", "vid")
106
+ */
107
+ update(id: string, vid: string, request?: Management.UpdateVariationRequestContent, requestOptions?: VariationsClient.RequestOptions): core.HttpResponsePromise<Management.UpdateVariationResponseContent>;
108
+ private __update;
109
+ }