auth0 7.2.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 +208 -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 +507 -91
  35. package/dist/cjs/management/api/types/types.js +99 -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 +208 -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 +507 -91
  76. package/dist/esm/management/api/types/types.mjs +78 -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,109 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../../../core/index.js";
4
+ import * as Management from "../../../../../../../index.js";
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
+ }
@@ -0,0 +1,390 @@
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.VariationsClient = 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
+ class VariationsClient {
55
+ constructor(options) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Retrieve all variations defined for a specific feature flag.
60
+ *
61
+ * @param {string} id - The ID of the parent feature flag.
62
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Management.BadRequestError}
65
+ * @throws {@link Management.UnauthorizedError}
66
+ * @throws {@link Management.ForbiddenError}
67
+ * @throws {@link Management.NotFoundError}
68
+ * @throws {@link Management.TooManyRequestsError}
69
+ *
70
+ * @example
71
+ * await client.experimentation.featureFlags.variations.list("id")
72
+ */
73
+ list(id, requestOptions) {
74
+ return core.HttpResponsePromise.fromPromise(this.__list(id, requestOptions));
75
+ }
76
+ __list(id, requestOptions) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
79
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
80
+ 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);
81
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
82
+ 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`),
83
+ method: "GET",
84
+ headers: _headers,
85
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
86
+ 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,
87
+ 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,
88
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
89
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
90
+ logging: this._options.logging,
91
+ });
92
+ if (_response.ok) {
93
+ return {
94
+ data: _response.body,
95
+ rawResponse: _response.rawResponse,
96
+ };
97
+ }
98
+ if (_response.error.reason === "status-code") {
99
+ switch (_response.error.statusCode) {
100
+ case 400:
101
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
102
+ case 401:
103
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
104
+ case 403:
105
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
106
+ case 404:
107
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
108
+ case 429:
109
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
110
+ default:
111
+ throw new errors.ManagementError({
112
+ statusCode: _response.error.statusCode,
113
+ body: _response.error.body,
114
+ rawResponse: _response.rawResponse,
115
+ });
116
+ }
117
+ }
118
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/experimentation/feature-flags/{id}/variations");
119
+ });
120
+ }
121
+ /**
122
+ * Create a new variation with parameter overrides for a specific feature flag.
123
+ *
124
+ * @param {string} id - The ID of the parent feature flag.
125
+ * @param {Management.CreateVariationRequestContent} request
126
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
127
+ *
128
+ * @throws {@link Management.BadRequestError}
129
+ * @throws {@link Management.UnauthorizedError}
130
+ * @throws {@link Management.ForbiddenError}
131
+ * @throws {@link Management.NotFoundError}
132
+ * @throws {@link Management.ConflictError}
133
+ * @throws {@link Management.TooManyRequestsError}
134
+ *
135
+ * @example
136
+ * await client.experimentation.featureFlags.variations.create("id", {
137
+ * name: "name",
138
+ * overrides: {
139
+ * "key": "value"
140
+ * }
141
+ * })
142
+ */
143
+ create(id, request, requestOptions) {
144
+ return core.HttpResponsePromise.fromPromise(this.__create(id, request, requestOptions));
145
+ }
146
+ __create(id, request, requestOptions) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
149
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
150
+ 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);
151
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
152
+ 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`),
153
+ method: "POST",
154
+ headers: _headers,
155
+ contentType: "application/json",
156
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
157
+ requestType: "json",
158
+ body: request,
159
+ 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,
160
+ 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,
161
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
162
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
163
+ logging: this._options.logging,
164
+ });
165
+ if (_response.ok) {
166
+ return {
167
+ data: _response.body,
168
+ rawResponse: _response.rawResponse,
169
+ };
170
+ }
171
+ if (_response.error.reason === "status-code") {
172
+ switch (_response.error.statusCode) {
173
+ case 400:
174
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
175
+ case 401:
176
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
177
+ case 403:
178
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
179
+ case 404:
180
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
181
+ case 409:
182
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
183
+ case 429:
184
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
185
+ default:
186
+ throw new errors.ManagementError({
187
+ statusCode: _response.error.statusCode,
188
+ body: _response.error.body,
189
+ rawResponse: _response.rawResponse,
190
+ });
191
+ }
192
+ }
193
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/feature-flags/{id}/variations");
194
+ });
195
+ }
196
+ /**
197
+ * Retrieve a single variation by its ID.
198
+ *
199
+ * @param {string} id - The ID of the parent feature flag.
200
+ * @param {string} vid - The ID of the variation to retrieve.
201
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
202
+ *
203
+ * @throws {@link Management.UnauthorizedError}
204
+ * @throws {@link Management.ForbiddenError}
205
+ * @throws {@link Management.NotFoundError}
206
+ * @throws {@link Management.TooManyRequestsError}
207
+ *
208
+ * @example
209
+ * await client.experimentation.featureFlags.variations.get("id", "vid")
210
+ */
211
+ get(id, vid, requestOptions) {
212
+ return core.HttpResponsePromise.fromPromise(this.__get(id, vid, requestOptions));
213
+ }
214
+ __get(id, vid, requestOptions) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
217
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
218
+ 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);
219
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
220
+ 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)}`),
221
+ method: "GET",
222
+ headers: _headers,
223
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
224
+ 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,
225
+ 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,
226
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
227
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
228
+ logging: this._options.logging,
229
+ });
230
+ if (_response.ok) {
231
+ return {
232
+ data: _response.body,
233
+ rawResponse: _response.rawResponse,
234
+ };
235
+ }
236
+ if (_response.error.reason === "status-code") {
237
+ switch (_response.error.statusCode) {
238
+ case 401:
239
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
240
+ case 403:
241
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
242
+ case 404:
243
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
244
+ case 429:
245
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
246
+ default:
247
+ throw new errors.ManagementError({
248
+ statusCode: _response.error.statusCode,
249
+ body: _response.error.body,
250
+ rawResponse: _response.rawResponse,
251
+ });
252
+ }
253
+ }
254
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/experimentation/feature-flags/{id}/variations/{vid}");
255
+ });
256
+ }
257
+ /**
258
+ * Delete a variation by ID. Returns 204 if the variation does not exist. Returns 404 if the parent feature flag does not exist.
259
+ *
260
+ * @param {string} id - The ID of the parent feature flag.
261
+ * @param {string} vid - The ID of the variation to delete.
262
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
263
+ *
264
+ * @throws {@link Management.BadRequestError}
265
+ * @throws {@link Management.ForbiddenError}
266
+ * @throws {@link Management.NotFoundError}
267
+ * @throws {@link Management.ConflictError}
268
+ * @throws {@link Management.TooManyRequestsError}
269
+ *
270
+ * @example
271
+ * await client.experimentation.featureFlags.variations.delete("id", "vid")
272
+ */
273
+ delete(id, vid, requestOptions) {
274
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, vid, requestOptions));
275
+ }
276
+ __delete(id, vid, requestOptions) {
277
+ return __awaiter(this, void 0, void 0, function* () {
278
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
279
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
280
+ 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);
281
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
282
+ 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)}`),
283
+ method: "DELETE",
284
+ headers: _headers,
285
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
286
+ 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,
287
+ 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,
288
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
289
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
290
+ logging: this._options.logging,
291
+ });
292
+ if (_response.ok) {
293
+ return { data: undefined, rawResponse: _response.rawResponse };
294
+ }
295
+ if (_response.error.reason === "status-code") {
296
+ switch (_response.error.statusCode) {
297
+ case 400:
298
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
299
+ case 403:
300
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
301
+ case 404:
302
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
303
+ case 409:
304
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
305
+ case 429:
306
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
307
+ default:
308
+ throw new errors.ManagementError({
309
+ statusCode: _response.error.statusCode,
310
+ body: _response.error.body,
311
+ rawResponse: _response.rawResponse,
312
+ });
313
+ }
314
+ }
315
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/experimentation/feature-flags/{id}/variations/{vid}");
316
+ });
317
+ }
318
+ /**
319
+ * Partially update a variation by ID. Only provided fields are updated.
320
+ *
321
+ * @param {string} id - The ID of the parent feature flag.
322
+ * @param {string} vid - The ID of the variation to update.
323
+ * @param {Management.UpdateVariationRequestContent} request
324
+ * @param {VariationsClient.RequestOptions} requestOptions - Request-specific configuration.
325
+ *
326
+ * @throws {@link Management.BadRequestError}
327
+ * @throws {@link Management.UnauthorizedError}
328
+ * @throws {@link Management.ForbiddenError}
329
+ * @throws {@link Management.NotFoundError}
330
+ * @throws {@link Management.ConflictError}
331
+ * @throws {@link Management.TooManyRequestsError}
332
+ *
333
+ * @example
334
+ * await client.experimentation.featureFlags.variations.update("id", "vid")
335
+ */
336
+ update(id, vid, request = {}, requestOptions) {
337
+ return core.HttpResponsePromise.fromPromise(this.__update(id, vid, request, requestOptions));
338
+ }
339
+ __update(id_1, vid_1) {
340
+ return __awaiter(this, arguments, void 0, function* (id, vid, request = {}, requestOptions) {
341
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
342
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
343
+ 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);
344
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
345
+ 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)}`),
346
+ method: "PATCH",
347
+ headers: _headers,
348
+ contentType: "application/json",
349
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
350
+ requestType: "json",
351
+ body: request,
352
+ 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,
353
+ 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,
354
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
355
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
356
+ logging: this._options.logging,
357
+ });
358
+ if (_response.ok) {
359
+ return {
360
+ data: _response.body,
361
+ rawResponse: _response.rawResponse,
362
+ };
363
+ }
364
+ if (_response.error.reason === "status-code") {
365
+ switch (_response.error.statusCode) {
366
+ case 400:
367
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
368
+ case 401:
369
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
370
+ case 403:
371
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
372
+ case 404:
373
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
374
+ case 409:
375
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
376
+ case 429:
377
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
378
+ default:
379
+ throw new errors.ManagementError({
380
+ statusCode: _response.error.statusCode,
381
+ body: _response.error.body,
382
+ rawResponse: _response.rawResponse,
383
+ });
384
+ }
385
+ }
386
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/experimentation/feature-flags/{id}/variations/{vid}");
387
+ });
388
+ }
389
+ }
390
+ exports.VariationsClient = VariationsClient;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { VariationsClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.OrganizationTemplateClient = void 0;
18
+ exports.VariationsClient = void 0;
19
19
  var Client_js_1 = require("./client/Client.js");
20
- Object.defineProperty(exports, "OrganizationTemplateClient", { enumerable: true, get: function () { return Client_js_1.OrganizationTemplateClient; } });
20
+ Object.defineProperty(exports, "VariationsClient", { enumerable: true, get: function () { return Client_js_1.VariationsClient; } });
21
21
  __exportStar(require("./client/index.js"), exports);
@@ -1 +1,3 @@
1
1
  export * as experiments from "./experiments/index.js";
2
+ export * as featureFlags from "./featureFlags/index.js";
3
+ export * as segments from "./segments/index.js";
@@ -33,5 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.experiments = void 0;
36
+ exports.segments = exports.featureFlags = exports.experiments = void 0;
37
37
  exports.experiments = __importStar(require("./experiments/index.js"));
38
+ exports.featureFlags = __importStar(require("./featureFlags/index.js"));
39
+ exports.segments = __importStar(require("./segments/index.js"));
@@ -0,0 +1,104 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as Management from "../../../../../index.js";
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
+ }