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