twelvelabs-js 1.2.7 → 1.2.8

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 (274) hide show
  1. package/Client.d.ts +4 -0
  2. package/Client.js +6 -2
  3. package/api/client/requests/AnalyzeRequest.d.ts +1 -1
  4. package/api/client/requests/AnalyzeStreamRequest.d.ts +1 -1
  5. package/api/errors/GatewayTimeoutError.d.ts +9 -0
  6. package/api/errors/GatewayTimeoutError.js +52 -0
  7. package/api/errors/ServiceUnavailableError.d.ts +9 -0
  8. package/api/errors/ServiceUnavailableError.js +52 -0
  9. package/api/errors/index.d.ts +2 -0
  10. package/api/errors/index.js +2 -0
  11. package/api/resources/analyzeAsync/client/Client.d.ts +3 -0
  12. package/api/resources/analyzeAsync/client/Client.js +5 -0
  13. package/api/resources/analyzeAsync/resources/batches/client/Client.d.ts +231 -0
  14. package/api/resources/analyzeAsync/resources/batches/client/Client.js +667 -0
  15. package/api/resources/analyzeAsync/resources/batches/client/index.d.ts +1 -0
  16. package/api/resources/analyzeAsync/resources/batches/client/index.js +17 -0
  17. package/api/resources/analyzeAsync/resources/batches/client/requests/BatchesListRequest.d.ts +42 -0
  18. package/api/resources/analyzeAsync/resources/batches/client/requests/BatchesListRequest.js +5 -0
  19. package/api/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.d.ts +101 -0
  20. package/api/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.js +5 -0
  21. package/api/resources/analyzeAsync/resources/batches/client/requests/index.d.ts +2 -0
  22. package/api/resources/analyzeAsync/resources/batches/client/requests/index.js +2 -0
  23. package/api/resources/analyzeAsync/resources/batches/index.d.ts +2 -0
  24. package/api/resources/analyzeAsync/resources/batches/index.js +18 -0
  25. package/api/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.d.ts +8 -0
  26. package/api/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.js +10 -0
  27. package/api/resources/analyzeAsync/resources/batches/types/BatchesListResponse.d.ts +9 -0
  28. package/api/resources/analyzeAsync/resources/batches/types/BatchesListResponse.js +5 -0
  29. package/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.d.ts +15 -0
  30. package/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.js +10 -0
  31. package/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.d.ts +10 -0
  32. package/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.js +9 -0
  33. package/api/resources/analyzeAsync/resources/batches/types/index.d.ts +4 -0
  34. package/api/resources/analyzeAsync/resources/batches/types/index.js +20 -0
  35. package/api/resources/analyzeAsync/resources/index.d.ts +3 -0
  36. package/api/resources/analyzeAsync/resources/index.js +4 -1
  37. package/api/resources/analyzeAsync/resources/tasks/client/Client.d.ts +2 -0
  38. package/api/resources/analyzeAsync/resources/tasks/client/Client.js +6 -4
  39. package/api/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.d.ts +1 -1
  40. package/api/resources/assets/client/Client.js +7 -7
  41. package/api/resources/embed/client/Client.js +1 -1
  42. package/api/resources/embed/resources/tasks/client/Client.js +4 -4
  43. package/api/resources/embed/resources/v2/client/Client.js +1 -1
  44. package/api/resources/embed/resources/v2/resources/tasks/client/Client.js +3 -3
  45. package/api/resources/entityCollections/client/Client.js +5 -5
  46. package/api/resources/entityCollections/resources/entities/client/Client.js +9 -9
  47. package/api/resources/indexes/client/Client.js +5 -5
  48. package/api/resources/indexes/resources/indexedAssets/client/Client.d.ts +2 -0
  49. package/api/resources/indexes/resources/indexedAssets/client/Client.js +8 -6
  50. package/api/resources/indexes/resources/videos/client/Client.js +4 -4
  51. package/api/resources/multipartUpload/client/Client.js +5 -5
  52. package/api/resources/search/client/Client.js +2 -2
  53. package/api/resources/tasks/client/Client.d.ts +2 -0
  54. package/api/resources/tasks/client/Client.js +6 -4
  55. package/api/types/AnalyzeBatchStatusResponse.d.ts +21 -0
  56. package/api/types/AnalyzeBatchStatusResponse.js +5 -0
  57. package/api/types/AnalyzeBatchSummary.d.ts +28 -0
  58. package/api/types/AnalyzeBatchSummary.js +5 -0
  59. package/api/types/AnalyzeBatchSummaryAnalysisMode.d.ts +11 -0
  60. package/api/types/AnalyzeBatchSummaryAnalysisMode.js +10 -0
  61. package/api/types/BatchDefaults.d.ts +46 -0
  62. package/api/types/BatchDefaults.js +5 -0
  63. package/api/types/BatchItemError.d.ts +12 -0
  64. package/api/types/BatchItemError.js +5 -0
  65. package/api/types/BatchItemRequest.d.ts +36 -0
  66. package/api/types/BatchItemRequest.js +5 -0
  67. package/api/types/BatchItemStatus.d.ts +14 -0
  68. package/api/types/BatchItemStatus.js +13 -0
  69. package/api/types/BatchPrompt.d.ts +13 -0
  70. package/api/types/BatchPrompt.js +5 -0
  71. package/api/types/BatchResultItem.d.ts +17 -0
  72. package/api/types/BatchResultItem.js +5 -0
  73. package/api/types/BatchStatus.d.ts +15 -0
  74. package/api/types/BatchStatus.js +14 -0
  75. package/api/types/BatchVideoContext.d.ts +13 -0
  76. package/api/types/BatchVideoContext.js +5 -0
  77. package/api/types/BatchVideoContextType.d.ts +10 -0
  78. package/api/types/BatchVideoContextType.js +9 -0
  79. package/api/types/CreateAnalyzeBatchResponse.d.ts +20 -0
  80. package/api/types/CreateAnalyzeBatchResponse.js +5 -0
  81. package/api/types/CreatedBatchItem.d.ts +12 -0
  82. package/api/types/CreatedBatchItem.js +5 -0
  83. package/api/types/index.d.ts +14 -0
  84. package/api/types/index.js +14 -0
  85. package/dist/Client.d.ts +4 -0
  86. package/dist/Client.js +6 -2
  87. package/dist/api/client/requests/AnalyzeRequest.d.ts +1 -1
  88. package/dist/api/client/requests/AnalyzeStreamRequest.d.ts +1 -1
  89. package/dist/api/errors/GatewayTimeoutError.d.ts +9 -0
  90. package/dist/api/errors/GatewayTimeoutError.js +52 -0
  91. package/dist/api/errors/ServiceUnavailableError.d.ts +9 -0
  92. package/dist/api/errors/ServiceUnavailableError.js +52 -0
  93. package/dist/api/errors/index.d.ts +2 -0
  94. package/dist/api/errors/index.js +2 -0
  95. package/dist/api/resources/analyzeAsync/client/Client.d.ts +3 -0
  96. package/dist/api/resources/analyzeAsync/client/Client.js +5 -0
  97. package/dist/api/resources/analyzeAsync/resources/batches/client/Client.d.ts +231 -0
  98. package/dist/api/resources/analyzeAsync/resources/batches/client/Client.js +667 -0
  99. package/dist/api/resources/analyzeAsync/resources/batches/client/index.d.ts +1 -0
  100. package/dist/api/resources/analyzeAsync/resources/batches/client/index.js +17 -0
  101. package/dist/api/resources/analyzeAsync/resources/batches/client/requests/BatchesListRequest.d.ts +42 -0
  102. package/dist/api/resources/analyzeAsync/resources/batches/client/requests/BatchesListRequest.js +5 -0
  103. package/dist/api/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.d.ts +101 -0
  104. package/dist/api/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.js +5 -0
  105. package/dist/api/resources/analyzeAsync/resources/batches/client/requests/index.d.ts +2 -0
  106. package/dist/api/resources/analyzeAsync/resources/batches/client/requests/index.js +2 -0
  107. package/dist/api/resources/analyzeAsync/resources/batches/index.d.ts +2 -0
  108. package/dist/api/resources/analyzeAsync/resources/batches/index.js +18 -0
  109. package/dist/api/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.d.ts +8 -0
  110. package/dist/api/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.js +10 -0
  111. package/dist/api/resources/analyzeAsync/resources/batches/types/BatchesListResponse.d.ts +9 -0
  112. package/dist/api/resources/analyzeAsync/resources/batches/types/BatchesListResponse.js +5 -0
  113. package/dist/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.d.ts +15 -0
  114. package/dist/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.js +10 -0
  115. package/dist/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.d.ts +10 -0
  116. package/dist/api/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.js +9 -0
  117. package/dist/api/resources/analyzeAsync/resources/batches/types/index.d.ts +4 -0
  118. package/dist/api/resources/analyzeAsync/resources/batches/types/index.js +20 -0
  119. package/dist/api/resources/analyzeAsync/resources/index.d.ts +3 -0
  120. package/dist/api/resources/analyzeAsync/resources/index.js +4 -1
  121. package/dist/api/resources/analyzeAsync/resources/tasks/client/Client.d.ts +2 -0
  122. package/dist/api/resources/analyzeAsync/resources/tasks/client/Client.js +6 -4
  123. package/dist/api/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.d.ts +1 -1
  124. package/dist/api/resources/assets/client/Client.js +7 -7
  125. package/dist/api/resources/embed/client/Client.js +1 -1
  126. package/dist/api/resources/embed/resources/tasks/client/Client.js +4 -4
  127. package/dist/api/resources/embed/resources/v2/client/Client.js +1 -1
  128. package/dist/api/resources/embed/resources/v2/resources/tasks/client/Client.js +3 -3
  129. package/dist/api/resources/entityCollections/client/Client.js +5 -5
  130. package/dist/api/resources/entityCollections/resources/entities/client/Client.js +9 -9
  131. package/dist/api/resources/indexes/client/Client.js +5 -5
  132. package/dist/api/resources/indexes/resources/indexedAssets/client/Client.d.ts +2 -0
  133. package/dist/api/resources/indexes/resources/indexedAssets/client/Client.js +8 -6
  134. package/dist/api/resources/indexes/resources/videos/client/Client.js +4 -4
  135. package/dist/api/resources/multipartUpload/client/Client.js +5 -5
  136. package/dist/api/resources/search/client/Client.js +2 -2
  137. package/dist/api/resources/tasks/client/Client.d.ts +2 -0
  138. package/dist/api/resources/tasks/client/Client.js +6 -4
  139. package/dist/api/types/AnalyzeBatchStatusResponse.d.ts +21 -0
  140. package/dist/api/types/AnalyzeBatchStatusResponse.js +5 -0
  141. package/dist/api/types/AnalyzeBatchSummary.d.ts +28 -0
  142. package/dist/api/types/AnalyzeBatchSummary.js +5 -0
  143. package/dist/api/types/AnalyzeBatchSummaryAnalysisMode.d.ts +11 -0
  144. package/dist/api/types/AnalyzeBatchSummaryAnalysisMode.js +10 -0
  145. package/dist/api/types/BatchDefaults.d.ts +46 -0
  146. package/dist/api/types/BatchDefaults.js +5 -0
  147. package/dist/api/types/BatchItemError.d.ts +12 -0
  148. package/dist/api/types/BatchItemError.js +5 -0
  149. package/dist/api/types/BatchItemRequest.d.ts +36 -0
  150. package/dist/api/types/BatchItemRequest.js +5 -0
  151. package/dist/api/types/BatchItemStatus.d.ts +14 -0
  152. package/dist/api/types/BatchItemStatus.js +13 -0
  153. package/dist/api/types/BatchPrompt.d.ts +13 -0
  154. package/dist/api/types/BatchPrompt.js +5 -0
  155. package/dist/api/types/BatchResultItem.d.ts +17 -0
  156. package/dist/api/types/BatchResultItem.js +5 -0
  157. package/dist/api/types/BatchStatus.d.ts +15 -0
  158. package/dist/api/types/BatchStatus.js +14 -0
  159. package/dist/api/types/BatchVideoContext.d.ts +13 -0
  160. package/dist/api/types/BatchVideoContext.js +5 -0
  161. package/dist/api/types/BatchVideoContextType.d.ts +10 -0
  162. package/dist/api/types/BatchVideoContextType.js +9 -0
  163. package/dist/api/types/CreateAnalyzeBatchResponse.d.ts +20 -0
  164. package/dist/api/types/CreateAnalyzeBatchResponse.js +5 -0
  165. package/dist/api/types/CreatedBatchItem.d.ts +12 -0
  166. package/dist/api/types/CreatedBatchItem.js +5 -0
  167. package/dist/api/types/index.d.ts +14 -0
  168. package/dist/api/types/index.js +14 -0
  169. package/dist/serialization/resources/analyzeAsync/resources/batches/client/index.d.ts +1 -0
  170. package/dist/serialization/resources/analyzeAsync/resources/batches/client/index.js +17 -0
  171. package/dist/serialization/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.d.ts +19 -0
  172. package/dist/serialization/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.js +50 -0
  173. package/dist/serialization/resources/analyzeAsync/resources/batches/client/requests/index.d.ts +1 -0
  174. package/dist/serialization/resources/analyzeAsync/resources/batches/client/requests/index.js +5 -0
  175. package/dist/serialization/resources/analyzeAsync/resources/batches/index.d.ts +2 -0
  176. package/dist/serialization/resources/analyzeAsync/resources/batches/index.js +18 -0
  177. package/dist/serialization/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.d.ts +10 -0
  178. package/dist/serialization/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.js +41 -0
  179. package/dist/serialization/resources/analyzeAsync/resources/batches/types/BatchesListResponse.d.ts +15 -0
  180. package/dist/serialization/resources/analyzeAsync/resources/batches/types/BatchesListResponse.js +46 -0
  181. package/dist/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.d.ts +10 -0
  182. package/dist/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.js +41 -0
  183. package/dist/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.d.ts +10 -0
  184. package/dist/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.js +41 -0
  185. package/dist/serialization/resources/analyzeAsync/resources/batches/types/index.d.ts +4 -0
  186. package/dist/serialization/resources/analyzeAsync/resources/batches/types/index.js +20 -0
  187. package/dist/serialization/resources/analyzeAsync/resources/index.d.ts +3 -0
  188. package/dist/serialization/resources/analyzeAsync/resources/index.js +4 -1
  189. package/dist/serialization/types/AnalyzeBatchStatusResponse.d.ts +19 -0
  190. package/dist/serialization/types/AnalyzeBatchStatusResponse.js +52 -0
  191. package/dist/serialization/types/AnalyzeBatchSummary.d.ts +23 -0
  192. package/dist/serialization/types/AnalyzeBatchSummary.js +54 -0
  193. package/dist/serialization/types/AnalyzeBatchSummaryAnalysisMode.d.ts +10 -0
  194. package/dist/serialization/types/AnalyzeBatchSummaryAnalysisMode.js +41 -0
  195. package/dist/serialization/types/BatchDefaults.d.ts +22 -0
  196. package/dist/serialization/types/BatchDefaults.js +53 -0
  197. package/dist/serialization/types/BatchItemError.d.ts +13 -0
  198. package/dist/serialization/types/BatchItemError.js +44 -0
  199. package/dist/serialization/types/BatchItemRequest.d.ts +25 -0
  200. package/dist/serialization/types/BatchItemRequest.js +56 -0
  201. package/dist/serialization/types/BatchItemStatus.d.ts +10 -0
  202. package/dist/serialization/types/BatchItemStatus.js +41 -0
  203. package/dist/serialization/types/BatchPrompt.d.ts +14 -0
  204. package/dist/serialization/types/BatchPrompt.js +45 -0
  205. package/dist/serialization/types/BatchResultItem.d.ts +19 -0
  206. package/dist/serialization/types/BatchResultItem.js +50 -0
  207. package/dist/serialization/types/BatchStatus.d.ts +10 -0
  208. package/dist/serialization/types/BatchStatus.js +41 -0
  209. package/dist/serialization/types/BatchVideoContext.d.ts +14 -0
  210. package/dist/serialization/types/BatchVideoContext.js +45 -0
  211. package/dist/serialization/types/BatchVideoContextType.d.ts +10 -0
  212. package/dist/serialization/types/BatchVideoContextType.js +41 -0
  213. package/dist/serialization/types/CreateAnalyzeBatchResponse.d.ts +19 -0
  214. package/dist/serialization/types/CreateAnalyzeBatchResponse.js +50 -0
  215. package/dist/serialization/types/CreatedBatchItem.d.ts +13 -0
  216. package/dist/serialization/types/CreatedBatchItem.js +44 -0
  217. package/dist/serialization/types/index.d.ts +14 -0
  218. package/dist/serialization/types/index.js +14 -0
  219. package/dist/version.d.ts +1 -1
  220. package/dist/version.js +1 -1
  221. package/package.json +1 -1
  222. package/reference.md +489 -0
  223. package/serialization/resources/analyzeAsync/resources/batches/client/index.d.ts +1 -0
  224. package/serialization/resources/analyzeAsync/resources/batches/client/index.js +17 -0
  225. package/serialization/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.d.ts +19 -0
  226. package/serialization/resources/analyzeAsync/resources/batches/client/requests/CreateAnalyzeBatchRequest.js +50 -0
  227. package/serialization/resources/analyzeAsync/resources/batches/client/requests/index.d.ts +1 -0
  228. package/serialization/resources/analyzeAsync/resources/batches/client/requests/index.js +5 -0
  229. package/serialization/resources/analyzeAsync/resources/batches/index.d.ts +2 -0
  230. package/serialization/resources/analyzeAsync/resources/batches/index.js +18 -0
  231. package/serialization/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.d.ts +10 -0
  232. package/serialization/resources/analyzeAsync/resources/batches/types/BatchesListRequestAnalysisModeItem.js +41 -0
  233. package/serialization/resources/analyzeAsync/resources/batches/types/BatchesListResponse.d.ts +15 -0
  234. package/serialization/resources/analyzeAsync/resources/batches/types/BatchesListResponse.js +46 -0
  235. package/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.d.ts +10 -0
  236. package/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestAnalysisMode.js +41 -0
  237. package/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.d.ts +10 -0
  238. package/serialization/resources/analyzeAsync/resources/batches/types/CreateAnalyzeBatchRequestModelName.js +41 -0
  239. package/serialization/resources/analyzeAsync/resources/batches/types/index.d.ts +4 -0
  240. package/serialization/resources/analyzeAsync/resources/batches/types/index.js +20 -0
  241. package/serialization/resources/analyzeAsync/resources/index.d.ts +3 -0
  242. package/serialization/resources/analyzeAsync/resources/index.js +4 -1
  243. package/serialization/types/AnalyzeBatchStatusResponse.d.ts +19 -0
  244. package/serialization/types/AnalyzeBatchStatusResponse.js +52 -0
  245. package/serialization/types/AnalyzeBatchSummary.d.ts +23 -0
  246. package/serialization/types/AnalyzeBatchSummary.js +54 -0
  247. package/serialization/types/AnalyzeBatchSummaryAnalysisMode.d.ts +10 -0
  248. package/serialization/types/AnalyzeBatchSummaryAnalysisMode.js +41 -0
  249. package/serialization/types/BatchDefaults.d.ts +22 -0
  250. package/serialization/types/BatchDefaults.js +53 -0
  251. package/serialization/types/BatchItemError.d.ts +13 -0
  252. package/serialization/types/BatchItemError.js +44 -0
  253. package/serialization/types/BatchItemRequest.d.ts +25 -0
  254. package/serialization/types/BatchItemRequest.js +56 -0
  255. package/serialization/types/BatchItemStatus.d.ts +10 -0
  256. package/serialization/types/BatchItemStatus.js +41 -0
  257. package/serialization/types/BatchPrompt.d.ts +14 -0
  258. package/serialization/types/BatchPrompt.js +45 -0
  259. package/serialization/types/BatchResultItem.d.ts +19 -0
  260. package/serialization/types/BatchResultItem.js +50 -0
  261. package/serialization/types/BatchStatus.d.ts +10 -0
  262. package/serialization/types/BatchStatus.js +41 -0
  263. package/serialization/types/BatchVideoContext.d.ts +14 -0
  264. package/serialization/types/BatchVideoContext.js +45 -0
  265. package/serialization/types/BatchVideoContextType.d.ts +10 -0
  266. package/serialization/types/BatchVideoContextType.js +41 -0
  267. package/serialization/types/CreateAnalyzeBatchResponse.d.ts +19 -0
  268. package/serialization/types/CreateAnalyzeBatchResponse.js +50 -0
  269. package/serialization/types/CreatedBatchItem.d.ts +13 -0
  270. package/serialization/types/CreatedBatchItem.js +44 -0
  271. package/serialization/types/index.d.ts +14 -0
  272. package/serialization/types/index.js +14 -0
  273. package/version.d.ts +1 -1
  274. package/version.js +1 -1
@@ -0,0 +1,667 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.Batches = void 0;
52
+ const environments = __importStar(require("../../../../../../environments"));
53
+ const core = __importStar(require("../../../../../../core"));
54
+ const TwelvelabsApi = __importStar(require("../../../../../index"));
55
+ const serializers = __importStar(require("../../../../../../serialization/index"));
56
+ const url_join_1 = __importDefault(require("url-join"));
57
+ const errors = __importStar(require("../../../../../../errors/index"));
58
+ class Batches {
59
+ constructor(_options) {
60
+ this._options = _options;
61
+ }
62
+ /**
63
+ * Use this method to list all the batch objects in your account. The response sorts batches by creation date, with the newest batch first.
64
+ *
65
+ * @param {TwelvelabsApi.analyzeAsync.BatchesListRequest} request
66
+ * @param {Batches.RequestOptions} requestOptions - Request-specific configuration.
67
+ *
68
+ * @throws {@link TwelvelabsApi.BadRequestError}
69
+ *
70
+ * @example
71
+ * await client.analyzeAsync.batches.list({
72
+ * page: 1,
73
+ * pageLimit: 10
74
+ * })
75
+ */
76
+ list() {
77
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
78
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
79
+ var _a, _b;
80
+ const { page, pageLimit, status, analysisMode } = request;
81
+ const _queryParams = {};
82
+ if (page != null) {
83
+ _queryParams["page"] = page.toString();
84
+ }
85
+ if (pageLimit != null) {
86
+ _queryParams["page_limit"] = pageLimit.toString();
87
+ }
88
+ if (status != null) {
89
+ if (Array.isArray(status)) {
90
+ _queryParams["status"] = status.map((item) => serializers.BatchStatus.jsonOrThrow(item, { unrecognizedObjectKeys: "strip" }));
91
+ }
92
+ else {
93
+ _queryParams["status"] = serializers.BatchStatus.jsonOrThrow(status, {
94
+ unrecognizedObjectKeys: "strip",
95
+ });
96
+ }
97
+ }
98
+ if (analysisMode != null) {
99
+ if (Array.isArray(analysisMode)) {
100
+ _queryParams["analysis_mode"] = analysisMode.map((item) => serializers.analyzeAsync.BatchesListRequestAnalysisModeItem.jsonOrThrow(item, {
101
+ unrecognizedObjectKeys: "strip",
102
+ }));
103
+ }
104
+ else {
105
+ _queryParams["analysis_mode"] =
106
+ serializers.analyzeAsync.BatchesListRequestAnalysisModeItem.jsonOrThrow(analysisMode, {
107
+ unrecognizedObjectKeys: "strip",
108
+ });
109
+ }
110
+ }
111
+ const _response = yield core.fetcher({
112
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, "analyze/batches"),
113
+ method: "GET",
114
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.8", "User-Agent": "twelvelabs-js/1.2.8", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
115
+ contentType: "application/json",
116
+ queryParameters: _queryParams,
117
+ requestType: "json",
118
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
119
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
120
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
121
+ });
122
+ if (_response.ok) {
123
+ return {
124
+ data: serializers.analyzeAsync.BatchesListResponse.parseOrThrow(_response.body, {
125
+ unrecognizedObjectKeys: "passthrough",
126
+ allowUnrecognizedUnionMembers: true,
127
+ allowUnrecognizedEnumValues: true,
128
+ breadcrumbsPrefix: ["response"],
129
+ }),
130
+ rawResponse: _response.rawResponse,
131
+ };
132
+ }
133
+ if (_response.error.reason === "status-code") {
134
+ switch (_response.error.statusCode) {
135
+ case 400:
136
+ throw new TwelvelabsApi.BadRequestError(_response.error.body, _response.rawResponse);
137
+ default:
138
+ throw new errors.TwelvelabsApiError({
139
+ statusCode: _response.error.statusCode,
140
+ body: _response.error.body,
141
+ rawResponse: _response.rawResponse,
142
+ });
143
+ }
144
+ }
145
+ switch (_response.error.reason) {
146
+ case "non-json":
147
+ throw new errors.TwelvelabsApiError({
148
+ statusCode: _response.error.statusCode,
149
+ body: _response.error.rawBody,
150
+ rawResponse: _response.rawResponse,
151
+ });
152
+ case "timeout":
153
+ throw new errors.TwelvelabsApiTimeoutError("Timeout exceeded when calling GET /analyze/batches.");
154
+ case "unknown":
155
+ throw new errors.TwelvelabsApiError({
156
+ message: _response.error.errorMessage,
157
+ rawResponse: _response.rawResponse,
158
+ });
159
+ }
160
+ }));
161
+ let _offset = (request === null || request === void 0 ? void 0 : request.page) != null ? request === null || request === void 0 ? void 0 : request.page : 1;
162
+ const dataWithRawResponse = yield list(request).withRawResponse();
163
+ return new core.Pageable({
164
+ response: dataWithRawResponse.data,
165
+ rawResponse: dataWithRawResponse.rawResponse,
166
+ hasNextPage: (response) => { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.data) !== null && _a !== void 0 ? _a : []).length > 0; },
167
+ getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.data) !== null && _a !== void 0 ? _a : []; },
168
+ loadPage: (_response) => {
169
+ _offset += 1;
170
+ return list(core.setObjectProperty(request, "page", _offset));
171
+ },
172
+ });
173
+ });
174
+ }
175
+ /**
176
+ * Use this method to submit many video analysis requests in a single call. Each request creates an analysis task. The response contains one batch identifier and one task identifier per request. Use the batch identifier to check progress and retrieve results.
177
+ *
178
+ * <Note title="Model requirement">
179
+ * You must use Pegasus 1.5 for batch analysis. Set the `model_name` parameter to `pegasus1.5`.
180
+ * </Note>
181
+ *
182
+ * **When to use this method**:
183
+ * - Run the same model and analysis settings across many videos.
184
+ * - Track a single batch instead of many individual analysis tasks.
185
+ *
186
+ * **Do not use this method for**:
187
+ * - Single videos that require immediate results. Use the [`POST`](/v1.3/api-reference/analyze-videos/sync-analysis) method of the `/analyze` endpoint instead.
188
+ * - Background processing of a single video. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
189
+ *
190
+ * **Retention and retry**:
191
+ * - Batches expire 24 hours after creation. You can retrieve results for 30 days after creation.
192
+ * - If processing does not finish for some items in time, resubmit them in a new batch.
193
+ *
194
+ * **Limits**:
195
+ * - Up to 1,000 requests per batch.
196
+ * - Up to 2,000 total content hours per batch.
197
+ * - Up to 5 active batches per account.
198
+ *
199
+ * @param {TwelvelabsApi.analyzeAsync.CreateAnalyzeBatchRequest} request
200
+ * @param {Batches.RequestOptions} requestOptions - Request-specific configuration.
201
+ *
202
+ * @throws {@link TwelvelabsApi.BadRequestError}
203
+ * @throws {@link TwelvelabsApi.NotFoundError}
204
+ * @throws {@link TwelvelabsApi.ConflictError}
205
+ * @throws {@link TwelvelabsApi.TooManyRequestsError}
206
+ * @throws {@link TwelvelabsApi.ServiceUnavailableError}
207
+ * @throws {@link TwelvelabsApi.GatewayTimeoutError}
208
+ *
209
+ * @example
210
+ * await client.analyzeAsync.batches.create({
211
+ * modelName: "pegasus1.5",
212
+ * analysisMode: "general",
213
+ * defaults: {
214
+ * prompt: {
215
+ * inputText: "Generate a 3-sentence executive summary of this video."
216
+ * },
217
+ * temperature: 0.2,
218
+ * maxTokens: 4096
219
+ * },
220
+ * requests: [{
221
+ * video: {
222
+ * type: "asset_id",
223
+ * assetId: "6298d673f1090f1100476d4c"
224
+ * },
225
+ * customId: "summary-001"
226
+ * }, {
227
+ * video: {
228
+ * type: "asset_id",
229
+ * assetId: "6298d673f1090f1100476d4d"
230
+ * },
231
+ * customId: "summary-002"
232
+ * }, {
233
+ * video: {
234
+ * type: "asset_id",
235
+ * assetId: "6298d673f1090f1100476d4e"
236
+ * },
237
+ * customId: "action-003",
238
+ * prompt: {
239
+ * inputText: "List all action items discussed."
240
+ * }
241
+ * }]
242
+ * })
243
+ *
244
+ * @example
245
+ * await client.analyzeAsync.batches.create({
246
+ * modelName: "pegasus1.5",
247
+ * analysisMode: "time_based_metadata",
248
+ * defaults: {
249
+ * responseFormat: {
250
+ * type: "segment_definitions",
251
+ * segmentDefinitions: [{
252
+ * id: "product_moments",
253
+ * description: "Moments where a person holds <@product> while speaking to the camera.",
254
+ * fields: [{
255
+ * name: "segment_title",
256
+ * type: "string",
257
+ * description: "A short headline for this moment"
258
+ * }, {
259
+ * name: "product_visibility",
260
+ * type: "string",
261
+ * description: "How prominently the product appears in this segment",
262
+ * enum: ["FULL", "PARTIAL", "BACKGROUND"]
263
+ * }],
264
+ * mediaSources: [{
265
+ * name: "product",
266
+ * mediaType: "image",
267
+ * url: "https://example.com/product.jpg"
268
+ * }]
269
+ * }]
270
+ * },
271
+ * temperature: 0,
272
+ * maxTokens: 4096,
273
+ * minSegmentDuration: 2
274
+ * },
275
+ * requests: [{
276
+ * video: {
277
+ * type: "asset_id",
278
+ * assetId: "6298d673f1090f1100476d4c"
279
+ * },
280
+ * customId: "ep-001"
281
+ * }, {
282
+ * video: {
283
+ * type: "asset_id",
284
+ * assetId: "6298d673f1090f1100476d4d"
285
+ * },
286
+ * customId: "ep-002"
287
+ * }]
288
+ * })
289
+ */
290
+ create(request, requestOptions) {
291
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
292
+ }
293
+ __create(request, requestOptions) {
294
+ return __awaiter(this, void 0, void 0, function* () {
295
+ var _a, _b;
296
+ const _response = yield core.fetcher({
297
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, "analyze/batches"),
298
+ method: "POST",
299
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.8", "User-Agent": "twelvelabs-js/1.2.8", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
300
+ contentType: "application/json",
301
+ requestType: "json",
302
+ body: serializers.analyzeAsync.CreateAnalyzeBatchRequest.jsonOrThrow(request, {
303
+ unrecognizedObjectKeys: "strip",
304
+ }),
305
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
306
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
307
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
308
+ });
309
+ if (_response.ok) {
310
+ return {
311
+ data: serializers.CreateAnalyzeBatchResponse.parseOrThrow(_response.body, {
312
+ unrecognizedObjectKeys: "passthrough",
313
+ allowUnrecognizedUnionMembers: true,
314
+ allowUnrecognizedEnumValues: true,
315
+ breadcrumbsPrefix: ["response"],
316
+ }),
317
+ rawResponse: _response.rawResponse,
318
+ };
319
+ }
320
+ if (_response.error.reason === "status-code") {
321
+ switch (_response.error.statusCode) {
322
+ case 400:
323
+ throw new TwelvelabsApi.BadRequestError(_response.error.body, _response.rawResponse);
324
+ case 404:
325
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
326
+ case 409:
327
+ throw new TwelvelabsApi.ConflictError(_response.error.body, _response.rawResponse);
328
+ case 429:
329
+ throw new TwelvelabsApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
330
+ case 503:
331
+ throw new TwelvelabsApi.ServiceUnavailableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
332
+ unrecognizedObjectKeys: "passthrough",
333
+ allowUnrecognizedUnionMembers: true,
334
+ allowUnrecognizedEnumValues: true,
335
+ breadcrumbsPrefix: ["response"],
336
+ }), _response.rawResponse);
337
+ case 504:
338
+ throw new TwelvelabsApi.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
339
+ unrecognizedObjectKeys: "passthrough",
340
+ allowUnrecognizedUnionMembers: true,
341
+ allowUnrecognizedEnumValues: true,
342
+ breadcrumbsPrefix: ["response"],
343
+ }), _response.rawResponse);
344
+ default:
345
+ throw new errors.TwelvelabsApiError({
346
+ statusCode: _response.error.statusCode,
347
+ body: _response.error.body,
348
+ rawResponse: _response.rawResponse,
349
+ });
350
+ }
351
+ }
352
+ switch (_response.error.reason) {
353
+ case "non-json":
354
+ throw new errors.TwelvelabsApiError({
355
+ statusCode: _response.error.statusCode,
356
+ body: _response.error.rawBody,
357
+ rawResponse: _response.rawResponse,
358
+ });
359
+ case "timeout":
360
+ throw new errors.TwelvelabsApiTimeoutError("Timeout exceeded when calling POST /analyze/batches.");
361
+ case "unknown":
362
+ throw new errors.TwelvelabsApiError({
363
+ message: _response.error.errorMessage,
364
+ rawResponse: _response.rawResponse,
365
+ });
366
+ }
367
+ });
368
+ }
369
+ /**
370
+ * Use this method to monitor a batch. The response includes the current batch status and counts for queued, processing, ready, failed, and canceled items.
371
+ *
372
+ * Poll this method until the batch reaches the `completed`, `canceled`, or `expired` status. To retrieve the results, call the [`GET`](/v1.3/api-reference/analyze-videos/batch-analysis/retrieve-batch-results) method of the `/analyze/batches/{batch_id}/results` endpoint.
373
+ *
374
+ * Do not treat the `completed` status as a success signal. It means processing has finished for every item, not that every analysis succeeded. To see how many items succeeded, failed, or were canceled, check the `ready_items`, `failed_items`, and `canceled_items` fields. A batch never has the `failed` status.
375
+ *
376
+ * @param {string} batchId - The unique identifier of the batch.
377
+ * @param {Batches.RequestOptions} requestOptions - Request-specific configuration.
378
+ *
379
+ * @throws {@link TwelvelabsApi.NotFoundError}
380
+ *
381
+ * @example
382
+ * await client.analyzeAsync.batches.retrieve("68f4ddaf8aaa60d33df0e800")
383
+ */
384
+ retrieve(batchId, requestOptions) {
385
+ return core.HttpResponsePromise.fromPromise(this.__retrieve(batchId, requestOptions));
386
+ }
387
+ __retrieve(batchId, requestOptions) {
388
+ return __awaiter(this, void 0, void 0, function* () {
389
+ var _a, _b;
390
+ const _response = yield core.fetcher({
391
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, `analyze/batches/${encodeURIComponent(batchId)}`),
392
+ method: "GET",
393
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.8", "User-Agent": "twelvelabs-js/1.2.8", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
394
+ contentType: "application/json",
395
+ requestType: "json",
396
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
397
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
398
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
399
+ });
400
+ if (_response.ok) {
401
+ return {
402
+ data: serializers.AnalyzeBatchStatusResponse.parseOrThrow(_response.body, {
403
+ unrecognizedObjectKeys: "passthrough",
404
+ allowUnrecognizedUnionMembers: true,
405
+ allowUnrecognizedEnumValues: true,
406
+ breadcrumbsPrefix: ["response"],
407
+ }),
408
+ rawResponse: _response.rawResponse,
409
+ };
410
+ }
411
+ if (_response.error.reason === "status-code") {
412
+ switch (_response.error.statusCode) {
413
+ case 404:
414
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
415
+ default:
416
+ throw new errors.TwelvelabsApiError({
417
+ statusCode: _response.error.statusCode,
418
+ body: _response.error.body,
419
+ rawResponse: _response.rawResponse,
420
+ });
421
+ }
422
+ }
423
+ switch (_response.error.reason) {
424
+ case "non-json":
425
+ throw new errors.TwelvelabsApiError({
426
+ statusCode: _response.error.statusCode,
427
+ body: _response.error.rawBody,
428
+ rawResponse: _response.rawResponse,
429
+ });
430
+ case "timeout":
431
+ throw new errors.TwelvelabsApiTimeoutError("Timeout exceeded when calling GET /analyze/batches/{batch_id}.");
432
+ case "unknown":
433
+ throw new errors.TwelvelabsApiError({
434
+ message: _response.error.errorMessage,
435
+ rawResponse: _response.rawResponse,
436
+ });
437
+ }
438
+ });
439
+ }
440
+ /**
441
+ * Use this method to delete a batch and all the tasks associated with it. You can only delete batches with status `completed`, `canceled`, or `expired`.
442
+ *
443
+ * Deleting a batch does not affect billing. You are billed for every completed analysis regardless of whether you delete the batch afterward.
444
+ *
445
+ * To stop a batch with the `pending` or `processing` status, use the [`POST`](/v1.3/api-reference/analyze-videos/batch-analysis/cancel-batch) method of the `/analyze/batches/{batch_id}/cancel` endpoint.
446
+ *
447
+ * Batches are deleted 30 days after creation.
448
+ *
449
+ * @param {string} batchId - The unique identifier of the batch.
450
+ * @param {Batches.RequestOptions} requestOptions - Request-specific configuration.
451
+ *
452
+ * @throws {@link TwelvelabsApi.NotFoundError}
453
+ * @throws {@link TwelvelabsApi.ConflictError}
454
+ *
455
+ * @example
456
+ * await client.analyzeAsync.batches.delete("68f4ddaf8aaa60d33df0e800")
457
+ */
458
+ delete(batchId, requestOptions) {
459
+ return core.HttpResponsePromise.fromPromise(this.__delete(batchId, requestOptions));
460
+ }
461
+ __delete(batchId, requestOptions) {
462
+ return __awaiter(this, void 0, void 0, function* () {
463
+ var _a, _b;
464
+ const _response = yield core.fetcher({
465
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, `analyze/batches/${encodeURIComponent(batchId)}`),
466
+ method: "DELETE",
467
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.8", "User-Agent": "twelvelabs-js/1.2.8", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
468
+ contentType: "application/json",
469
+ requestType: "json",
470
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
471
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
472
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
473
+ });
474
+ if (_response.ok) {
475
+ return { data: undefined, rawResponse: _response.rawResponse };
476
+ }
477
+ if (_response.error.reason === "status-code") {
478
+ switch (_response.error.statusCode) {
479
+ case 404:
480
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
481
+ case 409:
482
+ throw new TwelvelabsApi.ConflictError(_response.error.body, _response.rawResponse);
483
+ default:
484
+ throw new errors.TwelvelabsApiError({
485
+ statusCode: _response.error.statusCode,
486
+ body: _response.error.body,
487
+ rawResponse: _response.rawResponse,
488
+ });
489
+ }
490
+ }
491
+ switch (_response.error.reason) {
492
+ case "non-json":
493
+ throw new errors.TwelvelabsApiError({
494
+ statusCode: _response.error.statusCode,
495
+ body: _response.error.rawBody,
496
+ rawResponse: _response.rawResponse,
497
+ });
498
+ case "timeout":
499
+ throw new errors.TwelvelabsApiTimeoutError("Timeout exceeded when calling DELETE /analyze/batches/{batch_id}.");
500
+ case "unknown":
501
+ throw new errors.TwelvelabsApiError({
502
+ message: _response.error.errorMessage,
503
+ rawResponse: _response.rawResponse,
504
+ });
505
+ }
506
+ });
507
+ }
508
+ /**
509
+ * Use this method to retrieve the results for each item in a batch. You can call it while the batch has the `pending` or `processing` status.
510
+ *
511
+ * Each result entry has a status. For details on each status, see the [Item statuses](/v1.3/api-reference/analyze-videos/batch-analysis/the-batch-object#item-statuses) section on the **The batch object** page.
512
+ *
513
+ * Each result entry includes a task identifier in the `task_id` field. Use this value with the [`GET`](/v1.3/api-reference/analyze-videos/retrieve-analysis-task-status-results) method of the `/analyze/tasks/{task_id}` endpoint if you need the full analysis task response.
514
+ *
515
+ * You can retrieve results for 30 days after batch creation.
516
+ */
517
+ results(batchId, requestOptions) {
518
+ return core.HttpResponsePromise.fromPromise(this.__results(batchId, requestOptions));
519
+ }
520
+ __results(batchId, requestOptions) {
521
+ return __awaiter(this, void 0, void 0, function* () {
522
+ var _a, _b;
523
+ const _response = yield core.fetcher({
524
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, `analyze/batches/${encodeURIComponent(batchId)}/results`),
525
+ method: "GET",
526
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.8", "User-Agent": "twelvelabs-js/1.2.8", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
527
+ contentType: "application/json",
528
+ requestType: "json",
529
+ responseType: "sse",
530
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
531
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
532
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
533
+ });
534
+ if (_response.ok) {
535
+ return {
536
+ data: new core.Stream({
537
+ stream: _response.body,
538
+ parse: (data) => __awaiter(this, void 0, void 0, function* () {
539
+ return serializers.BatchResultItem.parseOrThrow(data, {
540
+ unrecognizedObjectKeys: "passthrough",
541
+ allowUnrecognizedUnionMembers: true,
542
+ allowUnrecognizedEnumValues: true,
543
+ breadcrumbsPrefix: ["response"],
544
+ });
545
+ }),
546
+ signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
547
+ eventShape: {
548
+ type: "json",
549
+ messageTerminator: "\n",
550
+ },
551
+ }),
552
+ rawResponse: _response.rawResponse,
553
+ };
554
+ }
555
+ if (_response.error.reason === "status-code") {
556
+ switch (_response.error.statusCode) {
557
+ case 404:
558
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
559
+ default:
560
+ throw new errors.TwelvelabsApiError({
561
+ statusCode: _response.error.statusCode,
562
+ body: _response.error.body,
563
+ rawResponse: _response.rawResponse,
564
+ });
565
+ }
566
+ }
567
+ switch (_response.error.reason) {
568
+ case "non-json":
569
+ throw new errors.TwelvelabsApiError({
570
+ statusCode: _response.error.statusCode,
571
+ body: _response.error.rawBody,
572
+ rawResponse: _response.rawResponse,
573
+ });
574
+ case "timeout":
575
+ throw new errors.TwelvelabsApiTimeoutError("Timeout exceeded when calling GET /analyze/batches/{batch_id}/results.");
576
+ case "unknown":
577
+ throw new errors.TwelvelabsApiError({
578
+ message: _response.error.errorMessage,
579
+ rawResponse: _response.rawResponse,
580
+ });
581
+ }
582
+ });
583
+ }
584
+ /**
585
+ * Use this method to request cancellation for a batch with the `pending` or `processing` status.
586
+ *
587
+ * When you invoke this method, the platform performs the following steps:
588
+ * - Cancels the items in the `queued` status.
589
+ * - Finishes the analysis for the items in the `processing` status.
590
+ *
591
+ * The batch status changes to `canceling` immediately, and to `canceled` after every item reaches `ready`, `failed`, or `canceled`. You are not billed for canceled or failed items.
592
+ *
593
+ * @param {string} batchId - The unique identifier of the batch.
594
+ * @param {Batches.RequestOptions} requestOptions - Request-specific configuration.
595
+ *
596
+ * @throws {@link TwelvelabsApi.NotFoundError}
597
+ * @throws {@link TwelvelabsApi.ConflictError}
598
+ *
599
+ * @example
600
+ * await client.analyzeAsync.batches.cancel("68f4ddaf8aaa60d33df0e800")
601
+ */
602
+ cancel(batchId, requestOptions) {
603
+ return core.HttpResponsePromise.fromPromise(this.__cancel(batchId, requestOptions));
604
+ }
605
+ __cancel(batchId, requestOptions) {
606
+ return __awaiter(this, void 0, void 0, function* () {
607
+ var _a, _b;
608
+ const _response = yield core.fetcher({
609
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, `analyze/batches/${encodeURIComponent(batchId)}/cancel`),
610
+ method: "POST",
611
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.8", "User-Agent": "twelvelabs-js/1.2.8", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
612
+ contentType: "application/json",
613
+ requestType: "json",
614
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
615
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
616
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
617
+ });
618
+ if (_response.ok) {
619
+ return {
620
+ data: serializers.AnalyzeBatchStatusResponse.parseOrThrow(_response.body, {
621
+ unrecognizedObjectKeys: "passthrough",
622
+ allowUnrecognizedUnionMembers: true,
623
+ allowUnrecognizedEnumValues: true,
624
+ breadcrumbsPrefix: ["response"],
625
+ }),
626
+ rawResponse: _response.rawResponse,
627
+ };
628
+ }
629
+ if (_response.error.reason === "status-code") {
630
+ switch (_response.error.statusCode) {
631
+ case 404:
632
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
633
+ case 409:
634
+ throw new TwelvelabsApi.ConflictError(_response.error.body, _response.rawResponse);
635
+ default:
636
+ throw new errors.TwelvelabsApiError({
637
+ statusCode: _response.error.statusCode,
638
+ body: _response.error.body,
639
+ rawResponse: _response.rawResponse,
640
+ });
641
+ }
642
+ }
643
+ switch (_response.error.reason) {
644
+ case "non-json":
645
+ throw new errors.TwelvelabsApiError({
646
+ statusCode: _response.error.statusCode,
647
+ body: _response.error.rawBody,
648
+ rawResponse: _response.rawResponse,
649
+ });
650
+ case "timeout":
651
+ throw new errors.TwelvelabsApiTimeoutError("Timeout exceeded when calling POST /analyze/batches/{batch_id}/cancel.");
652
+ case "unknown":
653
+ throw new errors.TwelvelabsApiError({
654
+ message: _response.error.errorMessage,
655
+ rawResponse: _response.rawResponse,
656
+ });
657
+ }
658
+ });
659
+ }
660
+ _getCustomAuthorizationHeaders() {
661
+ return __awaiter(this, void 0, void 0, function* () {
662
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
663
+ return { "x-api-key": apiKeyValue };
664
+ });
665
+ }
666
+ }
667
+ exports.Batches = Batches;
@@ -0,0 +1 @@
1
+ export * from "./requests";