@azure-rest/ai-document-translator 1.0.0-beta.1 → 1.0.0-beta.2

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 (199) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +52 -71
  3. package/dist/browser/clientDefinitions.d.ts +125 -0
  4. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  5. package/dist/browser/clientDefinitions.js +4 -0
  6. package/dist/browser/clientDefinitions.js.map +1 -0
  7. package/dist/browser/documentTranslator.d.ts +14 -0
  8. package/dist/browser/documentTranslator.d.ts.map +1 -0
  9. package/dist/browser/documentTranslator.js +33 -0
  10. package/dist/browser/documentTranslator.js.map +1 -0
  11. package/dist/browser/index.d.ts +12 -0
  12. package/dist/browser/index.d.ts.map +1 -0
  13. package/dist/browser/index.js +14 -0
  14. package/dist/browser/index.js.map +1 -0
  15. package/dist/browser/isUnexpected.d.ts +11 -0
  16. package/dist/browser/isUnexpected.d.ts.map +1 -0
  17. package/dist/browser/isUnexpected.js +78 -0
  18. package/dist/browser/isUnexpected.js.map +1 -0
  19. package/dist/browser/logger.d.ts +2 -0
  20. package/dist/browser/logger.d.ts.map +1 -0
  21. package/dist/browser/logger.js +5 -0
  22. package/dist/browser/logger.js.map +1 -0
  23. package/dist/browser/models.d.ts +69 -0
  24. package/dist/browser/models.d.ts.map +1 -0
  25. package/dist/browser/models.js +4 -0
  26. package/dist/browser/models.js.map +1 -0
  27. package/dist/browser/outputModels.d.ts +144 -0
  28. package/dist/browser/outputModels.d.ts.map +1 -0
  29. package/dist/browser/outputModels.js +4 -0
  30. package/dist/browser/outputModels.js.map +1 -0
  31. package/dist/browser/package.json +3 -0
  32. package/dist/browser/paginateHelper.d.ts +68 -0
  33. package/dist/browser/paginateHelper.d.ts.map +1 -0
  34. package/dist/browser/paginateHelper.js +167 -0
  35. package/dist/browser/paginateHelper.js.map +1 -0
  36. package/dist/browser/parameters.d.ts +98 -0
  37. package/dist/browser/parameters.d.ts.map +1 -0
  38. package/dist/browser/parameters.js +4 -0
  39. package/dist/browser/parameters.js.map +1 -0
  40. package/dist/browser/pollingHelper.d.ts +76 -0
  41. package/dist/browser/pollingHelper.d.ts.map +1 -0
  42. package/dist/browser/pollingHelper.js +104 -0
  43. package/dist/browser/pollingHelper.js.map +1 -0
  44. package/{types/ai-document-translator.d.ts → dist/browser/responses.d.ts} +725 -1242
  45. package/dist/browser/responses.d.ts.map +1 -0
  46. package/dist/browser/responses.js +4 -0
  47. package/dist/browser/responses.js.map +1 -0
  48. package/dist/commonjs/clientDefinitions.d.ts +125 -0
  49. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  50. package/dist/commonjs/clientDefinitions.js +5 -0
  51. package/dist/commonjs/clientDefinitions.js.map +1 -0
  52. package/dist/commonjs/documentTranslator.d.ts +14 -0
  53. package/dist/commonjs/documentTranslator.d.ts.map +1 -0
  54. package/dist/commonjs/documentTranslator.js +36 -0
  55. package/dist/commonjs/documentTranslator.js.map +1 -0
  56. package/dist/commonjs/index.d.ts +12 -0
  57. package/dist/commonjs/index.d.ts.map +1 -0
  58. package/dist/commonjs/index.js +17 -0
  59. package/dist/commonjs/index.js.map +1 -0
  60. package/dist/commonjs/isUnexpected.d.ts +11 -0
  61. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  62. package/dist/commonjs/isUnexpected.js +81 -0
  63. package/dist/commonjs/isUnexpected.js.map +1 -0
  64. package/dist/commonjs/logger.d.ts +2 -0
  65. package/dist/commonjs/logger.d.ts.map +1 -0
  66. package/dist/commonjs/logger.js +8 -0
  67. package/dist/commonjs/logger.js.map +1 -0
  68. package/dist/commonjs/models.d.ts +69 -0
  69. package/dist/commonjs/models.d.ts.map +1 -0
  70. package/dist/commonjs/models.js +5 -0
  71. package/dist/commonjs/models.js.map +1 -0
  72. package/dist/commonjs/outputModels.d.ts +144 -0
  73. package/dist/commonjs/outputModels.d.ts.map +1 -0
  74. package/dist/commonjs/outputModels.js +5 -0
  75. package/dist/commonjs/outputModels.js.map +1 -0
  76. package/dist/commonjs/package.json +3 -0
  77. package/dist/commonjs/paginateHelper.d.ts +68 -0
  78. package/dist/commonjs/paginateHelper.d.ts.map +1 -0
  79. package/dist/commonjs/paginateHelper.js +170 -0
  80. package/dist/commonjs/paginateHelper.js.map +1 -0
  81. package/dist/commonjs/parameters.d.ts +98 -0
  82. package/dist/commonjs/parameters.d.ts.map +1 -0
  83. package/dist/commonjs/parameters.js +5 -0
  84. package/dist/commonjs/parameters.js.map +1 -0
  85. package/dist/commonjs/pollingHelper.d.ts +76 -0
  86. package/dist/commonjs/pollingHelper.d.ts.map +1 -0
  87. package/dist/commonjs/pollingHelper.js +107 -0
  88. package/dist/commonjs/pollingHelper.js.map +1 -0
  89. package/dist/commonjs/responses.d.ts +725 -0
  90. package/dist/commonjs/responses.d.ts.map +1 -0
  91. package/dist/commonjs/responses.js +5 -0
  92. package/dist/commonjs/responses.js.map +1 -0
  93. package/dist/commonjs/tsdoc-metadata.json +11 -0
  94. package/dist/esm/clientDefinitions.d.ts +125 -0
  95. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  96. package/dist/esm/clientDefinitions.js +4 -0
  97. package/dist/esm/clientDefinitions.js.map +1 -0
  98. package/dist/esm/documentTranslator.d.ts +14 -0
  99. package/dist/esm/documentTranslator.d.ts.map +1 -0
  100. package/dist/esm/documentTranslator.js +33 -0
  101. package/dist/esm/documentTranslator.js.map +1 -0
  102. package/dist/esm/index.d.ts +12 -0
  103. package/dist/esm/index.d.ts.map +1 -0
  104. package/dist/esm/index.js +14 -0
  105. package/dist/esm/index.js.map +1 -0
  106. package/dist/esm/isUnexpected.d.ts +11 -0
  107. package/dist/esm/isUnexpected.d.ts.map +1 -0
  108. package/dist/esm/isUnexpected.js +78 -0
  109. package/dist/esm/isUnexpected.js.map +1 -0
  110. package/dist/esm/logger.d.ts +2 -0
  111. package/dist/esm/logger.d.ts.map +1 -0
  112. package/dist/esm/logger.js +5 -0
  113. package/dist/esm/logger.js.map +1 -0
  114. package/dist/esm/models.d.ts +69 -0
  115. package/dist/esm/models.d.ts.map +1 -0
  116. package/dist/esm/models.js +4 -0
  117. package/dist/esm/models.js.map +1 -0
  118. package/dist/esm/outputModels.d.ts +144 -0
  119. package/dist/esm/outputModels.d.ts.map +1 -0
  120. package/dist/esm/outputModels.js +4 -0
  121. package/dist/esm/outputModels.js.map +1 -0
  122. package/dist/esm/package.json +3 -0
  123. package/dist/esm/paginateHelper.d.ts +68 -0
  124. package/dist/esm/paginateHelper.d.ts.map +1 -0
  125. package/dist/esm/paginateHelper.js +167 -0
  126. package/dist/esm/paginateHelper.js.map +1 -0
  127. package/dist/esm/parameters.d.ts +98 -0
  128. package/dist/esm/parameters.d.ts.map +1 -0
  129. package/dist/esm/parameters.js +4 -0
  130. package/dist/esm/parameters.js.map +1 -0
  131. package/dist/esm/pollingHelper.d.ts +76 -0
  132. package/dist/esm/pollingHelper.d.ts.map +1 -0
  133. package/dist/esm/pollingHelper.js +104 -0
  134. package/dist/esm/pollingHelper.js.map +1 -0
  135. package/dist/esm/responses.d.ts +725 -0
  136. package/dist/esm/responses.d.ts.map +1 -0
  137. package/dist/esm/responses.js +4 -0
  138. package/dist/esm/responses.js.map +1 -0
  139. package/dist/react-native/clientDefinitions.d.ts +125 -0
  140. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  141. package/dist/react-native/clientDefinitions.js +4 -0
  142. package/dist/react-native/clientDefinitions.js.map +1 -0
  143. package/dist/react-native/documentTranslator.d.ts +14 -0
  144. package/dist/react-native/documentTranslator.d.ts.map +1 -0
  145. package/dist/react-native/documentTranslator.js +33 -0
  146. package/dist/react-native/documentTranslator.js.map +1 -0
  147. package/dist/react-native/index.d.ts +12 -0
  148. package/dist/react-native/index.d.ts.map +1 -0
  149. package/dist/react-native/index.js +14 -0
  150. package/dist/react-native/index.js.map +1 -0
  151. package/dist/react-native/isUnexpected.d.ts +11 -0
  152. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  153. package/dist/react-native/isUnexpected.js +78 -0
  154. package/dist/react-native/isUnexpected.js.map +1 -0
  155. package/dist/react-native/logger.d.ts +2 -0
  156. package/dist/react-native/logger.d.ts.map +1 -0
  157. package/dist/react-native/logger.js +5 -0
  158. package/dist/react-native/logger.js.map +1 -0
  159. package/dist/react-native/models.d.ts +69 -0
  160. package/dist/react-native/models.d.ts.map +1 -0
  161. package/dist/react-native/models.js +4 -0
  162. package/dist/react-native/models.js.map +1 -0
  163. package/dist/react-native/outputModels.d.ts +144 -0
  164. package/dist/react-native/outputModels.d.ts.map +1 -0
  165. package/dist/react-native/outputModels.js +4 -0
  166. package/dist/react-native/outputModels.js.map +1 -0
  167. package/dist/react-native/package.json +3 -0
  168. package/dist/react-native/paginateHelper.d.ts +68 -0
  169. package/dist/react-native/paginateHelper.d.ts.map +1 -0
  170. package/dist/react-native/paginateHelper.js +167 -0
  171. package/dist/react-native/paginateHelper.js.map +1 -0
  172. package/dist/react-native/parameters.d.ts +98 -0
  173. package/dist/react-native/parameters.d.ts.map +1 -0
  174. package/dist/react-native/parameters.js +4 -0
  175. package/dist/react-native/parameters.js.map +1 -0
  176. package/dist/react-native/pollingHelper.d.ts +76 -0
  177. package/dist/react-native/pollingHelper.d.ts.map +1 -0
  178. package/dist/react-native/pollingHelper.js +104 -0
  179. package/dist/react-native/pollingHelper.js.map +1 -0
  180. package/dist/react-native/responses.d.ts +725 -0
  181. package/dist/react-native/responses.d.ts.map +1 -0
  182. package/dist/react-native/responses.js +4 -0
  183. package/dist/react-native/responses.js.map +1 -0
  184. package/package.json +86 -71
  185. package/CHANGELOG.md +0 -5
  186. package/dist/index.js +0 -19
  187. package/dist/index.js.map +0 -1
  188. package/dist-esm/src/constants.js +0 -7
  189. package/dist-esm/src/constants.js.map +0 -1
  190. package/dist-esm/src/documentTranslator.js +0 -13
  191. package/dist-esm/src/documentTranslator.js.map +0 -1
  192. package/dist-esm/src/index.js +0 -13
  193. package/dist-esm/src/index.js.map +0 -1
  194. package/dist-esm/src/models.js +0 -4
  195. package/dist-esm/src/models.js.map +0 -1
  196. package/dist-esm/src/parameters.js +0 -4
  197. package/dist-esm/src/parameters.js.map +0 -1
  198. package/dist-esm/src/responses.js +0 -4
  199. package/dist-esm/src/responses.js.map +0 -1
@@ -0,0 +1,98 @@
1
+ import type { RequestParameters } from "@azure-rest/core-client";
2
+ import type { StartTranslationDetails } from "./models.js";
3
+ export interface DocumentTranslationStartTranslationBodyParam {
4
+ /** request details */
5
+ body: StartTranslationDetails;
6
+ }
7
+ export interface DocumentTranslationStartTranslationMediaTypesParam {
8
+ /** Request content type */
9
+ contentType?: "application/json" | "text/json" | "application/*+json";
10
+ }
11
+ export type DocumentTranslationStartTranslationParameters = DocumentTranslationStartTranslationMediaTypesParam & DocumentTranslationStartTranslationBodyParam & RequestParameters;
12
+ export interface DocumentTranslationGetTranslationsStatusQueryParamProperties {
13
+ /**
14
+ * $top indicates the total number of records the user wants to be returned across all pages.
15
+ *
16
+ * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.
17
+ * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.
18
+ *
19
+ * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.
20
+ */
21
+ $top?: number;
22
+ /**
23
+ * $skip indicates the number of records to skip from the list of records held by the server based on the sorting method specified. By default, we sort by descending start time.
24
+ *
25
+ * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.
26
+ * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.
27
+ *
28
+ * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.
29
+ */
30
+ $skip?: number;
31
+ /**
32
+ * $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), '\@nextLink' will contain the link to the next page.
33
+ *
34
+ * Clients MAY request server-driven paging with a specific page size by specifying a $maxpagesize preference. The server SHOULD honor this preference if the specified page size is smaller than the server's default page size.
35
+ */
36
+ $maxpagesize?: number;
37
+ /** Ids to use in filtering */
38
+ ids?: Array<string>;
39
+ /** Statuses to use in filtering */
40
+ statuses?: Array<string>;
41
+ /** the start datetime to get items after */
42
+ createdDateTimeUtcStart?: Date | string;
43
+ /** the end datetime to get items before */
44
+ createdDateTimeUtcEnd?: Date | string;
45
+ /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc', 'CreatedDateTimeUtc desc') */
46
+ $orderBy?: Array<string>;
47
+ }
48
+ export interface DocumentTranslationGetTranslationsStatusQueryParam {
49
+ queryParameters?: DocumentTranslationGetTranslationsStatusQueryParamProperties;
50
+ }
51
+ export type DocumentTranslationGetTranslationsStatusParameters = DocumentTranslationGetTranslationsStatusQueryParam & RequestParameters;
52
+ export type DocumentTranslationGetDocumentStatusParameters = RequestParameters;
53
+ export type DocumentTranslationGetTranslationStatusParameters = RequestParameters;
54
+ export type DocumentTranslationCancelTranslationParameters = RequestParameters;
55
+ export interface DocumentTranslationGetDocumentsStatusQueryParamProperties {
56
+ /**
57
+ * $top indicates the total number of records the user wants to be returned across all pages.
58
+ *
59
+ * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.
60
+ * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.
61
+ *
62
+ * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.
63
+ */
64
+ $top?: number;
65
+ /**
66
+ * $skip indicates the number of records to skip from the list of records held by the server based on the sorting method specified. By default, we sort by descending start time.
67
+ *
68
+ * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.
69
+ * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.
70
+ *
71
+ * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.
72
+ */
73
+ $skip?: number;
74
+ /**
75
+ * $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), '\@nextLink' will contain the link to the next page.
76
+ *
77
+ * Clients MAY request server-driven paging with a specific page size by specifying a $maxpagesize preference. The server SHOULD honor this preference if the specified page size is smaller than the server's default page size.
78
+ */
79
+ $maxpagesize?: number;
80
+ /** Ids to use in filtering */
81
+ ids?: Array<string>;
82
+ /** Statuses to use in filtering */
83
+ statuses?: Array<string>;
84
+ /** the start datetime to get items after */
85
+ createdDateTimeUtcStart?: Date | string;
86
+ /** the end datetime to get items before */
87
+ createdDateTimeUtcEnd?: Date | string;
88
+ /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc', 'CreatedDateTimeUtc desc') */
89
+ $orderBy?: Array<string>;
90
+ }
91
+ export interface DocumentTranslationGetDocumentsStatusQueryParam {
92
+ queryParameters?: DocumentTranslationGetDocumentsStatusQueryParamProperties;
93
+ }
94
+ export type DocumentTranslationGetDocumentsStatusParameters = DocumentTranslationGetDocumentsStatusQueryParam & RequestParameters;
95
+ export type DocumentTranslationGetSupportedDocumentFormatsParameters = RequestParameters;
96
+ export type DocumentTranslationGetSupportedGlossaryFormatsParameters = RequestParameters;
97
+ export type DocumentTranslationGetSupportedStorageSourcesParameters = RequestParameters;
98
+ //# 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,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,WAAW,4CAA4C;IAC3D,sBAAsB;IACtB,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED,MAAM,WAAW,kDAAkD;IACjE,2BAA2B;IAC3B,WAAW,CAAC,EAAE,kBAAkB,GAAG,WAAW,GAAG,oBAAoB,CAAC;CACvE;AAED,MAAM,MAAM,6CAA6C,GACvD,kDAAkD,GAChD,4CAA4C,GAC5C,iBAAiB,CAAC;AAEtB,MAAM,WAAW,4DAA4D;IAC3E;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,4CAA4C;IAC5C,uBAAuB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACxC,2CAA2C;IAC3C,qBAAqB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtC,qGAAqG;IACrG,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,kDAAkD;IACjE,eAAe,CAAC,EAAE,4DAA4D,CAAC;CAChF;AAED,MAAM,MAAM,kDAAkD,GAC5D,kDAAkD,GAAG,iBAAiB,CAAC;AACzE,MAAM,MAAM,8CAA8C,GAAG,iBAAiB,CAAC;AAC/E,MAAM,MAAM,iDAAiD,GAAG,iBAAiB,CAAC;AAClF,MAAM,MAAM,8CAA8C,GAAG,iBAAiB,CAAC;AAE/E,MAAM,WAAW,yDAAyD;IACxE;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,4CAA4C;IAC5C,uBAAuB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACxC,2CAA2C;IAC3C,qBAAqB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtC,qGAAqG;IACrG,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,+CAA+C;IAC9D,eAAe,CAAC,EAAE,yDAAyD,CAAC;CAC7E;AAED,MAAM,MAAM,+CAA+C,GACzD,+CAA+C,GAAG,iBAAiB,CAAC;AACtE,MAAM,MAAM,wDAAwD,GAAG,iBAAiB,CAAC;AACzF,MAAM,MAAM,wDAAwD,GAAG,iBAAiB,CAAC;AACzF,MAAM,MAAM,uDAAuD,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 { RequestParameters } from \"@azure-rest/core-client\";\nimport type { StartTranslationDetails } from \"./models.js\";\n\nexport interface DocumentTranslationStartTranslationBodyParam {\n /** request details */\n body: StartTranslationDetails;\n}\n\nexport interface DocumentTranslationStartTranslationMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\" | \"text/json\" | \"application/*+json\";\n}\n\nexport type DocumentTranslationStartTranslationParameters =\n DocumentTranslationStartTranslationMediaTypesParam &\n DocumentTranslationStartTranslationBodyParam &\n RequestParameters;\n\nexport interface DocumentTranslationGetTranslationsStatusQueryParamProperties {\n /**\n * $top indicates the total number of records the user wants to be returned across all pages.\n *\n * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.\n * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.\n *\n * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.\n */\n $top?: number;\n /**\n * $skip indicates the number of records to skip from the list of records held by the server based on the sorting method specified. By default, we sort by descending start time.\n *\n * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.\n * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.\n *\n * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.\n */\n $skip?: number;\n /**\n * $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), '\\@nextLink' will contain the link to the next page.\n *\n * Clients MAY request server-driven paging with a specific page size by specifying a $maxpagesize preference. The server SHOULD honor this preference if the specified page size is smaller than the server's default page size.\n */\n $maxpagesize?: number;\n /** Ids to use in filtering */\n ids?: Array<string>;\n /** Statuses to use in filtering */\n statuses?: Array<string>;\n /** the start datetime to get items after */\n createdDateTimeUtcStart?: Date | string;\n /** the end datetime to get items before */\n createdDateTimeUtcEnd?: Date | string;\n /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc', 'CreatedDateTimeUtc desc') */\n $orderBy?: Array<string>;\n}\n\nexport interface DocumentTranslationGetTranslationsStatusQueryParam {\n queryParameters?: DocumentTranslationGetTranslationsStatusQueryParamProperties;\n}\n\nexport type DocumentTranslationGetTranslationsStatusParameters =\n DocumentTranslationGetTranslationsStatusQueryParam & RequestParameters;\nexport type DocumentTranslationGetDocumentStatusParameters = RequestParameters;\nexport type DocumentTranslationGetTranslationStatusParameters = RequestParameters;\nexport type DocumentTranslationCancelTranslationParameters = RequestParameters;\n\nexport interface DocumentTranslationGetDocumentsStatusQueryParamProperties {\n /**\n * $top indicates the total number of records the user wants to be returned across all pages.\n *\n * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.\n * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.\n *\n * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.\n */\n $top?: number;\n /**\n * $skip indicates the number of records to skip from the list of records held by the server based on the sorting method specified. By default, we sort by descending start time.\n *\n * Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection.\n * When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection.\n *\n * Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options.\n */\n $skip?: number;\n /**\n * $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), '\\@nextLink' will contain the link to the next page.\n *\n * Clients MAY request server-driven paging with a specific page size by specifying a $maxpagesize preference. The server SHOULD honor this preference if the specified page size is smaller than the server's default page size.\n */\n $maxpagesize?: number;\n /** Ids to use in filtering */\n ids?: Array<string>;\n /** Statuses to use in filtering */\n statuses?: Array<string>;\n /** the start datetime to get items after */\n createdDateTimeUtcStart?: Date | string;\n /** the end datetime to get items before */\n createdDateTimeUtcEnd?: Date | string;\n /** the sorting query for the collection (ex: 'CreatedDateTimeUtc asc', 'CreatedDateTimeUtc desc') */\n $orderBy?: Array<string>;\n}\n\nexport interface DocumentTranslationGetDocumentsStatusQueryParam {\n queryParameters?: DocumentTranslationGetDocumentsStatusQueryParamProperties;\n}\n\nexport type DocumentTranslationGetDocumentsStatusParameters =\n DocumentTranslationGetDocumentsStatusQueryParam & RequestParameters;\nexport type DocumentTranslationGetSupportedDocumentFormatsParameters = RequestParameters;\nexport type DocumentTranslationGetSupportedGlossaryFormatsParameters = RequestParameters;\nexport type DocumentTranslationGetSupportedStorageSourcesParameters = RequestParameters;\n"]}
@@ -0,0 +1,76 @@
1
+ import type { Client, HttpResponse } from "@azure-rest/core-client";
2
+ import type { AbortSignalLike } from "@azure/abort-controller";
3
+ import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro";
4
+ /**
5
+ * A simple poller that can be used to poll a long running operation.
6
+ */
7
+ export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
8
+ /**
9
+ * Returns true if the poller has finished polling.
10
+ */
11
+ isDone(): boolean;
12
+ /**
13
+ * Returns the state of the operation.
14
+ */
15
+ getOperationState(): TState;
16
+ /**
17
+ * Returns the result value of the operation,
18
+ * regardless of the state of the poller.
19
+ * It can return undefined or an incomplete form of the final TResult value
20
+ * depending on the implementation.
21
+ */
22
+ getResult(): TResult | undefined;
23
+ /**
24
+ * Returns a promise that will resolve once a single polling request finishes.
25
+ * It does this by calling the update method of the Poller's operation.
26
+ */
27
+ poll(options?: {
28
+ abortSignal?: AbortSignalLike;
29
+ }): Promise<TState>;
30
+ /**
31
+ * Returns a promise that will resolve once the underlying operation is completed.
32
+ */
33
+ pollUntilDone(pollOptions?: {
34
+ abortSignal?: AbortSignalLike;
35
+ }): Promise<TResult>;
36
+ /**
37
+ * Invokes the provided callback after each polling is completed,
38
+ * sending the current state of the poller's operation.
39
+ *
40
+ * It returns a method that can be used to stop receiving updates on the given callback function.
41
+ */
42
+ onProgress(callback: (state: TState) => void): CancelOnProgress;
43
+ /**
44
+ * Returns a promise that could be used for serialized version of the poller's operation
45
+ * by invoking the operation's serialize method.
46
+ */
47
+ serialize(): Promise<string>;
48
+ /**
49
+ * Wait the poller to be submitted.
50
+ */
51
+ submitted(): Promise<void>;
52
+ /**
53
+ * Returns a string representation of the poller's operation. Similar to serialize but returns a string.
54
+ * @deprecated Use serialize() instead.
55
+ */
56
+ toString(): string;
57
+ /**
58
+ * Stops the poller from continuing to poll. Please note this will only stop the client-side polling
59
+ * @deprecated Use abortSignal to stop polling instead.
60
+ */
61
+ stopPolling(): void;
62
+ /**
63
+ * Returns true if the poller is stopped.
64
+ * @deprecated Use abortSignal status to track this instead.
65
+ */
66
+ isStopped(): boolean;
67
+ }
68
+ /**
69
+ * Helper function that builds a Poller object to help polling a long running operation.
70
+ * @param client - Client to use for sending the request to get additional pages.
71
+ * @param initialResponse - The initial response.
72
+ * @param options - Options to set a resume state or custom polling interval.
73
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
74
+ */
75
+ export declare function getLongRunningPoller<TResult extends HttpResponse>(client: Client, initialResponse: TResult, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
76
+ //# 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,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EAGvB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO;IAC/E;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC;IAClB;;OAEG;IACH,iBAAiB,IAAI,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE;;OAEG;IACH,aAAa,CAAC,WAAW,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAAC;IAEhE;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;OAGG;IACH,QAAQ,IAAI,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,SAAS,YAAY,EACrE,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,EACxB,OAAO,GAAE,uBAAuB,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAM,GACtE,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAgF7D"}
@@ -0,0 +1,104 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { createHttpPoller } 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 async function getLongRunningPoller(client, initialResponse, options = {}) {
12
+ var _a;
13
+ const abortController = new AbortController();
14
+ const poller = {
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, pollOptions) => {
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
+ function abortListener() {
27
+ abortController.abort();
28
+ }
29
+ const inputAbortSignal = pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.abortSignal;
30
+ const abortSignal = abortController.signal;
31
+ if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) {
32
+ abortController.abort();
33
+ }
34
+ else if (!abortSignal.aborted) {
35
+ inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, {
36
+ once: true,
37
+ });
38
+ }
39
+ let response;
40
+ try {
41
+ response = await client
42
+ .pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url)
43
+ .get({ abortSignal });
44
+ }
45
+ finally {
46
+ inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener);
47
+ }
48
+ const lroResponse = getLroResponse(response);
49
+ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
50
+ return lroResponse;
51
+ },
52
+ };
53
+ options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
54
+ const httpPoller = createHttpPoller(poller, options);
55
+ const simplePoller = {
56
+ isDone() {
57
+ return httpPoller.isDone;
58
+ },
59
+ isStopped() {
60
+ return abortController.signal.aborted;
61
+ },
62
+ getOperationState() {
63
+ if (!httpPoller.operationState) {
64
+ throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
65
+ }
66
+ return httpPoller.operationState;
67
+ },
68
+ getResult() {
69
+ return httpPoller.result;
70
+ },
71
+ toString() {
72
+ if (!httpPoller.operationState) {
73
+ throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
74
+ }
75
+ return JSON.stringify({
76
+ state: httpPoller.operationState,
77
+ });
78
+ },
79
+ stopPolling() {
80
+ abortController.abort();
81
+ },
82
+ onProgress: httpPoller.onProgress,
83
+ poll: httpPoller.poll,
84
+ pollUntilDone: httpPoller.pollUntilDone,
85
+ serialize: httpPoller.serialize,
86
+ submitted: httpPoller.submitted,
87
+ };
88
+ return simplePoller;
89
+ }
90
+ /**
91
+ * Converts a Rest Client response to a response that the LRO implementation understands
92
+ * @param response - a rest client http response
93
+ * @returns - An LRO response that the LRO implementation understands
94
+ */
95
+ function getLroResponse(response) {
96
+ if (Number.isNaN(response.status)) {
97
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
98
+ }
99
+ return {
100
+ flatResponse: response,
101
+ rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
102
+ };
103
+ }
104
+ //# sourceMappingURL=pollingHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\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 async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\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: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\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 function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\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 options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<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"]}