@azure-rest/iot-device-update 1.0.1-alpha.20241202.1 → 1.0.1-alpha.20241204.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.
Files changed (175) hide show
  1. package/dist/browser/clientDefinitions.d.ts +273 -0
  2. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  3. package/dist/browser/clientDefinitions.js.map +1 -0
  4. package/dist/browser/deviceUpdate.d.ts +5 -0
  5. package/dist/browser/deviceUpdate.d.ts.map +1 -0
  6. package/{dist-esm/src → dist/browser}/deviceUpdate.js.map +1 -1
  7. package/dist/browser/index.d.ts +12 -0
  8. package/dist/browser/index.d.ts.map +1 -0
  9. package/dist/browser/index.js +15 -0
  10. package/dist/browser/index.js.map +1 -0
  11. package/dist/browser/isUnexpected.d.ts +52 -0
  12. package/dist/browser/isUnexpected.d.ts.map +1 -0
  13. package/dist/browser/isUnexpected.js.map +1 -0
  14. package/dist/browser/models.d.ts +95 -0
  15. package/dist/browser/models.d.ts.map +1 -0
  16. package/dist/browser/outputModels.d.ts +499 -0
  17. package/dist/browser/outputModels.d.ts.map +1 -0
  18. package/dist/browser/package.json +3 -0
  19. package/dist/browser/paginateHelper.d.ts +43 -0
  20. package/dist/browser/paginateHelper.d.ts.map +1 -0
  21. package/dist/browser/parameters.d.ts +212 -0
  22. package/dist/browser/parameters.d.ts.map +1 -0
  23. package/dist/browser/parameters.js.map +1 -0
  24. package/dist/browser/pollingHelper.d.ts +11 -0
  25. package/dist/browser/pollingHelper.d.ts.map +1 -0
  26. package/dist/browser/responses.d.ts +554 -0
  27. package/dist/browser/responses.d.ts.map +1 -0
  28. package/dist/browser/responses.js.map +1 -0
  29. package/dist/commonjs/clientDefinitions.d.ts +273 -0
  30. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  31. package/dist/commonjs/clientDefinitions.js +5 -0
  32. package/dist/commonjs/clientDefinitions.js.map +1 -0
  33. package/dist/commonjs/deviceUpdate.d.ts +5 -0
  34. package/dist/commonjs/deviceUpdate.d.ts.map +1 -0
  35. package/dist/commonjs/deviceUpdate.js +24 -0
  36. package/dist/commonjs/deviceUpdate.js.map +1 -0
  37. package/dist/commonjs/index.d.ts +12 -0
  38. package/dist/commonjs/index.d.ts.map +1 -0
  39. package/dist/commonjs/index.js +18 -0
  40. package/dist/commonjs/index.js.map +1 -0
  41. package/dist/commonjs/isUnexpected.d.ts +52 -0
  42. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  43. package/dist/{index.js → commonjs/isUnexpected.js} +4 -152
  44. package/dist/commonjs/isUnexpected.js.map +1 -0
  45. package/dist/commonjs/models.d.ts +95 -0
  46. package/dist/commonjs/models.d.ts.map +1 -0
  47. package/dist/commonjs/models.js +5 -0
  48. package/dist/commonjs/models.js.map +1 -0
  49. package/dist/commonjs/outputModels.d.ts +499 -0
  50. package/dist/commonjs/outputModels.d.ts.map +1 -0
  51. package/dist/commonjs/outputModels.js +5 -0
  52. package/dist/commonjs/outputModels.js.map +1 -0
  53. package/dist/commonjs/package.json +3 -0
  54. package/dist/commonjs/paginateHelper.d.ts +43 -0
  55. package/dist/commonjs/paginateHelper.d.ts.map +1 -0
  56. package/dist/commonjs/paginateHelper.js +73 -0
  57. package/dist/commonjs/paginateHelper.js.map +1 -0
  58. package/dist/commonjs/parameters.d.ts +212 -0
  59. package/dist/commonjs/parameters.d.ts.map +1 -0
  60. package/dist/commonjs/parameters.js +5 -0
  61. package/dist/commonjs/parameters.js.map +1 -0
  62. package/dist/commonjs/pollingHelper.d.ts +11 -0
  63. package/dist/commonjs/pollingHelper.d.ts.map +1 -0
  64. package/dist/commonjs/pollingHelper.js +51 -0
  65. package/dist/commonjs/pollingHelper.js.map +1 -0
  66. package/dist/commonjs/responses.d.ts +554 -0
  67. package/dist/commonjs/responses.d.ts.map +1 -0
  68. package/dist/commonjs/responses.js +5 -0
  69. package/dist/commonjs/responses.js.map +1 -0
  70. package/dist/commonjs/tsdoc-metadata.json +11 -0
  71. package/dist/esm/clientDefinitions.d.ts +273 -0
  72. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  73. package/dist/esm/clientDefinitions.js +4 -0
  74. package/dist/esm/clientDefinitions.js.map +1 -0
  75. package/dist/esm/deviceUpdate.d.ts +5 -0
  76. package/dist/esm/deviceUpdate.d.ts.map +1 -0
  77. package/dist/esm/deviceUpdate.js +21 -0
  78. package/dist/esm/deviceUpdate.js.map +1 -0
  79. package/dist/esm/index.d.ts +12 -0
  80. package/dist/esm/index.d.ts.map +1 -0
  81. package/dist/esm/index.js +15 -0
  82. package/dist/esm/index.js.map +1 -0
  83. package/dist/esm/isUnexpected.d.ts +52 -0
  84. package/dist/esm/isUnexpected.d.ts.map +1 -0
  85. package/dist/esm/isUnexpected.js +127 -0
  86. package/dist/esm/isUnexpected.js.map +1 -0
  87. package/dist/esm/models.d.ts +95 -0
  88. package/dist/esm/models.d.ts.map +1 -0
  89. package/dist/esm/models.js +4 -0
  90. package/dist/esm/models.js.map +1 -0
  91. package/dist/esm/outputModels.d.ts +499 -0
  92. package/dist/esm/outputModels.d.ts.map +1 -0
  93. package/dist/esm/outputModels.js +4 -0
  94. package/dist/esm/outputModels.js.map +1 -0
  95. package/dist/esm/package.json +3 -0
  96. package/dist/esm/paginateHelper.d.ts +43 -0
  97. package/dist/esm/paginateHelper.d.ts.map +1 -0
  98. package/dist/esm/paginateHelper.js +70 -0
  99. package/dist/esm/paginateHelper.js.map +1 -0
  100. package/dist/esm/parameters.d.ts +212 -0
  101. package/dist/esm/parameters.d.ts.map +1 -0
  102. package/dist/esm/parameters.js +4 -0
  103. package/dist/esm/parameters.js.map +1 -0
  104. package/dist/esm/pollingHelper.d.ts +11 -0
  105. package/dist/esm/pollingHelper.d.ts.map +1 -0
  106. package/dist/esm/pollingHelper.js +48 -0
  107. package/dist/esm/pollingHelper.js.map +1 -0
  108. package/dist/esm/responses.d.ts +554 -0
  109. package/dist/esm/responses.d.ts.map +1 -0
  110. package/dist/esm/responses.js +4 -0
  111. package/dist/esm/responses.js.map +1 -0
  112. package/dist/react-native/clientDefinitions.d.ts +273 -0
  113. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  114. package/dist/react-native/clientDefinitions.js +4 -0
  115. package/dist/react-native/clientDefinitions.js.map +1 -0
  116. package/dist/react-native/deviceUpdate.d.ts +5 -0
  117. package/dist/react-native/deviceUpdate.d.ts.map +1 -0
  118. package/dist/react-native/deviceUpdate.js +21 -0
  119. package/dist/react-native/deviceUpdate.js.map +1 -0
  120. package/dist/react-native/index.d.ts +12 -0
  121. package/dist/react-native/index.d.ts.map +1 -0
  122. package/dist/react-native/index.js +15 -0
  123. package/dist/react-native/index.js.map +1 -0
  124. package/dist/react-native/isUnexpected.d.ts +52 -0
  125. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  126. package/dist/react-native/isUnexpected.js +127 -0
  127. package/dist/react-native/isUnexpected.js.map +1 -0
  128. package/dist/react-native/models.d.ts +95 -0
  129. package/dist/react-native/models.d.ts.map +1 -0
  130. package/dist/react-native/models.js +4 -0
  131. package/dist/react-native/models.js.map +1 -0
  132. package/dist/react-native/outputModels.d.ts +499 -0
  133. package/dist/react-native/outputModels.d.ts.map +1 -0
  134. package/dist/react-native/outputModels.js +4 -0
  135. package/dist/react-native/outputModels.js.map +1 -0
  136. package/dist/react-native/package.json +3 -0
  137. package/dist/react-native/paginateHelper.d.ts +43 -0
  138. package/dist/react-native/paginateHelper.d.ts.map +1 -0
  139. package/dist/react-native/paginateHelper.js +70 -0
  140. package/dist/react-native/paginateHelper.js.map +1 -0
  141. package/dist/react-native/parameters.d.ts +212 -0
  142. package/dist/react-native/parameters.d.ts.map +1 -0
  143. package/dist/react-native/parameters.js +4 -0
  144. package/dist/react-native/parameters.js.map +1 -0
  145. package/dist/react-native/pollingHelper.d.ts +11 -0
  146. package/dist/react-native/pollingHelper.d.ts.map +1 -0
  147. package/dist/react-native/pollingHelper.js +48 -0
  148. package/dist/react-native/pollingHelper.js.map +1 -0
  149. package/dist/react-native/responses.d.ts +554 -0
  150. package/dist/react-native/responses.d.ts.map +1 -0
  151. package/dist/react-native/responses.js +4 -0
  152. package/dist/react-native/responses.js.map +1 -0
  153. package/package.json +65 -50
  154. package/dist/index.js.map +0 -1
  155. package/dist-esm/src/clientDefinitions.js.map +0 -1
  156. package/dist-esm/src/index.js +0 -14
  157. package/dist-esm/src/index.js.map +0 -1
  158. package/dist-esm/src/isUnexpected.js.map +0 -1
  159. package/dist-esm/src/parameters.js.map +0 -1
  160. package/dist-esm/src/responses.js.map +0 -1
  161. package/review/iot-device-update.api.md +0 -2198
  162. package/types/iot-device-update.d.ts +0 -2096
  163. /package/{dist-esm/src → dist/browser}/clientDefinitions.js +0 -0
  164. /package/{dist-esm/src → dist/browser}/deviceUpdate.js +0 -0
  165. /package/{dist-esm/src → dist/browser}/isUnexpected.js +0 -0
  166. /package/{dist-esm/src → dist/browser}/models.js +0 -0
  167. /package/{dist-esm/src → dist/browser}/models.js.map +0 -0
  168. /package/{dist-esm/src → dist/browser}/outputModels.js +0 -0
  169. /package/{dist-esm/src → dist/browser}/outputModels.js.map +0 -0
  170. /package/{dist-esm/src → dist/browser}/paginateHelper.js +0 -0
  171. /package/{dist-esm/src → dist/browser}/paginateHelper.js.map +0 -0
  172. /package/{dist-esm/src → dist/browser}/parameters.js +0 -0
  173. /package/{dist-esm/src → dist/browser}/pollingHelper.js +0 -0
  174. /package/{dist-esm/src → dist/browser}/pollingHelper.js.map +0 -0
  175. /package/{dist-esm/src → dist/browser}/responses.js +0 -0
@@ -0,0 +1,70 @@
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 ? initialResponse : await client.pathUnchecked(pageLink).get();
23
+ firstRun = false;
24
+ checkPagingRequest(result);
25
+ const nextLink = getNextLink(result.body, nextLinkName);
26
+ const values = getElements(result.body, itemName);
27
+ return {
28
+ page: values,
29
+ nextPageLink: nextLink,
30
+ };
31
+ },
32
+ };
33
+ return getPagedAsyncIterator(pagedResult);
34
+ }
35
+ /**
36
+ * Gets for the value of nextLink in the body
37
+ */
38
+ function getNextLink(body, nextLinkName) {
39
+ if (!nextLinkName) {
40
+ return undefined;
41
+ }
42
+ const nextLink = body[nextLinkName];
43
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
44
+ throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
45
+ }
46
+ return nextLink;
47
+ }
48
+ /**
49
+ * Gets the elements of the current request in the body.
50
+ */
51
+ function getElements(body, itemName) {
52
+ const value = body[itemName];
53
+ // value has to be an array according to the x-ms-pageable extension.
54
+ // The fact that this must be an array is used above to calculate the
55
+ // type of elements in the page in PaginateReturn
56
+ if (!Array.isArray(value)) {
57
+ throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
58
+ }
59
+ return value !== null && value !== void 0 ? value : [];
60
+ }
61
+ /**
62
+ * Checks if a request failed
63
+ */
64
+ function checkPagingRequest(response) {
65
+ const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
66
+ if (!Http2xxStatusCodes.includes(response.status)) {
67
+ throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
68
+ }
69
+ }
70
+ //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,IAAa,EAAE,YAAqB;IACvD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { getPagedAsyncIterator } from \"@azure/core-paging\";\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
@@ -0,0 +1,212 @@
1
+ import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
2
+ import type { RequestParameters } from "@azure-rest/core-client";
3
+ import type { ImportUpdateInputItem, PatchBody, Deployment, LogCollection } from "./models.js";
4
+ export interface DeviceUpdateListUpdatesQueryParamProperties {
5
+ /** Request updates matching a free-text search expression. */
6
+ search?: string;
7
+ /** Optional to filter updates by isDeployable property. */
8
+ filter?: string;
9
+ }
10
+ export interface DeviceUpdateListUpdatesQueryParam {
11
+ queryParameters?: DeviceUpdateListUpdatesQueryParamProperties;
12
+ }
13
+ export type DeviceUpdateListUpdatesParameters = DeviceUpdateListUpdatesQueryParam & RequestParameters;
14
+ export interface DeviceUpdateImportUpdateBodyParam {
15
+ /** The update to be imported (see schema https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). */
16
+ body: Array<ImportUpdateInputItem>;
17
+ }
18
+ export interface DeviceUpdateImportUpdateMediaTypesParam {
19
+ /** Request content type */
20
+ contentType?: "application/json";
21
+ }
22
+ export type DeviceUpdateImportUpdateParameters = DeviceUpdateImportUpdateMediaTypesParam & DeviceUpdateImportUpdateBodyParam & RequestParameters;
23
+ export interface DeviceUpdateGetUpdateHeaders {
24
+ /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */
25
+ "If-None-Match"?: string;
26
+ }
27
+ export interface DeviceUpdateGetUpdateHeaderParam {
28
+ headers: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders;
29
+ }
30
+ export type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters;
31
+ export type DeviceUpdateDeleteUpdateParameters = RequestParameters;
32
+ export type DeviceUpdateListProvidersParameters = RequestParameters;
33
+ export type DeviceUpdateListNamesParameters = RequestParameters;
34
+ export interface DeviceUpdateListVersionsQueryParamProperties {
35
+ /** Optional to filter updates by isDeployable property. */
36
+ filter?: string;
37
+ }
38
+ export interface DeviceUpdateListVersionsQueryParam {
39
+ queryParameters?: DeviceUpdateListVersionsQueryParamProperties;
40
+ }
41
+ export type DeviceUpdateListVersionsParameters = DeviceUpdateListVersionsQueryParam & RequestParameters;
42
+ export type DeviceUpdateListFilesParameters = RequestParameters;
43
+ export interface DeviceUpdateGetFileHeaders {
44
+ /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */
45
+ "If-None-Match"?: string;
46
+ }
47
+ export interface DeviceUpdateGetFileHeaderParam {
48
+ headers: RawHttpHeadersInput & DeviceUpdateGetFileHeaders;
49
+ }
50
+ export type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters;
51
+ export interface DeviceUpdateListOperationStatusesQueryParamProperties {
52
+ /** Optional to filter operations by status property. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'" */
53
+ filter?: string;
54
+ /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */
55
+ top?: number;
56
+ }
57
+ export interface DeviceUpdateListOperationStatusesQueryParam {
58
+ queryParameters?: DeviceUpdateListOperationStatusesQueryParamProperties;
59
+ }
60
+ export type DeviceUpdateListOperationStatusesParameters = DeviceUpdateListOperationStatusesQueryParam & RequestParameters;
61
+ export interface DeviceUpdateGetOperationStatusHeaders {
62
+ /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */
63
+ "If-None-Match"?: string;
64
+ }
65
+ export interface DeviceUpdateGetOperationStatusHeaderParam {
66
+ headers: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders;
67
+ }
68
+ export type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationStatusHeaderParam & RequestParameters;
69
+ export interface DeviceManagementListDeviceClassesQueryParamProperties {
70
+ /** Restricts the set of device classes returned. You can filter on friendly name. */
71
+ filter?: string;
72
+ }
73
+ export interface DeviceManagementListDeviceClassesQueryParam {
74
+ queryParameters?: DeviceManagementListDeviceClassesQueryParamProperties;
75
+ }
76
+ export type DeviceManagementListDeviceClassesParameters = DeviceManagementListDeviceClassesQueryParam & RequestParameters;
77
+ export type DeviceManagementGetDeviceClassParameters = RequestParameters;
78
+ export interface DeviceManagementUpdateDeviceClassBodyParam {
79
+ /** The device class json merge patch body. Currently only supports patching friendlyName. */
80
+ body: PatchBody;
81
+ }
82
+ export interface DeviceManagementUpdateDeviceClassMediaTypesParam {
83
+ /** Request content type */
84
+ contentType?: "application/merge-patch+json";
85
+ }
86
+ export type DeviceManagementUpdateDeviceClassParameters = DeviceManagementUpdateDeviceClassMediaTypesParam & DeviceManagementUpdateDeviceClassBodyParam & RequestParameters;
87
+ export type DeviceManagementDeleteDeviceClassParameters = RequestParameters;
88
+ export type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters;
89
+ export interface DeviceManagementListDevicesQueryParamProperties {
90
+ /** Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, or GroupId and DeploymentStatus. Use DeploymentStatus eq null to query for devices with no deployment status (that have never been deployed to). */
91
+ filter?: string;
92
+ }
93
+ export interface DeviceManagementListDevicesQueryParam {
94
+ queryParameters?: DeviceManagementListDevicesQueryParamProperties;
95
+ }
96
+ export type DeviceManagementListDevicesParameters = DeviceManagementListDevicesQueryParam & RequestParameters;
97
+ export interface DeviceManagementImportDevicesBodyParam {
98
+ /** The types of devices to import. */
99
+ body: "Devices" | "Modules" | "All";
100
+ }
101
+ export interface DeviceManagementImportDevicesMediaTypesParam {
102
+ /** Request content type */
103
+ contentType?: "application/json";
104
+ }
105
+ export type DeviceManagementImportDevicesParameters = DeviceManagementImportDevicesMediaTypesParam & DeviceManagementImportDevicesBodyParam & RequestParameters;
106
+ export type DeviceManagementGetDeviceParameters = RequestParameters;
107
+ export type DeviceManagementGetDeviceModuleParameters = RequestParameters;
108
+ export type DeviceManagementGetUpdateComplianceParameters = RequestParameters;
109
+ export interface DeviceManagementListGroupsQueryParamProperties {
110
+ /** Orders the set of groups returned. You can order by groupId, deviceCount, createdDate, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. */
111
+ orderby?: string;
112
+ }
113
+ export interface DeviceManagementListGroupsQueryParam {
114
+ queryParameters?: DeviceManagementListGroupsQueryParamProperties;
115
+ }
116
+ export type DeviceManagementListGroupsParameters = DeviceManagementListGroupsQueryParam & RequestParameters;
117
+ export type DeviceManagementGetGroupParameters = RequestParameters;
118
+ export type DeviceManagementDeleteGroupParameters = RequestParameters;
119
+ export type DeviceManagementGetUpdateComplianceForGroupParameters = RequestParameters;
120
+ export type DeviceManagementListBestUpdatesForGroupParameters = RequestParameters;
121
+ export interface DeviceManagementListDeploymentsForGroupQueryParamProperties {
122
+ /** Orders the set of deployments returned. You can order by start date. */
123
+ orderby?: string;
124
+ }
125
+ export interface DeviceManagementListDeploymentsForGroupQueryParam {
126
+ queryParameters?: DeviceManagementListDeploymentsForGroupQueryParamProperties;
127
+ }
128
+ export type DeviceManagementListDeploymentsForGroupParameters = DeviceManagementListDeploymentsForGroupQueryParam & RequestParameters;
129
+ export type DeviceManagementGetDeploymentParameters = RequestParameters;
130
+ export interface DeviceManagementCreateOrUpdateDeploymentBodyParam {
131
+ /** The deployment properties. */
132
+ body: Deployment;
133
+ }
134
+ export interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam {
135
+ /** Request content type */
136
+ contentType?: "application/json";
137
+ }
138
+ export type DeviceManagementCreateOrUpdateDeploymentParameters = DeviceManagementCreateOrUpdateDeploymentMediaTypesParam & DeviceManagementCreateOrUpdateDeploymentBodyParam & RequestParameters;
139
+ export type DeviceManagementDeleteDeploymentParameters = RequestParameters;
140
+ export type DeviceManagementGetDeploymentStatusParameters = RequestParameters;
141
+ export interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties {
142
+ /** Restricts the set of device class subgroups returned. You can filter on compat properties by name and value. (i.e. filter=compatProperties/propertyName1 eq 'value1' and compatProperties/propertyName2 eq 'value2') */
143
+ filter?: string;
144
+ }
145
+ export interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParam {
146
+ queryParameters?: DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties;
147
+ }
148
+ export type DeviceManagementListDeviceClassSubgroupsForGroupParameters = DeviceManagementListDeviceClassSubgroupsForGroupQueryParam & RequestParameters;
149
+ export type DeviceManagementGetDeviceClassSubgroupParameters = RequestParameters;
150
+ export type DeviceManagementDeleteDeviceClassSubgroupParameters = RequestParameters;
151
+ export type DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters = RequestParameters;
152
+ export type DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters = RequestParameters;
153
+ export interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties {
154
+ /** Orders the set of deployments returned. You can order by start date. */
155
+ orderby?: string;
156
+ }
157
+ export interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam {
158
+ queryParameters?: DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties;
159
+ }
160
+ export type DeviceManagementListDeploymentsForDeviceClassSubgroupParameters = DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam & RequestParameters;
161
+ export type DeviceManagementGetDeploymentForDeviceClassSubgroupParameters = RequestParameters;
162
+ export type DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters = RequestParameters;
163
+ export type DeviceManagementStopDeploymentParameters = RequestParameters;
164
+ export type DeviceManagementRetryDeploymentParameters = RequestParameters;
165
+ export type DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters = RequestParameters;
166
+ export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties {
167
+ /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */
168
+ filter?: string;
169
+ }
170
+ export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam {
171
+ queryParameters?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties;
172
+ }
173
+ export type DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters = DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam & RequestParameters;
174
+ export interface DeviceManagementGetOperationStatusHeaders {
175
+ /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */
176
+ "If-None-Match"?: string;
177
+ }
178
+ export interface DeviceManagementGetOperationStatusHeaderParam {
179
+ headers: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders;
180
+ }
181
+ export type DeviceManagementGetOperationStatusParameters = DeviceManagementGetOperationStatusHeaderParam & RequestParameters;
182
+ export interface DeviceManagementListOperationStatusesQueryParamProperties {
183
+ /** Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'" */
184
+ filter?: string;
185
+ /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */
186
+ top?: number;
187
+ }
188
+ export interface DeviceManagementListOperationStatusesQueryParam {
189
+ queryParameters?: DeviceManagementListOperationStatusesQueryParamProperties;
190
+ }
191
+ export type DeviceManagementListOperationStatusesParameters = DeviceManagementListOperationStatusesQueryParam & RequestParameters;
192
+ export interface DeviceManagementStartLogCollectionBodyParam {
193
+ /** The log collection properties. */
194
+ body: LogCollection;
195
+ }
196
+ export interface DeviceManagementStartLogCollectionMediaTypesParam {
197
+ /** Request content type */
198
+ contentType?: "application/json";
199
+ }
200
+ export type DeviceManagementStartLogCollectionParameters = DeviceManagementStartLogCollectionMediaTypesParam & DeviceManagementStartLogCollectionBodyParam & RequestParameters;
201
+ export type DeviceManagementGetLogCollectionParameters = RequestParameters;
202
+ export type DeviceManagementListLogCollectionsParameters = RequestParameters;
203
+ export type DeviceManagementGetLogCollectionDetailedStatusParameters = RequestParameters;
204
+ export interface DeviceManagementListHealthOfDevicesQueryParamProperties {
205
+ /** Restricts the set of devices for which device health is returned. You can filter on status, device id and module id. */
206
+ filter: string;
207
+ }
208
+ export interface DeviceManagementListHealthOfDevicesQueryParam {
209
+ queryParameters: DeviceManagementListHealthOfDevicesQueryParamProperties;
210
+ }
211
+ export type DeviceManagementListHealthOfDevicesParameters = DeviceManagementListHealthOfDevicesQueryParam & RequestParameters;
212
+ //# sourceMappingURL=parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EA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AAM,CAAC;CAChB;AAED,MAAM,WAAW,6CAA6C;IAC5D,eAAe,EAAE,uDAAuD,CAAC;CAC1E;AAED,MAAM,MAAM,6CAA6C,GACvD,6CAA6C,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { ImportUpdateInputItem, PatchBody, Deployment, LogCollection } from \"./models.js\";\n\nexport interface DeviceUpdateListUpdatesQueryParamProperties {\n /** Request updates matching a free-text search expression. */\n search?: string;\n /** Optional to filter updates by isDeployable property. */\n filter?: string;\n}\n\nexport interface DeviceUpdateListUpdatesQueryParam {\n queryParameters?: DeviceUpdateListUpdatesQueryParamProperties;\n}\n\nexport type DeviceUpdateListUpdatesParameters = DeviceUpdateListUpdatesQueryParam &\n RequestParameters;\n\nexport interface DeviceUpdateImportUpdateBodyParam {\n /** The update to be imported (see schema https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). */\n body: Array<ImportUpdateInputItem>;\n}\n\nexport interface DeviceUpdateImportUpdateMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceUpdateImportUpdateParameters = DeviceUpdateImportUpdateMediaTypesParam &\n DeviceUpdateImportUpdateBodyParam &\n RequestParameters;\n\nexport interface DeviceUpdateGetUpdateHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetUpdateHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders;\n}\n\nexport type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters;\nexport type DeviceUpdateDeleteUpdateParameters = RequestParameters;\nexport type DeviceUpdateListProvidersParameters = RequestParameters;\nexport type DeviceUpdateListNamesParameters = RequestParameters;\n\nexport interface DeviceUpdateListVersionsQueryParamProperties {\n /** Optional to filter updates by isDeployable property. */\n filter?: string;\n}\n\nexport interface DeviceUpdateListVersionsQueryParam {\n queryParameters?: DeviceUpdateListVersionsQueryParamProperties;\n}\n\nexport type DeviceUpdateListVersionsParameters = DeviceUpdateListVersionsQueryParam &\n RequestParameters;\nexport type DeviceUpdateListFilesParameters = RequestParameters;\n\nexport interface DeviceUpdateGetFileHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetFileHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetFileHeaders;\n}\n\nexport type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters;\n\nexport interface DeviceUpdateListOperationStatusesQueryParamProperties {\n /** Optional to filter operations by status property. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n top?: number;\n}\n\nexport interface DeviceUpdateListOperationStatusesQueryParam {\n queryParameters?: DeviceUpdateListOperationStatusesQueryParamProperties;\n}\n\nexport type DeviceUpdateListOperationStatusesParameters =\n DeviceUpdateListOperationStatusesQueryParam & RequestParameters;\n\nexport interface DeviceUpdateGetOperationStatusHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetOperationStatusHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders;\n}\n\nexport type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationStatusHeaderParam &\n RequestParameters;\n\nexport interface DeviceManagementListDeviceClassesQueryParamProperties {\n /** Restricts the set of device classes returned. You can filter on friendly name. */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceClassesQueryParam {\n queryParameters?: DeviceManagementListDeviceClassesQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceClassesParameters =\n DeviceManagementListDeviceClassesQueryParam & RequestParameters;\nexport type DeviceManagementGetDeviceClassParameters = RequestParameters;\n\nexport interface DeviceManagementUpdateDeviceClassBodyParam {\n /** The device class json merge patch body. Currently only supports patching friendlyName. */\n body: PatchBody;\n}\n\nexport interface DeviceManagementUpdateDeviceClassMediaTypesParam {\n /** Request content type */\n contentType?: \"application/merge-patch+json\";\n}\n\nexport type DeviceManagementUpdateDeviceClassParameters =\n DeviceManagementUpdateDeviceClassMediaTypesParam &\n DeviceManagementUpdateDeviceClassBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeviceClassParameters = RequestParameters;\nexport type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters;\n\nexport interface DeviceManagementListDevicesQueryParamProperties {\n /** Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, or GroupId and DeploymentStatus. Use DeploymentStatus eq null to query for devices with no deployment status (that have never been deployed to). */\n filter?: string;\n}\n\nexport interface DeviceManagementListDevicesQueryParam {\n queryParameters?: DeviceManagementListDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListDevicesParameters = DeviceManagementListDevicesQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementImportDevicesBodyParam {\n /** The types of devices to import. */\n body: \"Devices\" | \"Modules\" | \"All\";\n}\n\nexport interface DeviceManagementImportDevicesMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementImportDevicesParameters = DeviceManagementImportDevicesMediaTypesParam &\n DeviceManagementImportDevicesBodyParam &\n RequestParameters;\nexport type DeviceManagementGetDeviceParameters = RequestParameters;\nexport type DeviceManagementGetDeviceModuleParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceParameters = RequestParameters;\n\nexport interface DeviceManagementListGroupsQueryParamProperties {\n /** Orders the set of groups returned. You can order by groupId, deviceCount, createdDate, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListGroupsQueryParam {\n queryParameters?: DeviceManagementListGroupsQueryParamProperties;\n}\n\nexport type DeviceManagementListGroupsParameters = DeviceManagementListGroupsQueryParam &\n RequestParameters;\nexport type DeviceManagementGetGroupParameters = RequestParameters;\nexport type DeviceManagementDeleteGroupParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceForGroupParameters = RequestParameters;\nexport type DeviceManagementListBestUpdatesForGroupParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParamProperties {\n /** Orders the set of deployments returned. You can order by start date. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForGroupParameters =\n DeviceManagementListDeploymentsForGroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeploymentParameters = RequestParameters;\n\nexport interface DeviceManagementCreateOrUpdateDeploymentBodyParam {\n /** The deployment properties. */\n body: Deployment;\n}\n\nexport interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementCreateOrUpdateDeploymentParameters =\n DeviceManagementCreateOrUpdateDeploymentMediaTypesParam &\n DeviceManagementCreateOrUpdateDeploymentBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties {\n /** Restricts the set of device class subgroups returned. You can filter on compat properties by name and value. (i.e. filter=compatProperties/propertyName1 eq 'value1' and compatProperties/propertyName2 eq 'value2') */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceClassSubgroupsForGroupParameters =\n DeviceManagementListDeviceClassSubgroupsForGroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementDeleteDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters = RequestParameters;\nexport type DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties {\n /** Orders the set of deployments returned. You can order by start date. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForDeviceClassSubgroupParameters =\n DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeploymentForDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementStopDeploymentParameters = RequestParameters;\nexport type DeviceManagementRetryDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties {\n /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam {\n queryParameters?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters =\n DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam & RequestParameters;\n\nexport interface DeviceManagementGetOperationStatusHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceManagementGetOperationStatusHeaderParam {\n headers: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders;\n}\n\nexport type DeviceManagementGetOperationStatusParameters =\n DeviceManagementGetOperationStatusHeaderParam & RequestParameters;\n\nexport interface DeviceManagementListOperationStatusesQueryParamProperties {\n /** Restricts the set of operations returned. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n top?: number;\n}\n\nexport interface DeviceManagementListOperationStatusesQueryParam {\n queryParameters?: DeviceManagementListOperationStatusesQueryParamProperties;\n}\n\nexport type DeviceManagementListOperationStatusesParameters =\n DeviceManagementListOperationStatusesQueryParam & RequestParameters;\n\nexport interface DeviceManagementStartLogCollectionBodyParam {\n /** The log collection properties. */\n body: LogCollection;\n}\n\nexport interface DeviceManagementStartLogCollectionMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementStartLogCollectionParameters =\n DeviceManagementStartLogCollectionMediaTypesParam &\n DeviceManagementStartLogCollectionBodyParam &\n RequestParameters;\nexport type DeviceManagementGetLogCollectionParameters = RequestParameters;\nexport type DeviceManagementListLogCollectionsParameters = RequestParameters;\nexport type DeviceManagementGetLogCollectionDetailedStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListHealthOfDevicesQueryParamProperties {\n /** Restricts the set of devices for which device health is returned. You can filter on status, device id and module id. */\n filter: string;\n}\n\nexport interface DeviceManagementListHealthOfDevicesQueryParam {\n queryParameters: DeviceManagementListHealthOfDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListHealthOfDevicesParameters =\n DeviceManagementListHealthOfDevicesQueryParam & RequestParameters;\n"]}
@@ -0,0 +1,11 @@
1
+ import type { Client, HttpResponse } from "@azure-rest/core-client";
2
+ import type { LroEngineOptions, PollerLike, PollOperationState } from "@azure/core-lro";
3
+ /**
4
+ * Helper function that builds a Poller object to help polling a long running operation.
5
+ * @param client - Client to use for sending the request to get additional pages.
6
+ * @param initialResponse - The initial response.
7
+ * @param options - Options to set a resume state or custom polling interval.
8
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
9
+ */
10
+ export declare function getLongRunningPoller<TResult extends HttpResponse>(client: Client, initialResponse: TResult, options?: LroEngineOptions<TResult, PollOperationState<TResult>>): PollerLike<PollOperationState<TResult>, TResult>;
11
+ //# sourceMappingURL=pollingHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.d.ts","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAEV,gBAAgB,EAEhB,UAAU,EACV,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAGzB;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,YAAY,EAC/D,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,EACxB,OAAO,GAAE,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAM,GACnE,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAuBlD"}
@@ -0,0 +1,48 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { LroEngine } from "@azure/core-lro";
4
+ /**
5
+ * Helper function that builds a Poller object to help polling a long running operation.
6
+ * @param client - Client to use for sending the request to get additional pages.
7
+ * @param initialResponse - The initial response.
8
+ * @param options - Options to set a resume state or custom polling interval.
9
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
10
+ */
11
+ export function getLongRunningPoller(client, initialResponse, options = {}) {
12
+ const poller = {
13
+ requestMethod: initialResponse.request.method,
14
+ requestPath: initialResponse.request.url,
15
+ sendInitialRequest: async () => {
16
+ // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
17
+ // we are not triggering the initial request here, just extracting the information from the
18
+ // response we were provided.
19
+ return getLroResponse(initialResponse);
20
+ },
21
+ sendPollRequest: async (path) => {
22
+ // This is the callback that is going to be called to poll the service
23
+ // to get the latest status. We use the client provided and the polling path
24
+ // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
25
+ // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
26
+ const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
27
+ const lroResponse = getLroResponse(response);
28
+ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
29
+ return lroResponse;
30
+ },
31
+ };
32
+ return new LroEngine(poller, options);
33
+ }
34
+ /**
35
+ * Converts a Rest Client response to a response that the LRO engine knows about
36
+ * @param response - a rest client http response
37
+ * @returns - An LRO response that the LRO engine can work with
38
+ */
39
+ function getLroResponse(response) {
40
+ if (Number.isNaN(response.status)) {
41
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
42
+ }
43
+ return {
44
+ flatResponse: response,
45
+ rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
46
+ };
47
+ }
48
+ //# sourceMappingURL=pollingHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAc,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C","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type {\n LongRunningOperation,\n LroEngineOptions,\n LroResponse,\n PollerLike,\n PollOperationState,\n} from \"@azure/core-lro\";\nimport { LroEngine } from \"@azure/core-lro\";\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: LroEngineOptions<TResult, PollOperationState<TResult>> = {},\n): PollerLike<PollOperationState<TResult>, TResult> {\n const poller: LongRunningOperation<TResult> = {\n requestMethod: initialResponse.request.method,\n requestPath: initialResponse.request.url,\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n return new LroEngine(poller, options);\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO engine knows about\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO engine can work with\n */\nfunction getLroResponse<TResult extends HttpResponse>(response: TResult): LroResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}