@azure-rest/communication-messages 2.0.1-alpha.20241114.1 → 2.0.1-alpha.20241119.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/dist/browser/generated/src/clientDefinitions.d.ts +27 -0
- package/dist/browser/generated/src/clientDefinitions.d.ts.map +1 -0
- package/dist/browser/generated/src/clientDefinitions.js.map +1 -0
- package/dist/browser/generated/src/index.d.ts +11 -0
- package/dist/browser/generated/src/index.d.ts.map +1 -0
- package/dist/browser/generated/src/index.js +13 -0
- package/dist/browser/generated/src/index.js.map +1 -0
- package/dist/browser/generated/src/isUnexpected.d.ts +5 -0
- package/dist/browser/generated/src/isUnexpected.d.ts.map +1 -0
- package/dist/browser/generated/src/isUnexpected.js.map +1 -0
- package/dist/browser/generated/src/logger.d.ts +2 -0
- package/dist/browser/generated/src/logger.d.ts.map +1 -0
- package/dist/browser/generated/src/messagesServiceClient.d.ts +16 -0
- package/dist/browser/generated/src/messagesServiceClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/src/messagesServiceClient.js +1 -1
- package/dist/browser/generated/src/messagesServiceClient.js.map +1 -0
- package/dist/browser/generated/src/models.d.ts +194 -0
- package/dist/browser/generated/src/models.d.ts.map +1 -0
- package/dist/browser/generated/src/outputModels.d.ts +45 -0
- package/dist/browser/generated/src/outputModels.d.ts.map +1 -0
- package/dist/browser/generated/src/paginateHelper.d.ts +43 -0
- package/dist/browser/generated/src/paginateHelper.d.ts.map +1 -0
- package/dist/browser/generated/src/parameters.d.ts +43 -0
- package/dist/browser/generated/src/parameters.d.ts.map +1 -0
- package/dist/browser/generated/src/parameters.js.map +1 -0
- package/dist/browser/generated/src/responses.d.ts +66 -0
- package/dist/browser/generated/src/responses.d.ts.map +1 -0
- package/dist/browser/generated/src/responses.js.map +1 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +13 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/messagesServiceClient.d.ts +17 -0
- package/dist/browser/messagesServiceClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/messagesServiceClient.js +1 -1
- package/dist/browser/messagesServiceClient.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/commonjs/generated/src/clientDefinitions.d.ts +27 -0
- package/dist/commonjs/generated/src/clientDefinitions.d.ts.map +1 -0
- package/dist/commonjs/generated/src/clientDefinitions.js +5 -0
- package/dist/commonjs/generated/src/clientDefinitions.js.map +1 -0
- package/dist/commonjs/generated/src/index.d.ts +11 -0
- package/dist/commonjs/generated/src/index.d.ts.map +1 -0
- package/dist/commonjs/generated/src/index.js +16 -0
- package/dist/commonjs/generated/src/index.js.map +1 -0
- package/dist/commonjs/generated/src/isUnexpected.d.ts +5 -0
- package/dist/commonjs/generated/src/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/generated/src/isUnexpected.js +76 -0
- package/dist/commonjs/generated/src/isUnexpected.js.map +1 -0
- package/dist/commonjs/generated/src/logger.d.ts +2 -0
- package/dist/commonjs/generated/src/logger.d.ts.map +1 -0
- package/dist/commonjs/generated/src/logger.js +8 -0
- package/dist/commonjs/generated/src/logger.js.map +1 -0
- package/dist/commonjs/generated/src/messagesServiceClient.d.ts +16 -0
- package/dist/commonjs/generated/src/messagesServiceClient.d.ts.map +1 -0
- package/dist/commonjs/generated/src/messagesServiceClient.js +49 -0
- package/dist/commonjs/generated/src/messagesServiceClient.js.map +1 -0
- package/dist/commonjs/generated/src/models.d.ts +194 -0
- package/dist/commonjs/generated/src/models.d.ts.map +1 -0
- package/dist/commonjs/generated/src/models.js +5 -0
- package/dist/commonjs/generated/src/models.js.map +1 -0
- package/dist/commonjs/generated/src/outputModels.d.ts +45 -0
- package/dist/commonjs/generated/src/outputModels.d.ts.map +1 -0
- package/dist/commonjs/generated/src/outputModels.js +5 -0
- package/dist/commonjs/generated/src/outputModels.js.map +1 -0
- package/dist/commonjs/generated/src/paginateHelper.d.ts +43 -0
- package/dist/commonjs/generated/src/paginateHelper.d.ts.map +1 -0
- package/dist/commonjs/generated/src/paginateHelper.js +86 -0
- package/dist/commonjs/generated/src/paginateHelper.js.map +1 -0
- package/dist/commonjs/generated/src/parameters.d.ts +43 -0
- package/dist/commonjs/generated/src/parameters.d.ts.map +1 -0
- package/dist/commonjs/generated/src/parameters.js +5 -0
- package/dist/commonjs/generated/src/parameters.js.map +1 -0
- package/dist/commonjs/generated/src/responses.d.ts +66 -0
- package/dist/commonjs/generated/src/responses.d.ts.map +1 -0
- package/dist/commonjs/generated/src/responses.js +5 -0
- package/dist/commonjs/generated/src/responses.js.map +1 -0
- package/dist/commonjs/index.d.ts +11 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +16 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/messagesServiceClient.d.ts +17 -0
- package/dist/commonjs/messagesServiceClient.d.ts.map +1 -0
- package/dist/commonjs/messagesServiceClient.js +31 -0
- package/dist/commonjs/messagesServiceClient.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/generated/src/clientDefinitions.d.ts +27 -0
- package/dist/esm/generated/src/clientDefinitions.d.ts.map +1 -0
- package/dist/esm/generated/src/clientDefinitions.js +4 -0
- package/dist/esm/generated/src/clientDefinitions.js.map +1 -0
- package/dist/esm/generated/src/index.d.ts +11 -0
- package/dist/esm/generated/src/index.d.ts.map +1 -0
- package/dist/esm/generated/src/index.js +13 -0
- package/dist/esm/generated/src/index.js.map +1 -0
- package/dist/esm/generated/src/isUnexpected.d.ts +5 -0
- package/dist/esm/generated/src/isUnexpected.d.ts.map +1 -0
- package/dist/esm/generated/src/isUnexpected.js +73 -0
- package/dist/esm/generated/src/isUnexpected.js.map +1 -0
- package/dist/esm/generated/src/logger.d.ts +2 -0
- package/dist/esm/generated/src/logger.d.ts.map +1 -0
- package/dist/esm/generated/src/logger.js +5 -0
- package/dist/esm/generated/src/logger.js.map +1 -0
- package/dist/esm/generated/src/messagesServiceClient.d.ts +16 -0
- package/dist/esm/generated/src/messagesServiceClient.d.ts.map +1 -0
- package/dist/esm/generated/src/messagesServiceClient.js +46 -0
- package/dist/esm/generated/src/messagesServiceClient.js.map +1 -0
- package/dist/esm/generated/src/models.d.ts +194 -0
- package/dist/esm/generated/src/models.d.ts.map +1 -0
- package/dist/esm/generated/src/models.js +4 -0
- package/dist/esm/generated/src/models.js.map +1 -0
- package/dist/esm/generated/src/outputModels.d.ts +45 -0
- package/dist/esm/generated/src/outputModels.d.ts.map +1 -0
- package/dist/esm/generated/src/outputModels.js +4 -0
- package/dist/esm/generated/src/outputModels.js.map +1 -0
- package/dist/esm/generated/src/paginateHelper.d.ts +43 -0
- package/dist/esm/generated/src/paginateHelper.d.ts.map +1 -0
- package/dist/esm/generated/src/paginateHelper.js +83 -0
- package/dist/esm/generated/src/paginateHelper.js.map +1 -0
- package/dist/esm/generated/src/parameters.d.ts +43 -0
- package/dist/esm/generated/src/parameters.d.ts.map +1 -0
- package/dist/esm/generated/src/parameters.js +4 -0
- package/dist/esm/generated/src/parameters.js.map +1 -0
- package/dist/esm/generated/src/responses.d.ts +66 -0
- package/dist/esm/generated/src/responses.d.ts.map +1 -0
- package/dist/esm/generated/src/responses.js +4 -0
- package/dist/esm/generated/src/responses.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/messagesServiceClient.d.ts +17 -0
- package/dist/esm/messagesServiceClient.d.ts.map +1 -0
- package/dist/esm/messagesServiceClient.js +27 -0
- package/dist/esm/messagesServiceClient.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/react-native/generated/src/clientDefinitions.d.ts +27 -0
- package/dist/react-native/generated/src/clientDefinitions.d.ts.map +1 -0
- package/dist/react-native/generated/src/clientDefinitions.js +4 -0
- package/dist/react-native/generated/src/clientDefinitions.js.map +1 -0
- package/dist/react-native/generated/src/index.d.ts +11 -0
- package/dist/react-native/generated/src/index.d.ts.map +1 -0
- package/dist/react-native/generated/src/index.js +13 -0
- package/dist/react-native/generated/src/index.js.map +1 -0
- package/dist/react-native/generated/src/isUnexpected.d.ts +5 -0
- package/dist/react-native/generated/src/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/generated/src/isUnexpected.js +73 -0
- package/dist/react-native/generated/src/isUnexpected.js.map +1 -0
- package/dist/react-native/generated/src/logger.d.ts +2 -0
- package/dist/react-native/generated/src/logger.d.ts.map +1 -0
- package/dist/react-native/generated/src/logger.js +5 -0
- package/dist/react-native/generated/src/logger.js.map +1 -0
- package/dist/react-native/generated/src/messagesServiceClient.d.ts +16 -0
- package/dist/react-native/generated/src/messagesServiceClient.d.ts.map +1 -0
- package/dist/react-native/generated/src/messagesServiceClient.js +46 -0
- package/dist/react-native/generated/src/messagesServiceClient.js.map +1 -0
- package/dist/react-native/generated/src/models.d.ts +194 -0
- package/dist/react-native/generated/src/models.d.ts.map +1 -0
- package/dist/react-native/generated/src/models.js +4 -0
- package/dist/react-native/generated/src/models.js.map +1 -0
- package/dist/react-native/generated/src/outputModels.d.ts +45 -0
- package/dist/react-native/generated/src/outputModels.d.ts.map +1 -0
- package/dist/react-native/generated/src/outputModels.js +4 -0
- package/dist/react-native/generated/src/outputModels.js.map +1 -0
- package/dist/react-native/generated/src/paginateHelper.d.ts +43 -0
- package/dist/react-native/generated/src/paginateHelper.d.ts.map +1 -0
- package/dist/react-native/generated/src/paginateHelper.js +83 -0
- package/dist/react-native/generated/src/paginateHelper.js.map +1 -0
- package/dist/react-native/generated/src/parameters.d.ts +43 -0
- package/dist/react-native/generated/src/parameters.d.ts.map +1 -0
- package/dist/react-native/generated/src/parameters.js +4 -0
- package/dist/react-native/generated/src/parameters.js.map +1 -0
- package/dist/react-native/generated/src/responses.d.ts +66 -0
- package/dist/react-native/generated/src/responses.d.ts.map +1 -0
- package/dist/react-native/generated/src/responses.js +4 -0
- package/dist/react-native/generated/src/responses.js.map +1 -0
- package/dist/react-native/index.d.ts +11 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +13 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/messagesServiceClient.d.ts +17 -0
- package/dist/react-native/messagesServiceClient.d.ts.map +1 -0
- package/dist/react-native/messagesServiceClient.js +27 -0
- package/dist/react-native/messagesServiceClient.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/package.json +60 -39
- package/dist/index.js +0 -243
- package/dist/index.js.map +0 -1
- package/dist-esm/src/generated/src/clientDefinitions.js.map +0 -1
- package/dist-esm/src/generated/src/index.js +0 -13
- package/dist-esm/src/generated/src/index.js.map +0 -1
- package/dist-esm/src/generated/src/isUnexpected.js.map +0 -1
- package/dist-esm/src/generated/src/messagesServiceClient.js.map +0 -1
- package/dist-esm/src/generated/src/parameters.js.map +0 -1
- package/dist-esm/src/generated/src/responses.js.map +0 -1
- package/dist-esm/src/index.js +0 -13
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/messagesServiceClient.js.map +0 -1
- package/review/communication-messages.api.md +0 -450
- /package/{dist-esm/src → dist/browser}/generated/src/clientDefinitions.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/isUnexpected.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/logger.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/logger.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/models.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/models.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/outputModels.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/outputModels.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/paginateHelper.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/paginateHelper.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/parameters.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/src/responses.js +0 -0
- /package/{types → dist}/communication-messages.d.ts +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
const responseMap = {
|
|
4
|
+
"GET /messages/streams/{id}": ["200"],
|
|
5
|
+
"POST /messages/notifications:send": ["202"],
|
|
6
|
+
"GET /messages/channels/{channelId}/templates": ["200"],
|
|
7
|
+
};
|
|
8
|
+
export function isUnexpected(response) {
|
|
9
|
+
const lroOriginal = response.headers["x-ms-original-url"];
|
|
10
|
+
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
11
|
+
const method = response.request.method;
|
|
12
|
+
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
13
|
+
if (!pathDetails) {
|
|
14
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
15
|
+
}
|
|
16
|
+
return !pathDetails.includes(response.status);
|
|
17
|
+
}
|
|
18
|
+
function getParametrizedPathSuccess(method, path) {
|
|
19
|
+
var _a, _b, _c, _d;
|
|
20
|
+
const pathParts = path.split("/");
|
|
21
|
+
// Traverse list to match the longest candidate
|
|
22
|
+
// matchedLen: the length of candidate path
|
|
23
|
+
// matchedValue: the matched status code array
|
|
24
|
+
let matchedLen = -1, matchedValue = [];
|
|
25
|
+
// Iterate the responseMap to find a match
|
|
26
|
+
for (const [key, value] of Object.entries(responseMap)) {
|
|
27
|
+
// Extracting the path from the map key which is in format
|
|
28
|
+
// GET /path/foo
|
|
29
|
+
if (!key.startsWith(method)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const candidatePath = getPathFromMapKey(key);
|
|
33
|
+
// Get each part of the url path
|
|
34
|
+
const candidateParts = candidatePath.split("/");
|
|
35
|
+
// track if we have found a match to return the values found.
|
|
36
|
+
let found = true;
|
|
37
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
38
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
|
|
39
|
+
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
40
|
+
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
41
|
+
// If the current part of the candidate is a "template" part
|
|
42
|
+
// Try to use the suffix of pattern to match the path
|
|
43
|
+
// {guid} ==> $
|
|
44
|
+
// {guid}:export ==> :export$
|
|
45
|
+
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
46
|
+
if (!isMatched) {
|
|
47
|
+
found = false;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// If the candidate part is not a template and
|
|
53
|
+
// the parts don't match mark the candidate as not found
|
|
54
|
+
// to move on with the next candidate path.
|
|
55
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
56
|
+
found = false;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// We finished evaluating the current candidate parts
|
|
61
|
+
// Update the matched value if and only if we found the longer pattern
|
|
62
|
+
if (found && candidatePath.length > matchedLen) {
|
|
63
|
+
matchedLen = candidatePath.length;
|
|
64
|
+
matchedValue = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return matchedValue;
|
|
68
|
+
}
|
|
69
|
+
function getPathFromMapKey(mapKey) {
|
|
70
|
+
const pathStart = mapKey.indexOf("/");
|
|
71
|
+
return mapKey.slice(pathStart);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=isUnexpected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/generated/src/isUnex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AK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n GetMedia200Response,\n GetMediaDefaultResponse,\n Send202Response,\n SendDefaultResponse,\n ListTemplates200Response,\n ListTemplatesDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /messages/streams/{id}\": [\"200\"],\n \"POST /messages/notifications:send\": [\"202\"],\n \"GET /messages/channels/{channelId}/templates\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetMedia200Response | GetMediaDefaultResponse,\n): response is GetMediaDefaultResponse;\nexport function isUnexpected(\n response: Send202Response | SendDefaultResponse,\n): response is SendDefaultResponse;\nexport function isUnexpected(\n response: ListTemplates200Response | ListTemplatesDefaultResponse,\n): response is ListTemplatesDefaultResponse;\nexport function isUnexpected(\n response:\n | GetMedia200Response\n | GetMediaDefaultResponse\n | Send202Response\n | SendDefaultResponse\n | ListTemplates200Response\n | ListTemplatesDefaultResponse,\n): response is\n | GetMediaDefaultResponse\n | SendDefaultResponse\n | ListTemplatesDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (\n let i = candidateParts.length - 1, j = pathParts.length - 1;\n i >= 1 && j >= 1;\n i--, j--\n ) {\n if (\n candidateParts[i]?.startsWith(\"{\") &&\n candidateParts[i]?.indexOf(\"}\") !== -1\n ) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(\n `${candidateParts[i]?.slice(start, end)}`,\n ).test(pathParts[j] || \"\");\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/logger.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,qCAA+C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/generated/src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"communication-messages\");\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ClientOptions } from "@azure-rest/core-client";
|
|
2
|
+
import { TokenCredential, KeyCredential } from "@azure/core-auth";
|
|
3
|
+
import { MessagesServiceClient } from "./clientDefinitions.js";
|
|
4
|
+
/** The optional parameters for the client */
|
|
5
|
+
export interface MessagesServiceClientOptions extends ClientOptions {
|
|
6
|
+
/** The api version option of the client */
|
|
7
|
+
apiVersion?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Initialize a new instance of `MessagesServiceClient`
|
|
11
|
+
* @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com
|
|
12
|
+
* @param credentials - uniquely identify client credential
|
|
13
|
+
* @param options - the parameter for all optional parameters
|
|
14
|
+
*/
|
|
15
|
+
export default function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, { apiVersion, ...options }?: MessagesServiceClientOptions): MessagesServiceClient;
|
|
16
|
+
//# sourceMappingURL=messagesServiceClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagesServiceClient.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/messagesServiceClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,6CAA6C;AAC7C,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IACjE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,4BAAiC,GAC3E,qBAAqB,CA+CvB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { __rest } from "tslib";
|
|
4
|
+
import { getClient } from "@azure-rest/core-client";
|
|
5
|
+
import { logger } from "./logger.js";
|
|
6
|
+
/**
|
|
7
|
+
* Initialize a new instance of `MessagesServiceClient`
|
|
8
|
+
* @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com
|
|
9
|
+
* @param credentials - uniquely identify client credential
|
|
10
|
+
* @param options - the parameter for all optional parameters
|
|
11
|
+
*/
|
|
12
|
+
export default function createClient(endpointParam, credentials, _a = {}) {
|
|
13
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14
|
+
var { apiVersion = "2024-08-30" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
15
|
+
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}`;
|
|
16
|
+
const userAgentInfo = `azsdk-js-communication-messages-rest/2.0.0`;
|
|
17
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
18
|
+
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
19
|
+
: `${userAgentInfo}`;
|
|
20
|
+
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
21
|
+
userAgentPrefix,
|
|
22
|
+
}, loggingOptions: {
|
|
23
|
+
logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
|
|
24
|
+
}, credentials: {
|
|
25
|
+
scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [
|
|
26
|
+
"https://communication.azure.com/.default",
|
|
27
|
+
],
|
|
28
|
+
apiKeyHeaderName: (_j = (_h = options.credentials) === null || _h === void 0 ? void 0 : _h.apiKeyHeaderName) !== null && _j !== void 0 ? _j : "Authorization",
|
|
29
|
+
} });
|
|
30
|
+
const client = getClient(endpointUrl, credentials, options);
|
|
31
|
+
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
32
|
+
client.pipeline.addPolicy({
|
|
33
|
+
name: "ClientApiVersionPolicy",
|
|
34
|
+
sendRequest: (req, next) => {
|
|
35
|
+
// Use the apiVersion defined in request url directly
|
|
36
|
+
// Append one if there is no apiVersion and we have one at client options
|
|
37
|
+
const url = new URL(req.url);
|
|
38
|
+
if (!url.searchParams.get("api-version") && apiVersion) {
|
|
39
|
+
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
40
|
+
}
|
|
41
|
+
return next(req);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return client;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=messagesServiceClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagesServiceClient.js","sourceRoot":"","sources":["../../../../src/generated/src/messagesServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,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yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport { MessagesServiceClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface MessagesServiceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `MessagesServiceClient`\n * @param endpointParam - The communication resource, for example https://my-resource.communication.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-08-30\", ...options }: MessagesServiceClientOptions = {},\n): MessagesServiceClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;\n const userAgentInfo = `azsdk-js-communication-messages-rest/2.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://communication.azure.com/.default\",\n ],\n apiKeyHeaderName:\n options.credentials?.apiKeyHeaderName ?? \"Authorization\",\n },\n };\n const client = getClient(\n endpointUrl,\n credentials,\n options,\n ) as MessagesServiceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/** Details of the message to send. */
|
|
2
|
+
export interface NotificationContentParent {
|
|
3
|
+
/** The Channel Registration ID for the Business Identifier. */
|
|
4
|
+
channelRegistrationId: string;
|
|
5
|
+
/** The native external platform user identifiers of the recipient. */
|
|
6
|
+
to: string[];
|
|
7
|
+
kind: CommunicationMessageKind;
|
|
8
|
+
}
|
|
9
|
+
/** A request to send a text notification. */
|
|
10
|
+
export interface TextNotificationContent extends NotificationContentParent {
|
|
11
|
+
/** Message notification type is text. */
|
|
12
|
+
kind: "text";
|
|
13
|
+
/** Message content. */
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
/** @deprecated A request to send an image notification. */
|
|
17
|
+
export interface MediaNotificationContent extends NotificationContentParent {
|
|
18
|
+
/** Message notification type is image. */
|
|
19
|
+
kind: "image_v0";
|
|
20
|
+
/** Optional text content. */
|
|
21
|
+
content?: string;
|
|
22
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
23
|
+
mediaUri: string;
|
|
24
|
+
}
|
|
25
|
+
/** A request to send an image notification. */
|
|
26
|
+
export interface ImageNotificationContent extends NotificationContentParent {
|
|
27
|
+
/** Message notification type is image. */
|
|
28
|
+
kind: "image";
|
|
29
|
+
/** Optional text content. */
|
|
30
|
+
caption?: string;
|
|
31
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
32
|
+
mediaUri: string;
|
|
33
|
+
}
|
|
34
|
+
/** A request to send a document notification. */
|
|
35
|
+
export interface DocumentNotificationContent extends NotificationContentParent {
|
|
36
|
+
/** Message notification type is image. */
|
|
37
|
+
kind: "document";
|
|
38
|
+
/** Optional text content. */
|
|
39
|
+
caption?: string;
|
|
40
|
+
/** Optional name for the file. */
|
|
41
|
+
fileName?: string;
|
|
42
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
43
|
+
mediaUri: string;
|
|
44
|
+
}
|
|
45
|
+
/** A request to send a video notification. */
|
|
46
|
+
export interface VideoNotificationContent extends NotificationContentParent {
|
|
47
|
+
/** Message notification type is image. */
|
|
48
|
+
kind: "video";
|
|
49
|
+
/** Optional text content. */
|
|
50
|
+
caption?: string;
|
|
51
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
52
|
+
mediaUri: string;
|
|
53
|
+
}
|
|
54
|
+
/** A request to send an audio notification. */
|
|
55
|
+
export interface AudioNotificationContent extends NotificationContentParent {
|
|
56
|
+
/** Message notification type is audio. */
|
|
57
|
+
kind: "audio";
|
|
58
|
+
/** A media url for the file. Required if the type is one of the supported media types, e.g. image */
|
|
59
|
+
mediaUri: string;
|
|
60
|
+
}
|
|
61
|
+
/** A request to send a template notification. */
|
|
62
|
+
export interface TemplateNotificationContent extends NotificationContentParent {
|
|
63
|
+
/** Message notification type is template. */
|
|
64
|
+
kind: "template";
|
|
65
|
+
/** The template object used to create templates. */
|
|
66
|
+
template: MessageTemplate;
|
|
67
|
+
}
|
|
68
|
+
/** The template object used to create templates. */
|
|
69
|
+
export interface MessageTemplate {
|
|
70
|
+
/** Name of the template. */
|
|
71
|
+
name: string;
|
|
72
|
+
/** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */
|
|
73
|
+
language: string;
|
|
74
|
+
/** The template values. */
|
|
75
|
+
values?: Array<MessageTemplateValue>;
|
|
76
|
+
/** The binding object to link values to the template specific locations */
|
|
77
|
+
bindings?: MessageTemplateBindings;
|
|
78
|
+
}
|
|
79
|
+
/** The class describes a parameter of a template. */
|
|
80
|
+
export interface MessageTemplateValueParent {
|
|
81
|
+
/** Template binding reference name */
|
|
82
|
+
name: string;
|
|
83
|
+
kind: MessageTemplateValueKind;
|
|
84
|
+
}
|
|
85
|
+
/** The message template's text value information. */
|
|
86
|
+
export interface MessageTemplateText extends MessageTemplateValueParent {
|
|
87
|
+
/** Message parameter type is text. */
|
|
88
|
+
kind: "text";
|
|
89
|
+
/** The text value. */
|
|
90
|
+
text: string;
|
|
91
|
+
}
|
|
92
|
+
/** The message template's image value information. */
|
|
93
|
+
export interface MessageTemplateImage extends MessageTemplateValueParent {
|
|
94
|
+
/** Message parameter type is image. */
|
|
95
|
+
kind: "image";
|
|
96
|
+
/** The (public) URL of the media. */
|
|
97
|
+
url: string;
|
|
98
|
+
/** The [optional] caption of the media object. */
|
|
99
|
+
caption?: string;
|
|
100
|
+
/** The [optional] filename of the media file. */
|
|
101
|
+
fileName?: string;
|
|
102
|
+
}
|
|
103
|
+
/** The message template's document value information. */
|
|
104
|
+
export interface MessageTemplateDocument extends MessageTemplateValueParent {
|
|
105
|
+
/** Message parameter type is document. */
|
|
106
|
+
kind: "document";
|
|
107
|
+
/** The (public) URL of the media. */
|
|
108
|
+
url: string;
|
|
109
|
+
/** The [optional] caption of the media object. */
|
|
110
|
+
caption?: string;
|
|
111
|
+
/** The [optional] filename of the media file. */
|
|
112
|
+
fileName?: string;
|
|
113
|
+
}
|
|
114
|
+
/** The message template's video value information. */
|
|
115
|
+
export interface MessageTemplateVideo extends MessageTemplateValueParent {
|
|
116
|
+
/** Message parameter type is video. */
|
|
117
|
+
kind: "video";
|
|
118
|
+
/** The (public) URL of the media. */
|
|
119
|
+
url: string;
|
|
120
|
+
/** The [optional] caption of the media object. */
|
|
121
|
+
caption?: string;
|
|
122
|
+
/** The [optional] filename of the media file. */
|
|
123
|
+
fileName?: string;
|
|
124
|
+
}
|
|
125
|
+
/** The message template's location value information. */
|
|
126
|
+
export interface MessageTemplateLocation extends MessageTemplateValueParent {
|
|
127
|
+
/** Message parameter type is location. */
|
|
128
|
+
kind: "location";
|
|
129
|
+
/** The [Optional] name of the location. */
|
|
130
|
+
locationName?: string;
|
|
131
|
+
/** The [Optional] address of the location. */
|
|
132
|
+
address?: string;
|
|
133
|
+
/** The latitude of the location. */
|
|
134
|
+
latitude: number;
|
|
135
|
+
/** The longitude of the location. */
|
|
136
|
+
longitude: number;
|
|
137
|
+
}
|
|
138
|
+
/** The message template's quick action value information. */
|
|
139
|
+
export interface MessageTemplateQuickAction extends MessageTemplateValueParent {
|
|
140
|
+
/** Message parameter type is quick action. */
|
|
141
|
+
kind: "quickAction";
|
|
142
|
+
/** The [Optional] quick action text */
|
|
143
|
+
text?: string;
|
|
144
|
+
/** The [Optional] quick action payload */
|
|
145
|
+
payload?: string;
|
|
146
|
+
}
|
|
147
|
+
/** The binding object to link values to the template specific locations */
|
|
148
|
+
export interface MessageTemplateBindingsParent {
|
|
149
|
+
kind: MessageTemplateBindingsKind;
|
|
150
|
+
}
|
|
151
|
+
/** The template bindings for WhatsApp */
|
|
152
|
+
export interface WhatsAppMessageTemplateBindings extends MessageTemplateBindingsParent {
|
|
153
|
+
/** MessageTemplateBindings is whatsApp */
|
|
154
|
+
kind: "whatsApp";
|
|
155
|
+
/** The header template bindings */
|
|
156
|
+
header?: Array<WhatsAppMessageTemplateBindingsComponent>;
|
|
157
|
+
/** The body template bindings */
|
|
158
|
+
body?: Array<WhatsAppMessageTemplateBindingsComponent>;
|
|
159
|
+
/** The footer template bindings */
|
|
160
|
+
footer?: Array<WhatsAppMessageTemplateBindingsComponent>;
|
|
161
|
+
/** The button template bindings */
|
|
162
|
+
buttons?: Array<WhatsAppMessageTemplateBindingsButton>;
|
|
163
|
+
}
|
|
164
|
+
/** The template bindings component for WhatsApp */
|
|
165
|
+
export interface WhatsAppMessageTemplateBindingsComponent {
|
|
166
|
+
/** The name of the referenced item in the template values. */
|
|
167
|
+
refValue: string;
|
|
168
|
+
}
|
|
169
|
+
/** The template bindings component button for WhatsApp */
|
|
170
|
+
export interface WhatsAppMessageTemplateBindingsButton {
|
|
171
|
+
/**
|
|
172
|
+
* The WhatsApp button sub type
|
|
173
|
+
*
|
|
174
|
+
* Possible values: "quickReply", "url"
|
|
175
|
+
*/
|
|
176
|
+
subType: WhatsAppMessageButtonSubType;
|
|
177
|
+
/** The name of the referenced item in the template values. */
|
|
178
|
+
refValue: string;
|
|
179
|
+
}
|
|
180
|
+
/** Details of the message to send. */
|
|
181
|
+
export type NotificationContent = NotificationContentParent | TextNotificationContent | MediaNotificationContent | ImageNotificationContent | DocumentNotificationContent | VideoNotificationContent | AudioNotificationContent | TemplateNotificationContent;
|
|
182
|
+
/** The class describes a parameter of a template. */
|
|
183
|
+
export type MessageTemplateValue = MessageTemplateValueParent | MessageTemplateText | MessageTemplateImage | MessageTemplateDocument | MessageTemplateVideo | MessageTemplateLocation | MessageTemplateQuickAction;
|
|
184
|
+
/** The binding object to link values to the template specific locations */
|
|
185
|
+
export type MessageTemplateBindings = MessageTemplateBindingsParent | WhatsAppMessageTemplateBindings;
|
|
186
|
+
/** Alias for CommunicationMessageKind */
|
|
187
|
+
export type CommunicationMessageKind = string;
|
|
188
|
+
/** Alias for MessageTemplateValueKind */
|
|
189
|
+
export type MessageTemplateValueKind = string;
|
|
190
|
+
/** Alias for MessageTemplateBindingsKind */
|
|
191
|
+
export type MessageTemplateBindingsKind = string;
|
|
192
|
+
/** Alias for WhatsAppMessageButtonSubType */
|
|
193
|
+
export type WhatsAppMessageButtonSubType = string;
|
|
194
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/models.ts"],"names":[],"mappings":"AAGA,sCAAsC;AACtC,MAAM,WAAW,yBAAyB;IACxC,+DAA+D;IAC/D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAED,6CAA6C;AAC7C,MAAM,WAAW,uBAAwB,SAAQ,yBAAyB;IACxE,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,0CAA0C;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qGAAqG;IACrG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,0CAA0C;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qGAAqG;IACrG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,iDAAiD;AACjD,MAAM,WAAW,2BAA4B,SAAQ,yBAAyB;IAC5E,0CAA0C;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qGAAqG;IACrG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8CAA8C;AAC9C,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,0CAA0C;IAC1C,IAAI,EAAE,OA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CAAC;IACzD,iCAAiC;IACjC,IAAI,CAAC,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACvD,mCAAmC;IACnC,MAAM,CAAC,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACzD,mCAAmC;IACnC,OAAO,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;CACxD;AAED,mDAAmD;AACnD,MAAM,WAAW,wCAAwC;IACvD,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,0DAA0D;AAC1D,MAAM,WAAW,qCAAqC;IACpD;;;;OAIG;IACH,OAAO,EAAE,4BAA4B,CAAC;IACtC,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sCAAsC;AACtC,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,uBAAuB,GACvB,wBAAwB,GACxB,wBAAwB,GACxB,2BAA2B,GAC3B,wBAAwB,GACxB,wBAAwB,GACxB,2BAA2B,CAAC;AAChC,qDAAqD;AACrD,MAAM,MAAM,oBAAoB,GAC5B,0BAA0B,GAC1B,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,GACvB,oBAAoB,GACpB,uBAAuB,GACvB,0BAA0B,CAAC;AAC/B,2EAA2E;AAC3E,MAAM,MAAM,uBAAuB,GAC/B,6BAA6B,GAC7B,+BAA+B,CAAC;AACpC,yCAAyC;AACzC,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC9C,yCAAyC;AACzC,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC9C,4CAA4C;AAC5C,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC;AACjD,6CAA6C;AAC7C,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/generated/src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Details of the message to send. */\nexport interface NotificationContentParent {\n /** The Channel Registration ID for the Business Identifier. */\n channelRegistrationId: string;\n /** The native external platform user identifiers of the recipient. */\n to: string[];\n kind: CommunicationMessageKind;\n}\n\n/** A request to send a text notification. */\nexport interface TextNotificationContent extends NotificationContentParent {\n /** Message notification type is text. */\n kind: \"text\";\n /** Message content. */\n content: string;\n}\n\n/** @deprecated A request to send an image notification. */\nexport interface MediaNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"image_v0\";\n /** Optional text content. */\n content?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send an image notification. */\nexport interface ImageNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"image\";\n /** Optional text content. */\n caption?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send a document notification. */\nexport interface DocumentNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"document\";\n /** Optional text content. */\n caption?: string;\n /** Optional name for the file. */\n fileName?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send a video notification. */\nexport interface VideoNotificationContent extends NotificationContentParent {\n /** Message notification type is image. */\n kind: \"video\";\n /** Optional text content. */\n caption?: string;\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send an audio notification. */\nexport interface AudioNotificationContent extends NotificationContentParent {\n /** Message notification type is audio. */\n kind: \"audio\";\n /** A media url for the file. Required if the type is one of the supported media types, e.g. image */\n mediaUri: string;\n}\n\n/** A request to send a template notification. */\nexport interface TemplateNotificationContent extends NotificationContentParent {\n /** Message notification type is template. */\n kind: \"template\";\n /** The template object used to create templates. */\n template: MessageTemplate;\n}\n\n/** The template object used to create templates. */\nexport interface MessageTemplate {\n /** Name of the template. */\n name: string;\n /** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */\n language: string;\n /** The template values. */\n values?: Array<MessageTemplateValue>;\n /** The binding object to link values to the template specific locations */\n bindings?: MessageTemplateBindings;\n}\n\n/** The class describes a parameter of a template. */\nexport interface MessageTemplateValueParent {\n /** Template binding reference name */\n name: string;\n kind: MessageTemplateValueKind;\n}\n\n/** The message template's text value information. */\nexport interface MessageTemplateText extends MessageTemplateValueParent {\n /** Message parameter type is text. */\n kind: \"text\";\n /** The text value. */\n text: string;\n}\n\n/** The message template's image value information. */\nexport interface MessageTemplateImage extends MessageTemplateValueParent {\n /** Message parameter type is image. */\n kind: \"image\";\n /** The (public) URL of the media. */\n url: string;\n /** The [optional] caption of the media object. */\n caption?: string;\n /** The [optional] filename of the media file. */\n fileName?: string;\n}\n\n/** The message template's document value information. */\nexport interface MessageTemplateDocument extends MessageTemplateValueParent {\n /** Message parameter type is document. */\n kind: \"document\";\n /** The (public) URL of the media. */\n url: string;\n /** The [optional] caption of the media object. */\n caption?: string;\n /** The [optional] filename of the media file. */\n fileName?: string;\n}\n\n/** The message template's video value information. */\nexport interface MessageTemplateVideo extends MessageTemplateValueParent {\n /** Message parameter type is video. */\n kind: \"video\";\n /** The (public) URL of the media. */\n url: string;\n /** The [optional] caption of the media object. */\n caption?: string;\n /** The [optional] filename of the media file. */\n fileName?: string;\n}\n\n/** The message template's location value information. */\nexport interface MessageTemplateLocation extends MessageTemplateValueParent {\n /** Message parameter type is location. */\n kind: \"location\";\n /** The [Optional] name of the location. */\n locationName?: string;\n /** The [Optional] address of the location. */\n address?: string;\n /** The latitude of the location. */\n latitude: number;\n /** The longitude of the location. */\n longitude: number;\n}\n\n/** The message template's quick action value information. */\nexport interface MessageTemplateQuickAction extends MessageTemplateValueParent {\n /** Message parameter type is quick action. */\n kind: \"quickAction\";\n /** The [Optional] quick action text */\n text?: string;\n /** The [Optional] quick action payload */\n payload?: string;\n}\n\n/** The binding object to link values to the template specific locations */\nexport interface MessageTemplateBindingsParent {\n kind: MessageTemplateBindingsKind;\n}\n\n/** The template bindings for WhatsApp */\nexport interface WhatsAppMessageTemplateBindings\n extends MessageTemplateBindingsParent {\n /** MessageTemplateBindings is whatsApp */\n kind: \"whatsApp\";\n /** The header template bindings */\n header?: Array<WhatsAppMessageTemplateBindingsComponent>;\n /** The body template bindings */\n body?: Array<WhatsAppMessageTemplateBindingsComponent>;\n /** The footer template bindings */\n footer?: Array<WhatsAppMessageTemplateBindingsComponent>;\n /** The button template bindings */\n buttons?: Array<WhatsAppMessageTemplateBindingsButton>;\n}\n\n/** The template bindings component for WhatsApp */\nexport interface WhatsAppMessageTemplateBindingsComponent {\n /** The name of the referenced item in the template values. */\n refValue: string;\n}\n\n/** The template bindings component button for WhatsApp */\nexport interface WhatsAppMessageTemplateBindingsButton {\n /**\n * The WhatsApp button sub type\n *\n * Possible values: \"quickReply\", \"url\"\n */\n subType: WhatsAppMessageButtonSubType;\n /** The name of the referenced item in the template values. */\n refValue: string;\n}\n\n/** Details of the message to send. */\nexport type NotificationContent =\n | NotificationContentParent\n | TextNotificationContent\n | MediaNotificationContent\n | ImageNotificationContent\n | DocumentNotificationContent\n | VideoNotificationContent\n | AudioNotificationContent\n | TemplateNotificationContent;\n/** The class describes a parameter of a template. */\nexport type MessageTemplateValue =\n | MessageTemplateValueParent\n | MessageTemplateText\n | MessageTemplateImage\n | MessageTemplateDocument\n | MessageTemplateVideo\n | MessageTemplateLocation\n | MessageTemplateQuickAction;\n/** The binding object to link values to the template specific locations */\nexport type MessageTemplateBindings =\n | MessageTemplateBindingsParent\n | WhatsAppMessageTemplateBindings;\n/** Alias for CommunicationMessageKind */\nexport type CommunicationMessageKind = string;\n/** Alias for MessageTemplateValueKind */\nexport type MessageTemplateValueKind = string;\n/** Alias for MessageTemplateBindingsKind */\nexport type MessageTemplateBindingsKind = string;\n/** Alias for WhatsAppMessageButtonSubType */\nexport type WhatsAppMessageButtonSubType = string;\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Paged } from "@azure/core-paging";
|
|
2
|
+
/** Result of the send message operation. */
|
|
3
|
+
export interface SendMessageResultOutput {
|
|
4
|
+
/** Receipts of the send message operation. */
|
|
5
|
+
receipts: Array<MessageReceiptOutput>;
|
|
6
|
+
}
|
|
7
|
+
/** Receipt of the sending one message. */
|
|
8
|
+
export interface MessageReceiptOutput {
|
|
9
|
+
/** The message id. */
|
|
10
|
+
messageId: string;
|
|
11
|
+
/** The native external platform user identifier of the recipient. */
|
|
12
|
+
to: string;
|
|
13
|
+
}
|
|
14
|
+
/** The message template as returned from the service. */
|
|
15
|
+
export interface MessageTemplateItemOutputParent {
|
|
16
|
+
/** The template's name. */
|
|
17
|
+
readonly name: string;
|
|
18
|
+
/** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */
|
|
19
|
+
language: string;
|
|
20
|
+
/**
|
|
21
|
+
* The aggregated template status.
|
|
22
|
+
*
|
|
23
|
+
* Possible values: "approved", "rejected", "pending", "paused"
|
|
24
|
+
*/
|
|
25
|
+
status: MessageTemplateStatusOutput;
|
|
26
|
+
kind: CommunicationMessagesChannelOutput;
|
|
27
|
+
}
|
|
28
|
+
/** The WhatsApp-specific template response contract */
|
|
29
|
+
export interface WhatsAppMessageTemplateItemOutput extends MessageTemplateItemOutputParent {
|
|
30
|
+
/** WhatsApp platform's template content. This is the payload returned from WhatsApp API. */
|
|
31
|
+
content?: any;
|
|
32
|
+
/** Message template response type is whatsApp. */
|
|
33
|
+
kind: "whatsApp";
|
|
34
|
+
}
|
|
35
|
+
/** The message template as returned from the service. */
|
|
36
|
+
export type MessageTemplateItemOutput = MessageTemplateItemOutputParent | WhatsAppMessageTemplateItemOutput;
|
|
37
|
+
/** Alias for RepeatabilityResultOutput */
|
|
38
|
+
export type RepeatabilityResultOutput = "accepted" | "rejected";
|
|
39
|
+
/** Paged collection of MessageTemplateItem items */
|
|
40
|
+
export type PagedMessageTemplateItemOutput = Paged<MessageTemplateItemOutput>;
|
|
41
|
+
/** Alias for MessageTemplateStatusOutput */
|
|
42
|
+
export type MessageTemplateStatusOutput = string;
|
|
43
|
+
/** Alias for CommunicationMessagesChannelOutput */
|
|
44
|
+
export type CommunicationMessagesChannelOutput = string;
|
|
45
|
+
//# sourceMappingURL=outputModels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/outputModels.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,8CAA8C;IAC9C,QAAQ,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;CACvC;AAED,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACnC,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,yDAAyD;AACzD,MAAM,WAAW,+BAA+B;IAC9C,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oKAAoK;IACpK,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,2BAA2B,CAAC;IACpC,IAAI,EAAE,kCAAkC,CAAC;CAC1C;AAED,uDAAuD;AACvD,MAAM,WAAW,iCACf,SAAQ,+BAA+B;IACvC,4FAA4F;IAC5F,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,kDAAkD;IAClD,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,yDAAyD;AACzD,MAAM,MAAM,yBAAyB,GACjC,+BAA+B,GAC/B,iCAAiC,CAAC;AACtC,0CAA0C;AAC1C,MAAM,MAAM,yBAAyB,GAAG,UAAU,GAAG,UAAU,CAAC;AAChE,oDAAoD;AACpD,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC9E,4CAA4C;AAC5C,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC;AACjD,mDAAmD;AACnD,MAAM,MAAM,kCAAkC,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/generated/src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Paged } from \"@azure/core-paging\";\n\n/** Result of the send message operation. */\nexport interface SendMessageResultOutput {\n /** Receipts of the send message operation. */\n receipts: Array<MessageReceiptOutput>;\n}\n\n/** Receipt of the sending one message. */\nexport interface MessageReceiptOutput {\n /** The message id. */\n messageId: string;\n /** The native external platform user identifier of the recipient. */\n to: string;\n}\n\n/** The message template as returned from the service. */\nexport interface MessageTemplateItemOutputParent {\n /** The template's name. */\n readonly name: string;\n /** The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. */\n language: string;\n /**\n * The aggregated template status.\n *\n * Possible values: \"approved\", \"rejected\", \"pending\", \"paused\"\n */\n status: MessageTemplateStatusOutput;\n kind: CommunicationMessagesChannelOutput;\n}\n\n/** The WhatsApp-specific template response contract */\nexport interface WhatsAppMessageTemplateItemOutput\n extends MessageTemplateItemOutputParent {\n /** WhatsApp platform's template content. This is the payload returned from WhatsApp API. */\n content?: any;\n /** Message template response type is whatsApp. */\n kind: \"whatsApp\";\n}\n\n/** The message template as returned from the service. */\nexport type MessageTemplateItemOutput =\n | MessageTemplateItemOutputParent\n | WhatsAppMessageTemplateItemOutput;\n/** Alias for RepeatabilityResultOutput */\nexport type RepeatabilityResultOutput = \"accepted\" | \"rejected\";\n/** Paged collection of MessageTemplateItem items */\nexport type PagedMessageTemplateItemOutput = Paged<MessageTemplateItemOutput>;\n/** Alias for MessageTemplateStatusOutput */\nexport type MessageTemplateStatusOutput = string;\n/** Alias for CommunicationMessagesChannelOutput */\nexport type CommunicationMessagesChannelOutput = string;\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
2
|
+
import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to extract the type of an array
|
|
5
|
+
*/
|
|
6
|
+
export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
|
|
7
|
+
/**
|
|
8
|
+
* The type of a custom function that defines how to get a page and a link to the next one if any.
|
|
9
|
+
*/
|
|
10
|
+
export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{
|
|
11
|
+
page: TPage;
|
|
12
|
+
nextPageLink?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Options for the paging helper
|
|
16
|
+
*/
|
|
17
|
+
export interface PagingOptions<TResponse> {
|
|
18
|
+
/**
|
|
19
|
+
* Custom function to extract pagination details for crating the PagedAsyncIterableIterator
|
|
20
|
+
*/
|
|
21
|
+
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Helper type to infer the Type of the paged elements from the response type
|
|
25
|
+
* This type is generated based on the swagger information for x-ms-pageable
|
|
26
|
+
* specifically on the itemName property which indicates the property of the response
|
|
27
|
+
* where the page items are found. The default value is `value`.
|
|
28
|
+
* This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
|
|
29
|
+
*/
|
|
30
|
+
export type PaginateReturn<TResult> = TResult extends {
|
|
31
|
+
body: {
|
|
32
|
+
value?: infer TPage;
|
|
33
|
+
};
|
|
34
|
+
} ? GetArrayType<TPage> : Array<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
37
|
+
* @param client - Client to use for sending the next page requests
|
|
38
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
39
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
40
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
41
|
+
*/
|
|
42
|
+
export declare function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
|
|
43
|
+
//# sourceMappingURL=paginateHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginateHelper.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/paginateHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,MAAM,EAEN,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI,CAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,KACjB,OAAO,CAAC;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,SAAS;IACtC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,OAAO,IAAI,OAAO,SAAS;IACpD,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CAC/B,GACG,YAAY,CAAC,KAAK,CAAC,GACnB,KAAK,CAAC,OAAO,CAAC,CAAC;AAEnB;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,qBAAqB,EAC9D,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,SAAS,EAC1B,OAAO,GAAE,aAAa,CAAC,SAAS,CAAM,GACrC,0BAA0B,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA4BvD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { getPagedAsyncIterator, } from "@azure/core-paging";
|
|
4
|
+
import { createRestError, } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
7
|
+
* @param client - Client to use for sending the next page requests
|
|
8
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
9
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
10
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
11
|
+
*/
|
|
12
|
+
export function paginate(client, initialResponse, options = {}) {
|
|
13
|
+
let firstRun = true;
|
|
14
|
+
const itemName = "value";
|
|
15
|
+
const nextLinkName = "nextLink";
|
|
16
|
+
const { customGetPage } = options;
|
|
17
|
+
const pagedResult = {
|
|
18
|
+
firstPageLink: "",
|
|
19
|
+
getPage: typeof customGetPage === "function"
|
|
20
|
+
? customGetPage
|
|
21
|
+
: async (pageLink) => {
|
|
22
|
+
const result = firstRun
|
|
23
|
+
? initialResponse
|
|
24
|
+
: await client.pathUnchecked(pageLink).get();
|
|
25
|
+
firstRun = false;
|
|
26
|
+
checkPagingRequest(result);
|
|
27
|
+
const nextLink = getNextLink(result.body, nextLinkName);
|
|
28
|
+
const values = getElements(result.body, itemName);
|
|
29
|
+
return {
|
|
30
|
+
page: values,
|
|
31
|
+
nextPageLink: nextLink,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
return getPagedAsyncIterator(pagedResult);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets for the value of nextLink in the body
|
|
39
|
+
*/
|
|
40
|
+
function getNextLink(body, nextLinkName) {
|
|
41
|
+
if (!nextLinkName) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const nextLink = body[nextLinkName];
|
|
45
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
46
|
+
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
47
|
+
}
|
|
48
|
+
return nextLink;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the elements of the current request in the body.
|
|
52
|
+
*/
|
|
53
|
+
function getElements(body, itemName) {
|
|
54
|
+
const value = body[itemName];
|
|
55
|
+
// value has to be an array according to the x-ms-pageable extension.
|
|
56
|
+
// The fact that this must be an array is used above to calculate the
|
|
57
|
+
// type of elements in the page in PaginateReturn
|
|
58
|
+
if (!Array.isArray(value)) {
|
|
59
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
60
|
+
}
|
|
61
|
+
return value !== null && value !== void 0 ? value : [];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a request failed
|
|
65
|
+
*/
|
|
66
|
+
function checkPagingRequest(response) {
|
|
67
|
+
const Http2xxStatusCodes = [
|
|
68
|
+
"200",
|
|
69
|
+
"201",
|
|
70
|
+
"202",
|
|
71
|
+
"203",
|
|
72
|
+
"204",
|
|
73
|
+
"205",
|
|
74
|
+
"206",
|
|
75
|
+
"207",
|
|
76
|
+
"208",
|
|
77
|
+
"226",
|
|
78
|
+
];
|
|
79
|
+
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
80
|
+
throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=paginateHelper.js.map
|