@roarkanalytics/sdk 2.21.0 → 2.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (419) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +83 -45
  3. package/api-promise.d.mts +47 -0
  4. package/api-promise.d.mts.map +1 -0
  5. package/api-promise.d.ts +47 -0
  6. package/api-promise.d.ts.map +1 -0
  7. package/api-promise.js +84 -0
  8. package/api-promise.js.map +1 -0
  9. package/api-promise.mjs +80 -0
  10. package/api-promise.mjs.map +1 -0
  11. package/client.d.mts +201 -0
  12. package/client.d.mts.map +1 -0
  13. package/client.d.ts +201 -0
  14. package/client.d.ts.map +1 -0
  15. package/client.js +454 -0
  16. package/client.js.map +1 -0
  17. package/client.mjs +427 -0
  18. package/client.mjs.map +1 -0
  19. package/error.d.mts +47 -0
  20. package/error.d.mts.map +1 -0
  21. package/error.d.ts +1 -1
  22. package/error.d.ts.map +1 -1
  23. package/error.js +2 -2
  24. package/error.js.map +1 -1
  25. package/error.mjs +1 -1
  26. package/error.mjs.map +1 -1
  27. package/index.d.mts +4 -130
  28. package/index.d.mts.map +1 -0
  29. package/index.d.ts +4 -130
  30. package/index.d.ts.map +1 -1
  31. package/index.js +10 -128
  32. package/index.js.map +1 -1
  33. package/index.mjs +4 -102
  34. package/index.mjs.map +1 -1
  35. package/internal/builtin-types.d.mts +65 -0
  36. package/internal/builtin-types.d.mts.map +1 -0
  37. package/internal/builtin-types.d.ts +65 -0
  38. package/internal/builtin-types.d.ts.map +1 -0
  39. package/internal/builtin-types.js +4 -0
  40. package/internal/builtin-types.js.map +1 -0
  41. package/internal/builtin-types.mjs +3 -0
  42. package/internal/builtin-types.mjs.map +1 -0
  43. package/internal/detect-platform.d.mts +15 -0
  44. package/internal/detect-platform.d.mts.map +1 -0
  45. package/internal/detect-platform.d.ts +15 -0
  46. package/internal/detect-platform.d.ts.map +1 -0
  47. package/internal/detect-platform.js +162 -0
  48. package/internal/detect-platform.js.map +1 -0
  49. package/internal/detect-platform.mjs +157 -0
  50. package/internal/detect-platform.mjs.map +1 -0
  51. package/internal/errors.d.mts +3 -0
  52. package/internal/errors.d.mts.map +1 -0
  53. package/internal/errors.d.ts +3 -0
  54. package/internal/errors.d.ts.map +1 -0
  55. package/internal/errors.js +26 -0
  56. package/internal/errors.js.map +1 -0
  57. package/internal/errors.mjs +21 -0
  58. package/internal/errors.mjs.map +1 -0
  59. package/internal/headers.d.mts +21 -0
  60. package/internal/headers.d.mts.map +1 -0
  61. package/internal/headers.d.ts +21 -0
  62. package/internal/headers.d.ts.map +1 -0
  63. package/internal/headers.js +77 -0
  64. package/internal/headers.js.map +1 -0
  65. package/internal/headers.mjs +72 -0
  66. package/internal/headers.mjs.map +1 -0
  67. package/internal/parse.d.mts +10 -0
  68. package/internal/parse.d.mts.map +1 -0
  69. package/internal/parse.d.ts +10 -0
  70. package/internal/parse.d.ts.map +1 -0
  71. package/internal/parse.js +28 -0
  72. package/internal/parse.js.map +1 -0
  73. package/internal/parse.mjs +24 -0
  74. package/internal/parse.mjs.map +1 -0
  75. package/internal/polyfill/crypto.node.d.ts +10 -0
  76. package/internal/polyfill/crypto.node.js +11 -0
  77. package/internal/polyfill/crypto.node.mjs +2 -0
  78. package/internal/polyfill/file.node.d.ts +9 -0
  79. package/internal/polyfill/file.node.js +17 -0
  80. package/internal/polyfill/file.node.mjs +9 -0
  81. package/internal/qs/formats.d.mts +6 -0
  82. package/internal/qs/formats.d.mts.map +1 -0
  83. package/internal/qs/formats.d.ts.map +1 -1
  84. package/internal/qs/index.d.mts +10 -0
  85. package/internal/qs/index.d.mts.map +1 -0
  86. package/internal/qs/index.d.ts.map +1 -1
  87. package/internal/qs/stringify.d.mts +3 -0
  88. package/internal/qs/stringify.d.mts.map +1 -0
  89. package/internal/qs/stringify.d.ts.map +1 -1
  90. package/internal/qs/types.d.mts +57 -0
  91. package/internal/qs/types.d.mts.map +1 -0
  92. package/internal/qs/utils.d.mts +14 -0
  93. package/internal/qs/utils.d.mts.map +1 -0
  94. package/internal/qs/utils.d.ts.map +1 -1
  95. package/internal/request-options.d.mts +34 -0
  96. package/internal/request-options.d.mts.map +1 -0
  97. package/internal/request-options.d.ts +34 -0
  98. package/internal/request-options.d.ts.map +1 -0
  99. package/internal/request-options.js +39 -0
  100. package/internal/request-options.js.map +1 -0
  101. package/internal/request-options.mjs +34 -0
  102. package/internal/request-options.mjs.map +1 -0
  103. package/internal/shim-types.d.mts +28 -0
  104. package/internal/shim-types.d.ts +28 -0
  105. package/internal/shims.d.mts +61 -0
  106. package/internal/shims.d.mts.map +1 -0
  107. package/internal/shims.d.ts +61 -0
  108. package/internal/shims.d.ts.map +1 -0
  109. package/internal/shims.js +101 -0
  110. package/internal/shims.js.map +1 -0
  111. package/internal/shims.mjs +92 -0
  112. package/internal/shims.mjs.map +1 -0
  113. package/internal/types.d.mts +68 -0
  114. package/internal/types.d.mts.map +1 -0
  115. package/internal/types.d.ts +68 -0
  116. package/internal/types.d.ts.map +1 -0
  117. package/internal/types.js +4 -0
  118. package/internal/types.js.map +1 -0
  119. package/internal/types.mjs +3 -0
  120. package/internal/types.mjs.map +1 -0
  121. package/internal/uploads.d.mts +73 -0
  122. package/internal/uploads.d.mts.map +1 -0
  123. package/internal/uploads.d.ts +73 -0
  124. package/internal/uploads.d.ts.map +1 -0
  125. package/internal/uploads.js +208 -0
  126. package/internal/uploads.js.map +1 -0
  127. package/internal/uploads.mjs +200 -0
  128. package/internal/uploads.mjs.map +1 -0
  129. package/internal/utils/base64.d.mts +3 -0
  130. package/internal/utils/base64.d.mts.map +1 -0
  131. package/internal/utils/base64.d.ts +3 -0
  132. package/internal/utils/base64.d.ts.map +1 -0
  133. package/internal/utils/base64.js +33 -0
  134. package/internal/utils/base64.js.map +1 -0
  135. package/internal/utils/base64.mjs +28 -0
  136. package/internal/utils/base64.mjs.map +1 -0
  137. package/internal/utils/env.d.mts +9 -0
  138. package/internal/utils/env.d.mts.map +1 -0
  139. package/internal/utils/env.d.ts +9 -0
  140. package/internal/utils/env.d.ts.map +1 -0
  141. package/internal/utils/env.js +22 -0
  142. package/internal/utils/env.js.map +1 -0
  143. package/internal/utils/env.mjs +18 -0
  144. package/internal/utils/env.mjs.map +1 -0
  145. package/internal/utils/log.d.mts +4 -0
  146. package/internal/utils/log.d.mts.map +1 -0
  147. package/internal/utils/log.d.ts +4 -0
  148. package/internal/utils/log.d.ts.map +1 -0
  149. package/internal/utils/log.js +47 -0
  150. package/internal/utils/log.js.map +1 -0
  151. package/internal/utils/log.mjs +43 -0
  152. package/internal/utils/log.mjs.map +1 -0
  153. package/internal/utils/sleep.d.mts +2 -0
  154. package/internal/utils/sleep.d.mts.map +1 -0
  155. package/internal/utils/sleep.d.ts +2 -0
  156. package/internal/utils/sleep.d.ts.map +1 -0
  157. package/internal/utils/sleep.js +7 -0
  158. package/internal/utils/sleep.js.map +1 -0
  159. package/internal/utils/sleep.mjs +3 -0
  160. package/internal/utils/sleep.mjs.map +1 -0
  161. package/internal/utils/uuid.d.mts +5 -0
  162. package/internal/utils/uuid.d.mts.map +1 -0
  163. package/internal/utils/uuid.d.ts +5 -0
  164. package/internal/utils/uuid.d.ts.map +1 -0
  165. package/internal/utils/uuid.js +15 -0
  166. package/internal/utils/uuid.js.map +1 -0
  167. package/internal/utils/uuid.mjs +11 -0
  168. package/internal/utils/uuid.mjs.map +1 -0
  169. package/internal/utils/values.d.mts +15 -0
  170. package/internal/utils/values.d.mts.map +1 -0
  171. package/internal/utils/values.d.ts +15 -0
  172. package/internal/utils/values.d.ts.map +1 -0
  173. package/internal/utils/values.js +100 -0
  174. package/internal/utils/values.js.map +1 -0
  175. package/internal/utils/values.mjs +84 -0
  176. package/internal/utils/values.mjs.map +1 -0
  177. package/internal/utils.d.mts +7 -0
  178. package/internal/utils.d.mts.map +1 -0
  179. package/internal/utils.d.ts +7 -0
  180. package/internal/utils.d.ts.map +1 -0
  181. package/{_shims/auto/runtime-bun.js → internal/utils.js} +8 -5
  182. package/internal/utils.js.map +1 -0
  183. package/internal/utils.mjs +8 -0
  184. package/internal/utils.mjs.map +1 -0
  185. package/package.json +83 -66
  186. package/resource.d.mts +6 -0
  187. package/resource.d.mts.map +1 -0
  188. package/resource.d.ts +2 -2
  189. package/resource.d.ts.map +1 -1
  190. package/resource.js.map +1 -1
  191. package/resource.mjs.map +1 -1
  192. package/resources/call.d.mts +1197 -0
  193. package/resources/call.d.mts.map +1 -0
  194. package/resources/call.d.ts +13 -24
  195. package/resources/call.d.ts.map +1 -1
  196. package/resources/call.js +15 -15
  197. package/resources/call.js.map +1 -1
  198. package/resources/call.mjs +15 -15
  199. package/resources/call.mjs.map +1 -1
  200. package/resources/evaluation.d.mts +1295 -0
  201. package/resources/evaluation.d.mts.map +1 -0
  202. package/resources/evaluation.d.ts +13 -26
  203. package/resources/evaluation.d.ts.map +1 -1
  204. package/resources/evaluation.js +13 -13
  205. package/resources/evaluation.js.map +1 -1
  206. package/resources/evaluation.mjs +13 -13
  207. package/resources/evaluation.mjs.map +1 -1
  208. package/resources/health.d.mts +29 -0
  209. package/resources/health.d.mts.map +1 -0
  210. package/resources/health.d.ts +3 -2
  211. package/resources/health.d.ts.map +1 -1
  212. package/resources/health.js.map +1 -1
  213. package/resources/health.mjs.map +1 -1
  214. package/resources/index.d.mts +8 -0
  215. package/resources/index.d.mts.map +1 -0
  216. package/resources/index.d.ts.map +1 -1
  217. package/resources/integrations.d.mts +81 -0
  218. package/resources/integrations.d.mts.map +1 -0
  219. package/resources/integrations.d.ts +8 -40
  220. package/resources/integrations.d.ts.map +1 -1
  221. package/resources/integrations.js +0 -25
  222. package/resources/integrations.js.map +1 -1
  223. package/resources/integrations.mjs +0 -25
  224. package/resources/integrations.mjs.map +1 -1
  225. package/resources/metric.d.mts +75 -0
  226. package/resources/metric.d.mts.map +1 -0
  227. package/resources/metric.d.ts +3 -2
  228. package/resources/metric.d.ts.map +1 -1
  229. package/resources/metric.js.map +1 -1
  230. package/resources/metric.mjs.map +1 -1
  231. package/resources/persona.d.mts +491 -0
  232. package/resources/persona.d.mts.map +1 -0
  233. package/resources/persona.d.ts +13 -51
  234. package/resources/persona.d.ts.map +1 -1
  235. package/resources/persona.js +10 -26
  236. package/resources/persona.js.map +1 -1
  237. package/resources/persona.mjs +10 -26
  238. package/resources/persona.mjs.map +1 -1
  239. package/resources/simulation.d.mts +756 -0
  240. package/resources/simulation.d.mts.map +1 -0
  241. package/resources/simulation.d.ts +11 -58
  242. package/resources/simulation.d.ts.map +1 -1
  243. package/resources/simulation.js +13 -43
  244. package/resources/simulation.js.map +1 -1
  245. package/resources/simulation.mjs +13 -43
  246. package/resources/simulation.mjs.map +1 -1
  247. package/src/api-promise.ts +92 -0
  248. package/src/client.ts +751 -0
  249. package/src/error.ts +1 -1
  250. package/src/index.ts +4 -307
  251. package/src/internal/builtin-types.ts +79 -0
  252. package/src/internal/detect-platform.ts +196 -0
  253. package/src/internal/errors.ts +22 -0
  254. package/src/internal/headers.ts +96 -0
  255. package/src/internal/parse.ts +41 -0
  256. package/src/internal/polyfill/crypto.node.d.ts +10 -0
  257. package/src/internal/polyfill/crypto.node.js +11 -0
  258. package/src/internal/polyfill/crypto.node.mjs +2 -0
  259. package/src/internal/polyfill/file.node.d.ts +9 -0
  260. package/src/internal/polyfill/file.node.js +17 -0
  261. package/src/internal/polyfill/file.node.mjs +9 -0
  262. package/src/internal/request-options.ts +67 -0
  263. package/src/internal/shim-types.d.ts +28 -0
  264. package/src/internal/shims.ts +145 -0
  265. package/src/internal/types.ts +98 -0
  266. package/src/internal/uploads.ts +307 -0
  267. package/src/internal/utils/base64.ts +37 -0
  268. package/src/internal/utils/env.ts +18 -0
  269. package/src/internal/utils/log.ts +49 -0
  270. package/src/internal/utils/sleep.ts +3 -0
  271. package/src/internal/utils/uuid.ts +13 -0
  272. package/src/internal/utils/values.ts +94 -0
  273. package/src/internal/utils.ts +8 -0
  274. package/src/resource.ts +2 -2
  275. package/src/resources/call.ts +22 -42
  276. package/src/resources/evaluation.ts +25 -42
  277. package/src/resources/health.ts +3 -2
  278. package/src/resources/integrations.ts +10 -34
  279. package/src/resources/metric.ts +3 -2
  280. package/src/resources/persona.ts +22 -61
  281. package/src/resources/simulation.ts +22 -84
  282. package/src/tsconfig.json +2 -2
  283. package/src/uploads.ts +1 -255
  284. package/src/version.ts +1 -1
  285. package/uploads.d.mts +2 -0
  286. package/uploads.d.mts.map +1 -0
  287. package/uploads.d.ts +1 -74
  288. package/uploads.d.ts.map +1 -1
  289. package/uploads.js +3 -168
  290. package/uploads.js.map +1 -1
  291. package/uploads.mjs +1 -157
  292. package/uploads.mjs.map +1 -1
  293. package/version.d.mts +2 -0
  294. package/version.d.mts.map +1 -0
  295. package/version.d.ts +1 -1
  296. package/version.js +1 -1
  297. package/version.mjs +1 -1
  298. package/_shims/MultipartBody.d.ts +0 -9
  299. package/_shims/MultipartBody.d.ts.map +0 -1
  300. package/_shims/MultipartBody.js +0 -16
  301. package/_shims/MultipartBody.js.map +0 -1
  302. package/_shims/MultipartBody.mjs +0 -12
  303. package/_shims/MultipartBody.mjs.map +0 -1
  304. package/_shims/README.md +0 -46
  305. package/_shims/auto/runtime-bun.d.ts +0 -5
  306. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  307. package/_shims/auto/runtime-bun.js.map +0 -1
  308. package/_shims/auto/runtime-bun.mjs +0 -2
  309. package/_shims/auto/runtime-bun.mjs.map +0 -1
  310. package/_shims/auto/runtime-node.d.ts +0 -5
  311. package/_shims/auto/runtime-node.d.ts.map +0 -1
  312. package/_shims/auto/runtime-node.js +0 -21
  313. package/_shims/auto/runtime-node.js.map +0 -1
  314. package/_shims/auto/runtime-node.mjs +0 -2
  315. package/_shims/auto/runtime-node.mjs.map +0 -1
  316. package/_shims/auto/runtime.d.ts +0 -5
  317. package/_shims/auto/runtime.d.ts.map +0 -1
  318. package/_shims/auto/runtime.js +0 -21
  319. package/_shims/auto/runtime.js.map +0 -1
  320. package/_shims/auto/runtime.mjs +0 -2
  321. package/_shims/auto/runtime.mjs.map +0 -1
  322. package/_shims/auto/types-node.d.ts +0 -5
  323. package/_shims/auto/types-node.d.ts.map +0 -1
  324. package/_shims/auto/types-node.js +0 -21
  325. package/_shims/auto/types-node.js.map +0 -1
  326. package/_shims/auto/types-node.mjs +0 -2
  327. package/_shims/auto/types-node.mjs.map +0 -1
  328. package/_shims/auto/types.d.ts +0 -101
  329. package/_shims/auto/types.js +0 -3
  330. package/_shims/auto/types.mjs +0 -3
  331. package/_shims/bun-runtime.d.ts +0 -6
  332. package/_shims/bun-runtime.d.ts.map +0 -1
  333. package/_shims/bun-runtime.js +0 -14
  334. package/_shims/bun-runtime.js.map +0 -1
  335. package/_shims/bun-runtime.mjs +0 -10
  336. package/_shims/bun-runtime.mjs.map +0 -1
  337. package/_shims/index.d.ts +0 -83
  338. package/_shims/index.js +0 -17
  339. package/_shims/index.mjs +0 -11
  340. package/_shims/manual-types.d.ts +0 -12
  341. package/_shims/manual-types.js +0 -3
  342. package/_shims/manual-types.mjs +0 -3
  343. package/_shims/node-runtime.d.ts +0 -3
  344. package/_shims/node-runtime.d.ts.map +0 -1
  345. package/_shims/node-runtime.js +0 -89
  346. package/_shims/node-runtime.js.map +0 -1
  347. package/_shims/node-runtime.mjs +0 -56
  348. package/_shims/node-runtime.mjs.map +0 -1
  349. package/_shims/node-types.d.ts +0 -42
  350. package/_shims/node-types.js +0 -3
  351. package/_shims/node-types.mjs +0 -3
  352. package/_shims/registry.d.ts +0 -37
  353. package/_shims/registry.d.ts.map +0 -1
  354. package/_shims/registry.js +0 -41
  355. package/_shims/registry.js.map +0 -1
  356. package/_shims/registry.mjs +0 -37
  357. package/_shims/registry.mjs.map +0 -1
  358. package/_shims/web-runtime.d.ts +0 -5
  359. package/_shims/web-runtime.d.ts.map +0 -1
  360. package/_shims/web-runtime.js +0 -78
  361. package/_shims/web-runtime.js.map +0 -1
  362. package/_shims/web-runtime.mjs +0 -71
  363. package/_shims/web-runtime.mjs.map +0 -1
  364. package/_shims/web-types.d.ts +0 -83
  365. package/_shims/web-types.js +0 -3
  366. package/_shims/web-types.mjs +0 -3
  367. package/core.d.ts +0 -255
  368. package/core.d.ts.map +0 -1
  369. package/core.js +0 -929
  370. package/core.js.map +0 -1
  371. package/core.mjs +0 -897
  372. package/core.mjs.map +0 -1
  373. package/resources.d.ts +0 -2
  374. package/resources.d.ts.map +0 -1
  375. package/resources.js +0 -18
  376. package/resources.js.map +0 -1
  377. package/resources.mjs +0 -2
  378. package/resources.mjs.map +0 -1
  379. package/shims/node.d.ts +0 -30
  380. package/shims/node.d.ts.map +0 -1
  381. package/shims/node.js +0 -31
  382. package/shims/node.js.map +0 -1
  383. package/shims/node.mjs +0 -5
  384. package/shims/node.mjs.map +0 -1
  385. package/shims/web.d.ts +0 -26
  386. package/shims/web.d.ts.map +0 -1
  387. package/shims/web.js +0 -31
  388. package/shims/web.js.map +0 -1
  389. package/shims/web.mjs +0 -5
  390. package/shims/web.mjs.map +0 -1
  391. package/src/_shims/MultipartBody.ts +0 -9
  392. package/src/_shims/README.md +0 -46
  393. package/src/_shims/auto/runtime-bun.ts +0 -4
  394. package/src/_shims/auto/runtime-node.ts +0 -4
  395. package/src/_shims/auto/runtime.ts +0 -4
  396. package/src/_shims/auto/types-node.ts +0 -4
  397. package/src/_shims/auto/types.d.ts +0 -101
  398. package/src/_shims/auto/types.js +0 -3
  399. package/src/_shims/auto/types.mjs +0 -3
  400. package/src/_shims/bun-runtime.ts +0 -14
  401. package/src/_shims/index.d.ts +0 -83
  402. package/src/_shims/index.js +0 -17
  403. package/src/_shims/index.mjs +0 -11
  404. package/src/_shims/manual-types.d.ts +0 -12
  405. package/src/_shims/manual-types.js +0 -3
  406. package/src/_shims/manual-types.mjs +0 -3
  407. package/src/_shims/node-runtime.ts +0 -81
  408. package/src/_shims/node-types.d.ts +0 -42
  409. package/src/_shims/node-types.js +0 -3
  410. package/src/_shims/node-types.mjs +0 -3
  411. package/src/_shims/registry.ts +0 -67
  412. package/src/_shims/web-runtime.ts +0 -103
  413. package/src/_shims/web-types.d.ts +0 -83
  414. package/src/_shims/web-types.js +0 -3
  415. package/src/_shims/web-types.mjs +0 -3
  416. package/src/core.ts +0 -1242
  417. package/src/resources.ts +0 -1
  418. package/src/shims/node.ts +0 -50
  419. package/src/shims/web.ts +0 -50
package/src/client.ts ADDED
@@ -0,0 +1,751 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types';
4
+ import type { HTTPMethod, PromiseOrValue, MergedRequestInit } from './internal/types';
5
+ import { uuid4 } from './internal/utils/uuid';
6
+ import { validatePositiveInteger, isAbsoluteURL } from './internal/utils/values';
7
+ import { sleep } from './internal/utils/sleep';
8
+ import { castToError, isAbortError } from './internal/errors';
9
+ import type { APIResponseProps } from './internal/parse';
10
+ import { getPlatformHeaders } from './internal/detect-platform';
11
+ import * as Shims from './internal/shims';
12
+ import * as Opts from './internal/request-options';
13
+ import * as qs from './internal/qs';
14
+ import { VERSION } from './version';
15
+ import * as Errors from './error';
16
+ import * as Uploads from './uploads';
17
+ import * as API from './resources/index';
18
+ import { APIPromise } from './api-promise';
19
+ import { type Fetch } from './internal/builtin-types';
20
+ import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
21
+ import { FinalRequestOptions, RequestOptions } from './internal/request-options';
22
+ import {
23
+ Call,
24
+ CallCreateParams,
25
+ CallCreateResponse,
26
+ CallGetByIDResponse,
27
+ CallListEvaluationRunsResponse,
28
+ CallListMetricsParams,
29
+ CallListMetricsResponse,
30
+ CallListParams,
31
+ CallListResponse,
32
+ CallListSentimentRunsResponse,
33
+ } from './resources/call';
34
+ import {
35
+ Evaluation,
36
+ EvaluationCreateJobParams,
37
+ EvaluationCreateJobResponse,
38
+ EvaluationGetEvaluatorByIDResponse,
39
+ EvaluationGetJobResponse,
40
+ EvaluationListEvaluatorsParams,
41
+ EvaluationListEvaluatorsResponse,
42
+ EvaluationListJobRunsParams,
43
+ EvaluationListJobRunsResponse,
44
+ } from './resources/evaluation';
45
+ import { Health, HealthGetResponse } from './resources/health';
46
+ import {
47
+ IntegrationCreateRetellCallParams,
48
+ IntegrationCreateRetellCallResponse,
49
+ IntegrationCreateVapiCallParams,
50
+ IntegrationCreateVapiCallResponse,
51
+ Integrations,
52
+ } from './resources/integrations';
53
+ import { Metric, MetricListDefinitionsResponse } from './resources/metric';
54
+ import {
55
+ Persona,
56
+ PersonaCreateParams,
57
+ PersonaCreateResponse,
58
+ PersonaGetByIDResponse,
59
+ PersonaListParams,
60
+ PersonaListResponse,
61
+ PersonaUpdateParams,
62
+ PersonaUpdateResponse,
63
+ } from './resources/persona';
64
+ import {
65
+ Simulation,
66
+ SimulationGetRunPlanJobResponse,
67
+ SimulationGetSimulationJobByIDResponse,
68
+ SimulationListRunPlanJobsParams,
69
+ SimulationListRunPlanJobsResponse,
70
+ SimulationListScenariosParams,
71
+ SimulationListScenariosResponse,
72
+ SimulationLookupSimulationJobParams,
73
+ SimulationLookupSimulationJobResponse,
74
+ SimulationStartRunPlanJobResponse,
75
+ } from './resources/simulation';
76
+ import { readEnv } from './internal/utils/env';
77
+ import { logger } from './internal/utils/log';
78
+ import { isEmptyObj } from './internal/utils/values';
79
+
80
+ const safeJSON = (text: string) => {
81
+ try {
82
+ return JSON.parse(text);
83
+ } catch (err) {
84
+ return undefined;
85
+ }
86
+ };
87
+
88
+ type LogFn = (message: string, ...rest: unknown[]) => void;
89
+ export type Logger = {
90
+ error: LogFn;
91
+ warn: LogFn;
92
+ info: LogFn;
93
+ debug: LogFn;
94
+ };
95
+ export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
96
+ const isLogLevel = (key: string | undefined): key is LogLevel => {
97
+ const levels: Record<LogLevel, true> = {
98
+ off: true,
99
+ error: true,
100
+ warn: true,
101
+ info: true,
102
+ debug: true,
103
+ };
104
+ return key! in levels;
105
+ };
106
+
107
+ export interface ClientOptions {
108
+ /**
109
+ * JWT token for authentication
110
+ */
111
+ bearerToken?: string | undefined;
112
+
113
+ /**
114
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
115
+ *
116
+ * Defaults to process.env['ROARK_BASE_URL'].
117
+ */
118
+ baseURL?: string | null | undefined;
119
+
120
+ /**
121
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
122
+ * from the server before timing out a single request.
123
+ *
124
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
125
+ * much longer than this timeout before the promise succeeds or fails.
126
+ */
127
+ timeout?: number | undefined;
128
+ /**
129
+ * Additional `RequestInit` options to be passed to `fetch` calls.
130
+ * Properties will be overridden by per-request `fetchOptions`.
131
+ */
132
+ fetchOptions?: MergedRequestInit | undefined;
133
+
134
+ /**
135
+ * Specify a custom `fetch` function implementation.
136
+ *
137
+ * If not provided, we expect that `fetch` is defined globally.
138
+ */
139
+ fetch?: Fetch | undefined;
140
+
141
+ /**
142
+ * The maximum number of times that the client will retry a request in case of a
143
+ * temporary failure, like a network error or a 5XX error from the server.
144
+ *
145
+ * @default 2
146
+ */
147
+ maxRetries?: number | undefined;
148
+
149
+ /**
150
+ * Default headers to include with every request to the API.
151
+ *
152
+ * These can be removed in individual requests by explicitly setting the
153
+ * header to `null` in request options.
154
+ */
155
+ defaultHeaders?: HeadersLike | undefined;
156
+
157
+ /**
158
+ * Default query parameters to include with every request to the API.
159
+ *
160
+ * These can be removed in individual requests by explicitly setting the
161
+ * param to `undefined` in request options.
162
+ */
163
+ defaultQuery?: Record<string, string | undefined> | undefined;
164
+
165
+ /**
166
+ * Set the log level.
167
+ *
168
+ * Defaults to process.env['ROARK_LOG'].
169
+ */
170
+ logLevel?: LogLevel | undefined | null;
171
+
172
+ /**
173
+ * Set the logger.
174
+ *
175
+ * Defaults to globalThis.console.
176
+ */
177
+ logger?: Logger | undefined | null;
178
+ }
179
+
180
+ type FinalizedRequestInit = RequestInit & { headers: Headers };
181
+
182
+ /**
183
+ * API Client for interfacing with the Roark API.
184
+ */
185
+ export class Roark {
186
+ bearerToken: string;
187
+
188
+ baseURL: string;
189
+ maxRetries: number;
190
+ timeout: number;
191
+ logger: Logger | undefined;
192
+ logLevel: LogLevel | undefined;
193
+ fetchOptions: MergedRequestInit | undefined;
194
+
195
+ private fetch: Fetch;
196
+ #encoder: Opts.RequestEncoder;
197
+ protected idempotencyHeader?: string;
198
+ private _options: ClientOptions;
199
+
200
+ /**
201
+ * API Client for interfacing with the Roark API.
202
+ *
203
+ * @param {string | undefined} [opts.bearerToken=process.env['ROARK_API_BEARER_TOKEN'] ?? undefined]
204
+ * @param {string} [opts.baseURL=process.env['ROARK_BASE_URL'] ?? https://api.roark.ai] - Override the default base URL for the API.
205
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
206
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
207
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
208
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
209
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
210
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
211
+ */
212
+ constructor({
213
+ baseURL = readEnv('ROARK_BASE_URL'),
214
+ bearerToken = readEnv('ROARK_API_BEARER_TOKEN'),
215
+ ...opts
216
+ }: ClientOptions = {}) {
217
+ if (bearerToken === undefined) {
218
+ throw new Errors.RoarkError(
219
+ "The ROARK_API_BEARER_TOKEN environment variable is missing or empty; either provide it, or instantiate the Roark client with an bearerToken option, like new Roark({ bearerToken: 'My Bearer Token' }).",
220
+ );
221
+ }
222
+
223
+ const options: ClientOptions = {
224
+ bearerToken,
225
+ ...opts,
226
+ baseURL: baseURL || `https://api.roark.ai`,
227
+ };
228
+
229
+ this.baseURL = options.baseURL!;
230
+ this.timeout = options.timeout ?? Roark.DEFAULT_TIMEOUT /* 1 minute */;
231
+ this.logger = options.logger ?? console;
232
+ if (options.logLevel != null) {
233
+ this.logLevel = options.logLevel;
234
+ } else {
235
+ const envLevel = readEnv('ROARK_LOG');
236
+ if (isLogLevel(envLevel)) {
237
+ this.logLevel = envLevel;
238
+ }
239
+ }
240
+ this.fetchOptions = options.fetchOptions;
241
+ this.maxRetries = options.maxRetries ?? 2;
242
+ this.fetch = options.fetch ?? Shims.getDefaultFetch();
243
+ this.#encoder = Opts.FallbackEncoder;
244
+
245
+ this._options = options;
246
+
247
+ this.bearerToken = bearerToken;
248
+ }
249
+
250
+ protected defaultQuery(): Record<string, string | undefined> | undefined {
251
+ return this._options.defaultQuery;
252
+ }
253
+
254
+ protected validateHeaders({ values, nulls }: NullableHeaders) {
255
+ return;
256
+ }
257
+
258
+ protected authHeaders(opts: FinalRequestOptions): Headers | undefined {
259
+ return new Headers({ Authorization: `Bearer ${this.bearerToken}` });
260
+ }
261
+
262
+ protected stringifyQuery(query: Record<string, unknown>): string {
263
+ return qs.stringify(query, { arrayFormat: 'comma' });
264
+ }
265
+
266
+ private getUserAgent(): string {
267
+ return `${this.constructor.name}/JS ${VERSION}`;
268
+ }
269
+
270
+ protected defaultIdempotencyKey(): string {
271
+ return `stainless-node-retry-${uuid4()}`;
272
+ }
273
+
274
+ protected makeStatusError(
275
+ status: number,
276
+ error: Object,
277
+ message: string | undefined,
278
+ headers: Headers,
279
+ ): Errors.APIError {
280
+ return Errors.APIError.generate(status, error, message, headers);
281
+ }
282
+
283
+ buildURL(path: string, query: Record<string, unknown> | null | undefined): string {
284
+ const url =
285
+ isAbsoluteURL(path) ?
286
+ new URL(path)
287
+ : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
288
+
289
+ const defaultQuery = this.defaultQuery();
290
+ if (!isEmptyObj(defaultQuery)) {
291
+ query = { ...defaultQuery, ...query };
292
+ }
293
+
294
+ if (typeof query === 'object' && query && !Array.isArray(query)) {
295
+ url.search = this.stringifyQuery(query as Record<string, unknown>);
296
+ }
297
+
298
+ return url.toString();
299
+ }
300
+
301
+ private calculateContentLength(body: unknown): string | null {
302
+ if (typeof body === 'string') {
303
+ if (typeof (globalThis as any).Buffer !== 'undefined') {
304
+ return (globalThis as any).Buffer.byteLength(body, 'utf8').toString();
305
+ }
306
+
307
+ if (typeof (globalThis as any).TextEncoder !== 'undefined') {
308
+ const encoder = new (globalThis as any).TextEncoder();
309
+ const encoded = encoder.encode(body);
310
+ return encoded.length.toString();
311
+ }
312
+ } else if (ArrayBuffer.isView(body)) {
313
+ return body.byteLength.toString();
314
+ }
315
+
316
+ return null;
317
+ }
318
+
319
+ /**
320
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
321
+ */
322
+ protected async prepareOptions(options: FinalRequestOptions): Promise<void> {}
323
+
324
+ /**
325
+ * Used as a callback for mutating the given `RequestInit` object.
326
+ *
327
+ * This is useful for cases where you want to add certain headers based off of
328
+ * the request properties, e.g. `method` or `url`.
329
+ */
330
+ protected async prepareRequest(
331
+ request: RequestInit,
332
+ { url, options }: { url: string; options: FinalRequestOptions },
333
+ ): Promise<void> {}
334
+
335
+ get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
336
+ return this.methodRequest('get', path, opts);
337
+ }
338
+
339
+ post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
340
+ return this.methodRequest('post', path, opts);
341
+ }
342
+
343
+ patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
344
+ return this.methodRequest('patch', path, opts);
345
+ }
346
+
347
+ put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
348
+ return this.methodRequest('put', path, opts);
349
+ }
350
+
351
+ delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
352
+ return this.methodRequest('delete', path, opts);
353
+ }
354
+
355
+ private methodRequest<Rsp>(
356
+ method: HTTPMethod,
357
+ path: string,
358
+ opts?: PromiseOrValue<RequestOptions>,
359
+ ): APIPromise<Rsp> {
360
+ return this.request(
361
+ Promise.resolve(opts).then((opts) => {
362
+ return { method, path, ...opts };
363
+ }),
364
+ );
365
+ }
366
+
367
+ request<Rsp>(
368
+ options: PromiseOrValue<FinalRequestOptions>,
369
+ remainingRetries: number | null = null,
370
+ ): APIPromise<Rsp> {
371
+ return new APIPromise(this, this.makeRequest(options, remainingRetries));
372
+ }
373
+
374
+ private async makeRequest(
375
+ optionsInput: PromiseOrValue<FinalRequestOptions>,
376
+ retriesRemaining: number | null,
377
+ ): Promise<APIResponseProps> {
378
+ const options = await optionsInput;
379
+ const maxRetries = options.maxRetries ?? this.maxRetries;
380
+ if (retriesRemaining == null) {
381
+ retriesRemaining = maxRetries;
382
+ }
383
+
384
+ await this.prepareOptions(options);
385
+
386
+ const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
387
+
388
+ await this.prepareRequest(req, { url, options });
389
+
390
+ logger(this).debug('request', url, options, req.headers);
391
+
392
+ if (options.signal?.aborted) {
393
+ throw new Errors.APIUserAbortError();
394
+ }
395
+
396
+ const controller = new AbortController();
397
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
398
+
399
+ if (response instanceof Error) {
400
+ if (options.signal?.aborted) {
401
+ throw new Errors.APIUserAbortError();
402
+ }
403
+ if (retriesRemaining) {
404
+ return this.retryRequest(options, retriesRemaining);
405
+ }
406
+ if (isAbortError(response)) {
407
+ throw new Errors.APIConnectionTimeoutError();
408
+ }
409
+ // detect native connection timeout errors
410
+ // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
411
+ // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
412
+ // others do not provide enough information to distinguish timeouts from other connection errors
413
+ if (/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''))) {
414
+ throw new Errors.APIConnectionTimeoutError();
415
+ }
416
+ throw new Errors.APIConnectionError({ cause: response });
417
+ }
418
+
419
+ if (!response.ok) {
420
+ if (retriesRemaining && this.shouldRetry(response)) {
421
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
422
+ logger(this).debug(`response (error; ${retryMessage})`, response.status, url, response.headers);
423
+ return this.retryRequest(options, retriesRemaining, response.headers);
424
+ }
425
+
426
+ const errText = await response.text().catch((err: any) => castToError(err).message);
427
+ const errJSON = safeJSON(errText);
428
+ const errMessage = errJSON ? undefined : errText;
429
+ const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`;
430
+
431
+ logger(this).debug(
432
+ `response (error; ${retryMessage})`,
433
+ response.status,
434
+ url,
435
+ response.headers,
436
+ errMessage,
437
+ );
438
+
439
+ const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
440
+ throw err;
441
+ }
442
+
443
+ return { response, options, controller };
444
+ }
445
+
446
+ async fetchWithTimeout(
447
+ url: RequestInfo,
448
+ init: RequestInit | undefined,
449
+ ms: number,
450
+ controller: AbortController,
451
+ ): Promise<Response> {
452
+ const { signal, method, ...options } = init || {};
453
+ if (signal) signal.addEventListener('abort', () => controller.abort());
454
+
455
+ const timeout = setTimeout(() => controller.abort(), ms);
456
+
457
+ const isReadableBody = Shims.isReadableLike(options.body);
458
+
459
+ const fetchOptions: RequestInit = {
460
+ signal: controller.signal as any,
461
+ ...(isReadableBody ? { duplex: 'half' } : {}),
462
+ method: 'GET',
463
+ ...options,
464
+ };
465
+ if (method) {
466
+ // Custom methods like 'patch' need to be uppercased
467
+ // See https://github.com/nodejs/undici/issues/2294
468
+ fetchOptions.method = method.toUpperCase();
469
+ }
470
+
471
+ return (
472
+ // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
473
+ this.fetch.call(undefined, url, fetchOptions).finally(() => {
474
+ clearTimeout(timeout);
475
+ })
476
+ );
477
+ }
478
+
479
+ private shouldRetry(response: Response): boolean {
480
+ // Note this is not a standard header.
481
+ const shouldRetryHeader = response.headers.get('x-should-retry');
482
+
483
+ // If the server explicitly says whether or not to retry, obey.
484
+ if (shouldRetryHeader === 'true') return true;
485
+ if (shouldRetryHeader === 'false') return false;
486
+
487
+ // Retry on request timeouts.
488
+ if (response.status === 408) return true;
489
+
490
+ // Retry on lock timeouts.
491
+ if (response.status === 409) return true;
492
+
493
+ // Retry on rate limits.
494
+ if (response.status === 429) return true;
495
+
496
+ // Retry internal errors.
497
+ if (response.status >= 500) return true;
498
+
499
+ return false;
500
+ }
501
+
502
+ private async retryRequest(
503
+ options: FinalRequestOptions,
504
+ retriesRemaining: number,
505
+ responseHeaders?: Headers | undefined,
506
+ ): Promise<APIResponseProps> {
507
+ let timeoutMillis: number | undefined;
508
+
509
+ // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
510
+ const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
511
+ if (retryAfterMillisHeader) {
512
+ const timeoutMs = parseFloat(retryAfterMillisHeader);
513
+ if (!Number.isNaN(timeoutMs)) {
514
+ timeoutMillis = timeoutMs;
515
+ }
516
+ }
517
+
518
+ // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
519
+ const retryAfterHeader = responseHeaders?.get('retry-after');
520
+ if (retryAfterHeader && !timeoutMillis) {
521
+ const timeoutSeconds = parseFloat(retryAfterHeader);
522
+ if (!Number.isNaN(timeoutSeconds)) {
523
+ timeoutMillis = timeoutSeconds * 1000;
524
+ } else {
525
+ timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
526
+ }
527
+ }
528
+
529
+ // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
530
+ // just do what it says, but otherwise calculate a default
531
+ if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
532
+ const maxRetries = options.maxRetries ?? this.maxRetries;
533
+ timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
534
+ }
535
+ await sleep(timeoutMillis);
536
+
537
+ return this.makeRequest(options, retriesRemaining - 1);
538
+ }
539
+
540
+ private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number {
541
+ const initialRetryDelay = 0.5;
542
+ const maxRetryDelay = 8.0;
543
+
544
+ const numRetries = maxRetries - retriesRemaining;
545
+
546
+ // Apply exponential backoff, but not more than the max.
547
+ const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
548
+
549
+ // Apply some jitter, take up to at most 25 percent of the retry time.
550
+ const jitter = 1 - Math.random() * 0.25;
551
+
552
+ return sleepSeconds * jitter * 1000;
553
+ }
554
+
555
+ buildRequest(
556
+ options: FinalRequestOptions,
557
+ { retryCount = 0 }: { retryCount?: number } = {},
558
+ ): { req: FinalizedRequestInit; url: string; timeout: number } {
559
+ const { method, path, query } = options;
560
+
561
+ const url = this.buildURL(path!, query as Record<string, unknown>);
562
+ if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
563
+ const timeout = options.timeout ?? this.timeout;
564
+ const { bodyHeaders, body } = this.buildBody({ options });
565
+ const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount });
566
+
567
+ const req: FinalizedRequestInit = {
568
+ method,
569
+ headers: reqHeaders,
570
+ ...(options.signal && { signal: options.signal }),
571
+ ...((globalThis as any).ReadableStream &&
572
+ body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }),
573
+ ...(body && { body }),
574
+ ...((this.fetchOptions as any) ?? {}),
575
+ ...((options.fetchOptions as any) ?? {}),
576
+ };
577
+
578
+ return { req, url, timeout };
579
+ }
580
+
581
+ private buildHeaders({
582
+ options,
583
+ method,
584
+ bodyHeaders,
585
+ retryCount,
586
+ }: {
587
+ options: FinalRequestOptions;
588
+ method: HTTPMethod;
589
+ bodyHeaders: HeadersLike;
590
+ retryCount: number;
591
+ }): Headers {
592
+ let idempotencyHeaders: HeadersLike = {};
593
+ if (this.idempotencyHeader && method !== 'get') {
594
+ if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
595
+ idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
596
+ }
597
+
598
+ const headers = buildHeaders([
599
+ idempotencyHeaders,
600
+ {
601
+ Accept: 'application/json',
602
+ 'User-Agent': this.getUserAgent(),
603
+ 'X-Stainless-Retry-Count': String(retryCount),
604
+ ...getPlatformHeaders(),
605
+ },
606
+ this.authHeaders(options),
607
+ this._options.defaultHeaders,
608
+ bodyHeaders,
609
+ options.headers,
610
+ ]);
611
+
612
+ this.validateHeaders(headers);
613
+
614
+ return headers.values;
615
+ }
616
+
617
+ private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
618
+ bodyHeaders: HeadersLike;
619
+ body: BodyInit | undefined;
620
+ } {
621
+ if (!body) {
622
+ return { bodyHeaders: undefined, body: undefined };
623
+ }
624
+ const headers = buildHeaders([rawHeaders]);
625
+ if (
626
+ // Pass raw type verbatim
627
+ ArrayBuffer.isView(body) ||
628
+ body instanceof ArrayBuffer ||
629
+ body instanceof DataView ||
630
+ (typeof body === 'string' &&
631
+ // Preserve legacy string encoding behavior for now
632
+ headers.values.has('content-type')) ||
633
+ // `Blob` is superset of `File`
634
+ body instanceof Blob ||
635
+ // `FormData` -> `multipart/form-data`
636
+ body instanceof FormData ||
637
+ // `URLSearchParams` -> `application/x-www-form-urlencoded`
638
+ body instanceof URLSearchParams ||
639
+ // Send chunked stream (each chunk has own `length`)
640
+ ((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream)
641
+ ) {
642
+ return { bodyHeaders: undefined, body: body as BodyInit };
643
+ } else if (
644
+ typeof body === 'object' &&
645
+ (Symbol.asyncIterator in body ||
646
+ (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
647
+ ) {
648
+ return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
649
+ } else {
650
+ return this.#encoder({ body, headers });
651
+ }
652
+ }
653
+
654
+ static Roark = this;
655
+ static DEFAULT_TIMEOUT = 60000; // 1 minute
656
+
657
+ static RoarkError = Errors.RoarkError;
658
+ static APIError = Errors.APIError;
659
+ static APIConnectionError = Errors.APIConnectionError;
660
+ static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
661
+ static APIUserAbortError = Errors.APIUserAbortError;
662
+ static NotFoundError = Errors.NotFoundError;
663
+ static ConflictError = Errors.ConflictError;
664
+ static RateLimitError = Errors.RateLimitError;
665
+ static BadRequestError = Errors.BadRequestError;
666
+ static AuthenticationError = Errors.AuthenticationError;
667
+ static InternalServerError = Errors.InternalServerError;
668
+ static PermissionDeniedError = Errors.PermissionDeniedError;
669
+ static UnprocessableEntityError = Errors.UnprocessableEntityError;
670
+
671
+ static toFile = Uploads.toFile;
672
+
673
+ health: API.Health = new API.Health(this);
674
+ evaluation: API.Evaluation = new API.Evaluation(this);
675
+ call: API.Call = new API.Call(this);
676
+ metric: API.Metric = new API.Metric(this);
677
+ integrations: API.Integrations = new API.Integrations(this);
678
+ simulation: API.Simulation = new API.Simulation(this);
679
+ persona: API.Persona = new API.Persona(this);
680
+ }
681
+ Roark.Health = Health;
682
+ Roark.Evaluation = Evaluation;
683
+ Roark.Call = Call;
684
+ Roark.Metric = Metric;
685
+ Roark.Integrations = Integrations;
686
+ Roark.Simulation = Simulation;
687
+ Roark.Persona = Persona;
688
+ export declare namespace Roark {
689
+ export type RequestOptions = Opts.RequestOptions;
690
+
691
+ export { Health as Health, type HealthGetResponse as HealthGetResponse };
692
+
693
+ export {
694
+ Evaluation as Evaluation,
695
+ type EvaluationCreateJobResponse as EvaluationCreateJobResponse,
696
+ type EvaluationGetEvaluatorByIDResponse as EvaluationGetEvaluatorByIDResponse,
697
+ type EvaluationGetJobResponse as EvaluationGetJobResponse,
698
+ type EvaluationListEvaluatorsResponse as EvaluationListEvaluatorsResponse,
699
+ type EvaluationListJobRunsResponse as EvaluationListJobRunsResponse,
700
+ type EvaluationCreateJobParams as EvaluationCreateJobParams,
701
+ type EvaluationListEvaluatorsParams as EvaluationListEvaluatorsParams,
702
+ type EvaluationListJobRunsParams as EvaluationListJobRunsParams,
703
+ };
704
+
705
+ export {
706
+ Call as Call,
707
+ type CallCreateResponse as CallCreateResponse,
708
+ type CallListResponse as CallListResponse,
709
+ type CallGetByIDResponse as CallGetByIDResponse,
710
+ type CallListEvaluationRunsResponse as CallListEvaluationRunsResponse,
711
+ type CallListMetricsResponse as CallListMetricsResponse,
712
+ type CallListSentimentRunsResponse as CallListSentimentRunsResponse,
713
+ type CallCreateParams as CallCreateParams,
714
+ type CallListParams as CallListParams,
715
+ type CallListMetricsParams as CallListMetricsParams,
716
+ };
717
+
718
+ export { Metric as Metric, type MetricListDefinitionsResponse as MetricListDefinitionsResponse };
719
+
720
+ export {
721
+ Integrations as Integrations,
722
+ type IntegrationCreateRetellCallResponse as IntegrationCreateRetellCallResponse,
723
+ type IntegrationCreateVapiCallResponse as IntegrationCreateVapiCallResponse,
724
+ type IntegrationCreateRetellCallParams as IntegrationCreateRetellCallParams,
725
+ type IntegrationCreateVapiCallParams as IntegrationCreateVapiCallParams,
726
+ };
727
+
728
+ export {
729
+ Simulation as Simulation,
730
+ type SimulationGetRunPlanJobResponse as SimulationGetRunPlanJobResponse,
731
+ type SimulationGetSimulationJobByIDResponse as SimulationGetSimulationJobByIDResponse,
732
+ type SimulationListRunPlanJobsResponse as SimulationListRunPlanJobsResponse,
733
+ type SimulationListScenariosResponse as SimulationListScenariosResponse,
734
+ type SimulationLookupSimulationJobResponse as SimulationLookupSimulationJobResponse,
735
+ type SimulationStartRunPlanJobResponse as SimulationStartRunPlanJobResponse,
736
+ type SimulationListRunPlanJobsParams as SimulationListRunPlanJobsParams,
737
+ type SimulationListScenariosParams as SimulationListScenariosParams,
738
+ type SimulationLookupSimulationJobParams as SimulationLookupSimulationJobParams,
739
+ };
740
+
741
+ export {
742
+ Persona as Persona,
743
+ type PersonaCreateResponse as PersonaCreateResponse,
744
+ type PersonaUpdateResponse as PersonaUpdateResponse,
745
+ type PersonaListResponse as PersonaListResponse,
746
+ type PersonaGetByIDResponse as PersonaGetByIDResponse,
747
+ type PersonaCreateParams as PersonaCreateParams,
748
+ type PersonaUpdateParams as PersonaUpdateParams,
749
+ type PersonaListParams as PersonaListParams,
750
+ };
751
+ }