@teemill/split-tests 1.0.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.
package/common.ts ADDED
@@ -0,0 +1,161 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Split Tests
5
+ * Inspect split test definitions and performance results.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import type { Configuration } from "./configuration";
16
+ import type { RequestArgs } from "./base";
17
+ import type { AxiosInstance, AxiosResponse } from 'axios';
18
+ import { RequiredError } from "./base";
19
+
20
+ /**
21
+ *
22
+ * @export
23
+ */
24
+ export const DUMMY_BASE_URL = 'https://example.com'
25
+
26
+ /**
27
+ *
28
+ * @throws {RequiredError}
29
+ * @export
30
+ */
31
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
32
+ if (paramValue === null || paramValue === undefined) {
33
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
34
+ }
35
+ }
36
+
37
+ /**
38
+ *
39
+ * @export
40
+ */
41
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
42
+ if (configuration && configuration.apiKey) {
43
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
44
+ ? await configuration.apiKey(keyParamName)
45
+ : await configuration.apiKey;
46
+ object[keyParamName] = localVarApiKeyValue;
47
+ }
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @export
53
+ */
54
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
55
+ if (configuration && (configuration.username || configuration.password)) {
56
+ object["auth"] = { username: configuration.username, password: configuration.password };
57
+ }
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @export
63
+ */
64
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
65
+ if (configuration && configuration.accessToken) {
66
+ const accessToken = typeof configuration.accessToken === 'function'
67
+ ? await configuration.accessToken()
68
+ : await configuration.accessToken;
69
+ object["Authorization"] = "Bearer " + accessToken;
70
+ }
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @export
76
+ */
77
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
78
+ if (configuration && configuration.accessToken) {
79
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
80
+ ? await configuration.accessToken(name, scopes)
81
+ : await configuration.accessToken;
82
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
83
+ }
84
+ }
85
+
86
+ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
87
+ if (parameter == null) return;
88
+ if (typeof parameter === "object") {
89
+ if (Array.isArray(parameter) || parameter instanceof Set) {
90
+ (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key !== '' ? `${key}[]` : key));
91
+ }
92
+ else {
93
+ Object.keys(parameter).forEach(currentKey =>
94
+ setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
95
+ );
96
+ }
97
+ }
98
+ else {
99
+ if (urlSearchParams.has(key)) {
100
+ urlSearchParams.append(key, parameter);
101
+ }
102
+ else {
103
+ urlSearchParams.set(key, parameter);
104
+ }
105
+ }
106
+ }
107
+
108
+ /**
109
+ *
110
+ * @export
111
+ */
112
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
113
+ const searchParams = new URLSearchParams(url.search);
114
+ setFlattenedQueryParams(searchParams, objects);
115
+ url.search = searchParams.toString();
116
+ }
117
+
118
+ /**
119
+ * JSON.stringify replacer used by generated API code (e.g. serializes Set as Array).
120
+ * @export
121
+ */
122
+ export const replaceWithSerializableTypeIfNeeded = function (_key: string, value: unknown) {
123
+ if (value instanceof Set) {
124
+ return Array.from(value);
125
+ }
126
+
127
+ return value;
128
+ }
129
+
130
+ /**
131
+ *
132
+ * @export
133
+ */
134
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
135
+ const nonString = typeof value !== 'string';
136
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
137
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
138
+ : nonString;
139
+ return needsSerialization
140
+ ? JSON.stringify(value !== undefined ? value : {}, replaceWithSerializableTypeIfNeeded)
141
+ : (value || "");
142
+ }
143
+
144
+ /**
145
+ *
146
+ * @export
147
+ */
148
+ export const toPathString = function (url: URL) {
149
+ return url.pathname + url.search + url.hash
150
+ }
151
+
152
+ /**
153
+ *
154
+ * @export
155
+ */
156
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
157
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
158
+ const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
159
+ return axios.request<T, R>(axiosRequestArgs);
160
+ };
161
+ }
@@ -0,0 +1,121 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * Split Tests
4
+ * Inspect split test definitions and performance results.
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ interface AWSv4Configuration {
15
+ options?: {
16
+ region?: string
17
+ service?: string
18
+ }
19
+ credentials?: {
20
+ accessKeyId?: string
21
+ secretAccessKey?: string,
22
+ sessionToken?: string
23
+ }
24
+ }
25
+
26
+ export interface ConfigurationParameters {
27
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
28
+ username?: string;
29
+ password?: string;
30
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
31
+ awsv4?: AWSv4Configuration;
32
+ basePath?: string;
33
+ serverIndex?: number;
34
+ baseOptions?: any;
35
+ formDataCtor?: new () => any;
36
+ }
37
+
38
+ export class Configuration {
39
+ /**
40
+ * parameter for apiKey security
41
+ * @param name security name
42
+ */
43
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
44
+ /**
45
+ * parameter for basic security
46
+ */
47
+ username?: string;
48
+ /**
49
+ * parameter for basic security
50
+ */
51
+ password?: string;
52
+ /**
53
+ * parameter for oauth2 security
54
+ * @param name security name
55
+ * @param scopes oauth2 scope
56
+ */
57
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
58
+ /**
59
+ * parameter for aws4 signature security
60
+ * @param {Object} AWS4Signature - AWS4 Signature security
61
+ * @param {string} options.region - aws region
62
+ * @param {string} options.service - name of the service.
63
+ * @param {string} credentials.accessKeyId - aws access key id
64
+ * @param {string} credentials.secretAccessKey - aws access key
65
+ * @param {string} credentials.sessionToken - aws session token
66
+ * @memberof Configuration
67
+ */
68
+ awsv4?: AWSv4Configuration;
69
+ /**
70
+ * override base path
71
+ */
72
+ basePath?: string;
73
+ /**
74
+ * override server index
75
+ */
76
+ serverIndex?: number;
77
+ /**
78
+ * base options for axios calls
79
+ */
80
+ baseOptions?: any;
81
+ /**
82
+ * The FormData constructor that will be used to create multipart form data
83
+ * requests. You can inject this here so that execution environments that
84
+ * do not support the FormData class can still run the generated client.
85
+ *
86
+ * @type {new () => FormData}
87
+ */
88
+ formDataCtor?: new () => any;
89
+
90
+ constructor(param: ConfigurationParameters = {}) {
91
+ this.apiKey = param.apiKey;
92
+ this.username = param.username;
93
+ this.password = param.password;
94
+ this.accessToken = param.accessToken;
95
+ this.awsv4 = param.awsv4;
96
+ this.basePath = param.basePath;
97
+ this.serverIndex = param.serverIndex;
98
+ this.baseOptions = {
99
+ ...param.baseOptions,
100
+ headers: {
101
+ ...param.baseOptions?.headers,
102
+ },
103
+ };
104
+ this.formDataCtor = param.formDataCtor;
105
+ }
106
+
107
+ /**
108
+ * Check if the given MIME is a JSON MIME.
109
+ * JSON MIME examples:
110
+ * application/json
111
+ * application/json; charset=UTF8
112
+ * APPLICATION/JSON
113
+ * application/vnd.company+json
114
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
115
+ * @return True if the given MIME is JSON, false otherwise.
116
+ */
117
+ public isJsonMime(mime: string): boolean {
118
+ const jsonMime: RegExp = /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i;
119
+ return mime !== null && jsonMime.test(mime);
120
+ }
121
+ }
package/dist/api.d.ts ADDED
@@ -0,0 +1,332 @@
1
+ /**
2
+ * Split Tests
3
+ * Inspect split test definitions and performance results.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { Configuration } from './configuration';
13
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
+ import type { RequestArgs } from './base';
15
+ import { BaseAPI } from './base';
16
+ export interface ListSplitTests200Response {
17
+ 'splitTests': Array<SplitTest>;
18
+ }
19
+ export interface ModelError {
20
+ /**
21
+ * Human-readable error message.
22
+ */
23
+ 'message'?: string;
24
+ }
25
+ /**
26
+ * Split test definition with variation metadata.
27
+ */
28
+ export interface SplitTest {
29
+ /**
30
+ * Unique split test UUID.
31
+ */
32
+ 'id': string;
33
+ /**
34
+ * Human-readable split test name.
35
+ */
36
+ 'name': string;
37
+ /**
38
+ * Stable split test code used by tracking and assignment logic.
39
+ */
40
+ 'code': string;
41
+ /**
42
+ * Date the split test starts serving.
43
+ */
44
+ 'startDate': string;
45
+ /**
46
+ * Date the split test stops serving.
47
+ */
48
+ 'endDate': string;
49
+ /**
50
+ * Winning variation UUID when a winner has been chosen; otherwise `null`.
51
+ */
52
+ 'winnerId': string | null;
53
+ /**
54
+ * Variations configured for this split test.
55
+ */
56
+ 'variations': Array<SplitTestVariation>;
57
+ }
58
+ /**
59
+ * Aggregated variation metrics for a single breakdown group.
60
+ */
61
+ export interface SplitTestResultBreakdown {
62
+ /**
63
+ * Breakdown group key (for example, `mobile`, `Chrome`, or a domain).
64
+ */
65
+ 'name': string;
66
+ /**
67
+ * Session count for this group.
68
+ */
69
+ 'sessions': number;
70
+ /**
71
+ * Total tracked order value for this group in minor currency units.
72
+ */
73
+ 'value': number;
74
+ /**
75
+ * Number of orders recorded for this group.
76
+ */
77
+ 'orderCount': number;
78
+ /**
79
+ * Average order value for this group.
80
+ */
81
+ 'averageOrderValue': number;
82
+ /**
83
+ * Average tracked value per session for this group.
84
+ */
85
+ 'valuePerSession': number;
86
+ /**
87
+ * Difference versus control variation for the selected metric.
88
+ */
89
+ 'controlDifference'?: number | null;
90
+ }
91
+ /**
92
+ * Event-level metrics for a variation.
93
+ */
94
+ export interface SplitTestResultEvent {
95
+ /**
96
+ * Event name (for example, `purchase` or `add-to-cart`).
97
+ */
98
+ 'name': string;
99
+ /**
100
+ * Number of sessions that triggered this event.
101
+ */
102
+ 'events': number;
103
+ /**
104
+ * Percentage of sessions that triggered this event.
105
+ */
106
+ 'conversionRate': number;
107
+ /**
108
+ * Difference in conversion rate versus the control variation.
109
+ */
110
+ 'controlDifference'?: number | null;
111
+ /**
112
+ * Average value per conversion for this event when available.
113
+ */
114
+ 'valuePerConversion'?: number | null;
115
+ }
116
+ /**
117
+ * Aggregated metrics for a single split test variation.
118
+ */
119
+ export interface SplitTestResultVariation {
120
+ /**
121
+ * Variation label.
122
+ */
123
+ 'name': string;
124
+ /**
125
+ * Number of sessions assigned to this variation.
126
+ */
127
+ 'sessions': number;
128
+ /**
129
+ * Total tracked order value in minor currency units.
130
+ */
131
+ 'value': number;
132
+ /**
133
+ * Average order value for conversion events.
134
+ */
135
+ 'averageOrderValue': number;
136
+ /**
137
+ * Average tracked value per session.
138
+ */
139
+ 'valuePerSession': number;
140
+ /**
141
+ * Event metrics for this variation.
142
+ */
143
+ 'events': Array<SplitTestResultEvent>;
144
+ /**
145
+ * Optional subgroup metrics when a breakdown dimension is requested.
146
+ */
147
+ 'breakdowns'?: Array<SplitTestResultBreakdown>;
148
+ }
149
+ /**
150
+ * Aggregated performance summary for a split test.
151
+ */
152
+ export interface SplitTestResults {
153
+ /**
154
+ * Split test name.
155
+ */
156
+ 'name': string;
157
+ /**
158
+ * Total session count across all returned variations.
159
+ */
160
+ 'sessions': number;
161
+ /**
162
+ * Distinct event names present in the result set.
163
+ */
164
+ 'events': Array<string>;
165
+ 'controlVariation': SplitTestResultVariation;
166
+ /**
167
+ * Per-variation performance metrics.
168
+ */
169
+ 'variations': Array<SplitTestResultVariation>;
170
+ }
171
+ /**
172
+ * Basic variation metadata for a split test definition.
173
+ */
174
+ export interface SplitTestVariation {
175
+ /**
176
+ * Unique variation UUID.
177
+ */
178
+ 'id': string;
179
+ /**
180
+ * Variation label.
181
+ */
182
+ 'name': string;
183
+ /**
184
+ * Whether this variation is the control baseline.
185
+ */
186
+ 'control': boolean;
187
+ /**
188
+ * Whether this variation is currently active for assignment.
189
+ */
190
+ 'active': boolean;
191
+ }
192
+ /**
193
+ * SplitTestsApi - axios parameter creator
194
+ */
195
+ export declare const SplitTestsApiAxiosParamCreator: (configuration?: Configuration) => {
196
+ /**
197
+ * Get aggregate split test results and optional breakdowns.
198
+ * @summary Get split test results
199
+ * @param {string} project Project identifier used to scope split test data for the current integration context.
200
+ * @param {string} splitTestId UUID of the split test to fetch detailed results for.
201
+ * @param {GetSplitTestResultsBreakdownEnum} [breakdown] Optional dimension used to group variation metrics in &#x60;breakdowns&#x60;.
202
+ * @param {*} [options] Override http request option.
203
+ * @throws {RequiredError}
204
+ */
205
+ getSplitTestResults: (project: string, splitTestId: string, breakdown?: GetSplitTestResultsBreakdownEnum, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
206
+ /**
207
+ * List split tests for inspector tooling.
208
+ * @summary List split tests
209
+ * @param {string} project Project identifier used to scope split test data for the current integration context.
210
+ * @param {string} [search] Case-insensitive search term matched against split test name and code.
211
+ * @param {ListSplitTestsStateEnum} [state] Filter for which split tests to return (&#x60;active&#x60; for currently running tests, &#x60;all&#x60; for every test).
212
+ * @param {*} [options] Override http request option.
213
+ * @throws {RequiredError}
214
+ */
215
+ listSplitTests: (project: string, search?: string, state?: ListSplitTestsStateEnum, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
216
+ };
217
+ /**
218
+ * SplitTestsApi - functional programming interface
219
+ */
220
+ export declare const SplitTestsApiFp: (configuration?: Configuration) => {
221
+ /**
222
+ * Get aggregate split test results and optional breakdowns.
223
+ * @summary Get split test results
224
+ * @param {string} project Project identifier used to scope split test data for the current integration context.
225
+ * @param {string} splitTestId UUID of the split test to fetch detailed results for.
226
+ * @param {GetSplitTestResultsBreakdownEnum} [breakdown] Optional dimension used to group variation metrics in &#x60;breakdowns&#x60;.
227
+ * @param {*} [options] Override http request option.
228
+ * @throws {RequiredError}
229
+ */
230
+ getSplitTestResults(project: string, splitTestId: string, breakdown?: GetSplitTestResultsBreakdownEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SplitTestResults>>;
231
+ /**
232
+ * List split tests for inspector tooling.
233
+ * @summary List split tests
234
+ * @param {string} project Project identifier used to scope split test data for the current integration context.
235
+ * @param {string} [search] Case-insensitive search term matched against split test name and code.
236
+ * @param {ListSplitTestsStateEnum} [state] Filter for which split tests to return (&#x60;active&#x60; for currently running tests, &#x60;all&#x60; for every test).
237
+ * @param {*} [options] Override http request option.
238
+ * @throws {RequiredError}
239
+ */
240
+ listSplitTests(project: string, search?: string, state?: ListSplitTestsStateEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListSplitTests200Response>>;
241
+ };
242
+ /**
243
+ * SplitTestsApi - factory interface
244
+ */
245
+ export declare const SplitTestsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
246
+ /**
247
+ * Get aggregate split test results and optional breakdowns.
248
+ * @summary Get split test results
249
+ * @param {SplitTestsApiGetSplitTestResultsRequest} requestParameters Request parameters.
250
+ * @param {*} [options] Override http request option.
251
+ * @throws {RequiredError}
252
+ */
253
+ getSplitTestResults(requestParameters: SplitTestsApiGetSplitTestResultsRequest, options?: RawAxiosRequestConfig): AxiosPromise<SplitTestResults>;
254
+ /**
255
+ * List split tests for inspector tooling.
256
+ * @summary List split tests
257
+ * @param {SplitTestsApiListSplitTestsRequest} requestParameters Request parameters.
258
+ * @param {*} [options] Override http request option.
259
+ * @throws {RequiredError}
260
+ */
261
+ listSplitTests(requestParameters: SplitTestsApiListSplitTestsRequest, options?: RawAxiosRequestConfig): AxiosPromise<ListSplitTests200Response>;
262
+ };
263
+ /**
264
+ * Request parameters for getSplitTestResults operation in SplitTestsApi.
265
+ */
266
+ export interface SplitTestsApiGetSplitTestResultsRequest {
267
+ /**
268
+ * Project identifier used to scope split test data for the current integration context.
269
+ */
270
+ readonly project: string;
271
+ /**
272
+ * UUID of the split test to fetch detailed results for.
273
+ */
274
+ readonly splitTestId: string;
275
+ /**
276
+ * Optional dimension used to group variation metrics in &#x60;breakdowns&#x60;.
277
+ */
278
+ readonly breakdown?: GetSplitTestResultsBreakdownEnum;
279
+ }
280
+ /**
281
+ * Request parameters for listSplitTests operation in SplitTestsApi.
282
+ */
283
+ export interface SplitTestsApiListSplitTestsRequest {
284
+ /**
285
+ * Project identifier used to scope split test data for the current integration context.
286
+ */
287
+ readonly project: string;
288
+ /**
289
+ * Case-insensitive search term matched against split test name and code.
290
+ */
291
+ readonly search?: string;
292
+ /**
293
+ * Filter for which split tests to return (&#x60;active&#x60; for currently running tests, &#x60;all&#x60; for every test).
294
+ */
295
+ readonly state?: ListSplitTestsStateEnum;
296
+ }
297
+ /**
298
+ * SplitTestsApi - object-oriented interface
299
+ */
300
+ export declare class SplitTestsApi extends BaseAPI {
301
+ /**
302
+ * Get aggregate split test results and optional breakdowns.
303
+ * @summary Get split test results
304
+ * @param {SplitTestsApiGetSplitTestResultsRequest} requestParameters Request parameters.
305
+ * @param {*} [options] Override http request option.
306
+ * @throws {RequiredError}
307
+ */
308
+ getSplitTestResults(requestParameters: SplitTestsApiGetSplitTestResultsRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<SplitTestResults, any, {}>>;
309
+ /**
310
+ * List split tests for inspector tooling.
311
+ * @summary List split tests
312
+ * @param {SplitTestsApiListSplitTestsRequest} requestParameters Request parameters.
313
+ * @param {*} [options] Override http request option.
314
+ * @throws {RequiredError}
315
+ */
316
+ listSplitTests(requestParameters: SplitTestsApiListSplitTestsRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ListSplitTests200Response, any, {}>>;
317
+ }
318
+ export declare const GetSplitTestResultsBreakdownEnum: {
319
+ readonly None: "none";
320
+ readonly Device: "device";
321
+ readonly Platform: "platform";
322
+ readonly Browser: "browser";
323
+ readonly Country: "country";
324
+ readonly Territory: "territory";
325
+ readonly Domain: "domain";
326
+ };
327
+ export type GetSplitTestResultsBreakdownEnum = typeof GetSplitTestResultsBreakdownEnum[keyof typeof GetSplitTestResultsBreakdownEnum];
328
+ export declare const ListSplitTestsStateEnum: {
329
+ readonly Active: "active";
330
+ readonly All: "all";
331
+ };
332
+ export type ListSplitTestsStateEnum = typeof ListSplitTestsStateEnum[keyof typeof ListSplitTestsStateEnum];