honeyhive 0.3.0

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/LICENSE.md +21 -0
  2. package/README.md +190 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +20 -0
  5. package/dist/internal/utils/contenttype.d.ts +1 -0
  6. package/dist/internal/utils/contenttype.js +33 -0
  7. package/dist/internal/utils/headers.d.ts +4 -0
  8. package/dist/internal/utils/headers.js +92 -0
  9. package/dist/internal/utils/index.d.ts +8 -0
  10. package/dist/internal/utils/index.js +27 -0
  11. package/dist/internal/utils/pathparams.d.ts +2 -0
  12. package/dist/internal/utils/pathparams.js +53 -0
  13. package/dist/internal/utils/queryparams.d.ts +2 -0
  14. package/dist/internal/utils/queryparams.js +180 -0
  15. package/dist/internal/utils/requestbody.d.ts +2 -0
  16. package/dist/internal/utils/requestbody.js +318 -0
  17. package/dist/internal/utils/retries.d.ts +20 -0
  18. package/dist/internal/utils/retries.js +250 -0
  19. package/dist/internal/utils/security.d.ts +5 -0
  20. package/dist/internal/utils/security.js +188 -0
  21. package/dist/internal/utils/utils.d.ts +37 -0
  22. package/dist/internal/utils/utils.js +370 -0
  23. package/dist/sdk/index.d.ts +1 -0
  24. package/dist/sdk/index.js +20 -0
  25. package/dist/sdk/models/errors/index.d.ts +1 -0
  26. package/dist/sdk/models/errors/index.js +20 -0
  27. package/dist/sdk/models/errors/sdkerror.d.ts +7 -0
  28. package/dist/sdk/models/errors/sdkerror.js +40 -0
  29. package/dist/sdk/models/operations/deletedatasetsname.d.ts +24 -0
  30. package/dist/sdk/models/operations/deletedatasetsname.js +91 -0
  31. package/dist/sdk/models/operations/deletemetrics.d.ts +26 -0
  32. package/dist/sdk/models/operations/deletemetrics.js +99 -0
  33. package/dist/sdk/models/operations/deletepromptsid.d.ts +24 -0
  34. package/dist/sdk/models/operations/deletepromptsid.js +91 -0
  35. package/dist/sdk/models/operations/deletetasks.d.ts +24 -0
  36. package/dist/sdk/models/operations/deletetasks.js +91 -0
  37. package/dist/sdk/models/operations/getdatasets.d.ts +27 -0
  38. package/dist/sdk/models/operations/getdatasets.js +103 -0
  39. package/dist/sdk/models/operations/getfinetunedmodels.d.ts +25 -0
  40. package/dist/sdk/models/operations/getfinetunedmodels.js +95 -0
  41. package/dist/sdk/models/operations/getfinetunedmodelsid.d.ts +24 -0
  42. package/dist/sdk/models/operations/getfinetunedmodelsid.js +91 -0
  43. package/dist/sdk/models/operations/getgenerations.d.ts +26 -0
  44. package/dist/sdk/models/operations/getgenerations.js +99 -0
  45. package/dist/sdk/models/operations/getmetrics.d.ts +25 -0
  46. package/dist/sdk/models/operations/getmetrics.js +95 -0
  47. package/dist/sdk/models/operations/getprompts.d.ts +25 -0
  48. package/dist/sdk/models/operations/getprompts.js +95 -0
  49. package/dist/sdk/models/operations/getsession.d.ts +40 -0
  50. package/dist/sdk/models/operations/getsession.js +110 -0
  51. package/dist/sdk/models/operations/getsessionsessionid.d.ts +24 -0
  52. package/dist/sdk/models/operations/getsessionsessionid.js +91 -0
  53. package/dist/sdk/models/operations/getsessionsessionidexport.d.ts +24 -0
  54. package/dist/sdk/models/operations/getsessionsessionidexport.js +91 -0
  55. package/dist/sdk/models/operations/gettasks.d.ts +24 -0
  56. package/dist/sdk/models/operations/gettasks.js +91 -0
  57. package/dist/sdk/models/operations/index.d.ts +29 -0
  58. package/dist/sdk/models/operations/index.js +48 -0
  59. package/dist/sdk/models/operations/postdatasets.d.ts +21 -0
  60. package/dist/sdk/models/operations/postdatasets.js +79 -0
  61. package/dist/sdk/models/operations/postevaluations.d.ts +21 -0
  62. package/dist/sdk/models/operations/postevaluations.js +79 -0
  63. package/dist/sdk/models/operations/postfeedback.d.ts +21 -0
  64. package/dist/sdk/models/operations/postfeedback.js +79 -0
  65. package/dist/sdk/models/operations/postgenerations.d.ts +21 -0
  66. package/dist/sdk/models/operations/postgenerations.js +79 -0
  67. package/dist/sdk/models/operations/postgenerationslog.d.ts +21 -0
  68. package/dist/sdk/models/operations/postgenerationslog.js +79 -0
  69. package/dist/sdk/models/operations/postmetrics.d.ts +21 -0
  70. package/dist/sdk/models/operations/postmetrics.js +79 -0
  71. package/dist/sdk/models/operations/postprompts.d.ts +21 -0
  72. package/dist/sdk/models/operations/postprompts.js +79 -0
  73. package/dist/sdk/models/operations/postsessionsessionidend.d.ts +24 -0
  74. package/dist/sdk/models/operations/postsessionsessionidend.js +91 -0
  75. package/dist/sdk/models/operations/postsessionsessionidevent.d.ts +25 -0
  76. package/dist/sdk/models/operations/postsessionsessionidevent.js +95 -0
  77. package/dist/sdk/models/operations/postsessionsessionidfeedback.d.ts +25 -0
  78. package/dist/sdk/models/operations/postsessionsessionidfeedback.js +95 -0
  79. package/dist/sdk/models/operations/postsessionssessionidtraces.d.ts +25 -0
  80. package/dist/sdk/models/operations/postsessionssessionidtraces.js +95 -0
  81. package/dist/sdk/models/operations/postsessionstart.d.ts +21 -0
  82. package/dist/sdk/models/operations/postsessionstart.js +79 -0
  83. package/dist/sdk/models/operations/posttasks.d.ts +21 -0
  84. package/dist/sdk/models/operations/posttasks.js +79 -0
  85. package/dist/sdk/models/operations/putpromptsid.d.ts +25 -0
  86. package/dist/sdk/models/operations/putpromptsid.js +95 -0
  87. package/dist/sdk/models/operations/puttasks.d.ts +21 -0
  88. package/dist/sdk/models/operations/puttasks.js +79 -0
  89. package/dist/sdk/models/shared/datasetresponse.d.ts +52 -0
  90. package/dist/sdk/models/shared/datasetresponse.js +115 -0
  91. package/dist/sdk/models/shared/deleteresponse.d.ts +10 -0
  92. package/dist/sdk/models/shared/deleteresponse.js +48 -0
  93. package/dist/sdk/models/shared/evaluationloggingquery.d.ts +76 -0
  94. package/dist/sdk/models/shared/evaluationloggingquery.js +176 -0
  95. package/dist/sdk/models/shared/feedbackquery.d.ts +27 -0
  96. package/dist/sdk/models/shared/feedbackquery.js +75 -0
  97. package/dist/sdk/models/shared/feedbackresponse.d.ts +31 -0
  98. package/dist/sdk/models/shared/feedbackresponse.js +84 -0
  99. package/dist/sdk/models/shared/finetunedmodelresponse.d.ts +54 -0
  100. package/dist/sdk/models/shared/finetunedmodelresponse.js +111 -0
  101. package/dist/sdk/models/shared/generatequery.d.ts +69 -0
  102. package/dist/sdk/models/shared/generatequery.js +139 -0
  103. package/dist/sdk/models/shared/generation.d.ts +54 -0
  104. package/dist/sdk/models/shared/generation.js +103 -0
  105. package/dist/sdk/models/shared/generationloggingquery.d.ts +92 -0
  106. package/dist/sdk/models/shared/generationloggingquery.js +185 -0
  107. package/dist/sdk/models/shared/generationresponse.d.ts +18 -0
  108. package/dist/sdk/models/shared/generationresponse.js +58 -0
  109. package/dist/sdk/models/shared/index.d.ts +32 -0
  110. package/dist/sdk/models/shared/index.js +51 -0
  111. package/dist/sdk/models/shared/metriccreateresponse.d.ts +7 -0
  112. package/dist/sdk/models/shared/metriccreateresponse.js +45 -0
  113. package/dist/sdk/models/shared/metricrequest.d.ts +18 -0
  114. package/dist/sdk/models/shared/metricrequest.js +58 -0
  115. package/dist/sdk/models/shared/metricresponse.d.ts +63 -0
  116. package/dist/sdk/models/shared/metricresponse.js +124 -0
  117. package/dist/sdk/models/shared/promptcreationquery.d.ts +44 -0
  118. package/dist/sdk/models/shared/promptcreationquery.js +97 -0
  119. package/dist/sdk/models/shared/promptresponse.d.ts +52 -0
  120. package/dist/sdk/models/shared/promptresponse.js +115 -0
  121. package/dist/sdk/models/shared/promptupdatequery.d.ts +36 -0
  122. package/dist/sdk/models/shared/promptupdatequery.js +87 -0
  123. package/dist/sdk/models/shared/security.d.ts +4 -0
  124. package/dist/sdk/models/shared/security.js +45 -0
  125. package/dist/sdk/models/shared/sessionendresponse.d.ts +14 -0
  126. package/dist/sdk/models/shared/sessionendresponse.js +53 -0
  127. package/dist/sdk/models/shared/sessioneventquery.d.ts +76 -0
  128. package/dist/sdk/models/shared/sessioneventquery.js +160 -0
  129. package/dist/sdk/models/shared/sessioneventresponse.d.ts +14 -0
  130. package/dist/sdk/models/shared/sessioneventresponse.js +53 -0
  131. package/dist/sdk/models/shared/sessionfeedback.d.ts +19 -0
  132. package/dist/sdk/models/shared/sessionfeedback.js +65 -0
  133. package/dist/sdk/models/shared/sessionstartquery.d.ts +31 -0
  134. package/dist/sdk/models/shared/sessionstartquery.js +80 -0
  135. package/dist/sdk/models/shared/sessionstartresponse.d.ts +14 -0
  136. package/dist/sdk/models/shared/sessionstartresponse.js +53 -0
  137. package/dist/sdk/models/shared/sessiontrace.d.ts +11 -0
  138. package/dist/sdk/models/shared/sessiontrace.js +50 -0
  139. package/dist/sdk/models/shared/successresponse.d.ts +14 -0
  140. package/dist/sdk/models/shared/successresponse.js +53 -0
  141. package/dist/sdk/models/shared/successtraceresponse.d.ts +14 -0
  142. package/dist/sdk/models/shared/successtraceresponse.js +53 -0
  143. package/dist/sdk/models/shared/taskcreationquery.d.ts +46 -0
  144. package/dist/sdk/models/shared/taskcreationquery.js +104 -0
  145. package/dist/sdk/models/shared/taskresponse.d.ts +54 -0
  146. package/dist/sdk/models/shared/taskresponse.js +114 -0
  147. package/dist/sdk/models/shared/taskupdatequery.d.ts +38 -0
  148. package/dist/sdk/models/shared/taskupdatequery.js +86 -0
  149. package/dist/sdk/models/shared/taskupdateresponse.d.ts +23 -0
  150. package/dist/sdk/models/shared/taskupdateresponse.js +65 -0
  151. package/dist/sdk/models/shared/traceevent.d.ts +31 -0
  152. package/dist/sdk/models/shared/traceevent.js +75 -0
  153. package/dist/sdk/models/shared/uploaddataset.d.ts +29 -0
  154. package/dist/sdk/models/shared/uploaddataset.js +82 -0
  155. package/dist/sdk/sdk.d.ts +163 -0
  156. package/dist/sdk/sdk.js +2097 -0
  157. package/dist/sdk/types/index.d.ts +1 -0
  158. package/dist/sdk/types/index.js +20 -0
  159. package/dist/sdk/types/rfcdate.d.ts +9 -0
  160. package/dist/sdk/types/rfcdate.js +59 -0
  161. package/docs/models/operations/deletedatasetsnamerequest.md +8 -0
  162. package/docs/models/operations/deletedatasetsnameresponse.md +11 -0
  163. package/docs/models/operations/deletemetricsrequest.md +10 -0
  164. package/docs/models/operations/deletemetricsresponse.md +11 -0
  165. package/docs/models/operations/deletepromptsidrequest.md +8 -0
  166. package/docs/models/operations/deletepromptsidresponse.md +11 -0
  167. package/docs/models/operations/deletetasksrequest.md +8 -0
  168. package/docs/models/operations/deletetasksresponse.md +11 -0
  169. package/docs/models/operations/getdatasetsrequest.md +11 -0
  170. package/docs/models/operations/getdatasetsresponse.md +11 -0
  171. package/docs/models/operations/getfinetunedmodelsidrequest.md +8 -0
  172. package/docs/models/operations/getfinetunedmodelsidresponse.md +11 -0
  173. package/docs/models/operations/getfinetunedmodelsrequest.md +9 -0
  174. package/docs/models/operations/getfinetunedmodelsresponse.md +11 -0
  175. package/docs/models/operations/getgenerationsrequest.md +10 -0
  176. package/docs/models/operations/getgenerationsresponse.md +11 -0
  177. package/docs/models/operations/getmetricsrequest.md +9 -0
  178. package/docs/models/operations/getmetricsresponse.md +11 -0
  179. package/docs/models/operations/getpromptsrequest.md +9 -0
  180. package/docs/models/operations/getpromptsresponse.md +11 -0
  181. package/docs/models/operations/getsessionquery.md +9 -0
  182. package/docs/models/operations/getsessionrequest.md +10 -0
  183. package/docs/models/operations/getsessionresponse.md +11 -0
  184. package/docs/models/operations/getsessionsessionidexportrequest.md +8 -0
  185. package/docs/models/operations/getsessionsessionidexportresponse.md +11 -0
  186. package/docs/models/operations/getsessionsessionidrequest.md +8 -0
  187. package/docs/models/operations/getsessionsessionidresponse.md +11 -0
  188. package/docs/models/operations/gettasksrequest.md +8 -0
  189. package/docs/models/operations/gettasksresponse.md +11 -0
  190. package/docs/models/operations/postdatasetsresponse.md +11 -0
  191. package/docs/models/operations/postevaluationsresponse.md +11 -0
  192. package/docs/models/operations/postfeedbackresponse.md +11 -0
  193. package/docs/models/operations/postgenerationslogresponse.md +11 -0
  194. package/docs/models/operations/postgenerationsresponse.md +11 -0
  195. package/docs/models/operations/postmetricsresponse.md +11 -0
  196. package/docs/models/operations/postpromptsresponse.md +11 -0
  197. package/docs/models/operations/postsessionsessionidendrequest.md +8 -0
  198. package/docs/models/operations/postsessionsessionidendresponse.md +11 -0
  199. package/docs/models/operations/postsessionsessionideventrequest.md +9 -0
  200. package/docs/models/operations/postsessionsessionideventresponse.md +11 -0
  201. package/docs/models/operations/postsessionsessionidfeedbackrequest.md +9 -0
  202. package/docs/models/operations/postsessionsessionidfeedbackresponse.md +11 -0
  203. package/docs/models/operations/postsessionssessionidtracesrequest.md +9 -0
  204. package/docs/models/operations/postsessionssessionidtracesresponse.md +11 -0
  205. package/docs/models/operations/postsessionstartresponse.md +11 -0
  206. package/docs/models/operations/posttasksresponse.md +11 -0
  207. package/docs/models/operations/putpromptsidrequest.md +9 -0
  208. package/docs/models/operations/putpromptsidresponse.md +11 -0
  209. package/docs/models/operations/puttasksresponse.md +11 -0
  210. package/docs/models/shared/datasetresponse.md +20 -0
  211. package/docs/models/shared/datasetresponsefile.md +7 -0
  212. package/docs/models/shared/deleteresponse.md +10 -0
  213. package/docs/models/shared/evaluationloggingquery.md +23 -0
  214. package/docs/models/shared/evaluationloggingquerycomments.md +7 -0
  215. package/docs/models/shared/evaluationloggingquerydataset.md +7 -0
  216. package/docs/models/shared/evaluationloggingquerygenerations.md +7 -0
  217. package/docs/models/shared/evaluationloggingquerymetrics.md +7 -0
  218. package/docs/models/shared/evaluationloggingqueryprompts.md +7 -0
  219. package/docs/models/shared/evaluationloggingqueryresults.md +7 -0
  220. package/docs/models/shared/evaluationloggingquerysummary.md +7 -0
  221. package/docs/models/shared/feedbackquery.md +13 -0
  222. package/docs/models/shared/feedbackqueryfeedbackjson.md +9 -0
  223. package/docs/models/shared/feedbackresponse.md +14 -0
  224. package/docs/models/shared/feedbackresponsefeedback.md +9 -0
  225. package/docs/models/shared/finetunedmodelresponse.md +21 -0
  226. package/docs/models/shared/generatequery.md +21 -0
  227. package/docs/models/shared/generatequeryinput.md +9 -0
  228. package/docs/models/shared/generatequerymetadata.md +9 -0
  229. package/docs/models/shared/generatequeryuserproperties.md +9 -0
  230. package/docs/models/shared/generation.md +21 -0
  231. package/docs/models/shared/generationloggingquery.md +23 -0
  232. package/docs/models/shared/generationloggingqueryfeedback.md +9 -0
  233. package/docs/models/shared/generationloggingqueryhyperparameters.md +9 -0
  234. package/docs/models/shared/generationloggingqueryinputs.md +9 -0
  235. package/docs/models/shared/generationloggingquerymetadata.md +9 -0
  236. package/docs/models/shared/generationloggingqueryusage.md +9 -0
  237. package/docs/models/shared/generationloggingqueryuserproperties.md +9 -0
  238. package/docs/models/shared/generationresponse.md +12 -0
  239. package/docs/models/shared/metriccreateresponse.md +8 -0
  240. package/docs/models/shared/metricrequest.md +12 -0
  241. package/docs/models/shared/metricresponse.md +22 -0
  242. package/docs/models/shared/metricresponsethreshold.md +9 -0
  243. package/docs/models/shared/promptcreationquery.md +18 -0
  244. package/docs/models/shared/promptcreationqueryfewshotexamples.md +7 -0
  245. package/docs/models/shared/promptresponse.md +20 -0
  246. package/docs/models/shared/promptresponsefewshotexamples.md +7 -0
  247. package/docs/models/shared/promptupdatequery.md +16 -0
  248. package/docs/models/shared/promptupdatequeryfewshotexamples.md +7 -0
  249. package/docs/models/shared/security.md +8 -0
  250. package/docs/models/shared/sessionendresponse.md +11 -0
  251. package/docs/models/shared/sessioneventquery.md +21 -0
  252. package/docs/models/shared/sessioneventquerychildren.md +7 -0
  253. package/docs/models/shared/sessioneventqueryconfig.md +9 -0
  254. package/docs/models/shared/sessioneventqueryerror.md +9 -0
  255. package/docs/models/shared/sessioneventqueryinputs.md +9 -0
  256. package/docs/models/shared/sessioneventquerymetadata.md +9 -0
  257. package/docs/models/shared/sessioneventresponse.md +11 -0
  258. package/docs/models/shared/sessionfeedback.md +11 -0
  259. package/docs/models/shared/sessionfeedbackfeedback.md +9 -0
  260. package/docs/models/shared/sessionstartquery.md +14 -0
  261. package/docs/models/shared/sessionstartqueryuserproperties.md +9 -0
  262. package/docs/models/shared/sessionstartresponse.md +11 -0
  263. package/docs/models/shared/sessiontrace.md +10 -0
  264. package/docs/models/shared/successresponse.md +11 -0
  265. package/docs/models/shared/successtraceresponse.md +11 -0
  266. package/docs/models/shared/taskcreationquery.md +18 -0
  267. package/docs/models/shared/taskresponse.md +20 -0
  268. package/docs/models/shared/taskupdatequery.md +16 -0
  269. package/docs/models/shared/taskupdateresponse.md +12 -0
  270. package/docs/models/shared/traceevent.md +14 -0
  271. package/docs/models/shared/uploaddataset.md +15 -0
  272. package/docs/models/shared/uploaddatasetfile.md +7 -0
  273. package/docs/sdks/honeyhive/README.md +1258 -0
  274. package/package.json +37 -0
@@ -0,0 +1,2097 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
40
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
+ return new (P || (P = Promise))(function (resolve, reject) {
42
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
46
+ });
47
+ };
48
+ var __generator = (this && this.__generator) || function (thisArg, body) {
49
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
50
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
51
+ function verb(n) { return function (v) { return step([n, v]); }; }
52
+ function step(op) {
53
+ if (f) throw new TypeError("Generator is already executing.");
54
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
55
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
56
+ if (y = 0, t) op = [op[0] & 2, t.value];
57
+ switch (op[0]) {
58
+ case 0: case 1: t = op; break;
59
+ case 4: _.label++; return { value: op[1], done: false };
60
+ case 5: _.label++; y = op[1]; op = [0]; continue;
61
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
62
+ default:
63
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
64
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
65
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
66
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
67
+ if (t[2]) _.ops.pop();
68
+ _.trys.pop(); continue;
69
+ }
70
+ op = body.call(thisArg, _);
71
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
72
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
73
+ }
74
+ };
75
+ var __read = (this && this.__read) || function (o, n) {
76
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
77
+ if (!m) return o;
78
+ var i = m.call(o), r, ar = [], e;
79
+ try {
80
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
81
+ }
82
+ catch (error) { e = { error: error }; }
83
+ finally {
84
+ try {
85
+ if (r && !r.done && (m = i["return"])) m.call(i);
86
+ }
87
+ finally { if (e) throw e.error; }
88
+ }
89
+ return ar;
90
+ };
91
+ var __importDefault = (this && this.__importDefault) || function (mod) {
92
+ return (mod && mod.__esModule) ? mod : { "default": mod };
93
+ };
94
+ Object.defineProperty(exports, "__esModule", { value: true });
95
+ exports.HoneyHive = exports.SDKConfiguration = exports.ServerList = void 0;
96
+ var utils = __importStar(require("../internal/utils"));
97
+ var errors = __importStar(require("./models/errors"));
98
+ var operations = __importStar(require("./models/operations"));
99
+ var shared = __importStar(require("./models/shared"));
100
+ var axios_1 = __importDefault(require("axios"));
101
+ /**
102
+ * Contains the list of servers available to the SDK
103
+ */
104
+ exports.ServerList = ["https://api.honeyhive.ai"];
105
+ var SDKConfiguration = /** @class */ (function () {
106
+ function SDKConfiguration(init) {
107
+ this.language = "typescript";
108
+ this.openapiDocVersion = "1.0.1";
109
+ this.sdkVersion = "0.3.0";
110
+ this.genVersion = "2.173.0";
111
+ this.userAgent = "speakeasy-sdk/typescript 0.3.0 2.173.0 1.0.1 HoneyHive";
112
+ Object.assign(this, init);
113
+ }
114
+ return SDKConfiguration;
115
+ }());
116
+ exports.SDKConfiguration = SDKConfiguration;
117
+ var HoneyHive = /** @class */ (function () {
118
+ function HoneyHive(props) {
119
+ var _a, _b;
120
+ var serverURL = props === null || props === void 0 ? void 0 : props.serverURL;
121
+ var serverIdx = (_a = props === null || props === void 0 ? void 0 : props.serverIdx) !== null && _a !== void 0 ? _a : 0;
122
+ if (!serverURL) {
123
+ serverURL = exports.ServerList[serverIdx];
124
+ }
125
+ var defaultClient = (_b = props === null || props === void 0 ? void 0 : props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create({ baseURL: serverURL });
126
+ this.sdkConfiguration = new SDKConfiguration({
127
+ defaultClient: defaultClient,
128
+ security: new shared.Security({ bearerAuth: props === null || props === void 0 ? void 0 : props.bearerAuth }),
129
+ serverURL: serverURL,
130
+ retryConfig: props === null || props === void 0 ? void 0 : props.retryConfig,
131
+ });
132
+ }
133
+ /**
134
+ * Delete a dataset
135
+ */
136
+ HoneyHive.prototype.deleteDatasetsName = function (req, config) {
137
+ var _a, _b;
138
+ return __awaiter(this, void 0, void 0, function () {
139
+ var baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
140
+ return __generator(this, function (_c) {
141
+ switch (_c.label) {
142
+ case 0:
143
+ if (!(req instanceof utils.SpeakeasyBase)) {
144
+ req = new operations.DeleteDatasetsNameRequest(req);
145
+ }
146
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
147
+ url = utils.generateURL(baseURL, "/datasets/{name}", req);
148
+ client = this.sdkConfiguration.defaultClient;
149
+ globalSecurity = this.sdkConfiguration.security;
150
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
151
+ return [4 /*yield*/, globalSecurity()];
152
+ case 1:
153
+ globalSecurity = _c.sent();
154
+ _c.label = 2;
155
+ case 2:
156
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
157
+ globalSecurity = new shared.Security(globalSecurity);
158
+ }
159
+ properties = utils.parseSecurityProperties(globalSecurity);
160
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
161
+ headers["Accept"] = "application/json";
162
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
163
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
164
+ case 3:
165
+ httpRes = _c.sent();
166
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
167
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
168
+ throw new Error("status code not found in response: ".concat(httpRes));
169
+ }
170
+ res = new operations.DeleteDatasetsNameResponse({
171
+ statusCode: httpRes.status,
172
+ contentType: contentType,
173
+ rawResponse: httpRes,
174
+ });
175
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
176
+ switch (true) {
177
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
178
+ if (utils.matchContentType(contentType, "application/json")) {
179
+ res.deleteResponse = utils.objectToClass(JSON.parse(decodedRes), shared.DeleteResponse);
180
+ }
181
+ else {
182
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
183
+ }
184
+ break;
185
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
186
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
187
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
188
+ }
189
+ return [2 /*return*/, res];
190
+ }
191
+ });
192
+ });
193
+ };
194
+ /**
195
+ * Delete a metric
196
+ */
197
+ HoneyHive.prototype.deleteMetrics = function (req, config) {
198
+ var _a, _b;
199
+ return __awaiter(this, void 0, void 0, function () {
200
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
201
+ return __generator(this, function (_c) {
202
+ switch (_c.label) {
203
+ case 0:
204
+ if (!(req instanceof utils.SpeakeasyBase)) {
205
+ req = new operations.DeleteMetricsRequest(req);
206
+ }
207
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
208
+ url = baseURL.replace(/\/$/, "") + "/metrics";
209
+ client = this.sdkConfiguration.defaultClient;
210
+ globalSecurity = this.sdkConfiguration.security;
211
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
212
+ return [4 /*yield*/, globalSecurity()];
213
+ case 1:
214
+ globalSecurity = _c.sent();
215
+ _c.label = 2;
216
+ case 2:
217
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
218
+ globalSecurity = new shared.Security(globalSecurity);
219
+ }
220
+ properties = utils.parseSecurityProperties(globalSecurity);
221
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
222
+ queryParams = utils.serializeQueryParams(req);
223
+ headers["Accept"] = "application/json";
224
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
225
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
226
+ case 3:
227
+ httpRes = _c.sent();
228
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
229
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
230
+ throw new Error("status code not found in response: ".concat(httpRes));
231
+ }
232
+ res = new operations.DeleteMetricsResponse({
233
+ statusCode: httpRes.status,
234
+ contentType: contentType,
235
+ rawResponse: httpRes,
236
+ });
237
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
238
+ switch (true) {
239
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
240
+ if (utils.matchContentType(contentType, "application/json")) {
241
+ res.deleteResponse = utils.objectToClass(JSON.parse(decodedRes), shared.DeleteResponse);
242
+ }
243
+ else {
244
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
245
+ }
246
+ break;
247
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
248
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
249
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
250
+ }
251
+ return [2 /*return*/, res];
252
+ }
253
+ });
254
+ });
255
+ };
256
+ /**
257
+ * Delete a prompt
258
+ */
259
+ HoneyHive.prototype.deletePromptsId = function (req, config) {
260
+ var _a, _b;
261
+ return __awaiter(this, void 0, void 0, function () {
262
+ var baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
263
+ return __generator(this, function (_c) {
264
+ switch (_c.label) {
265
+ case 0:
266
+ if (!(req instanceof utils.SpeakeasyBase)) {
267
+ req = new operations.DeletePromptsIdRequest(req);
268
+ }
269
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
270
+ url = utils.generateURL(baseURL, "/prompts/{id}", req);
271
+ client = this.sdkConfiguration.defaultClient;
272
+ globalSecurity = this.sdkConfiguration.security;
273
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
274
+ return [4 /*yield*/, globalSecurity()];
275
+ case 1:
276
+ globalSecurity = _c.sent();
277
+ _c.label = 2;
278
+ case 2:
279
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
280
+ globalSecurity = new shared.Security(globalSecurity);
281
+ }
282
+ properties = utils.parseSecurityProperties(globalSecurity);
283
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
284
+ headers["Accept"] = "application/json";
285
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
286
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
287
+ case 3:
288
+ httpRes = _c.sent();
289
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
290
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
291
+ throw new Error("status code not found in response: ".concat(httpRes));
292
+ }
293
+ res = new operations.DeletePromptsIdResponse({
294
+ statusCode: httpRes.status,
295
+ contentType: contentType,
296
+ rawResponse: httpRes,
297
+ });
298
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
299
+ switch (true) {
300
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
301
+ if (utils.matchContentType(contentType, "application/json")) {
302
+ res.deleteResponse = utils.objectToClass(JSON.parse(decodedRes), shared.DeleteResponse);
303
+ }
304
+ else {
305
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
306
+ }
307
+ break;
308
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
309
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
310
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
311
+ }
312
+ return [2 /*return*/, res];
313
+ }
314
+ });
315
+ });
316
+ };
317
+ /**
318
+ * Delete a task
319
+ */
320
+ HoneyHive.prototype.deleteTasks = function (req, config) {
321
+ var _a, _b;
322
+ return __awaiter(this, void 0, void 0, function () {
323
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
324
+ return __generator(this, function (_c) {
325
+ switch (_c.label) {
326
+ case 0:
327
+ if (!(req instanceof utils.SpeakeasyBase)) {
328
+ req = new operations.DeleteTasksRequest(req);
329
+ }
330
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
331
+ url = baseURL.replace(/\/$/, "") + "/tasks";
332
+ client = this.sdkConfiguration.defaultClient;
333
+ globalSecurity = this.sdkConfiguration.security;
334
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
335
+ return [4 /*yield*/, globalSecurity()];
336
+ case 1:
337
+ globalSecurity = _c.sent();
338
+ _c.label = 2;
339
+ case 2:
340
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
341
+ globalSecurity = new shared.Security(globalSecurity);
342
+ }
343
+ properties = utils.parseSecurityProperties(globalSecurity);
344
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
345
+ queryParams = utils.serializeQueryParams(req);
346
+ headers["Accept"] = "application/json";
347
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
348
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
349
+ case 3:
350
+ httpRes = _c.sent();
351
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
352
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
353
+ throw new Error("status code not found in response: ".concat(httpRes));
354
+ }
355
+ res = new operations.DeleteTasksResponse({
356
+ statusCode: httpRes.status,
357
+ contentType: contentType,
358
+ rawResponse: httpRes,
359
+ });
360
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
361
+ switch (true) {
362
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
363
+ if (utils.matchContentType(contentType, "application/json")) {
364
+ res.deleteResponse = utils.objectToClass(JSON.parse(decodedRes), shared.DeleteResponse);
365
+ }
366
+ else {
367
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
368
+ }
369
+ break;
370
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
371
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
372
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
373
+ }
374
+ return [2 /*return*/, res];
375
+ }
376
+ });
377
+ });
378
+ };
379
+ /**
380
+ * Get datasets
381
+ */
382
+ HoneyHive.prototype.getDatasets = function (req, config) {
383
+ var _a, _b;
384
+ return __awaiter(this, void 0, void 0, function () {
385
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
386
+ return __generator(this, function (_c) {
387
+ switch (_c.label) {
388
+ case 0:
389
+ if (!(req instanceof utils.SpeakeasyBase)) {
390
+ req = new operations.GetDatasetsRequest(req);
391
+ }
392
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
393
+ url = baseURL.replace(/\/$/, "") + "/datasets";
394
+ client = this.sdkConfiguration.defaultClient;
395
+ globalSecurity = this.sdkConfiguration.security;
396
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
397
+ return [4 /*yield*/, globalSecurity()];
398
+ case 1:
399
+ globalSecurity = _c.sent();
400
+ _c.label = 2;
401
+ case 2:
402
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
403
+ globalSecurity = new shared.Security(globalSecurity);
404
+ }
405
+ properties = utils.parseSecurityProperties(globalSecurity);
406
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
407
+ queryParams = utils.serializeQueryParams(req);
408
+ headers["Accept"] = "application/json";
409
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
410
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
411
+ case 3:
412
+ httpRes = _c.sent();
413
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
414
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
415
+ throw new Error("status code not found in response: ".concat(httpRes));
416
+ }
417
+ res = new operations.GetDatasetsResponse({
418
+ statusCode: httpRes.status,
419
+ contentType: contentType,
420
+ rawResponse: httpRes,
421
+ });
422
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
423
+ switch (true) {
424
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
425
+ if (utils.matchContentType(contentType, "application/json")) {
426
+ res.datasetResponses = [];
427
+ resFieldDepth = utils.getResFieldDepth(res);
428
+ res.datasetResponses = utils.objectToClass(JSON.parse(decodedRes), shared.DatasetResponse, resFieldDepth);
429
+ }
430
+ else {
431
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
432
+ }
433
+ break;
434
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
435
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
436
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
437
+ }
438
+ return [2 /*return*/, res];
439
+ }
440
+ });
441
+ });
442
+ };
443
+ /**
444
+ * Get all fine-tuned models
445
+ */
446
+ HoneyHive.prototype.getFineTunedModels = function (req, config) {
447
+ var _a, _b;
448
+ return __awaiter(this, void 0, void 0, function () {
449
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
450
+ return __generator(this, function (_c) {
451
+ switch (_c.label) {
452
+ case 0:
453
+ if (!(req instanceof utils.SpeakeasyBase)) {
454
+ req = new operations.GetFineTunedModelsRequest(req);
455
+ }
456
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
457
+ url = baseURL.replace(/\/$/, "") + "/fine_tuned_models";
458
+ client = this.sdkConfiguration.defaultClient;
459
+ globalSecurity = this.sdkConfiguration.security;
460
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
461
+ return [4 /*yield*/, globalSecurity()];
462
+ case 1:
463
+ globalSecurity = _c.sent();
464
+ _c.label = 2;
465
+ case 2:
466
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
467
+ globalSecurity = new shared.Security(globalSecurity);
468
+ }
469
+ properties = utils.parseSecurityProperties(globalSecurity);
470
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
471
+ queryParams = utils.serializeQueryParams(req);
472
+ headers["Accept"] = "application/json";
473
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
474
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
475
+ case 3:
476
+ httpRes = _c.sent();
477
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
478
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
479
+ throw new Error("status code not found in response: ".concat(httpRes));
480
+ }
481
+ res = new operations.GetFineTunedModelsResponse({
482
+ statusCode: httpRes.status,
483
+ contentType: contentType,
484
+ rawResponse: httpRes,
485
+ });
486
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
487
+ switch (true) {
488
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
489
+ if (utils.matchContentType(contentType, "application/json")) {
490
+ res.fineTunedModelResponses = [];
491
+ resFieldDepth = utils.getResFieldDepth(res);
492
+ res.fineTunedModelResponses = utils.objectToClass(JSON.parse(decodedRes), shared.FineTunedModelResponse, resFieldDepth);
493
+ }
494
+ else {
495
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
496
+ }
497
+ break;
498
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
499
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
500
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
501
+ }
502
+ return [2 /*return*/, res];
503
+ }
504
+ });
505
+ });
506
+ };
507
+ /**
508
+ * Get a fine-tuned model
509
+ */
510
+ HoneyHive.prototype.getFineTunedModelsId = function (req, config) {
511
+ var _a, _b;
512
+ return __awaiter(this, void 0, void 0, function () {
513
+ var baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
514
+ return __generator(this, function (_c) {
515
+ switch (_c.label) {
516
+ case 0:
517
+ if (!(req instanceof utils.SpeakeasyBase)) {
518
+ req = new operations.GetFineTunedModelsIdRequest(req);
519
+ }
520
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
521
+ url = utils.generateURL(baseURL, "/fine_tuned_models/{id}", req);
522
+ client = this.sdkConfiguration.defaultClient;
523
+ globalSecurity = this.sdkConfiguration.security;
524
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
525
+ return [4 /*yield*/, globalSecurity()];
526
+ case 1:
527
+ globalSecurity = _c.sent();
528
+ _c.label = 2;
529
+ case 2:
530
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
531
+ globalSecurity = new shared.Security(globalSecurity);
532
+ }
533
+ properties = utils.parseSecurityProperties(globalSecurity);
534
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
535
+ headers["Accept"] = "application/json";
536
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
537
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
538
+ case 3:
539
+ httpRes = _c.sent();
540
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
541
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
542
+ throw new Error("status code not found in response: ".concat(httpRes));
543
+ }
544
+ res = new operations.GetFineTunedModelsIdResponse({
545
+ statusCode: httpRes.status,
546
+ contentType: contentType,
547
+ rawResponse: httpRes,
548
+ });
549
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
550
+ switch (true) {
551
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
552
+ if (utils.matchContentType(contentType, "application/json")) {
553
+ res.fineTunedModelResponse = utils.objectToClass(JSON.parse(decodedRes), shared.FineTunedModelResponse);
554
+ }
555
+ else {
556
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
557
+ }
558
+ break;
559
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
560
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
561
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
562
+ }
563
+ return [2 /*return*/, res];
564
+ }
565
+ });
566
+ });
567
+ };
568
+ /**
569
+ * Get all generations
570
+ */
571
+ HoneyHive.prototype.getGenerations = function (req, config) {
572
+ var _a, _b;
573
+ return __awaiter(this, void 0, void 0, function () {
574
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
575
+ return __generator(this, function (_c) {
576
+ switch (_c.label) {
577
+ case 0:
578
+ if (!(req instanceof utils.SpeakeasyBase)) {
579
+ req = new operations.GetGenerationsRequest(req);
580
+ }
581
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
582
+ url = baseURL.replace(/\/$/, "") + "/generations";
583
+ client = this.sdkConfiguration.defaultClient;
584
+ globalSecurity = this.sdkConfiguration.security;
585
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
586
+ return [4 /*yield*/, globalSecurity()];
587
+ case 1:
588
+ globalSecurity = _c.sent();
589
+ _c.label = 2;
590
+ case 2:
591
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
592
+ globalSecurity = new shared.Security(globalSecurity);
593
+ }
594
+ properties = utils.parseSecurityProperties(globalSecurity);
595
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
596
+ queryParams = utils.serializeQueryParams(req);
597
+ headers["Accept"] = "application/json";
598
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
599
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
600
+ case 3:
601
+ httpRes = _c.sent();
602
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
603
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
604
+ throw new Error("status code not found in response: ".concat(httpRes));
605
+ }
606
+ res = new operations.GetGenerationsResponse({
607
+ statusCode: httpRes.status,
608
+ contentType: contentType,
609
+ rawResponse: httpRes,
610
+ });
611
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
612
+ switch (true) {
613
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
614
+ if (utils.matchContentType(contentType, "application/json")) {
615
+ res.generations = [];
616
+ resFieldDepth = utils.getResFieldDepth(res);
617
+ res.generations = utils.objectToClass(JSON.parse(decodedRes), shared.Generation, resFieldDepth);
618
+ }
619
+ else {
620
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
621
+ }
622
+ break;
623
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
624
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
625
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
626
+ }
627
+ return [2 /*return*/, res];
628
+ }
629
+ });
630
+ });
631
+ };
632
+ /**
633
+ * Get all metrics
634
+ */
635
+ HoneyHive.prototype.getMetrics = function (req, config) {
636
+ var _a, _b;
637
+ return __awaiter(this, void 0, void 0, function () {
638
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
639
+ return __generator(this, function (_c) {
640
+ switch (_c.label) {
641
+ case 0:
642
+ if (!(req instanceof utils.SpeakeasyBase)) {
643
+ req = new operations.GetMetricsRequest(req);
644
+ }
645
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
646
+ url = baseURL.replace(/\/$/, "") + "/metrics";
647
+ client = this.sdkConfiguration.defaultClient;
648
+ globalSecurity = this.sdkConfiguration.security;
649
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
650
+ return [4 /*yield*/, globalSecurity()];
651
+ case 1:
652
+ globalSecurity = _c.sent();
653
+ _c.label = 2;
654
+ case 2:
655
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
656
+ globalSecurity = new shared.Security(globalSecurity);
657
+ }
658
+ properties = utils.parseSecurityProperties(globalSecurity);
659
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
660
+ queryParams = utils.serializeQueryParams(req);
661
+ headers["Accept"] = "application/json";
662
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
663
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
664
+ case 3:
665
+ httpRes = _c.sent();
666
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
667
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
668
+ throw new Error("status code not found in response: ".concat(httpRes));
669
+ }
670
+ res = new operations.GetMetricsResponse({
671
+ statusCode: httpRes.status,
672
+ contentType: contentType,
673
+ rawResponse: httpRes,
674
+ });
675
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
676
+ switch (true) {
677
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
678
+ if (utils.matchContentType(contentType, "application/json")) {
679
+ res.metricResponses = [];
680
+ resFieldDepth = utils.getResFieldDepth(res);
681
+ res.metricResponses = utils.objectToClass(JSON.parse(decodedRes), shared.MetricResponse, resFieldDepth);
682
+ }
683
+ else {
684
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
685
+ }
686
+ break;
687
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
688
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
689
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
690
+ }
691
+ return [2 /*return*/, res];
692
+ }
693
+ });
694
+ });
695
+ };
696
+ /**
697
+ * Get all prompts
698
+ */
699
+ HoneyHive.prototype.getPrompts = function (req, config) {
700
+ var _a, _b;
701
+ return __awaiter(this, void 0, void 0, function () {
702
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
703
+ return __generator(this, function (_c) {
704
+ switch (_c.label) {
705
+ case 0:
706
+ if (!(req instanceof utils.SpeakeasyBase)) {
707
+ req = new operations.GetPromptsRequest(req);
708
+ }
709
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
710
+ url = baseURL.replace(/\/$/, "") + "/prompts";
711
+ client = this.sdkConfiguration.defaultClient;
712
+ globalSecurity = this.sdkConfiguration.security;
713
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
714
+ return [4 /*yield*/, globalSecurity()];
715
+ case 1:
716
+ globalSecurity = _c.sent();
717
+ _c.label = 2;
718
+ case 2:
719
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
720
+ globalSecurity = new shared.Security(globalSecurity);
721
+ }
722
+ properties = utils.parseSecurityProperties(globalSecurity);
723
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
724
+ queryParams = utils.serializeQueryParams(req);
725
+ headers["Accept"] = "application/json";
726
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
727
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
728
+ case 3:
729
+ httpRes = _c.sent();
730
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
731
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
732
+ throw new Error("status code not found in response: ".concat(httpRes));
733
+ }
734
+ res = new operations.GetPromptsResponse({
735
+ statusCode: httpRes.status,
736
+ contentType: contentType,
737
+ rawResponse: httpRes,
738
+ });
739
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
740
+ switch (true) {
741
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
742
+ if (utils.matchContentType(contentType, "application/json")) {
743
+ res.promptResponses = [];
744
+ resFieldDepth = utils.getResFieldDepth(res);
745
+ res.promptResponses = utils.objectToClass(JSON.parse(decodedRes), shared.PromptResponse, resFieldDepth);
746
+ }
747
+ else {
748
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
749
+ }
750
+ break;
751
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
752
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
753
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
754
+ }
755
+ return [2 /*return*/, res];
756
+ }
757
+ });
758
+ });
759
+ };
760
+ /**
761
+ * Get all sessions
762
+ */
763
+ HoneyHive.prototype.getSession = function (req, config) {
764
+ var _a, _b;
765
+ return __awaiter(this, void 0, void 0, function () {
766
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
767
+ return __generator(this, function (_c) {
768
+ switch (_c.label) {
769
+ case 0:
770
+ if (!(req instanceof utils.SpeakeasyBase)) {
771
+ req = new operations.GetSessionRequest(req);
772
+ }
773
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
774
+ url = baseURL.replace(/\/$/, "") + "/session";
775
+ client = this.sdkConfiguration.defaultClient;
776
+ globalSecurity = this.sdkConfiguration.security;
777
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
778
+ return [4 /*yield*/, globalSecurity()];
779
+ case 1:
780
+ globalSecurity = _c.sent();
781
+ _c.label = 2;
782
+ case 2:
783
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
784
+ globalSecurity = new shared.Security(globalSecurity);
785
+ }
786
+ properties = utils.parseSecurityProperties(globalSecurity);
787
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
788
+ queryParams = utils.serializeQueryParams(req);
789
+ headers["Accept"] = "application/json";
790
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
791
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
792
+ case 3:
793
+ httpRes = _c.sent();
794
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
795
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
796
+ throw new Error("status code not found in response: ".concat(httpRes));
797
+ }
798
+ res = new operations.GetSessionResponse({
799
+ statusCode: httpRes.status,
800
+ contentType: contentType,
801
+ rawResponse: httpRes,
802
+ });
803
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
804
+ switch (true) {
805
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
806
+ if (utils.matchContentType(contentType, "application/json")) {
807
+ res.sessionEventQueries = [];
808
+ resFieldDepth = utils.getResFieldDepth(res);
809
+ res.sessionEventQueries = utils.objectToClass(JSON.parse(decodedRes), shared.SessionEventQuery, resFieldDepth);
810
+ }
811
+ else {
812
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
813
+ }
814
+ break;
815
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
816
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
817
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
818
+ }
819
+ return [2 /*return*/, res];
820
+ }
821
+ });
822
+ });
823
+ };
824
+ /**
825
+ * Get a session
826
+ */
827
+ HoneyHive.prototype.getSessionSessionId = function (req, config) {
828
+ var _a, _b;
829
+ return __awaiter(this, void 0, void 0, function () {
830
+ var baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
831
+ return __generator(this, function (_c) {
832
+ switch (_c.label) {
833
+ case 0:
834
+ if (!(req instanceof utils.SpeakeasyBase)) {
835
+ req = new operations.GetSessionSessionIdRequest(req);
836
+ }
837
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
838
+ url = utils.generateURL(baseURL, "/session/{session_id}", req);
839
+ client = this.sdkConfiguration.defaultClient;
840
+ globalSecurity = this.sdkConfiguration.security;
841
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
842
+ return [4 /*yield*/, globalSecurity()];
843
+ case 1:
844
+ globalSecurity = _c.sent();
845
+ _c.label = 2;
846
+ case 2:
847
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
848
+ globalSecurity = new shared.Security(globalSecurity);
849
+ }
850
+ properties = utils.parseSecurityProperties(globalSecurity);
851
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
852
+ headers["Accept"] = "application/json";
853
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
854
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
855
+ case 3:
856
+ httpRes = _c.sent();
857
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
858
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
859
+ throw new Error("status code not found in response: ".concat(httpRes));
860
+ }
861
+ res = new operations.GetSessionSessionIdResponse({
862
+ statusCode: httpRes.status,
863
+ contentType: contentType,
864
+ rawResponse: httpRes,
865
+ });
866
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
867
+ switch (true) {
868
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
869
+ if (utils.matchContentType(contentType, "application/json")) {
870
+ res.sessionEventQuery = utils.objectToClass(JSON.parse(decodedRes), shared.SessionEventQuery);
871
+ }
872
+ else {
873
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
874
+ }
875
+ break;
876
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
877
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
878
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
879
+ }
880
+ return [2 /*return*/, res];
881
+ }
882
+ });
883
+ });
884
+ };
885
+ /**
886
+ * Get a session in Trace Event format
887
+ */
888
+ HoneyHive.prototype.getSessionSessionIdExport = function (req, config) {
889
+ var _a, _b;
890
+ return __awaiter(this, void 0, void 0, function () {
891
+ var baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, resFieldDepth;
892
+ return __generator(this, function (_c) {
893
+ switch (_c.label) {
894
+ case 0:
895
+ if (!(req instanceof utils.SpeakeasyBase)) {
896
+ req = new operations.GetSessionSessionIdExportRequest(req);
897
+ }
898
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
899
+ url = utils.generateURL(baseURL, "/session/{session_id}/export", req);
900
+ client = this.sdkConfiguration.defaultClient;
901
+ globalSecurity = this.sdkConfiguration.security;
902
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
903
+ return [4 /*yield*/, globalSecurity()];
904
+ case 1:
905
+ globalSecurity = _c.sent();
906
+ _c.label = 2;
907
+ case 2:
908
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
909
+ globalSecurity = new shared.Security(globalSecurity);
910
+ }
911
+ properties = utils.parseSecurityProperties(globalSecurity);
912
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
913
+ headers["Accept"] = "application/json";
914
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
915
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
916
+ case 3:
917
+ httpRes = _c.sent();
918
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
919
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
920
+ throw new Error("status code not found in response: ".concat(httpRes));
921
+ }
922
+ res = new operations.GetSessionSessionIdExportResponse({
923
+ statusCode: httpRes.status,
924
+ contentType: contentType,
925
+ rawResponse: httpRes,
926
+ });
927
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
928
+ switch (true) {
929
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
930
+ if (utils.matchContentType(contentType, "application/json")) {
931
+ res.traceEventTrace = [];
932
+ resFieldDepth = utils.getResFieldDepth(res);
933
+ res.traceEventTrace = utils.objectToClass(JSON.parse(decodedRes), shared.TraceEvent, resFieldDepth);
934
+ }
935
+ else {
936
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
937
+ }
938
+ break;
939
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
940
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
941
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
942
+ }
943
+ return [2 /*return*/, res];
944
+ }
945
+ });
946
+ });
947
+ };
948
+ /**
949
+ * Get all tasks
950
+ */
951
+ HoneyHive.prototype.getTasks = function (req, config) {
952
+ var _a, _b;
953
+ return __awaiter(this, void 0, void 0, function () {
954
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, resFieldDepth;
955
+ return __generator(this, function (_c) {
956
+ switch (_c.label) {
957
+ case 0:
958
+ if (!(req instanceof utils.SpeakeasyBase)) {
959
+ req = new operations.GetTasksRequest(req);
960
+ }
961
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
962
+ url = baseURL.replace(/\/$/, "") + "/tasks";
963
+ client = this.sdkConfiguration.defaultClient;
964
+ globalSecurity = this.sdkConfiguration.security;
965
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
966
+ return [4 /*yield*/, globalSecurity()];
967
+ case 1:
968
+ globalSecurity = _c.sent();
969
+ _c.label = 2;
970
+ case 2:
971
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
972
+ globalSecurity = new shared.Security(globalSecurity);
973
+ }
974
+ properties = utils.parseSecurityProperties(globalSecurity);
975
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
976
+ queryParams = utils.serializeQueryParams(req);
977
+ headers["Accept"] = "application/json";
978
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
979
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
980
+ case 3:
981
+ httpRes = _c.sent();
982
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
983
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
984
+ throw new Error("status code not found in response: ".concat(httpRes));
985
+ }
986
+ res = new operations.GetTasksResponse({
987
+ statusCode: httpRes.status,
988
+ contentType: contentType,
989
+ rawResponse: httpRes,
990
+ });
991
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
992
+ switch (true) {
993
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
994
+ if (utils.matchContentType(contentType, "application/json")) {
995
+ res.taskResponses = [];
996
+ resFieldDepth = utils.getResFieldDepth(res);
997
+ res.taskResponses = utils.objectToClass(JSON.parse(decodedRes), shared.TaskResponse, resFieldDepth);
998
+ }
999
+ else {
1000
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1001
+ }
1002
+ break;
1003
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1004
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1005
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1006
+ }
1007
+ return [2 /*return*/, res];
1008
+ }
1009
+ });
1010
+ });
1011
+ };
1012
+ /**
1013
+ * Create a dataset
1014
+ */
1015
+ HoneyHive.prototype.postDatasets = function (req, config) {
1016
+ var _a, _b;
1017
+ return __awaiter(this, void 0, void 0, function () {
1018
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1019
+ var _d;
1020
+ return __generator(this, function (_e) {
1021
+ switch (_e.label) {
1022
+ case 0:
1023
+ if (!(req instanceof utils.SpeakeasyBase)) {
1024
+ req = new shared.UploadDataset(req);
1025
+ }
1026
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1027
+ url = baseURL.replace(/\/$/, "") + "/datasets";
1028
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1029
+ try {
1030
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1031
+ }
1032
+ catch (e) {
1033
+ if (e instanceof Error) {
1034
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1035
+ }
1036
+ }
1037
+ client = this.sdkConfiguration.defaultClient;
1038
+ globalSecurity = this.sdkConfiguration.security;
1039
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1040
+ return [4 /*yield*/, globalSecurity()];
1041
+ case 1:
1042
+ globalSecurity = _e.sent();
1043
+ _e.label = 2;
1044
+ case 2:
1045
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1046
+ globalSecurity = new shared.Security(globalSecurity);
1047
+ }
1048
+ properties = utils.parseSecurityProperties(globalSecurity);
1049
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1050
+ if (reqBody == null)
1051
+ throw new Error("request body is required");
1052
+ headers["Accept"] = "application/json";
1053
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1054
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1055
+ case 3:
1056
+ httpRes = _e.sent();
1057
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1058
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1059
+ throw new Error("status code not found in response: ".concat(httpRes));
1060
+ }
1061
+ res = new operations.PostDatasetsResponse({
1062
+ statusCode: httpRes.status,
1063
+ contentType: contentType,
1064
+ rawResponse: httpRes,
1065
+ });
1066
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1067
+ switch (true) {
1068
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1069
+ if (utils.matchContentType(contentType, "application/json")) {
1070
+ res.datasetResponse = utils.objectToClass(JSON.parse(decodedRes), shared.DatasetResponse);
1071
+ }
1072
+ else {
1073
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1074
+ }
1075
+ break;
1076
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1077
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1078
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1079
+ }
1080
+ return [2 /*return*/, res];
1081
+ }
1082
+ });
1083
+ });
1084
+ };
1085
+ /**
1086
+ * Log an evaluation
1087
+ */
1088
+ HoneyHive.prototype.postEvaluations = function (req, config) {
1089
+ var _a, _b;
1090
+ return __awaiter(this, void 0, void 0, function () {
1091
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1092
+ var _d;
1093
+ return __generator(this, function (_e) {
1094
+ switch (_e.label) {
1095
+ case 0:
1096
+ if (!(req instanceof utils.SpeakeasyBase)) {
1097
+ req = new shared.EvaluationLoggingQuery(req);
1098
+ }
1099
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1100
+ url = baseURL.replace(/\/$/, "") + "/evaluations";
1101
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1102
+ try {
1103
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1104
+ }
1105
+ catch (e) {
1106
+ if (e instanceof Error) {
1107
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1108
+ }
1109
+ }
1110
+ client = this.sdkConfiguration.defaultClient;
1111
+ globalSecurity = this.sdkConfiguration.security;
1112
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1113
+ return [4 /*yield*/, globalSecurity()];
1114
+ case 1:
1115
+ globalSecurity = _e.sent();
1116
+ _e.label = 2;
1117
+ case 2:
1118
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1119
+ globalSecurity = new shared.Security(globalSecurity);
1120
+ }
1121
+ properties = utils.parseSecurityProperties(globalSecurity);
1122
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1123
+ if (reqBody == null)
1124
+ throw new Error("request body is required");
1125
+ headers["Accept"] = "application/json";
1126
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1127
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1128
+ case 3:
1129
+ httpRes = _e.sent();
1130
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1131
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1132
+ throw new Error("status code not found in response: ".concat(httpRes));
1133
+ }
1134
+ res = new operations.PostEvaluationsResponse({
1135
+ statusCode: httpRes.status,
1136
+ contentType: contentType,
1137
+ rawResponse: httpRes,
1138
+ });
1139
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1140
+ switch (true) {
1141
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1142
+ if (utils.matchContentType(contentType, "application/json")) {
1143
+ res.successResponse = utils.objectToClass(JSON.parse(decodedRes), shared.SuccessResponse);
1144
+ }
1145
+ else {
1146
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1147
+ }
1148
+ break;
1149
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1150
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1151
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1152
+ }
1153
+ return [2 /*return*/, res];
1154
+ }
1155
+ });
1156
+ });
1157
+ };
1158
+ /**
1159
+ * Send feedback
1160
+ */
1161
+ HoneyHive.prototype.postFeedback = function (req, config) {
1162
+ var _a, _b;
1163
+ return __awaiter(this, void 0, void 0, function () {
1164
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1165
+ var _d;
1166
+ return __generator(this, function (_e) {
1167
+ switch (_e.label) {
1168
+ case 0:
1169
+ if (!(req instanceof utils.SpeakeasyBase)) {
1170
+ req = new shared.FeedbackQuery(req);
1171
+ }
1172
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1173
+ url = baseURL.replace(/\/$/, "") + "/feedback";
1174
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1175
+ try {
1176
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1177
+ }
1178
+ catch (e) {
1179
+ if (e instanceof Error) {
1180
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1181
+ }
1182
+ }
1183
+ client = this.sdkConfiguration.defaultClient;
1184
+ globalSecurity = this.sdkConfiguration.security;
1185
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1186
+ return [4 /*yield*/, globalSecurity()];
1187
+ case 1:
1188
+ globalSecurity = _e.sent();
1189
+ _e.label = 2;
1190
+ case 2:
1191
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1192
+ globalSecurity = new shared.Security(globalSecurity);
1193
+ }
1194
+ properties = utils.parseSecurityProperties(globalSecurity);
1195
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1196
+ if (reqBody == null)
1197
+ throw new Error("request body is required");
1198
+ headers["Accept"] = "application/json";
1199
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1200
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1201
+ case 3:
1202
+ httpRes = _e.sent();
1203
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1204
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1205
+ throw new Error("status code not found in response: ".concat(httpRes));
1206
+ }
1207
+ res = new operations.PostFeedbackResponse({
1208
+ statusCode: httpRes.status,
1209
+ contentType: contentType,
1210
+ rawResponse: httpRes,
1211
+ });
1212
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1213
+ switch (true) {
1214
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1215
+ if (utils.matchContentType(contentType, "application/json")) {
1216
+ res.feedbackResponse = utils.objectToClass(JSON.parse(decodedRes), shared.FeedbackResponse);
1217
+ }
1218
+ else {
1219
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1220
+ }
1221
+ break;
1222
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1223
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1224
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1225
+ }
1226
+ return [2 /*return*/, res];
1227
+ }
1228
+ });
1229
+ });
1230
+ };
1231
+ /**
1232
+ * Generate a text
1233
+ */
1234
+ HoneyHive.prototype.postGenerations = function (req, config) {
1235
+ var _a, _b;
1236
+ return __awaiter(this, void 0, void 0, function () {
1237
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1238
+ var _d;
1239
+ return __generator(this, function (_e) {
1240
+ switch (_e.label) {
1241
+ case 0:
1242
+ if (!(req instanceof utils.SpeakeasyBase)) {
1243
+ req = new shared.GenerateQuery(req);
1244
+ }
1245
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1246
+ url = baseURL.replace(/\/$/, "") + "/generations";
1247
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1248
+ try {
1249
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1250
+ }
1251
+ catch (e) {
1252
+ if (e instanceof Error) {
1253
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1254
+ }
1255
+ }
1256
+ client = this.sdkConfiguration.defaultClient;
1257
+ globalSecurity = this.sdkConfiguration.security;
1258
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1259
+ return [4 /*yield*/, globalSecurity()];
1260
+ case 1:
1261
+ globalSecurity = _e.sent();
1262
+ _e.label = 2;
1263
+ case 2:
1264
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1265
+ globalSecurity = new shared.Security(globalSecurity);
1266
+ }
1267
+ properties = utils.parseSecurityProperties(globalSecurity);
1268
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1269
+ if (reqBody == null)
1270
+ throw new Error("request body is required");
1271
+ headers["Accept"] = "application/json";
1272
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1273
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1274
+ case 3:
1275
+ httpRes = _e.sent();
1276
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1277
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1278
+ throw new Error("status code not found in response: ".concat(httpRes));
1279
+ }
1280
+ res = new operations.PostGenerationsResponse({
1281
+ statusCode: httpRes.status,
1282
+ contentType: contentType,
1283
+ rawResponse: httpRes,
1284
+ });
1285
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1286
+ switch (true) {
1287
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1288
+ if (utils.matchContentType(contentType, "application/json")) {
1289
+ res.generationResponse = utils.objectToClass(JSON.parse(decodedRes), shared.GenerationResponse);
1290
+ }
1291
+ else {
1292
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1293
+ }
1294
+ break;
1295
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1296
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1297
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1298
+ }
1299
+ return [2 /*return*/, res];
1300
+ }
1301
+ });
1302
+ });
1303
+ };
1304
+ /**
1305
+ * Log a generation
1306
+ */
1307
+ HoneyHive.prototype.postGenerationsLog = function (req, config) {
1308
+ var _a, _b;
1309
+ return __awaiter(this, void 0, void 0, function () {
1310
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1311
+ var _d;
1312
+ return __generator(this, function (_e) {
1313
+ switch (_e.label) {
1314
+ case 0:
1315
+ if (!(req instanceof utils.SpeakeasyBase)) {
1316
+ req = new shared.GenerationLoggingQuery(req);
1317
+ }
1318
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1319
+ url = baseURL.replace(/\/$/, "") + "/generations/log";
1320
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1321
+ try {
1322
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1323
+ }
1324
+ catch (e) {
1325
+ if (e instanceof Error) {
1326
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1327
+ }
1328
+ }
1329
+ client = this.sdkConfiguration.defaultClient;
1330
+ globalSecurity = this.sdkConfiguration.security;
1331
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1332
+ return [4 /*yield*/, globalSecurity()];
1333
+ case 1:
1334
+ globalSecurity = _e.sent();
1335
+ _e.label = 2;
1336
+ case 2:
1337
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1338
+ globalSecurity = new shared.Security(globalSecurity);
1339
+ }
1340
+ properties = utils.parseSecurityProperties(globalSecurity);
1341
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1342
+ if (reqBody == null)
1343
+ throw new Error("request body is required");
1344
+ headers["Accept"] = "application/json";
1345
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1346
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1347
+ case 3:
1348
+ httpRes = _e.sent();
1349
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1350
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1351
+ throw new Error("status code not found in response: ".concat(httpRes));
1352
+ }
1353
+ res = new operations.PostGenerationsLogResponse({
1354
+ statusCode: httpRes.status,
1355
+ contentType: contentType,
1356
+ rawResponse: httpRes,
1357
+ });
1358
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1359
+ switch (true) {
1360
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1361
+ if (utils.matchContentType(contentType, "application/json")) {
1362
+ res.generationResponse = utils.objectToClass(JSON.parse(decodedRes), shared.GenerationResponse);
1363
+ }
1364
+ else {
1365
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1366
+ }
1367
+ break;
1368
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1369
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1370
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1371
+ }
1372
+ return [2 /*return*/, res];
1373
+ }
1374
+ });
1375
+ });
1376
+ };
1377
+ /**
1378
+ * Create a metric
1379
+ */
1380
+ HoneyHive.prototype.postMetrics = function (req, config) {
1381
+ var _a, _b;
1382
+ return __awaiter(this, void 0, void 0, function () {
1383
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1384
+ var _d;
1385
+ return __generator(this, function (_e) {
1386
+ switch (_e.label) {
1387
+ case 0:
1388
+ if (!(req instanceof utils.SpeakeasyBase)) {
1389
+ req = new shared.MetricRequest(req);
1390
+ }
1391
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1392
+ url = baseURL.replace(/\/$/, "") + "/metrics";
1393
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1394
+ try {
1395
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1396
+ }
1397
+ catch (e) {
1398
+ if (e instanceof Error) {
1399
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1400
+ }
1401
+ }
1402
+ client = this.sdkConfiguration.defaultClient;
1403
+ globalSecurity = this.sdkConfiguration.security;
1404
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1405
+ return [4 /*yield*/, globalSecurity()];
1406
+ case 1:
1407
+ globalSecurity = _e.sent();
1408
+ _e.label = 2;
1409
+ case 2:
1410
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1411
+ globalSecurity = new shared.Security(globalSecurity);
1412
+ }
1413
+ properties = utils.parseSecurityProperties(globalSecurity);
1414
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1415
+ if (reqBody == null)
1416
+ throw new Error("request body is required");
1417
+ headers["Accept"] = "application/json";
1418
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1419
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1420
+ case 3:
1421
+ httpRes = _e.sent();
1422
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1423
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1424
+ throw new Error("status code not found in response: ".concat(httpRes));
1425
+ }
1426
+ res = new operations.PostMetricsResponse({
1427
+ statusCode: httpRes.status,
1428
+ contentType: contentType,
1429
+ rawResponse: httpRes,
1430
+ });
1431
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1432
+ switch (true) {
1433
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1434
+ if (utils.matchContentType(contentType, "application/json")) {
1435
+ res.metricCreateResponse = utils.objectToClass(JSON.parse(decodedRes), shared.MetricCreateResponse);
1436
+ }
1437
+ else {
1438
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1439
+ }
1440
+ break;
1441
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1442
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1443
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1444
+ }
1445
+ return [2 /*return*/, res];
1446
+ }
1447
+ });
1448
+ });
1449
+ };
1450
+ /**
1451
+ * Create a prompt
1452
+ */
1453
+ HoneyHive.prototype.postPrompts = function (req, config) {
1454
+ var _a, _b;
1455
+ return __awaiter(this, void 0, void 0, function () {
1456
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1457
+ var _d;
1458
+ return __generator(this, function (_e) {
1459
+ switch (_e.label) {
1460
+ case 0:
1461
+ if (!(req instanceof utils.SpeakeasyBase)) {
1462
+ req = new shared.PromptCreationQuery(req);
1463
+ }
1464
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1465
+ url = baseURL.replace(/\/$/, "") + "/prompts";
1466
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1467
+ try {
1468
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1469
+ }
1470
+ catch (e) {
1471
+ if (e instanceof Error) {
1472
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1473
+ }
1474
+ }
1475
+ client = this.sdkConfiguration.defaultClient;
1476
+ globalSecurity = this.sdkConfiguration.security;
1477
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1478
+ return [4 /*yield*/, globalSecurity()];
1479
+ case 1:
1480
+ globalSecurity = _e.sent();
1481
+ _e.label = 2;
1482
+ case 2:
1483
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1484
+ globalSecurity = new shared.Security(globalSecurity);
1485
+ }
1486
+ properties = utils.parseSecurityProperties(globalSecurity);
1487
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1488
+ if (reqBody == null)
1489
+ throw new Error("request body is required");
1490
+ headers["Accept"] = "application/json";
1491
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1492
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1493
+ case 3:
1494
+ httpRes = _e.sent();
1495
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1496
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1497
+ throw new Error("status code not found in response: ".concat(httpRes));
1498
+ }
1499
+ res = new operations.PostPromptsResponse({
1500
+ statusCode: httpRes.status,
1501
+ contentType: contentType,
1502
+ rawResponse: httpRes,
1503
+ });
1504
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1505
+ switch (true) {
1506
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1507
+ if (utils.matchContentType(contentType, "application/json")) {
1508
+ res.promptResponse = utils.objectToClass(JSON.parse(decodedRes), shared.PromptResponse);
1509
+ }
1510
+ else {
1511
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1512
+ }
1513
+ break;
1514
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1515
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1516
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1517
+ }
1518
+ return [2 /*return*/, res];
1519
+ }
1520
+ });
1521
+ });
1522
+ };
1523
+ /**
1524
+ * Start a session
1525
+ */
1526
+ HoneyHive.prototype.postSessionStart = function (req, config) {
1527
+ var _a, _b;
1528
+ return __awaiter(this, void 0, void 0, function () {
1529
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1530
+ var _d;
1531
+ return __generator(this, function (_e) {
1532
+ switch (_e.label) {
1533
+ case 0:
1534
+ if (!(req instanceof utils.SpeakeasyBase)) {
1535
+ req = new shared.SessionStartQuery(req);
1536
+ }
1537
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1538
+ url = baseURL.replace(/\/$/, "") + "/session/start";
1539
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1540
+ try {
1541
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1542
+ }
1543
+ catch (e) {
1544
+ if (e instanceof Error) {
1545
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1546
+ }
1547
+ }
1548
+ client = this.sdkConfiguration.defaultClient;
1549
+ globalSecurity = this.sdkConfiguration.security;
1550
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1551
+ return [4 /*yield*/, globalSecurity()];
1552
+ case 1:
1553
+ globalSecurity = _e.sent();
1554
+ _e.label = 2;
1555
+ case 2:
1556
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1557
+ globalSecurity = new shared.Security(globalSecurity);
1558
+ }
1559
+ properties = utils.parseSecurityProperties(globalSecurity);
1560
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1561
+ if (reqBody == null)
1562
+ throw new Error("request body is required");
1563
+ headers["Accept"] = "application/json";
1564
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1565
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1566
+ case 3:
1567
+ httpRes = _e.sent();
1568
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1569
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1570
+ throw new Error("status code not found in response: ".concat(httpRes));
1571
+ }
1572
+ res = new operations.PostSessionStartResponse({
1573
+ statusCode: httpRes.status,
1574
+ contentType: contentType,
1575
+ rawResponse: httpRes,
1576
+ });
1577
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1578
+ switch (true) {
1579
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1580
+ if (utils.matchContentType(contentType, "application/json")) {
1581
+ res.sessionStartResponse = utils.objectToClass(JSON.parse(decodedRes), shared.SessionStartResponse);
1582
+ }
1583
+ else {
1584
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1585
+ }
1586
+ break;
1587
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1588
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1589
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1590
+ }
1591
+ return [2 /*return*/, res];
1592
+ }
1593
+ });
1594
+ });
1595
+ };
1596
+ /**
1597
+ * End a session
1598
+ */
1599
+ HoneyHive.prototype.postSessionSessionIdEnd = function (req, config) {
1600
+ var _a, _b;
1601
+ return __awaiter(this, void 0, void 0, function () {
1602
+ var baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1603
+ return __generator(this, function (_c) {
1604
+ switch (_c.label) {
1605
+ case 0:
1606
+ if (!(req instanceof utils.SpeakeasyBase)) {
1607
+ req = new operations.PostSessionSessionIdEndRequest(req);
1608
+ }
1609
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1610
+ url = utils.generateURL(baseURL, "/session/{session_id}/end", req);
1611
+ client = this.sdkConfiguration.defaultClient;
1612
+ globalSecurity = this.sdkConfiguration.security;
1613
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1614
+ return [4 /*yield*/, globalSecurity()];
1615
+ case 1:
1616
+ globalSecurity = _c.sent();
1617
+ _c.label = 2;
1618
+ case 2:
1619
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1620
+ globalSecurity = new shared.Security(globalSecurity);
1621
+ }
1622
+ properties = utils.parseSecurityProperties(globalSecurity);
1623
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1624
+ headers["Accept"] = "application/json";
1625
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1626
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer" }, config))];
1627
+ case 3:
1628
+ httpRes = _c.sent();
1629
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1630
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1631
+ throw new Error("status code not found in response: ".concat(httpRes));
1632
+ }
1633
+ res = new operations.PostSessionSessionIdEndResponse({
1634
+ statusCode: httpRes.status,
1635
+ contentType: contentType,
1636
+ rawResponse: httpRes,
1637
+ });
1638
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1639
+ switch (true) {
1640
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1641
+ if (utils.matchContentType(contentType, "application/json")) {
1642
+ res.sessionEndResponse = utils.objectToClass(JSON.parse(decodedRes), shared.SessionEndResponse);
1643
+ }
1644
+ else {
1645
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1646
+ }
1647
+ break;
1648
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1649
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1650
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1651
+ }
1652
+ return [2 /*return*/, res];
1653
+ }
1654
+ });
1655
+ });
1656
+ };
1657
+ /**
1658
+ * Log an event
1659
+ */
1660
+ HoneyHive.prototype.postSessionSessionIdEvent = function (req, config) {
1661
+ var _a, _b;
1662
+ return __awaiter(this, void 0, void 0, function () {
1663
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1664
+ var _d;
1665
+ return __generator(this, function (_e) {
1666
+ switch (_e.label) {
1667
+ case 0:
1668
+ if (!(req instanceof utils.SpeakeasyBase)) {
1669
+ req = new operations.PostSessionSessionIdEventRequest(req);
1670
+ }
1671
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1672
+ url = utils.generateURL(baseURL, "/session/{session_id}/event", req);
1673
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1674
+ try {
1675
+ _d = __read(utils.serializeRequestBody(req, "sessionEventQuery", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1676
+ }
1677
+ catch (e) {
1678
+ if (e instanceof Error) {
1679
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1680
+ }
1681
+ }
1682
+ client = this.sdkConfiguration.defaultClient;
1683
+ globalSecurity = this.sdkConfiguration.security;
1684
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1685
+ return [4 /*yield*/, globalSecurity()];
1686
+ case 1:
1687
+ globalSecurity = _e.sent();
1688
+ _e.label = 2;
1689
+ case 2:
1690
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1691
+ globalSecurity = new shared.Security(globalSecurity);
1692
+ }
1693
+ properties = utils.parseSecurityProperties(globalSecurity);
1694
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1695
+ if (reqBody == null)
1696
+ throw new Error("request body is required");
1697
+ headers["Accept"] = "application/json";
1698
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1699
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1700
+ case 3:
1701
+ httpRes = _e.sent();
1702
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1703
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1704
+ throw new Error("status code not found in response: ".concat(httpRes));
1705
+ }
1706
+ res = new operations.PostSessionSessionIdEventResponse({
1707
+ statusCode: httpRes.status,
1708
+ contentType: contentType,
1709
+ rawResponse: httpRes,
1710
+ });
1711
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1712
+ switch (true) {
1713
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1714
+ if (utils.matchContentType(contentType, "application/json")) {
1715
+ res.sessionEventResponse = utils.objectToClass(JSON.parse(decodedRes), shared.SessionEventResponse);
1716
+ }
1717
+ else {
1718
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1719
+ }
1720
+ break;
1721
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1722
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1723
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1724
+ }
1725
+ return [2 /*return*/, res];
1726
+ }
1727
+ });
1728
+ });
1729
+ };
1730
+ /**
1731
+ * Log session feedback
1732
+ */
1733
+ HoneyHive.prototype.postSessionSessionIdFeedback = function (req, config) {
1734
+ var _a, _b;
1735
+ return __awaiter(this, void 0, void 0, function () {
1736
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1737
+ var _d;
1738
+ return __generator(this, function (_e) {
1739
+ switch (_e.label) {
1740
+ case 0:
1741
+ if (!(req instanceof utils.SpeakeasyBase)) {
1742
+ req = new operations.PostSessionSessionIdFeedbackRequest(req);
1743
+ }
1744
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1745
+ url = utils.generateURL(baseURL, "/session/{session_id}/feedback", req);
1746
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1747
+ try {
1748
+ _d = __read(utils.serializeRequestBody(req, "sessionFeedback", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1749
+ }
1750
+ catch (e) {
1751
+ if (e instanceof Error) {
1752
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1753
+ }
1754
+ }
1755
+ client = this.sdkConfiguration.defaultClient;
1756
+ globalSecurity = this.sdkConfiguration.security;
1757
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1758
+ return [4 /*yield*/, globalSecurity()];
1759
+ case 1:
1760
+ globalSecurity = _e.sent();
1761
+ _e.label = 2;
1762
+ case 2:
1763
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1764
+ globalSecurity = new shared.Security(globalSecurity);
1765
+ }
1766
+ properties = utils.parseSecurityProperties(globalSecurity);
1767
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1768
+ if (reqBody == null)
1769
+ throw new Error("request body is required");
1770
+ headers["Accept"] = "application/json";
1771
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1772
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1773
+ case 3:
1774
+ httpRes = _e.sent();
1775
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1776
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1777
+ throw new Error("status code not found in response: ".concat(httpRes));
1778
+ }
1779
+ res = new operations.PostSessionSessionIdFeedbackResponse({
1780
+ statusCode: httpRes.status,
1781
+ contentType: contentType,
1782
+ rawResponse: httpRes,
1783
+ });
1784
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1785
+ switch (true) {
1786
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1787
+ if (utils.matchContentType(contentType, "application/json")) {
1788
+ res.successResponse = utils.objectToClass(JSON.parse(decodedRes), shared.SuccessResponse);
1789
+ }
1790
+ else {
1791
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1792
+ }
1793
+ break;
1794
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1795
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1796
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1797
+ }
1798
+ return [2 /*return*/, res];
1799
+ }
1800
+ });
1801
+ });
1802
+ };
1803
+ /**
1804
+ * Log a trace
1805
+ */
1806
+ HoneyHive.prototype.postSessionsSessionIdTraces = function (req, config) {
1807
+ var _a, _b;
1808
+ return __awaiter(this, void 0, void 0, function () {
1809
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1810
+ var _d;
1811
+ return __generator(this, function (_e) {
1812
+ switch (_e.label) {
1813
+ case 0:
1814
+ if (!(req instanceof utils.SpeakeasyBase)) {
1815
+ req = new operations.PostSessionsSessionIdTracesRequest(req);
1816
+ }
1817
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1818
+ url = utils.generateURL(baseURL, "/sessions/{session_id}/traces", req);
1819
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1820
+ try {
1821
+ _d = __read(utils.serializeRequestBody(req, "sessionTrace", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1822
+ }
1823
+ catch (e) {
1824
+ if (e instanceof Error) {
1825
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1826
+ }
1827
+ }
1828
+ client = this.sdkConfiguration.defaultClient;
1829
+ globalSecurity = this.sdkConfiguration.security;
1830
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1831
+ return [4 /*yield*/, globalSecurity()];
1832
+ case 1:
1833
+ globalSecurity = _e.sent();
1834
+ _e.label = 2;
1835
+ case 2:
1836
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1837
+ globalSecurity = new shared.Security(globalSecurity);
1838
+ }
1839
+ properties = utils.parseSecurityProperties(globalSecurity);
1840
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1841
+ if (reqBody == null)
1842
+ throw new Error("request body is required");
1843
+ headers["Accept"] = "application/json";
1844
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1845
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1846
+ case 3:
1847
+ httpRes = _e.sent();
1848
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1849
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1850
+ throw new Error("status code not found in response: ".concat(httpRes));
1851
+ }
1852
+ res = new operations.PostSessionsSessionIdTracesResponse({
1853
+ statusCode: httpRes.status,
1854
+ contentType: contentType,
1855
+ rawResponse: httpRes,
1856
+ });
1857
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1858
+ switch (true) {
1859
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1860
+ if (utils.matchContentType(contentType, "application/json")) {
1861
+ res.successTraceResponse = utils.objectToClass(JSON.parse(decodedRes), shared.SuccessTraceResponse);
1862
+ }
1863
+ else {
1864
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1865
+ }
1866
+ break;
1867
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1868
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1869
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1870
+ }
1871
+ return [2 /*return*/, res];
1872
+ }
1873
+ });
1874
+ });
1875
+ };
1876
+ /**
1877
+ * Create a task
1878
+ */
1879
+ HoneyHive.prototype.postTasks = function (req, config) {
1880
+ var _a, _b;
1881
+ return __awaiter(this, void 0, void 0, function () {
1882
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1883
+ var _d;
1884
+ return __generator(this, function (_e) {
1885
+ switch (_e.label) {
1886
+ case 0:
1887
+ if (!(req instanceof utils.SpeakeasyBase)) {
1888
+ req = new shared.TaskCreationQuery(req);
1889
+ }
1890
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1891
+ url = baseURL.replace(/\/$/, "") + "/tasks";
1892
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1893
+ try {
1894
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1895
+ }
1896
+ catch (e) {
1897
+ if (e instanceof Error) {
1898
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1899
+ }
1900
+ }
1901
+ client = this.sdkConfiguration.defaultClient;
1902
+ globalSecurity = this.sdkConfiguration.security;
1903
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1904
+ return [4 /*yield*/, globalSecurity()];
1905
+ case 1:
1906
+ globalSecurity = _e.sent();
1907
+ _e.label = 2;
1908
+ case 2:
1909
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1910
+ globalSecurity = new shared.Security(globalSecurity);
1911
+ }
1912
+ properties = utils.parseSecurityProperties(globalSecurity);
1913
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1914
+ if (reqBody == null)
1915
+ throw new Error("request body is required");
1916
+ headers["Accept"] = "application/json";
1917
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1918
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1919
+ case 3:
1920
+ httpRes = _e.sent();
1921
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1922
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1923
+ throw new Error("status code not found in response: ".concat(httpRes));
1924
+ }
1925
+ res = new operations.PostTasksResponse({
1926
+ statusCode: httpRes.status,
1927
+ contentType: contentType,
1928
+ rawResponse: httpRes,
1929
+ });
1930
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1931
+ switch (true) {
1932
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1933
+ if (utils.matchContentType(contentType, "application/json")) {
1934
+ res.taskResponse = utils.objectToClass(JSON.parse(decodedRes), shared.TaskResponse);
1935
+ }
1936
+ else {
1937
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1938
+ }
1939
+ break;
1940
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1941
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1942
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1943
+ }
1944
+ return [2 /*return*/, res];
1945
+ }
1946
+ });
1947
+ });
1948
+ };
1949
+ /**
1950
+ * Update a prompt
1951
+ */
1952
+ HoneyHive.prototype.putPromptsId = function (req, config) {
1953
+ var _a, _b;
1954
+ return __awaiter(this, void 0, void 0, function () {
1955
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1956
+ var _d;
1957
+ return __generator(this, function (_e) {
1958
+ switch (_e.label) {
1959
+ case 0:
1960
+ if (!(req instanceof utils.SpeakeasyBase)) {
1961
+ req = new operations.PutPromptsIdRequest(req);
1962
+ }
1963
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1964
+ url = utils.generateURL(baseURL, "/prompts/{id}", req);
1965
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1966
+ try {
1967
+ _d = __read(utils.serializeRequestBody(req, "promptUpdateQuery", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1968
+ }
1969
+ catch (e) {
1970
+ if (e instanceof Error) {
1971
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1972
+ }
1973
+ }
1974
+ client = this.sdkConfiguration.defaultClient;
1975
+ globalSecurity = this.sdkConfiguration.security;
1976
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1977
+ return [4 /*yield*/, globalSecurity()];
1978
+ case 1:
1979
+ globalSecurity = _e.sent();
1980
+ _e.label = 2;
1981
+ case 2:
1982
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1983
+ globalSecurity = new shared.Security(globalSecurity);
1984
+ }
1985
+ properties = utils.parseSecurityProperties(globalSecurity);
1986
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1987
+ if (reqBody == null)
1988
+ throw new Error("request body is required");
1989
+ headers["Accept"] = "application/json";
1990
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1991
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1992
+ case 3:
1993
+ httpRes = _e.sent();
1994
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1995
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1996
+ throw new Error("status code not found in response: ".concat(httpRes));
1997
+ }
1998
+ res = new operations.PutPromptsIdResponse({
1999
+ statusCode: httpRes.status,
2000
+ contentType: contentType,
2001
+ rawResponse: httpRes,
2002
+ });
2003
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
2004
+ switch (true) {
2005
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
2006
+ if (utils.matchContentType(contentType, "application/json")) {
2007
+ res.promptResponse = utils.objectToClass(JSON.parse(decodedRes), shared.PromptResponse);
2008
+ }
2009
+ else {
2010
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2011
+ }
2012
+ break;
2013
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
2014
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
2015
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2016
+ }
2017
+ return [2 /*return*/, res];
2018
+ }
2019
+ });
2020
+ });
2021
+ };
2022
+ /**
2023
+ * Update a task
2024
+ */
2025
+ HoneyHive.prototype.putTasks = function (req, config) {
2026
+ var _a, _b;
2027
+ return __awaiter(this, void 0, void 0, function () {
2028
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
2029
+ var _d;
2030
+ return __generator(this, function (_e) {
2031
+ switch (_e.label) {
2032
+ case 0:
2033
+ if (!(req instanceof utils.SpeakeasyBase)) {
2034
+ req = new shared.TaskUpdateQuery(req);
2035
+ }
2036
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
2037
+ url = baseURL.replace(/\/$/, "") + "/tasks";
2038
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
2039
+ try {
2040
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
2041
+ }
2042
+ catch (e) {
2043
+ if (e instanceof Error) {
2044
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
2045
+ }
2046
+ }
2047
+ client = this.sdkConfiguration.defaultClient;
2048
+ globalSecurity = this.sdkConfiguration.security;
2049
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
2050
+ return [4 /*yield*/, globalSecurity()];
2051
+ case 1:
2052
+ globalSecurity = _e.sent();
2053
+ _e.label = 2;
2054
+ case 2:
2055
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
2056
+ globalSecurity = new shared.Security(globalSecurity);
2057
+ }
2058
+ properties = utils.parseSecurityProperties(globalSecurity);
2059
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
2060
+ if (reqBody == null)
2061
+ throw new Error("request body is required");
2062
+ headers["Accept"] = "application/json";
2063
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
2064
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
2065
+ case 3:
2066
+ httpRes = _e.sent();
2067
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
2068
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
2069
+ throw new Error("status code not found in response: ".concat(httpRes));
2070
+ }
2071
+ res = new operations.PutTasksResponse({
2072
+ statusCode: httpRes.status,
2073
+ contentType: contentType,
2074
+ rawResponse: httpRes,
2075
+ });
2076
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
2077
+ switch (true) {
2078
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
2079
+ if (utils.matchContentType(contentType, "application/json")) {
2080
+ res.taskUpdateResponse = utils.objectToClass(JSON.parse(decodedRes), shared.TaskUpdateResponse);
2081
+ }
2082
+ else {
2083
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2084
+ }
2085
+ break;
2086
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
2087
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
2088
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2089
+ }
2090
+ return [2 /*return*/, res];
2091
+ }
2092
+ });
2093
+ });
2094
+ };
2095
+ return HoneyHive;
2096
+ }());
2097
+ exports.HoneyHive = HoneyHive;