auth0 7.2.0 → 7.4.0-beta.1
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.
- package/README.md +5 -0
- package/dist/cjs/management/api/requests/requests.d.ts +238 -4
- package/dist/cjs/management/api/resources/clients/client/Client.d.ts +37 -0
- package/dist/cjs/management/api/resources/clients/client/Client.js +111 -0
- package/dist/cjs/management/api/resources/experimentation/client/Client.d.ts +6 -0
- package/dist/cjs/management/api/resources/experimentation/client/Client.js +10 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.d.ts +133 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.js +485 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/client/Client.d.ts +126 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/client/Client.js +471 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/exports.d.ts +3 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/exports.js +22 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/index.d.ts +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/index.js +18 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/index.js +37 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.d.ts +109 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.js +390 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.js +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/exports.js +2 -2
- package/dist/cjs/management/api/resources/experimentation/resources/index.d.ts +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/index.js +3 -1
- package/dist/cjs/management/api/resources/experimentation/resources/segments/client/Client.d.ts +104 -0
- package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/segments}/client/Client.js +205 -39
- package/dist/cjs/management/api/resources/experimentation/resources/segments/client/index.js +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/segments/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/segments/exports.js +21 -0
- package/dist/cjs/management/api/resources/experimentation/resources/segments/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/experimentation/resources/segments/index.js +17 -0
- package/dist/cjs/management/api/resources/organizations/client/Client.d.ts +0 -3
- package/dist/cjs/management/api/resources/organizations/client/Client.js +2 -7
- package/dist/cjs/management/api/resources/organizations/resources/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/organizations/resources/index.js +1 -2
- package/dist/cjs/management/api/resources/users/client/Client.d.ts +8 -10
- package/dist/cjs/management/api/resources/users/client/Client.js +8 -10
- package/dist/cjs/management/api/types/types.d.ts +642 -91
- package/dist/cjs/management/api/types/types.js +109 -50
- package/dist/cjs/management/version.d.ts +1 -1
- package/dist/cjs/management/version.js +1 -1
- package/dist/esm/management/api/requests/requests.d.mts +238 -4
- package/dist/esm/management/api/resources/clients/client/Client.d.mts +37 -0
- package/dist/esm/management/api/resources/clients/client/Client.mjs +111 -0
- package/dist/esm/management/api/resources/experimentation/client/Client.d.mts +6 -0
- package/dist/esm/management/api/resources/experimentation/client/Client.mjs +10 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.d.mts +133 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.mjs +485 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/Client.d.mts +126 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/Client.mjs +434 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/exports.d.mts +3 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/exports.mjs +4 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/index.d.mts +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/index.mjs +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.d.mts +109 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.mjs +353 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/exports.mjs +1 -1
- package/dist/esm/management/api/resources/experimentation/resources/index.d.mts +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/index.mjs +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.d.mts +104 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.mjs +361 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/exports.mjs +3 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/segments/index.mjs +1 -0
- package/dist/esm/management/api/resources/organizations/client/Client.d.mts +0 -3
- package/dist/esm/management/api/resources/organizations/client/Client.mjs +0 -5
- package/dist/esm/management/api/resources/organizations/resources/index.d.mts +0 -1
- package/dist/esm/management/api/resources/organizations/resources/index.mjs +0 -1
- package/dist/esm/management/api/resources/users/client/Client.d.mts +8 -10
- package/dist/esm/management/api/resources/users/client/Client.mjs +8 -10
- package/dist/esm/management/api/types/types.d.mts +642 -91
- package/dist/esm/management/api/types/types.mjs +88 -29
- package/dist/esm/management/version.d.mts +1 -1
- package/dist/esm/management/version.mjs +1 -1
- package/package.json +34 -12
- package/reference.md +1829 -313
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.ts +0 -63
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.d.ts +0 -2
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.mts +0 -63
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.mjs +0 -195
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.d.mts +0 -2
- /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags}/client/index.d.ts +0 -0
- /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags}/client/index.js +0 -0
- /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
- /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.d.ts +0 -0
- /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.js +0 -0
- /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
- /package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.d.mts +0 -0
- /package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.mjs +0 -0
package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.d.ts
CHANGED
|
@@ -10,6 +10,101 @@ export declare namespace ExperimentsClient {
|
|
|
10
10
|
export declare class ExperimentsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<ExperimentsClient.Options>;
|
|
12
12
|
constructor(options: ExperimentsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve a paginated list of experiments for the tenant, with optional filters.
|
|
15
|
+
*
|
|
16
|
+
* @param {Management.ListExperimentsRequestParameters} request
|
|
17
|
+
* @param {ExperimentsClient.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.experiments.list({
|
|
26
|
+
* from: "from",
|
|
27
|
+
* take: 1,
|
|
28
|
+
* status: "draft",
|
|
29
|
+
* authentication_flow: "authentication_flow",
|
|
30
|
+
* feature_flag_id: "feature_flag_id"
|
|
31
|
+
* })
|
|
32
|
+
*/
|
|
33
|
+
list(request?: Management.ListExperimentsRequestParameters, requestOptions?: ExperimentsClient.RequestOptions): Promise<core.Page<Management.ExperimentListItem, Management.ListExperimentsResponseContent>>;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new experiment for A/B testing.
|
|
36
|
+
*
|
|
37
|
+
* @param {Management.CreateExperimentRequestContent} request
|
|
38
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
|
+
*
|
|
40
|
+
* @throws {@link Management.BadRequestError}
|
|
41
|
+
* @throws {@link Management.UnauthorizedError}
|
|
42
|
+
* @throws {@link Management.ForbiddenError}
|
|
43
|
+
* @throws {@link Management.NotFoundError}
|
|
44
|
+
* @throws {@link Management.ConflictError}
|
|
45
|
+
* @throws {@link Management.UnprocessableEntityError}
|
|
46
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* await client.experimentation.experiments.create({
|
|
50
|
+
* name: "name",
|
|
51
|
+
* feature_flag_id: "feature_flag_id",
|
|
52
|
+
* authentication_flow: "authentication"
|
|
53
|
+
* })
|
|
54
|
+
*/
|
|
55
|
+
create(request: Management.CreateExperimentRequestContent, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<Management.CreateExperimentResponseContent>;
|
|
56
|
+
private __create;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieve a single experiment with its allocations by ID.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} id - The ID of the experiment to retrieve.
|
|
61
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
|
+
*
|
|
63
|
+
* @throws {@link Management.UnauthorizedError}
|
|
64
|
+
* @throws {@link Management.ForbiddenError}
|
|
65
|
+
* @throws {@link Management.NotFoundError}
|
|
66
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* await client.experimentation.experiments.get("id")
|
|
70
|
+
*/
|
|
71
|
+
get(id: string, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<Management.GetExperimentResponseContent>;
|
|
72
|
+
private __get;
|
|
73
|
+
/**
|
|
74
|
+
* Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} id - The ID of the experiment to delete.
|
|
77
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
78
|
+
*
|
|
79
|
+
* @throws {@link Management.BadRequestError}
|
|
80
|
+
* @throws {@link Management.ForbiddenError}
|
|
81
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* await client.experimentation.experiments.delete("id")
|
|
85
|
+
*/
|
|
86
|
+
delete(id: string, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
87
|
+
private __delete;
|
|
88
|
+
/**
|
|
89
|
+
* Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set.
|
|
90
|
+
*
|
|
91
|
+
* @param {string} id - The ID of the experiment to update.
|
|
92
|
+
* @param {Management.UpdateExperimentRequestParameters} request
|
|
93
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
94
|
+
*
|
|
95
|
+
* @throws {@link Management.BadRequestError}
|
|
96
|
+
* @throws {@link Management.UnauthorizedError}
|
|
97
|
+
* @throws {@link Management.ForbiddenError}
|
|
98
|
+
* @throws {@link Management.NotFoundError}
|
|
99
|
+
* @throws {@link Management.ConflictError}
|
|
100
|
+
* @throws {@link Management.UnprocessableEntityError}
|
|
101
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* await client.experimentation.experiments.update("id")
|
|
105
|
+
*/
|
|
106
|
+
update(id: string, request?: Management.UpdateExperimentRequestParameters, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<Management.UpdateExperimentResponseContent>;
|
|
107
|
+
private __update;
|
|
13
108
|
/**
|
|
14
109
|
* Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything.
|
|
15
110
|
*
|
|
@@ -31,4 +126,42 @@ export declare class ExperimentsClient {
|
|
|
31
126
|
*/
|
|
32
127
|
advanceRamp(id: string, request: Management.AdvanceRampRequestContent, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<Management.AdvanceRampResponseContent>;
|
|
33
128
|
private __advanceRamp;
|
|
129
|
+
/**
|
|
130
|
+
* Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} id - The ID of the experiment to transition.
|
|
133
|
+
* @param {Management.UpdateExperimentStatusRequestContent} request
|
|
134
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
135
|
+
*
|
|
136
|
+
* @throws {@link Management.BadRequestError}
|
|
137
|
+
* @throws {@link Management.UnauthorizedError}
|
|
138
|
+
* @throws {@link Management.ForbiddenError}
|
|
139
|
+
* @throws {@link Management.NotFoundError}
|
|
140
|
+
* @throws {@link Management.ConflictError}
|
|
141
|
+
* @throws {@link Management.UnprocessableEntityError}
|
|
142
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* await client.experimentation.experiments.updateStatus("id", {
|
|
146
|
+
* status: "active"
|
|
147
|
+
* })
|
|
148
|
+
*/
|
|
149
|
+
updateStatus(id: string, request: Management.UpdateExperimentStatusRequestContent, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<Management.UpdateExperimentStatusResponseContent>;
|
|
150
|
+
private __updateStatus;
|
|
151
|
+
/**
|
|
152
|
+
* Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified.
|
|
153
|
+
*
|
|
154
|
+
* @param {string} id - The ID of the experiment to validate.
|
|
155
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
156
|
+
*
|
|
157
|
+
* @throws {@link Management.UnauthorizedError}
|
|
158
|
+
* @throws {@link Management.ForbiddenError}
|
|
159
|
+
* @throws {@link Management.NotFoundError}
|
|
160
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* await client.experimentation.experiments.validate("id")
|
|
164
|
+
*/
|
|
165
|
+
validate(id: string, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise<Management.ValidateExperimentResponseContent>;
|
|
166
|
+
private __validate;
|
|
34
167
|
}
|
package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.js
CHANGED
|
@@ -55,6 +55,356 @@ class ExperimentsClient {
|
|
|
55
55
|
constructor(options) {
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve a paginated list of experiments for the tenant, with optional filters.
|
|
60
|
+
*
|
|
61
|
+
* @param {Management.ListExperimentsRequestParameters} request
|
|
62
|
+
* @param {ExperimentsClient.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.TooManyRequestsError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.experimentation.experiments.list({
|
|
71
|
+
* from: "from",
|
|
72
|
+
* take: 1,
|
|
73
|
+
* status: "draft",
|
|
74
|
+
* authentication_flow: "authentication_flow",
|
|
75
|
+
* feature_flag_id: "feature_flag_id"
|
|
76
|
+
* })
|
|
77
|
+
*/
|
|
78
|
+
list() {
|
|
79
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
80
|
+
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
82
|
+
const { from: from_, take = 50, status, authentication_flow: authenticationFlow, feature_flag_id: featureFlagId, } = request;
|
|
83
|
+
const _queryParams = {
|
|
84
|
+
from: from_,
|
|
85
|
+
take,
|
|
86
|
+
status: status !== undefined ? status : undefined,
|
|
87
|
+
authentication_flow: authenticationFlow,
|
|
88
|
+
feature_flag_id: featureFlagId,
|
|
89
|
+
};
|
|
90
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
91
|
+
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);
|
|
92
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
93
|
+
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/experiments"),
|
|
94
|
+
method: "GET",
|
|
95
|
+
headers: _headers,
|
|
96
|
+
queryString: core.url
|
|
97
|
+
.queryBuilder()
|
|
98
|
+
.addMany(_queryParams)
|
|
99
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
100
|
+
.build(),
|
|
101
|
+
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,
|
|
102
|
+
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,
|
|
103
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
104
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
105
|
+
logging: this._options.logging,
|
|
106
|
+
});
|
|
107
|
+
if (_response.ok) {
|
|
108
|
+
return {
|
|
109
|
+
data: _response.body,
|
|
110
|
+
rawResponse: _response.rawResponse,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (_response.error.reason === "status-code") {
|
|
114
|
+
switch (_response.error.statusCode) {
|
|
115
|
+
case 400:
|
|
116
|
+
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
117
|
+
case 401:
|
|
118
|
+
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
119
|
+
case 403:
|
|
120
|
+
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
121
|
+
case 429:
|
|
122
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
123
|
+
default:
|
|
124
|
+
throw new errors.ManagementError({
|
|
125
|
+
statusCode: _response.error.statusCode,
|
|
126
|
+
body: _response.error.body,
|
|
127
|
+
rawResponse: _response.rawResponse,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/experimentation/experiments");
|
|
132
|
+
}));
|
|
133
|
+
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
134
|
+
return new core.Page({
|
|
135
|
+
response: dataWithRawResponse.data,
|
|
136
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
137
|
+
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) === ""),
|
|
138
|
+
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.experiments) !== null && _a !== void 0 ? _a : []; },
|
|
139
|
+
loadPage: (response) => {
|
|
140
|
+
return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next));
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Create a new experiment for A/B testing.
|
|
147
|
+
*
|
|
148
|
+
* @param {Management.CreateExperimentRequestContent} request
|
|
149
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
150
|
+
*
|
|
151
|
+
* @throws {@link Management.BadRequestError}
|
|
152
|
+
* @throws {@link Management.UnauthorizedError}
|
|
153
|
+
* @throws {@link Management.ForbiddenError}
|
|
154
|
+
* @throws {@link Management.NotFoundError}
|
|
155
|
+
* @throws {@link Management.ConflictError}
|
|
156
|
+
* @throws {@link Management.UnprocessableEntityError}
|
|
157
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* await client.experimentation.experiments.create({
|
|
161
|
+
* name: "name",
|
|
162
|
+
* feature_flag_id: "feature_flag_id",
|
|
163
|
+
* authentication_flow: "authentication"
|
|
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/experiments"),
|
|
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 404:
|
|
203
|
+
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
204
|
+
case 409:
|
|
205
|
+
throw new Management.ConflictError(_response.error.body, _response.rawResponse);
|
|
206
|
+
case 422:
|
|
207
|
+
throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
208
|
+
case 429:
|
|
209
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
210
|
+
default:
|
|
211
|
+
throw new errors.ManagementError({
|
|
212
|
+
statusCode: _response.error.statusCode,
|
|
213
|
+
body: _response.error.body,
|
|
214
|
+
rawResponse: _response.rawResponse,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments");
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Retrieve a single experiment with its allocations by ID.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} id - The ID of the experiment to retrieve.
|
|
225
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
226
|
+
*
|
|
227
|
+
* @throws {@link Management.UnauthorizedError}
|
|
228
|
+
* @throws {@link Management.ForbiddenError}
|
|
229
|
+
* @throws {@link Management.NotFoundError}
|
|
230
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* await client.experimentation.experiments.get("id")
|
|
234
|
+
*/
|
|
235
|
+
get(id, requestOptions) {
|
|
236
|
+
return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
|
|
237
|
+
}
|
|
238
|
+
__get(id, requestOptions) {
|
|
239
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
241
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
242
|
+
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);
|
|
243
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
244
|
+
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/experiments/${core.url.encodePathParam(id)}`),
|
|
245
|
+
method: "GET",
|
|
246
|
+
headers: _headers,
|
|
247
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
248
|
+
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,
|
|
249
|
+
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,
|
|
250
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
251
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
252
|
+
logging: this._options.logging,
|
|
253
|
+
});
|
|
254
|
+
if (_response.ok) {
|
|
255
|
+
return {
|
|
256
|
+
data: _response.body,
|
|
257
|
+
rawResponse: _response.rawResponse,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
if (_response.error.reason === "status-code") {
|
|
261
|
+
switch (_response.error.statusCode) {
|
|
262
|
+
case 401:
|
|
263
|
+
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
264
|
+
case 403:
|
|
265
|
+
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
266
|
+
case 404:
|
|
267
|
+
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
268
|
+
case 429:
|
|
269
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
270
|
+
default:
|
|
271
|
+
throw new errors.ManagementError({
|
|
272
|
+
statusCode: _response.error.statusCode,
|
|
273
|
+
body: _response.error.body,
|
|
274
|
+
rawResponse: _response.rawResponse,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/experimentation/experiments/{id}");
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist.
|
|
283
|
+
*
|
|
284
|
+
* @param {string} id - The ID of the experiment to delete.
|
|
285
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
286
|
+
*
|
|
287
|
+
* @throws {@link Management.BadRequestError}
|
|
288
|
+
* @throws {@link Management.ForbiddenError}
|
|
289
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* await client.experimentation.experiments.delete("id")
|
|
293
|
+
*/
|
|
294
|
+
delete(id, requestOptions) {
|
|
295
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
|
|
296
|
+
}
|
|
297
|
+
__delete(id, requestOptions) {
|
|
298
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
299
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
300
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
301
|
+
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);
|
|
302
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
303
|
+
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/experiments/${core.url.encodePathParam(id)}`),
|
|
304
|
+
method: "DELETE",
|
|
305
|
+
headers: _headers,
|
|
306
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
307
|
+
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,
|
|
308
|
+
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,
|
|
309
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
310
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
311
|
+
logging: this._options.logging,
|
|
312
|
+
});
|
|
313
|
+
if (_response.ok) {
|
|
314
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
315
|
+
}
|
|
316
|
+
if (_response.error.reason === "status-code") {
|
|
317
|
+
switch (_response.error.statusCode) {
|
|
318
|
+
case 400:
|
|
319
|
+
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
320
|
+
case 403:
|
|
321
|
+
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
322
|
+
case 429:
|
|
323
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
324
|
+
default:
|
|
325
|
+
throw new errors.ManagementError({
|
|
326
|
+
statusCode: _response.error.statusCode,
|
|
327
|
+
body: _response.error.body,
|
|
328
|
+
rawResponse: _response.rawResponse,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/experimentation/experiments/{id}");
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set.
|
|
337
|
+
*
|
|
338
|
+
* @param {string} id - The ID of the experiment to update.
|
|
339
|
+
* @param {Management.UpdateExperimentRequestParameters} request
|
|
340
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
341
|
+
*
|
|
342
|
+
* @throws {@link Management.BadRequestError}
|
|
343
|
+
* @throws {@link Management.UnauthorizedError}
|
|
344
|
+
* @throws {@link Management.ForbiddenError}
|
|
345
|
+
* @throws {@link Management.NotFoundError}
|
|
346
|
+
* @throws {@link Management.ConflictError}
|
|
347
|
+
* @throws {@link Management.UnprocessableEntityError}
|
|
348
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* await client.experimentation.experiments.update("id")
|
|
352
|
+
*/
|
|
353
|
+
update(id, request = {}, requestOptions) {
|
|
354
|
+
return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
|
|
355
|
+
}
|
|
356
|
+
__update(id_1) {
|
|
357
|
+
return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
|
|
358
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
359
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
360
|
+
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);
|
|
361
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
362
|
+
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/experiments/${core.url.encodePathParam(id)}`),
|
|
363
|
+
method: "PATCH",
|
|
364
|
+
headers: _headers,
|
|
365
|
+
contentType: "application/json",
|
|
366
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
367
|
+
requestType: "json",
|
|
368
|
+
body: request,
|
|
369
|
+
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,
|
|
370
|
+
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,
|
|
371
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
372
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
373
|
+
logging: this._options.logging,
|
|
374
|
+
});
|
|
375
|
+
if (_response.ok) {
|
|
376
|
+
return {
|
|
377
|
+
data: _response.body,
|
|
378
|
+
rawResponse: _response.rawResponse,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
if (_response.error.reason === "status-code") {
|
|
382
|
+
switch (_response.error.statusCode) {
|
|
383
|
+
case 400:
|
|
384
|
+
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
385
|
+
case 401:
|
|
386
|
+
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
387
|
+
case 403:
|
|
388
|
+
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
389
|
+
case 404:
|
|
390
|
+
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
391
|
+
case 409:
|
|
392
|
+
throw new Management.ConflictError(_response.error.body, _response.rawResponse);
|
|
393
|
+
case 422:
|
|
394
|
+
throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
395
|
+
case 429:
|
|
396
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
397
|
+
default:
|
|
398
|
+
throw new errors.ManagementError({
|
|
399
|
+
statusCode: _response.error.statusCode,
|
|
400
|
+
body: _response.error.body,
|
|
401
|
+
rawResponse: _response.rawResponse,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/experimentation/experiments/{id}");
|
|
406
|
+
});
|
|
407
|
+
}
|
|
58
408
|
/**
|
|
59
409
|
* Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything.
|
|
60
410
|
*
|
|
@@ -127,5 +477,140 @@ class ExperimentsClient {
|
|
|
127
477
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/advance-ramp");
|
|
128
478
|
});
|
|
129
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation.
|
|
482
|
+
*
|
|
483
|
+
* @param {string} id - The ID of the experiment to transition.
|
|
484
|
+
* @param {Management.UpdateExperimentStatusRequestContent} request
|
|
485
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
486
|
+
*
|
|
487
|
+
* @throws {@link Management.BadRequestError}
|
|
488
|
+
* @throws {@link Management.UnauthorizedError}
|
|
489
|
+
* @throws {@link Management.ForbiddenError}
|
|
490
|
+
* @throws {@link Management.NotFoundError}
|
|
491
|
+
* @throws {@link Management.ConflictError}
|
|
492
|
+
* @throws {@link Management.UnprocessableEntityError}
|
|
493
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* await client.experimentation.experiments.updateStatus("id", {
|
|
497
|
+
* status: "active"
|
|
498
|
+
* })
|
|
499
|
+
*/
|
|
500
|
+
updateStatus(id, request, requestOptions) {
|
|
501
|
+
return core.HttpResponsePromise.fromPromise(this.__updateStatus(id, request, requestOptions));
|
|
502
|
+
}
|
|
503
|
+
__updateStatus(id, request, requestOptions) {
|
|
504
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
506
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
507
|
+
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);
|
|
508
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
509
|
+
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/experiments/${core.url.encodePathParam(id)}/status`),
|
|
510
|
+
method: "POST",
|
|
511
|
+
headers: _headers,
|
|
512
|
+
contentType: "application/json",
|
|
513
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
514
|
+
requestType: "json",
|
|
515
|
+
body: request,
|
|
516
|
+
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,
|
|
517
|
+
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,
|
|
518
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
519
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
520
|
+
logging: this._options.logging,
|
|
521
|
+
});
|
|
522
|
+
if (_response.ok) {
|
|
523
|
+
return {
|
|
524
|
+
data: _response.body,
|
|
525
|
+
rawResponse: _response.rawResponse,
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
if (_response.error.reason === "status-code") {
|
|
529
|
+
switch (_response.error.statusCode) {
|
|
530
|
+
case 400:
|
|
531
|
+
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
532
|
+
case 401:
|
|
533
|
+
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
534
|
+
case 403:
|
|
535
|
+
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
536
|
+
case 404:
|
|
537
|
+
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
538
|
+
case 409:
|
|
539
|
+
throw new Management.ConflictError(_response.error.body, _response.rawResponse);
|
|
540
|
+
case 422:
|
|
541
|
+
throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
542
|
+
case 429:
|
|
543
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
544
|
+
default:
|
|
545
|
+
throw new errors.ManagementError({
|
|
546
|
+
statusCode: _response.error.statusCode,
|
|
547
|
+
body: _response.error.body,
|
|
548
|
+
rawResponse: _response.rawResponse,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/status");
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified.
|
|
557
|
+
*
|
|
558
|
+
* @param {string} id - The ID of the experiment to validate.
|
|
559
|
+
* @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
560
|
+
*
|
|
561
|
+
* @throws {@link Management.UnauthorizedError}
|
|
562
|
+
* @throws {@link Management.ForbiddenError}
|
|
563
|
+
* @throws {@link Management.NotFoundError}
|
|
564
|
+
* @throws {@link Management.TooManyRequestsError}
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* await client.experimentation.experiments.validate("id")
|
|
568
|
+
*/
|
|
569
|
+
validate(id, requestOptions) {
|
|
570
|
+
return core.HttpResponsePromise.fromPromise(this.__validate(id, requestOptions));
|
|
571
|
+
}
|
|
572
|
+
__validate(id, requestOptions) {
|
|
573
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
574
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
575
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
576
|
+
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);
|
|
577
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
578
|
+
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/experiments/${core.url.encodePathParam(id)}/validate`),
|
|
579
|
+
method: "POST",
|
|
580
|
+
headers: _headers,
|
|
581
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
582
|
+
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,
|
|
583
|
+
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,
|
|
584
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
585
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
586
|
+
logging: this._options.logging,
|
|
587
|
+
});
|
|
588
|
+
if (_response.ok) {
|
|
589
|
+
return {
|
|
590
|
+
data: _response.body,
|
|
591
|
+
rawResponse: _response.rawResponse,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
if (_response.error.reason === "status-code") {
|
|
595
|
+
switch (_response.error.statusCode) {
|
|
596
|
+
case 401:
|
|
597
|
+
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
598
|
+
case 403:
|
|
599
|
+
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
600
|
+
case 404:
|
|
601
|
+
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
602
|
+
case 429:
|
|
603
|
+
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
604
|
+
default:
|
|
605
|
+
throw new errors.ManagementError({
|
|
606
|
+
statusCode: _response.error.statusCode,
|
|
607
|
+
body: _response.error.body,
|
|
608
|
+
rawResponse: _response.rawResponse,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/validate");
|
|
613
|
+
});
|
|
614
|
+
}
|
|
130
615
|
}
|
|
131
616
|
exports.ExperimentsClient = ExperimentsClient;
|