@azure-rest/onlineexperimentation 1.0.0-alpha.20250613.5
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/browser/clientDefinitions.d.ts +30 -0
- package/dist/browser/clientDefinitions.js +3 -0
- package/dist/browser/extensibleEnums.d.ts +99 -0
- package/dist/browser/extensibleEnums.js +106 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/index.js +13 -0
- package/dist/browser/isUnexpected.d.ts +6 -0
- package/dist/browser/isUnexpected.js +72 -0
- package/dist/browser/logger.d.ts +1 -0
- package/dist/browser/logger.js +4 -0
- package/dist/browser/models.d.ts +104 -0
- package/dist/browser/models.js +3 -0
- package/dist/browser/onlineExperimentationClient.d.ts +15 -0
- package/dist/browser/onlineExperimentationClient.js +45 -0
- package/dist/browser/outputModels.d.ts +137 -0
- package/dist/browser/outputModels.js +3 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/paginateHelper.d.ts +67 -0
- package/dist/browser/paginateHelper.js +136 -0
- package/dist/browser/parameters.d.ts +92 -0
- package/dist/browser/parameters.js +3 -0
- package/dist/browser/responses.d.ts +113 -0
- package/dist/browser/responses.js +3 -0
- package/dist/commonjs/clientDefinitions.d.ts +30 -0
- package/dist/commonjs/clientDefinitions.js +4 -0
- package/dist/commonjs/extensibleEnums.d.ts +99 -0
- package/dist/commonjs/extensibleEnums.js +109 -0
- package/dist/commonjs/index.d.ts +11 -0
- package/dist/commonjs/index.js +33 -0
- package/dist/commonjs/isUnexpected.d.ts +6 -0
- package/dist/commonjs/isUnexpected.js +75 -0
- package/dist/commonjs/logger.d.ts +1 -0
- package/dist/commonjs/logger.js +7 -0
- package/dist/commonjs/models.d.ts +104 -0
- package/dist/commonjs/models.js +4 -0
- package/dist/commonjs/onlineExperimentationClient.d.ts +15 -0
- package/dist/commonjs/onlineExperimentationClient.js +48 -0
- package/dist/commonjs/outputModels.d.ts +137 -0
- package/dist/commonjs/outputModels.js +4 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/paginateHelper.d.ts +67 -0
- package/dist/commonjs/paginateHelper.js +139 -0
- package/dist/commonjs/parameters.d.ts +92 -0
- package/dist/commonjs/parameters.js +4 -0
- package/dist/commonjs/responses.d.ts +113 -0
- package/dist/commonjs/responses.js +4 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/clientDefinitions.d.ts +30 -0
- package/dist/esm/clientDefinitions.js +3 -0
- package/dist/esm/extensibleEnums.d.ts +99 -0
- package/dist/esm/extensibleEnums.js +106 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/isUnexpected.d.ts +6 -0
- package/dist/esm/isUnexpected.js +72 -0
- package/dist/esm/logger.d.ts +1 -0
- package/dist/esm/logger.js +4 -0
- package/dist/esm/models.d.ts +104 -0
- package/dist/esm/models.js +3 -0
- package/dist/esm/onlineExperimentationClient.d.ts +15 -0
- package/dist/esm/onlineExperimentationClient.js +45 -0
- package/dist/esm/outputModels.d.ts +137 -0
- package/dist/esm/outputModels.js +3 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/paginateHelper.d.ts +67 -0
- package/dist/esm/paginateHelper.js +136 -0
- package/dist/esm/parameters.d.ts +92 -0
- package/dist/esm/parameters.js +3 -0
- package/dist/esm/responses.d.ts +113 -0
- package/dist/esm/responses.js +3 -0
- package/dist/react-native/clientDefinitions.d.ts +30 -0
- package/dist/react-native/clientDefinitions.js +3 -0
- package/dist/react-native/extensibleEnums.d.ts +99 -0
- package/dist/react-native/extensibleEnums.js +106 -0
- package/dist/react-native/index.d.ts +11 -0
- package/dist/react-native/index.js +13 -0
- package/dist/react-native/isUnexpected.d.ts +6 -0
- package/dist/react-native/isUnexpected.js +72 -0
- package/dist/react-native/logger.d.ts +1 -0
- package/dist/react-native/logger.js +4 -0
- package/dist/react-native/models.d.ts +104 -0
- package/dist/react-native/models.js +3 -0
- package/dist/react-native/onlineExperimentationClient.d.ts +15 -0
- package/dist/react-native/onlineExperimentationClient.js +45 -0
- package/dist/react-native/outputModels.d.ts +137 -0
- package/dist/react-native/outputModels.js +3 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/paginateHelper.d.ts +67 -0
- package/dist/react-native/paginateHelper.js +136 -0
- package/dist/react-native/parameters.d.ts +92 -0
- package/dist/react-native/parameters.js +3 -0
- package/dist/react-native/responses.d.ts +113 -0
- package/dist/react-native/responses.js +3 -0
- package/package.json +138 -0
- package/review/onlineexperimentation.api.md +612 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createRestError } from "@azure-rest/core-client";
|
|
4
|
+
/**
|
|
5
|
+
* returns an async iterator that iterates over results. It also has a `byPage`
|
|
6
|
+
* method that returns pages of items at once.
|
|
7
|
+
*
|
|
8
|
+
* @param pagedResult - an object that specifies how to get pages.
|
|
9
|
+
* @returns a paged async iterator that iterates over results.
|
|
10
|
+
*/
|
|
11
|
+
function getPagedAsyncIterator(pagedResult) {
|
|
12
|
+
const iter = getItemAsyncIterator(pagedResult);
|
|
13
|
+
return {
|
|
14
|
+
next() {
|
|
15
|
+
return iter.next();
|
|
16
|
+
},
|
|
17
|
+
[Symbol.asyncIterator]() {
|
|
18
|
+
return this;
|
|
19
|
+
},
|
|
20
|
+
byPage: pagedResult?.byPage ??
|
|
21
|
+
((settings) => {
|
|
22
|
+
const { continuationToken } = settings ?? {};
|
|
23
|
+
return getPageAsyncIterator(pagedResult, {
|
|
24
|
+
pageLink: continuationToken,
|
|
25
|
+
});
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async function* getItemAsyncIterator(pagedResult) {
|
|
30
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
31
|
+
const firstVal = await pages.next();
|
|
32
|
+
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
|
|
33
|
+
if (!Array.isArray(firstVal.value)) {
|
|
34
|
+
// can extract elements from this page
|
|
35
|
+
const { toElements } = pagedResult;
|
|
36
|
+
if (toElements) {
|
|
37
|
+
yield* toElements(firstVal.value);
|
|
38
|
+
for await (const page of pages) {
|
|
39
|
+
yield* toElements(page);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
yield firstVal.value;
|
|
44
|
+
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case
|
|
45
|
+
yield* pages;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
yield* firstVal.value;
|
|
50
|
+
for await (const page of pages) {
|
|
51
|
+
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,
|
|
52
|
+
// it must be the case that `TPage = TElement[]`
|
|
53
|
+
yield* page;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function* getPageAsyncIterator(pagedResult, options = {}) {
|
|
58
|
+
const { pageLink } = options;
|
|
59
|
+
let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
|
|
60
|
+
if (!response) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
yield response.page;
|
|
64
|
+
while (response.nextPageLink) {
|
|
65
|
+
response = await pagedResult.getPage(response.nextPageLink);
|
|
66
|
+
if (!response) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
yield response.page;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
74
|
+
* @param client - Client to use for sending the next page requests
|
|
75
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
76
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
77
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
78
|
+
*/
|
|
79
|
+
export function paginate(client, initialResponse, options = {}) {
|
|
80
|
+
let firstRun = true;
|
|
81
|
+
const itemName = "value";
|
|
82
|
+
const nextLinkName = "nextLink";
|
|
83
|
+
const { customGetPage } = options;
|
|
84
|
+
const pagedResult = {
|
|
85
|
+
firstPageLink: "",
|
|
86
|
+
getPage: typeof customGetPage === "function"
|
|
87
|
+
? customGetPage
|
|
88
|
+
: async (pageLink) => {
|
|
89
|
+
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
90
|
+
firstRun = false;
|
|
91
|
+
checkPagingRequest(result);
|
|
92
|
+
const nextLink = getNextLink(result.body, nextLinkName);
|
|
93
|
+
const values = getElements(result.body, itemName);
|
|
94
|
+
return {
|
|
95
|
+
page: values,
|
|
96
|
+
nextPageLink: nextLink,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
return getPagedAsyncIterator(pagedResult);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets for the value of nextLink in the body
|
|
104
|
+
*/
|
|
105
|
+
function getNextLink(body, nextLinkName) {
|
|
106
|
+
if (!nextLinkName) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const nextLink = body[nextLinkName];
|
|
110
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
111
|
+
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
112
|
+
}
|
|
113
|
+
return nextLink;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets the elements of the current request in the body.
|
|
117
|
+
*/
|
|
118
|
+
function getElements(body, itemName) {
|
|
119
|
+
const value = body[itemName];
|
|
120
|
+
// value has to be an array according to the x-ms-pageable extension.
|
|
121
|
+
// The fact that this must be an array is used above to calculate the
|
|
122
|
+
// type of elements in the page in PaginateReturn
|
|
123
|
+
if (!Array.isArray(value)) {
|
|
124
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
125
|
+
}
|
|
126
|
+
return value ?? [];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Checks if a request failed
|
|
130
|
+
*/
|
|
131
|
+
function checkPagingRequest(response) {
|
|
132
|
+
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
133
|
+
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
134
|
+
throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
|
|
2
|
+
import type { RequestParameters } from "@azure-rest/core-client";
|
|
3
|
+
import type { ExperimentMetric } from "./models.js";
|
|
4
|
+
export interface GetMetricHeaders {
|
|
5
|
+
/** The request should only proceed if an entity matches this string. */
|
|
6
|
+
"If-Match"?: string;
|
|
7
|
+
/** The request should only proceed if no entity matches this string. */
|
|
8
|
+
"If-None-Match"?: string;
|
|
9
|
+
/** The request should only proceed if the entity was not modified after this time. */
|
|
10
|
+
"If-Unmodified-Since"?: string;
|
|
11
|
+
/** The request should only proceed if the entity was modified after this time. */
|
|
12
|
+
"If-Modified-Since"?: string;
|
|
13
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
14
|
+
"x-ms-client-request-id"?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GetMetricHeaderParam {
|
|
17
|
+
headers?: RawHttpHeadersInput & GetMetricHeaders;
|
|
18
|
+
}
|
|
19
|
+
export type GetMetricParameters = GetMetricHeaderParam & RequestParameters;
|
|
20
|
+
export interface CreateOrUpdateMetricHeaders {
|
|
21
|
+
/** The request should only proceed if an entity matches this string. */
|
|
22
|
+
"If-Match"?: string;
|
|
23
|
+
/** The request should only proceed if no entity matches this string. */
|
|
24
|
+
"If-None-Match"?: string;
|
|
25
|
+
/** The request should only proceed if the entity was not modified after this time. */
|
|
26
|
+
"If-Unmodified-Since"?: string;
|
|
27
|
+
/** The request should only proceed if the entity was modified after this time. */
|
|
28
|
+
"If-Modified-Since"?: string;
|
|
29
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
30
|
+
"x-ms-client-request-id"?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The resource instance. */
|
|
33
|
+
export type ExperimentMetricResourceMergeAndPatch = Partial<ExperimentMetric>;
|
|
34
|
+
export interface CreateOrUpdateMetricBodyParam {
|
|
35
|
+
/** The resource instance. */
|
|
36
|
+
body: ExperimentMetricResourceMergeAndPatch;
|
|
37
|
+
}
|
|
38
|
+
export interface CreateOrUpdateMetricHeaderParam {
|
|
39
|
+
headers?: RawHttpHeadersInput & CreateOrUpdateMetricHeaders;
|
|
40
|
+
}
|
|
41
|
+
export interface CreateOrUpdateMetricMediaTypesParam {
|
|
42
|
+
/** This request has a JSON Merge Patch body. */
|
|
43
|
+
contentType: "application/merge-patch+json";
|
|
44
|
+
}
|
|
45
|
+
export type CreateOrUpdateMetricParameters = CreateOrUpdateMetricHeaderParam & CreateOrUpdateMetricMediaTypesParam & CreateOrUpdateMetricBodyParam & RequestParameters;
|
|
46
|
+
export interface ValidateMetricHeaders {
|
|
47
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
48
|
+
"x-ms-client-request-id"?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ValidateMetricBodyParam {
|
|
51
|
+
/** Experiment metric input to validate */
|
|
52
|
+
body: ExperimentMetric;
|
|
53
|
+
}
|
|
54
|
+
export interface ValidateMetricHeaderParam {
|
|
55
|
+
headers?: RawHttpHeadersInput & ValidateMetricHeaders;
|
|
56
|
+
}
|
|
57
|
+
export type ValidateMetricParameters = ValidateMetricHeaderParam & ValidateMetricBodyParam & RequestParameters;
|
|
58
|
+
export interface DeleteMetricHeaders {
|
|
59
|
+
/** The request should only proceed if an entity matches this string. */
|
|
60
|
+
"If-Match"?: string;
|
|
61
|
+
/** The request should only proceed if no entity matches this string. */
|
|
62
|
+
"If-None-Match"?: string;
|
|
63
|
+
/** The request should only proceed if the entity was not modified after this time. */
|
|
64
|
+
"If-Unmodified-Since"?: string;
|
|
65
|
+
/** The request should only proceed if the entity was modified after this time. */
|
|
66
|
+
"If-Modified-Since"?: string;
|
|
67
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
68
|
+
"x-ms-client-request-id"?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface DeleteMetricHeaderParam {
|
|
71
|
+
headers?: RawHttpHeadersInput & DeleteMetricHeaders;
|
|
72
|
+
}
|
|
73
|
+
export type DeleteMetricParameters = DeleteMetricHeaderParam & RequestParameters;
|
|
74
|
+
export interface ListMetricsHeaders {
|
|
75
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
76
|
+
"x-ms-client-request-id"?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface ListMetricsQueryParamProperties {
|
|
79
|
+
/** The number of result items to return. */
|
|
80
|
+
top?: number;
|
|
81
|
+
/** The number of result items to skip. */
|
|
82
|
+
skip?: number;
|
|
83
|
+
/** The maximum number of result items per page. */
|
|
84
|
+
maxpagesize?: number;
|
|
85
|
+
}
|
|
86
|
+
export interface ListMetricsQueryParam {
|
|
87
|
+
queryParameters?: ListMetricsQueryParamProperties;
|
|
88
|
+
}
|
|
89
|
+
export interface ListMetricsHeaderParam {
|
|
90
|
+
headers?: RawHttpHeadersInput & ListMetricsHeaders;
|
|
91
|
+
}
|
|
92
|
+
export type ListMetricsParameters = ListMetricsQueryParam & ListMetricsHeaderParam & RequestParameters;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { RawHttpHeaders } from "@azure/core-rest-pipeline";
|
|
2
|
+
import type { HttpResponse, ErrorResponse } from "@azure-rest/core-client";
|
|
3
|
+
import type { ExperimentMetricOutput, ExperimentMetricValidationResultOutput, PagedExperimentMetricOutput } from "./outputModels.js";
|
|
4
|
+
export interface GetMetric200Headers {
|
|
5
|
+
/** The entity tag for the response. */
|
|
6
|
+
etag?: string;
|
|
7
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
8
|
+
"x-ms-client-request-id"?: string;
|
|
9
|
+
}
|
|
10
|
+
/** The request has succeeded. */
|
|
11
|
+
export interface GetMetric200Response extends HttpResponse {
|
|
12
|
+
status: "200";
|
|
13
|
+
body: ExperimentMetricOutput;
|
|
14
|
+
headers: RawHttpHeaders & GetMetric200Headers;
|
|
15
|
+
}
|
|
16
|
+
export interface GetMetricDefaultHeaders {
|
|
17
|
+
/** String error code indicating what went wrong. */
|
|
18
|
+
"x-ms-error-code"?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface GetMetricDefaultResponse extends HttpResponse {
|
|
21
|
+
status: string;
|
|
22
|
+
body: ErrorResponse;
|
|
23
|
+
headers: RawHttpHeaders & GetMetricDefaultHeaders;
|
|
24
|
+
}
|
|
25
|
+
export interface CreateOrUpdateMetric200Headers {
|
|
26
|
+
/** The entity tag for the response. */
|
|
27
|
+
etag?: string;
|
|
28
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
29
|
+
"x-ms-client-request-id"?: string;
|
|
30
|
+
}
|
|
31
|
+
/** The request has succeeded. */
|
|
32
|
+
export interface CreateOrUpdateMetric200Response extends HttpResponse {
|
|
33
|
+
status: "200";
|
|
34
|
+
body: ExperimentMetricOutput;
|
|
35
|
+
headers: RawHttpHeaders & CreateOrUpdateMetric200Headers;
|
|
36
|
+
}
|
|
37
|
+
export interface CreateOrUpdateMetric201Headers {
|
|
38
|
+
/** The entity tag for the response. */
|
|
39
|
+
etag?: string;
|
|
40
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
41
|
+
"x-ms-client-request-id"?: string;
|
|
42
|
+
}
|
|
43
|
+
/** The request has succeeded and a new resource has been created as a result. */
|
|
44
|
+
export interface CreateOrUpdateMetric201Response extends HttpResponse {
|
|
45
|
+
status: "201";
|
|
46
|
+
body: ExperimentMetricOutput;
|
|
47
|
+
headers: RawHttpHeaders & CreateOrUpdateMetric201Headers;
|
|
48
|
+
}
|
|
49
|
+
export interface CreateOrUpdateMetricDefaultHeaders {
|
|
50
|
+
/** String error code indicating what went wrong. */
|
|
51
|
+
"x-ms-error-code"?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface CreateOrUpdateMetricDefaultResponse extends HttpResponse {
|
|
54
|
+
status: string;
|
|
55
|
+
body: ErrorResponse;
|
|
56
|
+
headers: RawHttpHeaders & CreateOrUpdateMetricDefaultHeaders;
|
|
57
|
+
}
|
|
58
|
+
export interface ValidateMetric200Headers {
|
|
59
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
60
|
+
"x-ms-client-request-id"?: string;
|
|
61
|
+
}
|
|
62
|
+
/** The request has succeeded. */
|
|
63
|
+
export interface ValidateMetric200Response extends HttpResponse {
|
|
64
|
+
status: "200";
|
|
65
|
+
body: ExperimentMetricValidationResultOutput;
|
|
66
|
+
headers: RawHttpHeaders & ValidateMetric200Headers;
|
|
67
|
+
}
|
|
68
|
+
export interface ValidateMetricDefaultHeaders {
|
|
69
|
+
/** String error code indicating what went wrong. */
|
|
70
|
+
"x-ms-error-code"?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ValidateMetricDefaultResponse extends HttpResponse {
|
|
73
|
+
status: string;
|
|
74
|
+
body: ErrorResponse;
|
|
75
|
+
headers: RawHttpHeaders & ValidateMetricDefaultHeaders;
|
|
76
|
+
}
|
|
77
|
+
export interface DeleteMetric204Headers {
|
|
78
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
79
|
+
"x-ms-client-request-id"?: string;
|
|
80
|
+
}
|
|
81
|
+
/** There is no content to send for this request, but the headers may be useful. */
|
|
82
|
+
export interface DeleteMetric204Response extends HttpResponse {
|
|
83
|
+
status: "204";
|
|
84
|
+
headers: RawHttpHeaders & DeleteMetric204Headers;
|
|
85
|
+
}
|
|
86
|
+
export interface DeleteMetricDefaultHeaders {
|
|
87
|
+
/** String error code indicating what went wrong. */
|
|
88
|
+
"x-ms-error-code"?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface DeleteMetricDefaultResponse extends HttpResponse {
|
|
91
|
+
status: string;
|
|
92
|
+
body: ErrorResponse;
|
|
93
|
+
headers: RawHttpHeaders & DeleteMetricDefaultHeaders;
|
|
94
|
+
}
|
|
95
|
+
export interface ListMetrics200Headers {
|
|
96
|
+
/** An opaque, globally-unique, client-generated string identifier for the request. */
|
|
97
|
+
"x-ms-client-request-id"?: string;
|
|
98
|
+
}
|
|
99
|
+
/** The request has succeeded. */
|
|
100
|
+
export interface ListMetrics200Response extends HttpResponse {
|
|
101
|
+
status: "200";
|
|
102
|
+
body: PagedExperimentMetricOutput;
|
|
103
|
+
headers: RawHttpHeaders & ListMetrics200Headers;
|
|
104
|
+
}
|
|
105
|
+
export interface ListMetricsDefaultHeaders {
|
|
106
|
+
/** String error code indicating what went wrong. */
|
|
107
|
+
"x-ms-error-code"?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface ListMetricsDefaultResponse extends HttpResponse {
|
|
110
|
+
status: string;
|
|
111
|
+
body: ErrorResponse;
|
|
112
|
+
headers: RawHttpHeaders & ListMetricsDefaultHeaders;
|
|
113
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GetMetricParameters, CreateOrUpdateMetricParameters, DeleteMetricParameters, ValidateMetricParameters, ListMetricsParameters } from "./parameters.js";
|
|
2
|
+
import type { GetMetric200Response, GetMetricDefaultResponse, CreateOrUpdateMetric200Response, CreateOrUpdateMetric201Response, CreateOrUpdateMetricDefaultResponse, DeleteMetric204Response, DeleteMetricDefaultResponse, ValidateMetric200Response, ValidateMetricDefaultResponse, ListMetrics200Response, ListMetricsDefaultResponse } from "./responses.js";
|
|
3
|
+
import type { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
4
|
+
export interface GetMetric {
|
|
5
|
+
/** Fetches an experiment metric by ID. */
|
|
6
|
+
get(options?: GetMetricParameters): StreamableMethod<GetMetric200Response | GetMetricDefaultResponse>;
|
|
7
|
+
/** Creates or updates an experiment metric. */
|
|
8
|
+
patch(options: CreateOrUpdateMetricParameters): StreamableMethod<CreateOrUpdateMetric200Response | CreateOrUpdateMetric201Response | CreateOrUpdateMetricDefaultResponse>;
|
|
9
|
+
/** Deletes an experiment metric. */
|
|
10
|
+
delete(options?: DeleteMetricParameters): StreamableMethod<DeleteMetric204Response | DeleteMetricDefaultResponse>;
|
|
11
|
+
}
|
|
12
|
+
export interface ValidateMetric {
|
|
13
|
+
/** Validates an experiment metric definition. */
|
|
14
|
+
post(options: ValidateMetricParameters): StreamableMethod<ValidateMetric200Response | ValidateMetricDefaultResponse>;
|
|
15
|
+
}
|
|
16
|
+
export interface ListMetrics {
|
|
17
|
+
/** Lists experiment metrics. */
|
|
18
|
+
get(options?: ListMetricsParameters): StreamableMethod<ListMetrics200Response | ListMetricsDefaultResponse>;
|
|
19
|
+
}
|
|
20
|
+
export interface Routes {
|
|
21
|
+
/** Resource for '/experiment-metrics/\{experimentMetricId\}' has methods for the following verbs: get, patch, delete */
|
|
22
|
+
(path: "/experiment-metrics/{experimentMetricId}", experimentMetricId: string): GetMetric;
|
|
23
|
+
/** Resource for '/experiment-metrics:validate' has methods for the following verbs: post */
|
|
24
|
+
(path: "/experiment-metrics:validate"): ValidateMetric;
|
|
25
|
+
/** Resource for '/experiment-metrics' has methods for the following verbs: get */
|
|
26
|
+
(path: "/experiment-metrics"): ListMetrics;
|
|
27
|
+
}
|
|
28
|
+
export type OnlineExperimentationClient = Client & {
|
|
29
|
+
path: Routes;
|
|
30
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desired direction for an experiment metric value.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum KnownDesiredDirection {
|
|
5
|
+
/**
|
|
6
|
+
* An increase to the metric value is desired. E.g., Success rate, Total revenue.
|
|
7
|
+
*/
|
|
8
|
+
Increase = "Increase",
|
|
9
|
+
/**
|
|
10
|
+
* A decrease to the metric value is desired. E.g., Error rate, Latency.
|
|
11
|
+
*/
|
|
12
|
+
Decrease = "Decrease",
|
|
13
|
+
/**
|
|
14
|
+
* Neither an increase nor a decrease to the metric value is desired, or the desired direction depends on other factors. E.g., Number of video play attempts, Number of user feedbacks
|
|
15
|
+
*/
|
|
16
|
+
Neutral = "Neutral"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* How the metric definition calculates metric values from event data.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum KnownExperimentMetricType {
|
|
22
|
+
/**
|
|
23
|
+
* Counts the occurrences of an event. Experiment analysis accounts for unequal traffic allocation.
|
|
24
|
+
*/
|
|
25
|
+
EventCount = "EventCount",
|
|
26
|
+
/**
|
|
27
|
+
* Counts the number of unique users who encounter an event. Experiment analysis accounts for unequal traffic allocation.
|
|
28
|
+
*/
|
|
29
|
+
UserCount = "UserCount",
|
|
30
|
+
/**
|
|
31
|
+
* Calculates the percentage of events that satisfy a specified condition.
|
|
32
|
+
*/
|
|
33
|
+
EventRate = "EventRate",
|
|
34
|
+
/**
|
|
35
|
+
* Calculates the percentage of users who encounter a start event and subsequently encounter an end event. Users must encounter the start event before the end event to be counted.
|
|
36
|
+
*/
|
|
37
|
+
UserRate = "UserRate",
|
|
38
|
+
/**
|
|
39
|
+
* Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic allocation.
|
|
40
|
+
*/
|
|
41
|
+
Sum = "Sum",
|
|
42
|
+
/**
|
|
43
|
+
* Calculates the average value of a specified event property.
|
|
44
|
+
*/
|
|
45
|
+
Average = "Average",
|
|
46
|
+
/**
|
|
47
|
+
* Calculates a specified percentile of an event property.
|
|
48
|
+
*/
|
|
49
|
+
Percentile = "Percentile"
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Lifecycle stages of an experiment metric, determining whether the metric is included in experiment analysis.
|
|
53
|
+
*/
|
|
54
|
+
export declare enum KnownLifecycleStage {
|
|
55
|
+
/**
|
|
56
|
+
* The metric is included in experiment analysis.
|
|
57
|
+
*/
|
|
58
|
+
Active = "Active",
|
|
59
|
+
/**
|
|
60
|
+
* The metric is excluded from experiment analysis but remains available for future use.
|
|
61
|
+
*/
|
|
62
|
+
Inactive = "Inactive"
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The diagnostic error codes.
|
|
66
|
+
*/
|
|
67
|
+
export declare enum KnownDiagnosticCode {
|
|
68
|
+
/**
|
|
69
|
+
* The metric definition does not conform to the JSON schema.
|
|
70
|
+
*/
|
|
71
|
+
FailedSchemaValidation = "FailedSchemaValidation",
|
|
72
|
+
/**
|
|
73
|
+
* The event filter condition is invalid.
|
|
74
|
+
*/
|
|
75
|
+
InvalidEventCondition = "InvalidEventCondition",
|
|
76
|
+
/**
|
|
77
|
+
* Event filter condition has valid syntax but is not currently supported.
|
|
78
|
+
*/
|
|
79
|
+
UnsupportedEventCondition = "UnsupportedEventCondition",
|
|
80
|
+
/**
|
|
81
|
+
* The provided experiment metric definition is invalid.
|
|
82
|
+
* For example, defining a metric to calculate the average of a numeric property but
|
|
83
|
+
* including a filter condition that compares it to a string value creates a type mismatch.
|
|
84
|
+
*/
|
|
85
|
+
InvalidExperimentMetricDefinition = "InvalidExperimentMetricDefinition"
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The result of validating an experiment metric.
|
|
89
|
+
*/
|
|
90
|
+
export declare enum KnownValidationResult {
|
|
91
|
+
/**
|
|
92
|
+
* The experiment metric is valid.
|
|
93
|
+
*/
|
|
94
|
+
Valid = "Valid",
|
|
95
|
+
/**
|
|
96
|
+
* The experiment metric is invalid.
|
|
97
|
+
*/
|
|
98
|
+
Invalid = "Invalid"
|
|
99
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* Desired direction for an experiment metric value.
|
|
5
|
+
*/
|
|
6
|
+
export var KnownDesiredDirection;
|
|
7
|
+
(function (KnownDesiredDirection) {
|
|
8
|
+
/**
|
|
9
|
+
* An increase to the metric value is desired. E.g., Success rate, Total revenue.
|
|
10
|
+
*/
|
|
11
|
+
KnownDesiredDirection["Increase"] = "Increase";
|
|
12
|
+
/**
|
|
13
|
+
* A decrease to the metric value is desired. E.g., Error rate, Latency.
|
|
14
|
+
*/
|
|
15
|
+
KnownDesiredDirection["Decrease"] = "Decrease";
|
|
16
|
+
/**
|
|
17
|
+
* Neither an increase nor a decrease to the metric value is desired, or the desired direction depends on other factors. E.g., Number of video play attempts, Number of user feedbacks
|
|
18
|
+
*/
|
|
19
|
+
KnownDesiredDirection["Neutral"] = "Neutral";
|
|
20
|
+
})(KnownDesiredDirection || (KnownDesiredDirection = {}));
|
|
21
|
+
/**
|
|
22
|
+
* How the metric definition calculates metric values from event data.
|
|
23
|
+
*/
|
|
24
|
+
export var KnownExperimentMetricType;
|
|
25
|
+
(function (KnownExperimentMetricType) {
|
|
26
|
+
/**
|
|
27
|
+
* Counts the occurrences of an event. Experiment analysis accounts for unequal traffic allocation.
|
|
28
|
+
*/
|
|
29
|
+
KnownExperimentMetricType["EventCount"] = "EventCount";
|
|
30
|
+
/**
|
|
31
|
+
* Counts the number of unique users who encounter an event. Experiment analysis accounts for unequal traffic allocation.
|
|
32
|
+
*/
|
|
33
|
+
KnownExperimentMetricType["UserCount"] = "UserCount";
|
|
34
|
+
/**
|
|
35
|
+
* Calculates the percentage of events that satisfy a specified condition.
|
|
36
|
+
*/
|
|
37
|
+
KnownExperimentMetricType["EventRate"] = "EventRate";
|
|
38
|
+
/**
|
|
39
|
+
* Calculates the percentage of users who encounter a start event and subsequently encounter an end event. Users must encounter the start event before the end event to be counted.
|
|
40
|
+
*/
|
|
41
|
+
KnownExperimentMetricType["UserRate"] = "UserRate";
|
|
42
|
+
/**
|
|
43
|
+
* Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic allocation.
|
|
44
|
+
*/
|
|
45
|
+
KnownExperimentMetricType["Sum"] = "Sum";
|
|
46
|
+
/**
|
|
47
|
+
* Calculates the average value of a specified event property.
|
|
48
|
+
*/
|
|
49
|
+
KnownExperimentMetricType["Average"] = "Average";
|
|
50
|
+
/**
|
|
51
|
+
* Calculates a specified percentile of an event property.
|
|
52
|
+
*/
|
|
53
|
+
KnownExperimentMetricType["Percentile"] = "Percentile";
|
|
54
|
+
})(KnownExperimentMetricType || (KnownExperimentMetricType = {}));
|
|
55
|
+
/**
|
|
56
|
+
* Lifecycle stages of an experiment metric, determining whether the metric is included in experiment analysis.
|
|
57
|
+
*/
|
|
58
|
+
export var KnownLifecycleStage;
|
|
59
|
+
(function (KnownLifecycleStage) {
|
|
60
|
+
/**
|
|
61
|
+
* The metric is included in experiment analysis.
|
|
62
|
+
*/
|
|
63
|
+
KnownLifecycleStage["Active"] = "Active";
|
|
64
|
+
/**
|
|
65
|
+
* The metric is excluded from experiment analysis but remains available for future use.
|
|
66
|
+
*/
|
|
67
|
+
KnownLifecycleStage["Inactive"] = "Inactive";
|
|
68
|
+
})(KnownLifecycleStage || (KnownLifecycleStage = {}));
|
|
69
|
+
/**
|
|
70
|
+
* The diagnostic error codes.
|
|
71
|
+
*/
|
|
72
|
+
export var KnownDiagnosticCode;
|
|
73
|
+
(function (KnownDiagnosticCode) {
|
|
74
|
+
/**
|
|
75
|
+
* The metric definition does not conform to the JSON schema.
|
|
76
|
+
*/
|
|
77
|
+
KnownDiagnosticCode["FailedSchemaValidation"] = "FailedSchemaValidation";
|
|
78
|
+
/**
|
|
79
|
+
* The event filter condition is invalid.
|
|
80
|
+
*/
|
|
81
|
+
KnownDiagnosticCode["InvalidEventCondition"] = "InvalidEventCondition";
|
|
82
|
+
/**
|
|
83
|
+
* Event filter condition has valid syntax but is not currently supported.
|
|
84
|
+
*/
|
|
85
|
+
KnownDiagnosticCode["UnsupportedEventCondition"] = "UnsupportedEventCondition";
|
|
86
|
+
/**
|
|
87
|
+
* The provided experiment metric definition is invalid.
|
|
88
|
+
* For example, defining a metric to calculate the average of a numeric property but
|
|
89
|
+
* including a filter condition that compares it to a string value creates a type mismatch.
|
|
90
|
+
*/
|
|
91
|
+
KnownDiagnosticCode["InvalidExperimentMetricDefinition"] = "InvalidExperimentMetricDefinition";
|
|
92
|
+
})(KnownDiagnosticCode || (KnownDiagnosticCode = {}));
|
|
93
|
+
/**
|
|
94
|
+
* The result of validating an experiment metric.
|
|
95
|
+
*/
|
|
96
|
+
export var KnownValidationResult;
|
|
97
|
+
(function (KnownValidationResult) {
|
|
98
|
+
/**
|
|
99
|
+
* The experiment metric is valid.
|
|
100
|
+
*/
|
|
101
|
+
KnownValidationResult["Valid"] = "Valid";
|
|
102
|
+
/**
|
|
103
|
+
* The experiment metric is invalid.
|
|
104
|
+
*/
|
|
105
|
+
KnownValidationResult["Invalid"] = "Invalid";
|
|
106
|
+
})(KnownValidationResult || (KnownValidationResult = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import OnlineExperimentationClient from "./onlineExperimentationClient.js";
|
|
2
|
+
export * from "./onlineExperimentationClient.js";
|
|
3
|
+
export * from "./parameters.js";
|
|
4
|
+
export * from "./responses.js";
|
|
5
|
+
export * from "./clientDefinitions.js";
|
|
6
|
+
export * from "./isUnexpected.js";
|
|
7
|
+
export * from "./models.js";
|
|
8
|
+
export * from "./outputModels.js";
|
|
9
|
+
export * from "./paginateHelper.js";
|
|
10
|
+
export * from "./extensibleEnums.js";
|
|
11
|
+
export { OnlineExperimentationClient };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import OnlineExperimentationClient from "./onlineExperimentationClient.js";
|
|
4
|
+
export * from "./onlineExperimentationClient.js";
|
|
5
|
+
export * from "./parameters.js";
|
|
6
|
+
export * from "./responses.js";
|
|
7
|
+
export * from "./clientDefinitions.js";
|
|
8
|
+
export * from "./isUnexpected.js";
|
|
9
|
+
export * from "./models.js";
|
|
10
|
+
export * from "./outputModels.js";
|
|
11
|
+
export * from "./paginateHelper.js";
|
|
12
|
+
export * from "./extensibleEnums.js";
|
|
13
|
+
export { OnlineExperimentationClient };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GetMetric200Response, GetMetricDefaultResponse, CreateOrUpdateMetric200Response, CreateOrUpdateMetric201Response, CreateOrUpdateMetricDefaultResponse, DeleteMetric204Response, DeleteMetricDefaultResponse, ValidateMetric200Response, ValidateMetricDefaultResponse, ListMetrics200Response, ListMetricsDefaultResponse } from "./responses.js";
|
|
2
|
+
export declare function isUnexpected(response: GetMetric200Response | GetMetricDefaultResponse): response is GetMetricDefaultResponse;
|
|
3
|
+
export declare function isUnexpected(response: CreateOrUpdateMetric200Response | CreateOrUpdateMetric201Response | CreateOrUpdateMetricDefaultResponse): response is CreateOrUpdateMetricDefaultResponse;
|
|
4
|
+
export declare function isUnexpected(response: DeleteMetric204Response | DeleteMetricDefaultResponse): response is DeleteMetricDefaultResponse;
|
|
5
|
+
export declare function isUnexpected(response: ValidateMetric200Response | ValidateMetricDefaultResponse): response is ValidateMetricDefaultResponse;
|
|
6
|
+
export declare function isUnexpected(response: ListMetrics200Response | ListMetricsDefaultResponse): response is ListMetricsDefaultResponse;
|