dub 0.10.0 → 0.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (540) hide show
  1. package/.github/workflows/sdk_generation.yaml +26 -0
  2. package/.github/workflows/sdk_publish.yaml +15 -0
  3. package/.speakeasy/gen.lock +205 -0
  4. package/.speakeasy/gen.yaml +37 -0
  5. package/.speakeasy/workflow.yaml +12 -0
  6. package/README.md +292 -182
  7. package/docs/sdks/analytics/README.md +535 -0
  8. package/docs/sdks/dub/README.md +9 -0
  9. package/docs/sdks/links/README.md +415 -0
  10. package/docs/sdks/qrcodes/README.md +58 -0
  11. package/docs/sdks/tags/README.md +113 -0
  12. package/docs/sdks/workspaces/README.md +168 -0
  13. package/hooks/hooks.d.ts +20 -0
  14. package/hooks/hooks.d.ts.map +1 -0
  15. package/hooks/hooks.js +55 -0
  16. package/hooks/hooks.js.map +1 -0
  17. package/hooks/index.d.ts +3 -0
  18. package/hooks/index.d.ts.map +1 -0
  19. package/{_shims/auto/runtime-bun.js → hooks/index.js} +6 -5
  20. package/hooks/index.js.map +1 -0
  21. package/hooks/types.d.ts +59 -0
  22. package/hooks/types.d.ts.map +1 -0
  23. package/hooks/types.js +6 -0
  24. package/hooks/types.js.map +1 -0
  25. package/index.d.ts +4 -125
  26. package/index.d.ts.map +1 -1
  27. package/index.js +10 -103
  28. package/index.js.map +1 -1
  29. package/lib/base64.d.ts +10 -0
  30. package/lib/base64.d.ts.map +1 -0
  31. package/lib/base64.js +61 -0
  32. package/lib/base64.js.map +1 -0
  33. package/lib/config.d.ts +39 -0
  34. package/lib/config.d.ts.map +1 -0
  35. package/lib/config.js +39 -0
  36. package/lib/config.js.map +1 -0
  37. package/lib/encodings.d.ts +39 -0
  38. package/lib/encodings.d.ts.map +1 -0
  39. package/lib/encodings.js +311 -0
  40. package/lib/encodings.js.map +1 -0
  41. package/lib/http.d.ts +46 -0
  42. package/lib/http.d.ts.map +1 -0
  43. package/lib/http.js +143 -0
  44. package/lib/http.js.map +1 -0
  45. package/lib/retries.d.ts +18 -0
  46. package/lib/retries.d.ts.map +1 -0
  47. package/lib/retries.js +157 -0
  48. package/lib/retries.js.map +1 -0
  49. package/lib/schemas.d.ts +7 -0
  50. package/lib/schemas.d.ts.map +1 -0
  51. package/{shims/web.js → lib/schemas.js} +24 -6
  52. package/lib/schemas.js.map +1 -0
  53. package/lib/sdks.d.ts +39 -0
  54. package/lib/sdks.d.ts.map +1 -0
  55. package/lib/sdks.js +98 -0
  56. package/lib/sdks.js.map +1 -0
  57. package/lib/security.d.ts +57 -0
  58. package/lib/security.d.ts.map +1 -0
  59. package/lib/security.js +115 -0
  60. package/lib/security.js.map +1 -0
  61. package/lib/url.d.ts +4 -0
  62. package/lib/url.d.ts.map +1 -0
  63. package/lib/url.js +26 -0
  64. package/lib/url.js.map +1 -0
  65. package/models/components/index.d.ts +5 -0
  66. package/models/components/index.d.ts.map +1 -0
  67. package/{_shims/auto/runtime-node.js → models/components/index.js} +8 -5
  68. package/models/components/index.js.map +1 -0
  69. package/models/components/linkschema.d.ts +222 -0
  70. package/models/components/linkschema.d.ts.map +1 -0
  71. package/models/components/linkschema.js +189 -0
  72. package/models/components/linkschema.js.map +1 -0
  73. package/models/components/security.d.ts +16 -0
  74. package/models/components/security.d.ts.map +1 -0
  75. package/models/components/security.js +53 -0
  76. package/models/components/security.js.map +1 -0
  77. package/models/components/tagschema.d.ts +45 -0
  78. package/models/components/tagschema.d.ts.map +1 -0
  79. package/models/components/tagschema.js +76 -0
  80. package/models/components/tagschema.js.map +1 -0
  81. package/models/components/workspaceschema.d.ts +178 -0
  82. package/models/components/workspaceschema.d.ts.map +1 -0
  83. package/models/components/workspaceschema.js +190 -0
  84. package/models/components/workspaceschema.js.map +1 -0
  85. package/models/errors/badrequest.d.ts +65 -0
  86. package/models/errors/badrequest.d.ts.map +1 -0
  87. package/models/errors/badrequest.js +111 -0
  88. package/models/errors/badrequest.js.map +1 -0
  89. package/models/errors/conflict.d.ts +65 -0
  90. package/models/errors/conflict.d.ts.map +1 -0
  91. package/models/errors/conflict.js +111 -0
  92. package/models/errors/conflict.js.map +1 -0
  93. package/models/errors/forbidden.d.ts +65 -0
  94. package/models/errors/forbidden.d.ts.map +1 -0
  95. package/models/errors/forbidden.js +111 -0
  96. package/models/errors/forbidden.js.map +1 -0
  97. package/models/errors/index.d.ts +12 -0
  98. package/models/errors/index.d.ts.map +1 -0
  99. package/{_shims/auto/types-node.js → models/errors/index.js} +15 -5
  100. package/models/errors/index.js.map +1 -0
  101. package/models/errors/internalservererror.d.ts +65 -0
  102. package/models/errors/internalservererror.d.ts.map +1 -0
  103. package/models/errors/internalservererror.js +111 -0
  104. package/models/errors/internalservererror.js.map +1 -0
  105. package/models/errors/inviteexpired.d.ts +65 -0
  106. package/models/errors/inviteexpired.d.ts.map +1 -0
  107. package/models/errors/inviteexpired.js +111 -0
  108. package/models/errors/inviteexpired.js.map +1 -0
  109. package/models/errors/notfound.d.ts +65 -0
  110. package/models/errors/notfound.d.ts.map +1 -0
  111. package/models/errors/notfound.js +111 -0
  112. package/models/errors/notfound.js.map +1 -0
  113. package/models/errors/ratelimitexceeded.d.ts +65 -0
  114. package/models/errors/ratelimitexceeded.d.ts.map +1 -0
  115. package/models/errors/ratelimitexceeded.js +111 -0
  116. package/models/errors/ratelimitexceeded.js.map +1 -0
  117. package/models/errors/sdkerror.d.ts +7 -0
  118. package/models/errors/sdkerror.d.ts.map +1 -0
  119. package/models/errors/sdkerror.js +19 -0
  120. package/models/errors/sdkerror.js.map +1 -0
  121. package/models/errors/sdkvalidationerror.d.ts +17 -0
  122. package/models/errors/sdkvalidationerror.d.ts.map +1 -0
  123. package/models/errors/sdkvalidationerror.js +107 -0
  124. package/models/errors/sdkvalidationerror.js.map +1 -0
  125. package/models/errors/unauthorized.d.ts +65 -0
  126. package/models/errors/unauthorized.d.ts.map +1 -0
  127. package/models/errors/unauthorized.js +111 -0
  128. package/models/errors/unauthorized.js.map +1 -0
  129. package/models/errors/unprocessableentity.d.ts +65 -0
  130. package/models/errors/unprocessableentity.d.ts.map +1 -0
  131. package/models/errors/unprocessableentity.js +111 -0
  132. package/models/errors/unprocessableentity.js.map +1 -0
  133. package/models/operations/bulkcreatelinks.d.ts +146 -0
  134. package/models/operations/bulkcreatelinks.d.ts.map +1 -0
  135. package/models/operations/bulkcreatelinks.js +138 -0
  136. package/models/operations/bulkcreatelinks.js.map +1 -0
  137. package/models/operations/createlink.d.ts +146 -0
  138. package/models/operations/createlink.d.ts.map +1 -0
  139. package/models/operations/createlink.js +141 -0
  140. package/models/operations/createlink.js.map +1 -0
  141. package/models/operations/createtag.d.ts +39 -0
  142. package/models/operations/createtag.d.ts.map +1 -0
  143. package/models/operations/createtag.js +72 -0
  144. package/models/operations/createtag.js.map +1 -0
  145. package/models/operations/createworkspace.d.ts +22 -0
  146. package/models/operations/createworkspace.d.ts.map +1 -0
  147. package/models/operations/createworkspace.js +61 -0
  148. package/models/operations/createworkspace.js.map +1 -0
  149. package/models/operations/deletelink.d.ts +39 -0
  150. package/models/operations/deletelink.d.ts.map +1 -0
  151. package/models/operations/deletelink.js +75 -0
  152. package/models/operations/deletelink.js.map +1 -0
  153. package/models/operations/editlink.d.ts +166 -0
  154. package/models/operations/editlink.d.ts.map +1 -0
  155. package/models/operations/editlink.js +167 -0
  156. package/models/operations/editlink.js.map +1 -0
  157. package/models/operations/getbrowseranalytics.d.ts +378 -0
  158. package/models/operations/getbrowseranalytics.d.ts.map +1 -0
  159. package/models/operations/getbrowseranalytics.js +395 -0
  160. package/models/operations/getbrowseranalytics.js.map +1 -0
  161. package/models/operations/getcityanalytics.d.ts +641 -0
  162. package/models/operations/getcityanalytics.d.ts.map +1 -0
  163. package/models/operations/getcityanalytics.js +657 -0
  164. package/models/operations/getcityanalytics.js.map +1 -0
  165. package/models/operations/getclicksanalytics.d.ts +355 -0
  166. package/models/operations/getclicksanalytics.d.ts.map +1 -0
  167. package/models/operations/getclicksanalytics.js +369 -0
  168. package/models/operations/getclicksanalytics.js.map +1 -0
  169. package/models/operations/getcountryanalytics.d.ts +635 -0
  170. package/models/operations/getcountryanalytics.d.ts.map +1 -0
  171. package/models/operations/getcountryanalytics.js +653 -0
  172. package/models/operations/getcountryanalytics.js.map +1 -0
  173. package/models/operations/getdeviceanalytics.d.ts +378 -0
  174. package/models/operations/getdeviceanalytics.d.ts.map +1 -0
  175. package/models/operations/getdeviceanalytics.js +395 -0
  176. package/models/operations/getdeviceanalytics.js.map +1 -0
  177. package/models/operations/getlinkinfo.d.ts +25 -0
  178. package/models/operations/getlinkinfo.d.ts.map +1 -0
  179. package/models/operations/getlinkinfo.js +57 -0
  180. package/models/operations/getlinkinfo.js.map +1 -0
  181. package/models/operations/getlinks.d.ts +88 -0
  182. package/models/operations/getlinks.d.ts.map +1 -0
  183. package/models/operations/getlinks.js +108 -0
  184. package/models/operations/getlinks.js.map +1 -0
  185. package/models/operations/getlinkscount.d.ts +93 -0
  186. package/models/operations/getlinkscount.d.ts.map +1 -0
  187. package/models/operations/getlinkscount.js +105 -0
  188. package/models/operations/getlinkscount.js.map +1 -0
  189. package/models/operations/getosanalytics.d.ts +378 -0
  190. package/models/operations/getosanalytics.d.ts.map +1 -0
  191. package/models/operations/getosanalytics.js +395 -0
  192. package/models/operations/getosanalytics.js.map +1 -0
  193. package/models/operations/getqrcode.d.ts +60 -0
  194. package/models/operations/getqrcode.d.ts.map +1 -0
  195. package/models/operations/getqrcode.js +85 -0
  196. package/models/operations/getqrcode.js.map +1 -0
  197. package/models/operations/getrefereranalytics.d.ts +378 -0
  198. package/models/operations/getrefereranalytics.d.ts.map +1 -0
  199. package/models/operations/getrefereranalytics.js +395 -0
  200. package/models/operations/getrefereranalytics.js.map +1 -0
  201. package/models/operations/gettags.d.ts +10 -0
  202. package/models/operations/gettags.d.ts.map +1 -0
  203. package/{shims/node.js → models/operations/gettags.js} +12 -6
  204. package/models/operations/gettags.js.map +1 -0
  205. package/models/operations/gettimeseriesanalytics.d.ts +378 -0
  206. package/models/operations/gettimeseriesanalytics.d.ts.map +1 -0
  207. package/models/operations/gettimeseriesanalytics.js +395 -0
  208. package/models/operations/gettimeseriesanalytics.js.map +1 -0
  209. package/models/operations/gettoplinks.d.ts +378 -0
  210. package/models/operations/gettoplinks.d.ts.map +1 -0
  211. package/models/operations/gettoplinks.js +395 -0
  212. package/models/operations/gettoplinks.js.map +1 -0
  213. package/models/operations/gettopurls.d.ts +378 -0
  214. package/models/operations/gettopurls.d.ts.map +1 -0
  215. package/models/operations/gettopurls.js +395 -0
  216. package/models/operations/gettopurls.js.map +1 -0
  217. package/models/operations/getworkspace.d.ts +19 -0
  218. package/models/operations/getworkspace.d.ts.map +1 -0
  219. package/models/operations/getworkspace.js +53 -0
  220. package/models/operations/getworkspace.js.map +1 -0
  221. package/models/operations/index.d.ts +23 -0
  222. package/models/operations/index.d.ts.map +1 -0
  223. package/models/operations/index.js +42 -0
  224. package/models/operations/index.js.map +1 -0
  225. package/package.json +25 -98
  226. package/sdk/analytics.d.ts +78 -0
  227. package/sdk/analytics.d.ts.map +1 -0
  228. package/sdk/analytics.js +2044 -0
  229. package/sdk/analytics.js.map +1 -0
  230. package/sdk/index.d.ts +2 -0
  231. package/sdk/index.d.ts.map +1 -0
  232. package/{_shims/auto/runtime.js → sdk/index.js} +5 -5
  233. package/sdk/index.js.map +1 -0
  234. package/sdk/links.d.ts +58 -0
  235. package/sdk/links.d.ts.map +1 -0
  236. package/sdk/links.js +1309 -0
  237. package/sdk/links.js.map +1 -0
  238. package/sdk/qrcodes.d.ts +21 -0
  239. package/sdk/qrcodes.d.ts.map +1 -0
  240. package/sdk/qrcodes.js +249 -0
  241. package/sdk/qrcodes.js.map +1 -0
  242. package/sdk/sdk.d.ts +22 -0
  243. package/sdk/sdk.d.ts.map +1 -0
  244. package/sdk/sdk.js +59 -0
  245. package/sdk/sdk.js.map +1 -0
  246. package/sdk/tags.d.ts +23 -0
  247. package/sdk/tags.d.ts.map +1 -0
  248. package/sdk/tags.js +401 -0
  249. package/sdk/tags.js.map +1 -0
  250. package/sdk/workspaces.d.ts +30 -0
  251. package/sdk/workspaces.d.ts.map +1 -0
  252. package/sdk/workspaces.js +556 -0
  253. package/sdk/workspaces.js.map +1 -0
  254. package/src/hooks/hooks.ts +81 -0
  255. package/src/hooks/index.ts +6 -0
  256. package/src/hooks/types.ts +74 -0
  257. package/src/index.ts +8 -209
  258. package/src/lib/base64.ts +37 -0
  259. package/src/lib/config.ts +70 -0
  260. package/src/lib/encodings.ts +384 -0
  261. package/src/lib/http.ts +215 -0
  262. package/src/lib/retries.ts +226 -0
  263. package/src/lib/schemas.ts +22 -0
  264. package/src/lib/sdks.ts +139 -0
  265. package/src/lib/security.ts +180 -0
  266. package/src/lib/url.ts +31 -0
  267. package/src/models/components/index.ts +8 -0
  268. package/src/models/components/linkschema.ts +383 -0
  269. package/src/models/components/security.ts +40 -0
  270. package/src/models/components/tagschema.ts +79 -0
  271. package/src/models/components/workspaceschema.ts +316 -0
  272. package/src/models/errors/badrequest.ts +140 -0
  273. package/src/models/errors/conflict.ts +140 -0
  274. package/src/models/errors/forbidden.ts +140 -0
  275. package/src/models/errors/index.ts +15 -0
  276. package/src/models/errors/internalservererror.ts +140 -0
  277. package/src/models/errors/inviteexpired.ts +140 -0
  278. package/src/models/errors/notfound.ts +140 -0
  279. package/src/models/errors/ratelimitexceeded.ts +140 -0
  280. package/src/models/errors/sdkerror.ts +22 -0
  281. package/src/models/errors/sdkvalidationerror.ts +95 -0
  282. package/src/models/errors/unauthorized.ts +140 -0
  283. package/src/models/errors/unprocessableentity.ts +140 -0
  284. package/src/models/operations/bulkcreatelinks.ts +254 -0
  285. package/src/models/operations/createlink.ts +255 -0
  286. package/src/models/operations/createtag.ts +69 -0
  287. package/src/models/operations/createworkspace.ts +54 -0
  288. package/src/models/operations/deletelink.ts +84 -0
  289. package/src/models/operations/editlink.ts +300 -0
  290. package/src/models/operations/getbrowseranalytics.ts +484 -0
  291. package/src/models/operations/getcityanalytics.ts +744 -0
  292. package/src/models/operations/getclicksanalytics.ts +427 -0
  293. package/src/models/operations/getcountryanalytics.ts +743 -0
  294. package/src/models/operations/getdeviceanalytics.ts +480 -0
  295. package/src/models/operations/getlinkinfo.ts +53 -0
  296. package/src/models/operations/getlinks.ts +155 -0
  297. package/src/models/operations/getlinkscount.ts +157 -0
  298. package/src/models/operations/getosanalytics.ts +475 -0
  299. package/src/models/operations/getqrcode.ts +106 -0
  300. package/src/models/operations/getrefereranalytics.ts +484 -0
  301. package/src/models/operations/gettags.ts +18 -0
  302. package/src/models/operations/gettimeseriesanalytics.ts +476 -0
  303. package/src/models/operations/gettoplinks.ts +475 -0
  304. package/src/models/operations/gettopurls.ts +475 -0
  305. package/src/models/operations/getworkspace.ts +43 -0
  306. package/src/models/operations/index.ts +26 -0
  307. package/src/sdk/analytics.ts +2493 -0
  308. package/src/sdk/index.ts +5 -0
  309. package/src/sdk/links.ts +1617 -0
  310. package/src/sdk/qrcodes.ts +276 -0
  311. package/src/sdk/sdk.ts +66 -0
  312. package/src/sdk/tags.ts +470 -0
  313. package/src/sdk/workspaces.ts +670 -0
  314. package/src/types/blobs.ts +30 -0
  315. package/src/types/index.ts +8 -0
  316. package/src/types/operations.ts +25 -0
  317. package/src/types/rfcdate.ts +54 -0
  318. package/types/blobs.d.ts +4 -0
  319. package/types/blobs.d.ts.map +1 -0
  320. package/{resources/projects/projects.js → types/blobs.js} +23 -24
  321. package/types/blobs.js.map +1 -0
  322. package/types/index.d.ts +5 -0
  323. package/types/index.d.ts.map +1 -0
  324. package/types/index.js +14 -0
  325. package/types/index.js.map +1 -0
  326. package/types/operations.d.ts +13 -0
  327. package/types/operations.d.ts.map +1 -0
  328. package/types/operations.js +19 -0
  329. package/types/operations.js.map +1 -0
  330. package/types/rfcdate.d.ts +21 -0
  331. package/types/rfcdate.d.ts.map +1 -0
  332. package/types/rfcdate.js +46 -0
  333. package/types/rfcdate.js.map +1 -0
  334. package/CHANGELOG.md +0 -116
  335. package/LICENSE +0 -201
  336. package/_shims/MultipartBody.d.ts +0 -9
  337. package/_shims/MultipartBody.d.ts.map +0 -1
  338. package/_shims/MultipartBody.js +0 -16
  339. package/_shims/MultipartBody.js.map +0 -1
  340. package/_shims/MultipartBody.mjs +0 -12
  341. package/_shims/MultipartBody.mjs.map +0 -1
  342. package/_shims/README.md +0 -46
  343. package/_shims/auto/runtime-bun.d.ts +0 -5
  344. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  345. package/_shims/auto/runtime-bun.js.map +0 -1
  346. package/_shims/auto/runtime-bun.mjs +0 -2
  347. package/_shims/auto/runtime-bun.mjs.map +0 -1
  348. package/_shims/auto/runtime-node.d.ts +0 -5
  349. package/_shims/auto/runtime-node.d.ts.map +0 -1
  350. package/_shims/auto/runtime-node.js.map +0 -1
  351. package/_shims/auto/runtime-node.mjs +0 -2
  352. package/_shims/auto/runtime-node.mjs.map +0 -1
  353. package/_shims/auto/runtime.d.ts +0 -5
  354. package/_shims/auto/runtime.d.ts.map +0 -1
  355. package/_shims/auto/runtime.js.map +0 -1
  356. package/_shims/auto/runtime.mjs +0 -2
  357. package/_shims/auto/runtime.mjs.map +0 -1
  358. package/_shims/auto/types-node.d.ts +0 -5
  359. package/_shims/auto/types-node.d.ts.map +0 -1
  360. package/_shims/auto/types-node.js.map +0 -1
  361. package/_shims/auto/types-node.mjs +0 -2
  362. package/_shims/auto/types-node.mjs.map +0 -1
  363. package/_shims/auto/types.d.ts +0 -101
  364. package/_shims/auto/types.js +0 -3
  365. package/_shims/auto/types.mjs +0 -3
  366. package/_shims/bun-runtime.d.ts +0 -6
  367. package/_shims/bun-runtime.d.ts.map +0 -1
  368. package/_shims/bun-runtime.js +0 -14
  369. package/_shims/bun-runtime.js.map +0 -1
  370. package/_shims/bun-runtime.mjs +0 -10
  371. package/_shims/bun-runtime.mjs.map +0 -1
  372. package/_shims/index.d.ts +0 -81
  373. package/_shims/index.js +0 -13
  374. package/_shims/index.mjs +0 -7
  375. package/_shims/manual-types.d.ts +0 -12
  376. package/_shims/manual-types.js +0 -3
  377. package/_shims/manual-types.mjs +0 -3
  378. package/_shims/node-runtime.d.ts +0 -3
  379. package/_shims/node-runtime.d.ts.map +0 -1
  380. package/_shims/node-runtime.js +0 -90
  381. package/_shims/node-runtime.js.map +0 -1
  382. package/_shims/node-runtime.mjs +0 -56
  383. package/_shims/node-runtime.mjs.map +0 -1
  384. package/_shims/node-types.d.ts +0 -42
  385. package/_shims/node-types.js +0 -3
  386. package/_shims/node-types.mjs +0 -3
  387. package/_shims/registry.d.ts +0 -37
  388. package/_shims/registry.d.ts.map +0 -1
  389. package/_shims/registry.js +0 -41
  390. package/_shims/registry.js.map +0 -1
  391. package/_shims/registry.mjs +0 -37
  392. package/_shims/registry.mjs.map +0 -1
  393. package/_shims/web-runtime.d.ts +0 -5
  394. package/_shims/web-runtime.d.ts.map +0 -1
  395. package/_shims/web-runtime.js +0 -78
  396. package/_shims/web-runtime.js.map +0 -1
  397. package/_shims/web-runtime.mjs +0 -71
  398. package/_shims/web-runtime.mjs.map +0 -1
  399. package/_shims/web-types.d.ts +0 -83
  400. package/_shims/web-types.js +0 -3
  401. package/_shims/web-types.mjs +0 -3
  402. package/core.d.ts +0 -237
  403. package/core.d.ts.map +0 -1
  404. package/core.js +0 -868
  405. package/core.js.map +0 -1
  406. package/core.mjs +0 -837
  407. package/core.mjs.map +0 -1
  408. package/error.d.ts +0 -53
  409. package/error.d.ts.map +0 -1
  410. package/error.js +0 -143
  411. package/error.js.map +0 -1
  412. package/error.mjs +0 -127
  413. package/error.mjs.map +0 -1
  414. package/index.d.mts +0 -127
  415. package/index.mjs +0 -90
  416. package/index.mjs.map +0 -1
  417. package/resource.d.ts +0 -6
  418. package/resource.d.ts.map +0 -1
  419. package/resource.js +0 -11
  420. package/resource.js.map +0 -1
  421. package/resource.mjs +0 -7
  422. package/resource.mjs.map +0 -1
  423. package/resources/index.d.ts +0 -4
  424. package/resources/index.d.ts.map +0 -1
  425. package/resources/index.js +0 -11
  426. package/resources/index.js.map +0 -1
  427. package/resources/index.mjs +0 -5
  428. package/resources/index.mjs.map +0 -1
  429. package/resources/links/bulk.d.ts +0 -274
  430. package/resources/links/bulk.d.ts.map +0 -1
  431. package/resources/links/bulk.js +0 -18
  432. package/resources/links/bulk.js.map +0 -1
  433. package/resources/links/bulk.mjs +0 -14
  434. package/resources/links/bulk.mjs.map +0 -1
  435. package/resources/links/index.d.ts +0 -4
  436. package/resources/links/index.d.ts.map +0 -1
  437. package/resources/links/index.js +0 -11
  438. package/resources/links/index.js.map +0 -1
  439. package/resources/links/index.mjs +0 -5
  440. package/resources/links/index.mjs.map +0 -1
  441. package/resources/links/info.d.ts +0 -186
  442. package/resources/links/info.d.ts.map +0 -1
  443. package/resources/links/info.js +0 -18
  444. package/resources/links/info.js.map +0 -1
  445. package/resources/links/info.mjs +0 -14
  446. package/resources/links/info.mjs.map +0 -1
  447. package/resources/links/links.d.ts +0 -916
  448. package/resources/links/links.d.ts.map +0 -1
  449. package/resources/links/links.js +0 -72
  450. package/resources/links/links.js.map +0 -1
  451. package/resources/links/links.mjs +0 -45
  452. package/resources/links/links.mjs.map +0 -1
  453. package/resources/projects/index.d.ts +0 -3
  454. package/resources/projects/index.d.ts.map +0 -1
  455. package/resources/projects/index.js +0 -9
  456. package/resources/projects/index.js.map +0 -1
  457. package/resources/projects/index.mjs +0 -4
  458. package/resources/projects/index.mjs.map +0 -1
  459. package/resources/projects/projects.d.ts +0 -200
  460. package/resources/projects/projects.d.ts.map +0 -1
  461. package/resources/projects/projects.js.map +0 -1
  462. package/resources/projects/projects.mjs +0 -26
  463. package/resources/projects/projects.mjs.map +0 -1
  464. package/resources/projects/tags.d.ts +0 -4
  465. package/resources/projects/tags.d.ts.map +0 -1
  466. package/resources/projects/tags.js +0 -9
  467. package/resources/projects/tags.js.map +0 -1
  468. package/resources/projects/tags.mjs +0 -5
  469. package/resources/projects/tags.mjs.map +0 -1
  470. package/resources/qr.d.ts +0 -45
  471. package/resources/qr.d.ts.map +0 -1
  472. package/resources/qr.js +0 -18
  473. package/resources/qr.js.map +0 -1
  474. package/resources/qr.mjs +0 -14
  475. package/resources/qr.mjs.map +0 -1
  476. package/shims/node.d.ts +0 -29
  477. package/shims/node.d.ts.map +0 -1
  478. package/shims/node.js.map +0 -1
  479. package/shims/node.mjs +0 -5
  480. package/shims/node.mjs.map +0 -1
  481. package/shims/web.d.ts +0 -26
  482. package/shims/web.d.ts.map +0 -1
  483. package/shims/web.js.map +0 -1
  484. package/shims/web.mjs +0 -5
  485. package/shims/web.mjs.map +0 -1
  486. package/src/_shims/MultipartBody.ts +0 -9
  487. package/src/_shims/README.md +0 -46
  488. package/src/_shims/auto/runtime-bun.ts +0 -4
  489. package/src/_shims/auto/runtime-node.ts +0 -4
  490. package/src/_shims/auto/runtime.ts +0 -4
  491. package/src/_shims/auto/types-node.ts +0 -4
  492. package/src/_shims/auto/types.d.ts +0 -101
  493. package/src/_shims/auto/types.js +0 -3
  494. package/src/_shims/auto/types.mjs +0 -3
  495. package/src/_shims/bun-runtime.ts +0 -14
  496. package/src/_shims/index.d.ts +0 -81
  497. package/src/_shims/index.js +0 -13
  498. package/src/_shims/index.mjs +0 -7
  499. package/src/_shims/manual-types.d.ts +0 -12
  500. package/src/_shims/manual-types.js +0 -3
  501. package/src/_shims/manual-types.mjs +0 -3
  502. package/src/_shims/node-runtime.ts +0 -83
  503. package/src/_shims/node-types.d.ts +0 -42
  504. package/src/_shims/node-types.js +0 -3
  505. package/src/_shims/node-types.mjs +0 -3
  506. package/src/_shims/registry.ts +0 -63
  507. package/src/_shims/web-runtime.ts +0 -103
  508. package/src/_shims/web-types.d.ts +0 -83
  509. package/src/_shims/web-types.js +0 -3
  510. package/src/_shims/web-types.mjs +0 -3
  511. package/src/core.ts +0 -1145
  512. package/src/error.ts +0 -146
  513. package/src/lib/.keep +0 -4
  514. package/src/resource.ts +0 -11
  515. package/src/resources/index.ts +0 -20
  516. package/src/resources/links/bulk.ts +0 -337
  517. package/src/resources/links/index.ts +0 -15
  518. package/src/resources/links/info.ts +0 -230
  519. package/src/resources/links/links.ts +0 -1135
  520. package/src/resources/projects/index.ts +0 -4
  521. package/src/resources/projects/projects.ts +0 -253
  522. package/src/resources/projects/tags.ts +0 -5
  523. package/src/resources/qr.ts +0 -64
  524. package/src/shims/node.ts +0 -50
  525. package/src/shims/web.ts +0 -50
  526. package/src/tsconfig.json +0 -11
  527. package/src/uploads.ts +0 -245
  528. package/src/version.ts +0 -1
  529. package/uploads.d.ts +0 -75
  530. package/uploads.d.ts.map +0 -1
  531. package/uploads.js +0 -163
  532. package/uploads.js.map +0 -1
  533. package/uploads.mjs +0 -150
  534. package/uploads.mjs.map +0 -1
  535. package/version.d.ts +0 -2
  536. package/version.d.ts.map +0 -1
  537. package/version.js +0 -5
  538. package/version.js.map +0 -1
  539. package/version.mjs +0 -2
  540. package/version.mjs.map +0 -1
@@ -0,0 +1,2044 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Analytics = void 0;
30
+ const hooks_1 = require("../hooks");
31
+ const config_1 = require("../lib/config");
32
+ const enc$ = __importStar(require("../lib/encodings"));
33
+ const http_1 = require("../lib/http");
34
+ const schemas$ = __importStar(require("../lib/schemas"));
35
+ const sdks_1 = require("../lib/sdks");
36
+ const errors = __importStar(require("../models/errors"));
37
+ const operations = __importStar(require("../models/operations"));
38
+ const z = __importStar(require("zod"));
39
+ class Analytics extends sdks_1.ClientSDK {
40
+ constructor(options = {}) {
41
+ const opt = options;
42
+ let hooks;
43
+ if (typeof opt === "object" &&
44
+ opt != null &&
45
+ "hooks" in opt &&
46
+ opt.hooks instanceof hooks_1.SDKHooks) {
47
+ hooks = opt.hooks;
48
+ }
49
+ else {
50
+ hooks = new hooks_1.SDKHooks();
51
+ }
52
+ super({
53
+ client: options.httpClient || new http_1.HTTPClient(),
54
+ baseURL: (0, config_1.serverURLFromOptions)(options),
55
+ hooks,
56
+ });
57
+ this.options$ = { ...options, hooks };
58
+ void this.options$;
59
+ }
60
+ /**
61
+ * Retrieve clicks analytics
62
+ *
63
+ * @remarks
64
+ * Retrieve the number of clicks for a link, a domain, or the authenticated workspace.
65
+ */
66
+ async clicks(input, options) {
67
+ const headers$ = new Headers();
68
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
69
+ headers$.set("Accept", "application/json");
70
+ const payload$ = schemas$.parse(input, (value$) => operations.GetClicksAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
71
+ const body$ = null;
72
+ const path$ = this.templateURLComponent("/analytics/clicks")();
73
+ const query$ = [
74
+ enc$.encodeForm("browser", payload$.browser, {
75
+ explode: true,
76
+ charEncoding: "percent",
77
+ }),
78
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
79
+ enc$.encodeForm("country", payload$.country, {
80
+ explode: true,
81
+ charEncoding: "percent",
82
+ }),
83
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
84
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
85
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
86
+ explode: true,
87
+ charEncoding: "percent",
88
+ }),
89
+ enc$.encodeForm("interval", payload$.interval, {
90
+ explode: true,
91
+ charEncoding: "percent",
92
+ }),
93
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
94
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
95
+ enc$.encodeForm("referer", payload$.referer, {
96
+ explode: true,
97
+ charEncoding: "percent",
98
+ }),
99
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
100
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
101
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
102
+ explode: true,
103
+ charEncoding: "percent",
104
+ }),
105
+ ]
106
+ .filter(Boolean)
107
+ .join("&");
108
+ let security$;
109
+ if (typeof this.options$.token === "function") {
110
+ security$ = { token: await this.options$.token() };
111
+ }
112
+ else if (this.options$.token) {
113
+ security$ = { token: this.options$.token };
114
+ }
115
+ else {
116
+ security$ = {};
117
+ }
118
+ const context = {
119
+ operationID: "getClicksAnalytics",
120
+ oAuth2Scopes: [],
121
+ securitySource: this.options$.token,
122
+ };
123
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
124
+ const doOptions = {
125
+ context,
126
+ errorCodes: [
127
+ "400",
128
+ "401",
129
+ "403",
130
+ "404",
131
+ "409",
132
+ "410",
133
+ "422",
134
+ "429",
135
+ "4XX",
136
+ "500",
137
+ "5XX",
138
+ ],
139
+ };
140
+ const request = this.createRequest$({
141
+ security: securitySettings$,
142
+ method: "GET",
143
+ path: path$,
144
+ headers: headers$,
145
+ query: query$,
146
+ body: body$,
147
+ }, options);
148
+ const response = await this.do$(request, doOptions);
149
+ const responseFields$ = {
150
+ HttpMeta: {
151
+ Response: response,
152
+ Request: request,
153
+ },
154
+ };
155
+ if (this.matchResponse(response, 200, "application/json")) {
156
+ const responseBody = await response.json();
157
+ const result = schemas$.parse(responseBody, (val$) => {
158
+ return z.number().parse(val$);
159
+ }, "Response validation failed");
160
+ return result;
161
+ }
162
+ else if (this.matchResponse(response, 400, "application/json")) {
163
+ const responseBody = await response.json();
164
+ const result = schemas$.parse(responseBody, (val$) => {
165
+ return errors.BadRequest$.inboundSchema.parse({
166
+ ...responseFields$,
167
+ ...val$,
168
+ });
169
+ }, "Response validation failed");
170
+ throw result;
171
+ }
172
+ else if (this.matchResponse(response, 401, "application/json")) {
173
+ const responseBody = await response.json();
174
+ const result = schemas$.parse(responseBody, (val$) => {
175
+ return errors.Unauthorized$.inboundSchema.parse({
176
+ ...responseFields$,
177
+ ...val$,
178
+ });
179
+ }, "Response validation failed");
180
+ throw result;
181
+ }
182
+ else if (this.matchResponse(response, 403, "application/json")) {
183
+ const responseBody = await response.json();
184
+ const result = schemas$.parse(responseBody, (val$) => {
185
+ return errors.Forbidden$.inboundSchema.parse({
186
+ ...responseFields$,
187
+ ...val$,
188
+ });
189
+ }, "Response validation failed");
190
+ throw result;
191
+ }
192
+ else if (this.matchResponse(response, 404, "application/json")) {
193
+ const responseBody = await response.json();
194
+ const result = schemas$.parse(responseBody, (val$) => {
195
+ return errors.NotFound$.inboundSchema.parse({
196
+ ...responseFields$,
197
+ ...val$,
198
+ });
199
+ }, "Response validation failed");
200
+ throw result;
201
+ }
202
+ else if (this.matchResponse(response, 409, "application/json")) {
203
+ const responseBody = await response.json();
204
+ const result = schemas$.parse(responseBody, (val$) => {
205
+ return errors.Conflict$.inboundSchema.parse({
206
+ ...responseFields$,
207
+ ...val$,
208
+ });
209
+ }, "Response validation failed");
210
+ throw result;
211
+ }
212
+ else if (this.matchResponse(response, 410, "application/json")) {
213
+ const responseBody = await response.json();
214
+ const result = schemas$.parse(responseBody, (val$) => {
215
+ return errors.InviteExpired$.inboundSchema.parse({
216
+ ...responseFields$,
217
+ ...val$,
218
+ });
219
+ }, "Response validation failed");
220
+ throw result;
221
+ }
222
+ else if (this.matchResponse(response, 422, "application/json")) {
223
+ const responseBody = await response.json();
224
+ const result = schemas$.parse(responseBody, (val$) => {
225
+ return errors.UnprocessableEntity$.inboundSchema.parse({
226
+ ...responseFields$,
227
+ ...val$,
228
+ });
229
+ }, "Response validation failed");
230
+ throw result;
231
+ }
232
+ else if (this.matchResponse(response, 429, "application/json")) {
233
+ const responseBody = await response.json();
234
+ const result = schemas$.parse(responseBody, (val$) => {
235
+ return errors.RateLimitExceeded$.inboundSchema.parse({
236
+ ...responseFields$,
237
+ ...val$,
238
+ });
239
+ }, "Response validation failed");
240
+ throw result;
241
+ }
242
+ else if (this.matchResponse(response, 500, "application/json")) {
243
+ const responseBody = await response.json();
244
+ const result = schemas$.parse(responseBody, (val$) => {
245
+ return errors.InternalServerError$.inboundSchema.parse({
246
+ ...responseFields$,
247
+ ...val$,
248
+ });
249
+ }, "Response validation failed");
250
+ throw result;
251
+ }
252
+ else {
253
+ const responseBody = await response.text();
254
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
255
+ }
256
+ }
257
+ /**
258
+ * Retrieve timeseries analytics
259
+ *
260
+ * @remarks
261
+ * Retrieve the number of clicks for a link, a domain, or the authenticated workspace over a period of time.
262
+ */
263
+ async timeseries(input, options) {
264
+ const headers$ = new Headers();
265
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
266
+ headers$.set("Accept", "application/json");
267
+ const payload$ = schemas$.parse(input, (value$) => operations.GetTimeseriesAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
268
+ const body$ = null;
269
+ const path$ = this.templateURLComponent("/analytics/timeseries")();
270
+ const query$ = [
271
+ enc$.encodeForm("browser", payload$.browser, {
272
+ explode: true,
273
+ charEncoding: "percent",
274
+ }),
275
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
276
+ enc$.encodeForm("country", payload$.country, {
277
+ explode: true,
278
+ charEncoding: "percent",
279
+ }),
280
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
281
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
282
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
283
+ explode: true,
284
+ charEncoding: "percent",
285
+ }),
286
+ enc$.encodeForm("interval", payload$.interval, {
287
+ explode: true,
288
+ charEncoding: "percent",
289
+ }),
290
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
291
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
292
+ enc$.encodeForm("referer", payload$.referer, {
293
+ explode: true,
294
+ charEncoding: "percent",
295
+ }),
296
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
297
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
298
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
299
+ explode: true,
300
+ charEncoding: "percent",
301
+ }),
302
+ ]
303
+ .filter(Boolean)
304
+ .join("&");
305
+ let security$;
306
+ if (typeof this.options$.token === "function") {
307
+ security$ = { token: await this.options$.token() };
308
+ }
309
+ else if (this.options$.token) {
310
+ security$ = { token: this.options$.token };
311
+ }
312
+ else {
313
+ security$ = {};
314
+ }
315
+ const context = {
316
+ operationID: "getTimeseriesAnalytics",
317
+ oAuth2Scopes: [],
318
+ securitySource: this.options$.token,
319
+ };
320
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
321
+ const doOptions = {
322
+ context,
323
+ errorCodes: [
324
+ "400",
325
+ "401",
326
+ "403",
327
+ "404",
328
+ "409",
329
+ "410",
330
+ "422",
331
+ "429",
332
+ "4XX",
333
+ "500",
334
+ "5XX",
335
+ ],
336
+ };
337
+ const request = this.createRequest$({
338
+ security: securitySettings$,
339
+ method: "GET",
340
+ path: path$,
341
+ headers: headers$,
342
+ query: query$,
343
+ body: body$,
344
+ }, options);
345
+ const response = await this.do$(request, doOptions);
346
+ const responseFields$ = {
347
+ HttpMeta: {
348
+ Response: response,
349
+ Request: request,
350
+ },
351
+ };
352
+ if (this.matchResponse(response, 200, "application/json")) {
353
+ const responseBody = await response.json();
354
+ const result = schemas$.parse(responseBody, (val$) => {
355
+ return z.array(operations.ResponseBody$.inboundSchema).parse(val$);
356
+ }, "Response validation failed");
357
+ return result;
358
+ }
359
+ else if (this.matchResponse(response, 400, "application/json")) {
360
+ const responseBody = await response.json();
361
+ const result = schemas$.parse(responseBody, (val$) => {
362
+ return errors.BadRequest$.inboundSchema.parse({
363
+ ...responseFields$,
364
+ ...val$,
365
+ });
366
+ }, "Response validation failed");
367
+ throw result;
368
+ }
369
+ else if (this.matchResponse(response, 401, "application/json")) {
370
+ const responseBody = await response.json();
371
+ const result = schemas$.parse(responseBody, (val$) => {
372
+ return errors.Unauthorized$.inboundSchema.parse({
373
+ ...responseFields$,
374
+ ...val$,
375
+ });
376
+ }, "Response validation failed");
377
+ throw result;
378
+ }
379
+ else if (this.matchResponse(response, 403, "application/json")) {
380
+ const responseBody = await response.json();
381
+ const result = schemas$.parse(responseBody, (val$) => {
382
+ return errors.Forbidden$.inboundSchema.parse({
383
+ ...responseFields$,
384
+ ...val$,
385
+ });
386
+ }, "Response validation failed");
387
+ throw result;
388
+ }
389
+ else if (this.matchResponse(response, 404, "application/json")) {
390
+ const responseBody = await response.json();
391
+ const result = schemas$.parse(responseBody, (val$) => {
392
+ return errors.NotFound$.inboundSchema.parse({
393
+ ...responseFields$,
394
+ ...val$,
395
+ });
396
+ }, "Response validation failed");
397
+ throw result;
398
+ }
399
+ else if (this.matchResponse(response, 409, "application/json")) {
400
+ const responseBody = await response.json();
401
+ const result = schemas$.parse(responseBody, (val$) => {
402
+ return errors.Conflict$.inboundSchema.parse({
403
+ ...responseFields$,
404
+ ...val$,
405
+ });
406
+ }, "Response validation failed");
407
+ throw result;
408
+ }
409
+ else if (this.matchResponse(response, 410, "application/json")) {
410
+ const responseBody = await response.json();
411
+ const result = schemas$.parse(responseBody, (val$) => {
412
+ return errors.InviteExpired$.inboundSchema.parse({
413
+ ...responseFields$,
414
+ ...val$,
415
+ });
416
+ }, "Response validation failed");
417
+ throw result;
418
+ }
419
+ else if (this.matchResponse(response, 422, "application/json")) {
420
+ const responseBody = await response.json();
421
+ const result = schemas$.parse(responseBody, (val$) => {
422
+ return errors.UnprocessableEntity$.inboundSchema.parse({
423
+ ...responseFields$,
424
+ ...val$,
425
+ });
426
+ }, "Response validation failed");
427
+ throw result;
428
+ }
429
+ else if (this.matchResponse(response, 429, "application/json")) {
430
+ const responseBody = await response.json();
431
+ const result = schemas$.parse(responseBody, (val$) => {
432
+ return errors.RateLimitExceeded$.inboundSchema.parse({
433
+ ...responseFields$,
434
+ ...val$,
435
+ });
436
+ }, "Response validation failed");
437
+ throw result;
438
+ }
439
+ else if (this.matchResponse(response, 500, "application/json")) {
440
+ const responseBody = await response.json();
441
+ const result = schemas$.parse(responseBody, (val$) => {
442
+ return errors.InternalServerError$.inboundSchema.parse({
443
+ ...responseFields$,
444
+ ...val$,
445
+ });
446
+ }, "Response validation failed");
447
+ throw result;
448
+ }
449
+ else {
450
+ const responseBody = await response.text();
451
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
452
+ }
453
+ }
454
+ /**
455
+ * Retrieve country analytics
456
+ *
457
+ * @remarks
458
+ * Retrieve the top countries by number of clicks for a link, a domain, or the authenticated workspace.
459
+ */
460
+ async countries(input, options) {
461
+ const headers$ = new Headers();
462
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
463
+ headers$.set("Accept", "application/json");
464
+ const payload$ = schemas$.parse(input, (value$) => operations.GetCountryAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
465
+ const body$ = null;
466
+ const path$ = this.templateURLComponent("/analytics/country")();
467
+ const query$ = [
468
+ enc$.encodeForm("browser", payload$.browser, {
469
+ explode: true,
470
+ charEncoding: "percent",
471
+ }),
472
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
473
+ enc$.encodeForm("country", payload$.country, {
474
+ explode: true,
475
+ charEncoding: "percent",
476
+ }),
477
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
478
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
479
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
480
+ explode: true,
481
+ charEncoding: "percent",
482
+ }),
483
+ enc$.encodeForm("interval", payload$.interval, {
484
+ explode: true,
485
+ charEncoding: "percent",
486
+ }),
487
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
488
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
489
+ enc$.encodeForm("referer", payload$.referer, {
490
+ explode: true,
491
+ charEncoding: "percent",
492
+ }),
493
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
494
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
495
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
496
+ explode: true,
497
+ charEncoding: "percent",
498
+ }),
499
+ ]
500
+ .filter(Boolean)
501
+ .join("&");
502
+ let security$;
503
+ if (typeof this.options$.token === "function") {
504
+ security$ = { token: await this.options$.token() };
505
+ }
506
+ else if (this.options$.token) {
507
+ security$ = { token: this.options$.token };
508
+ }
509
+ else {
510
+ security$ = {};
511
+ }
512
+ const context = {
513
+ operationID: "getCountryAnalytics",
514
+ oAuth2Scopes: [],
515
+ securitySource: this.options$.token,
516
+ };
517
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
518
+ const doOptions = {
519
+ context,
520
+ errorCodes: [
521
+ "400",
522
+ "401",
523
+ "403",
524
+ "404",
525
+ "409",
526
+ "410",
527
+ "422",
528
+ "429",
529
+ "4XX",
530
+ "500",
531
+ "5XX",
532
+ ],
533
+ };
534
+ const request = this.createRequest$({
535
+ security: securitySettings$,
536
+ method: "GET",
537
+ path: path$,
538
+ headers: headers$,
539
+ query: query$,
540
+ body: body$,
541
+ }, options);
542
+ const response = await this.do$(request, doOptions);
543
+ const responseFields$ = {
544
+ HttpMeta: {
545
+ Response: response,
546
+ Request: request,
547
+ },
548
+ };
549
+ if (this.matchResponse(response, 200, "application/json")) {
550
+ const responseBody = await response.json();
551
+ const result = schemas$.parse(responseBody, (val$) => {
552
+ return z
553
+ .array(operations.GetCountryAnalyticsResponseBody$.inboundSchema)
554
+ .parse(val$);
555
+ }, "Response validation failed");
556
+ return result;
557
+ }
558
+ else if (this.matchResponse(response, 400, "application/json")) {
559
+ const responseBody = await response.json();
560
+ const result = schemas$.parse(responseBody, (val$) => {
561
+ return errors.BadRequest$.inboundSchema.parse({
562
+ ...responseFields$,
563
+ ...val$,
564
+ });
565
+ }, "Response validation failed");
566
+ throw result;
567
+ }
568
+ else if (this.matchResponse(response, 401, "application/json")) {
569
+ const responseBody = await response.json();
570
+ const result = schemas$.parse(responseBody, (val$) => {
571
+ return errors.Unauthorized$.inboundSchema.parse({
572
+ ...responseFields$,
573
+ ...val$,
574
+ });
575
+ }, "Response validation failed");
576
+ throw result;
577
+ }
578
+ else if (this.matchResponse(response, 403, "application/json")) {
579
+ const responseBody = await response.json();
580
+ const result = schemas$.parse(responseBody, (val$) => {
581
+ return errors.Forbidden$.inboundSchema.parse({
582
+ ...responseFields$,
583
+ ...val$,
584
+ });
585
+ }, "Response validation failed");
586
+ throw result;
587
+ }
588
+ else if (this.matchResponse(response, 404, "application/json")) {
589
+ const responseBody = await response.json();
590
+ const result = schemas$.parse(responseBody, (val$) => {
591
+ return errors.NotFound$.inboundSchema.parse({
592
+ ...responseFields$,
593
+ ...val$,
594
+ });
595
+ }, "Response validation failed");
596
+ throw result;
597
+ }
598
+ else if (this.matchResponse(response, 409, "application/json")) {
599
+ const responseBody = await response.json();
600
+ const result = schemas$.parse(responseBody, (val$) => {
601
+ return errors.Conflict$.inboundSchema.parse({
602
+ ...responseFields$,
603
+ ...val$,
604
+ });
605
+ }, "Response validation failed");
606
+ throw result;
607
+ }
608
+ else if (this.matchResponse(response, 410, "application/json")) {
609
+ const responseBody = await response.json();
610
+ const result = schemas$.parse(responseBody, (val$) => {
611
+ return errors.InviteExpired$.inboundSchema.parse({
612
+ ...responseFields$,
613
+ ...val$,
614
+ });
615
+ }, "Response validation failed");
616
+ throw result;
617
+ }
618
+ else if (this.matchResponse(response, 422, "application/json")) {
619
+ const responseBody = await response.json();
620
+ const result = schemas$.parse(responseBody, (val$) => {
621
+ return errors.UnprocessableEntity$.inboundSchema.parse({
622
+ ...responseFields$,
623
+ ...val$,
624
+ });
625
+ }, "Response validation failed");
626
+ throw result;
627
+ }
628
+ else if (this.matchResponse(response, 429, "application/json")) {
629
+ const responseBody = await response.json();
630
+ const result = schemas$.parse(responseBody, (val$) => {
631
+ return errors.RateLimitExceeded$.inboundSchema.parse({
632
+ ...responseFields$,
633
+ ...val$,
634
+ });
635
+ }, "Response validation failed");
636
+ throw result;
637
+ }
638
+ else if (this.matchResponse(response, 500, "application/json")) {
639
+ const responseBody = await response.json();
640
+ const result = schemas$.parse(responseBody, (val$) => {
641
+ return errors.InternalServerError$.inboundSchema.parse({
642
+ ...responseFields$,
643
+ ...val$,
644
+ });
645
+ }, "Response validation failed");
646
+ throw result;
647
+ }
648
+ else {
649
+ const responseBody = await response.text();
650
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
651
+ }
652
+ }
653
+ /**
654
+ * Retrieve city analytics
655
+ *
656
+ * @remarks
657
+ * Retrieve the top countries by number of clicks for a link, a domain, or the authenticated workspace.
658
+ */
659
+ async cities(input, options) {
660
+ const headers$ = new Headers();
661
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
662
+ headers$.set("Accept", "application/json");
663
+ const payload$ = schemas$.parse(input, (value$) => operations.GetCityAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
664
+ const body$ = null;
665
+ const path$ = this.templateURLComponent("/analytics/city")();
666
+ const query$ = [
667
+ enc$.encodeForm("browser", payload$.browser, {
668
+ explode: true,
669
+ charEncoding: "percent",
670
+ }),
671
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
672
+ enc$.encodeForm("country", payload$.country, {
673
+ explode: true,
674
+ charEncoding: "percent",
675
+ }),
676
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
677
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
678
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
679
+ explode: true,
680
+ charEncoding: "percent",
681
+ }),
682
+ enc$.encodeForm("interval", payload$.interval, {
683
+ explode: true,
684
+ charEncoding: "percent",
685
+ }),
686
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
687
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
688
+ enc$.encodeForm("referer", payload$.referer, {
689
+ explode: true,
690
+ charEncoding: "percent",
691
+ }),
692
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
693
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
694
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
695
+ explode: true,
696
+ charEncoding: "percent",
697
+ }),
698
+ ]
699
+ .filter(Boolean)
700
+ .join("&");
701
+ let security$;
702
+ if (typeof this.options$.token === "function") {
703
+ security$ = { token: await this.options$.token() };
704
+ }
705
+ else if (this.options$.token) {
706
+ security$ = { token: this.options$.token };
707
+ }
708
+ else {
709
+ security$ = {};
710
+ }
711
+ const context = {
712
+ operationID: "getCityAnalytics",
713
+ oAuth2Scopes: [],
714
+ securitySource: this.options$.token,
715
+ };
716
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
717
+ const doOptions = {
718
+ context,
719
+ errorCodes: [
720
+ "400",
721
+ "401",
722
+ "403",
723
+ "404",
724
+ "409",
725
+ "410",
726
+ "422",
727
+ "429",
728
+ "4XX",
729
+ "500",
730
+ "5XX",
731
+ ],
732
+ };
733
+ const request = this.createRequest$({
734
+ security: securitySettings$,
735
+ method: "GET",
736
+ path: path$,
737
+ headers: headers$,
738
+ query: query$,
739
+ body: body$,
740
+ }, options);
741
+ const response = await this.do$(request, doOptions);
742
+ const responseFields$ = {
743
+ HttpMeta: {
744
+ Response: response,
745
+ Request: request,
746
+ },
747
+ };
748
+ if (this.matchResponse(response, 200, "application/json")) {
749
+ const responseBody = await response.json();
750
+ const result = schemas$.parse(responseBody, (val$) => {
751
+ return z
752
+ .array(operations.GetCityAnalyticsResponseBody$.inboundSchema)
753
+ .parse(val$);
754
+ }, "Response validation failed");
755
+ return result;
756
+ }
757
+ else if (this.matchResponse(response, 400, "application/json")) {
758
+ const responseBody = await response.json();
759
+ const result = schemas$.parse(responseBody, (val$) => {
760
+ return errors.BadRequest$.inboundSchema.parse({
761
+ ...responseFields$,
762
+ ...val$,
763
+ });
764
+ }, "Response validation failed");
765
+ throw result;
766
+ }
767
+ else if (this.matchResponse(response, 401, "application/json")) {
768
+ const responseBody = await response.json();
769
+ const result = schemas$.parse(responseBody, (val$) => {
770
+ return errors.Unauthorized$.inboundSchema.parse({
771
+ ...responseFields$,
772
+ ...val$,
773
+ });
774
+ }, "Response validation failed");
775
+ throw result;
776
+ }
777
+ else if (this.matchResponse(response, 403, "application/json")) {
778
+ const responseBody = await response.json();
779
+ const result = schemas$.parse(responseBody, (val$) => {
780
+ return errors.Forbidden$.inboundSchema.parse({
781
+ ...responseFields$,
782
+ ...val$,
783
+ });
784
+ }, "Response validation failed");
785
+ throw result;
786
+ }
787
+ else if (this.matchResponse(response, 404, "application/json")) {
788
+ const responseBody = await response.json();
789
+ const result = schemas$.parse(responseBody, (val$) => {
790
+ return errors.NotFound$.inboundSchema.parse({
791
+ ...responseFields$,
792
+ ...val$,
793
+ });
794
+ }, "Response validation failed");
795
+ throw result;
796
+ }
797
+ else if (this.matchResponse(response, 409, "application/json")) {
798
+ const responseBody = await response.json();
799
+ const result = schemas$.parse(responseBody, (val$) => {
800
+ return errors.Conflict$.inboundSchema.parse({
801
+ ...responseFields$,
802
+ ...val$,
803
+ });
804
+ }, "Response validation failed");
805
+ throw result;
806
+ }
807
+ else if (this.matchResponse(response, 410, "application/json")) {
808
+ const responseBody = await response.json();
809
+ const result = schemas$.parse(responseBody, (val$) => {
810
+ return errors.InviteExpired$.inboundSchema.parse({
811
+ ...responseFields$,
812
+ ...val$,
813
+ });
814
+ }, "Response validation failed");
815
+ throw result;
816
+ }
817
+ else if (this.matchResponse(response, 422, "application/json")) {
818
+ const responseBody = await response.json();
819
+ const result = schemas$.parse(responseBody, (val$) => {
820
+ return errors.UnprocessableEntity$.inboundSchema.parse({
821
+ ...responseFields$,
822
+ ...val$,
823
+ });
824
+ }, "Response validation failed");
825
+ throw result;
826
+ }
827
+ else if (this.matchResponse(response, 429, "application/json")) {
828
+ const responseBody = await response.json();
829
+ const result = schemas$.parse(responseBody, (val$) => {
830
+ return errors.RateLimitExceeded$.inboundSchema.parse({
831
+ ...responseFields$,
832
+ ...val$,
833
+ });
834
+ }, "Response validation failed");
835
+ throw result;
836
+ }
837
+ else if (this.matchResponse(response, 500, "application/json")) {
838
+ const responseBody = await response.json();
839
+ const result = schemas$.parse(responseBody, (val$) => {
840
+ return errors.InternalServerError$.inboundSchema.parse({
841
+ ...responseFields$,
842
+ ...val$,
843
+ });
844
+ }, "Response validation failed");
845
+ throw result;
846
+ }
847
+ else {
848
+ const responseBody = await response.text();
849
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
850
+ }
851
+ }
852
+ /**
853
+ * Retrieve device analytics
854
+ *
855
+ * @remarks
856
+ * Retrieve the top devices by number of clicks for a link, a domain, or the authenticated workspace.
857
+ */
858
+ async devices(input, options) {
859
+ const headers$ = new Headers();
860
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
861
+ headers$.set("Accept", "application/json");
862
+ const payload$ = schemas$.parse(input, (value$) => operations.GetDeviceAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
863
+ const body$ = null;
864
+ const path$ = this.templateURLComponent("/analytics/device")();
865
+ const query$ = [
866
+ enc$.encodeForm("browser", payload$.browser, {
867
+ explode: true,
868
+ charEncoding: "percent",
869
+ }),
870
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
871
+ enc$.encodeForm("country", payload$.country, {
872
+ explode: true,
873
+ charEncoding: "percent",
874
+ }),
875
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
876
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
877
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
878
+ explode: true,
879
+ charEncoding: "percent",
880
+ }),
881
+ enc$.encodeForm("interval", payload$.interval, {
882
+ explode: true,
883
+ charEncoding: "percent",
884
+ }),
885
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
886
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
887
+ enc$.encodeForm("referer", payload$.referer, {
888
+ explode: true,
889
+ charEncoding: "percent",
890
+ }),
891
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
892
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
893
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
894
+ explode: true,
895
+ charEncoding: "percent",
896
+ }),
897
+ ]
898
+ .filter(Boolean)
899
+ .join("&");
900
+ let security$;
901
+ if (typeof this.options$.token === "function") {
902
+ security$ = { token: await this.options$.token() };
903
+ }
904
+ else if (this.options$.token) {
905
+ security$ = { token: this.options$.token };
906
+ }
907
+ else {
908
+ security$ = {};
909
+ }
910
+ const context = {
911
+ operationID: "getDeviceAnalytics",
912
+ oAuth2Scopes: [],
913
+ securitySource: this.options$.token,
914
+ };
915
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
916
+ const doOptions = {
917
+ context,
918
+ errorCodes: [
919
+ "400",
920
+ "401",
921
+ "403",
922
+ "404",
923
+ "409",
924
+ "410",
925
+ "422",
926
+ "429",
927
+ "4XX",
928
+ "500",
929
+ "5XX",
930
+ ],
931
+ };
932
+ const request = this.createRequest$({
933
+ security: securitySettings$,
934
+ method: "GET",
935
+ path: path$,
936
+ headers: headers$,
937
+ query: query$,
938
+ body: body$,
939
+ }, options);
940
+ const response = await this.do$(request, doOptions);
941
+ const responseFields$ = {
942
+ HttpMeta: {
943
+ Response: response,
944
+ Request: request,
945
+ },
946
+ };
947
+ if (this.matchResponse(response, 200, "application/json")) {
948
+ const responseBody = await response.json();
949
+ const result = schemas$.parse(responseBody, (val$) => {
950
+ return z
951
+ .array(operations.GetDeviceAnalyticsResponseBody$.inboundSchema)
952
+ .parse(val$);
953
+ }, "Response validation failed");
954
+ return result;
955
+ }
956
+ else if (this.matchResponse(response, 400, "application/json")) {
957
+ const responseBody = await response.json();
958
+ const result = schemas$.parse(responseBody, (val$) => {
959
+ return errors.BadRequest$.inboundSchema.parse({
960
+ ...responseFields$,
961
+ ...val$,
962
+ });
963
+ }, "Response validation failed");
964
+ throw result;
965
+ }
966
+ else if (this.matchResponse(response, 401, "application/json")) {
967
+ const responseBody = await response.json();
968
+ const result = schemas$.parse(responseBody, (val$) => {
969
+ return errors.Unauthorized$.inboundSchema.parse({
970
+ ...responseFields$,
971
+ ...val$,
972
+ });
973
+ }, "Response validation failed");
974
+ throw result;
975
+ }
976
+ else if (this.matchResponse(response, 403, "application/json")) {
977
+ const responseBody = await response.json();
978
+ const result = schemas$.parse(responseBody, (val$) => {
979
+ return errors.Forbidden$.inboundSchema.parse({
980
+ ...responseFields$,
981
+ ...val$,
982
+ });
983
+ }, "Response validation failed");
984
+ throw result;
985
+ }
986
+ else if (this.matchResponse(response, 404, "application/json")) {
987
+ const responseBody = await response.json();
988
+ const result = schemas$.parse(responseBody, (val$) => {
989
+ return errors.NotFound$.inboundSchema.parse({
990
+ ...responseFields$,
991
+ ...val$,
992
+ });
993
+ }, "Response validation failed");
994
+ throw result;
995
+ }
996
+ else if (this.matchResponse(response, 409, "application/json")) {
997
+ const responseBody = await response.json();
998
+ const result = schemas$.parse(responseBody, (val$) => {
999
+ return errors.Conflict$.inboundSchema.parse({
1000
+ ...responseFields$,
1001
+ ...val$,
1002
+ });
1003
+ }, "Response validation failed");
1004
+ throw result;
1005
+ }
1006
+ else if (this.matchResponse(response, 410, "application/json")) {
1007
+ const responseBody = await response.json();
1008
+ const result = schemas$.parse(responseBody, (val$) => {
1009
+ return errors.InviteExpired$.inboundSchema.parse({
1010
+ ...responseFields$,
1011
+ ...val$,
1012
+ });
1013
+ }, "Response validation failed");
1014
+ throw result;
1015
+ }
1016
+ else if (this.matchResponse(response, 422, "application/json")) {
1017
+ const responseBody = await response.json();
1018
+ const result = schemas$.parse(responseBody, (val$) => {
1019
+ return errors.UnprocessableEntity$.inboundSchema.parse({
1020
+ ...responseFields$,
1021
+ ...val$,
1022
+ });
1023
+ }, "Response validation failed");
1024
+ throw result;
1025
+ }
1026
+ else if (this.matchResponse(response, 429, "application/json")) {
1027
+ const responseBody = await response.json();
1028
+ const result = schemas$.parse(responseBody, (val$) => {
1029
+ return errors.RateLimitExceeded$.inboundSchema.parse({
1030
+ ...responseFields$,
1031
+ ...val$,
1032
+ });
1033
+ }, "Response validation failed");
1034
+ throw result;
1035
+ }
1036
+ else if (this.matchResponse(response, 500, "application/json")) {
1037
+ const responseBody = await response.json();
1038
+ const result = schemas$.parse(responseBody, (val$) => {
1039
+ return errors.InternalServerError$.inboundSchema.parse({
1040
+ ...responseFields$,
1041
+ ...val$,
1042
+ });
1043
+ }, "Response validation failed");
1044
+ throw result;
1045
+ }
1046
+ else {
1047
+ const responseBody = await response.text();
1048
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
1049
+ }
1050
+ }
1051
+ /**
1052
+ * Retrieve browser analytics
1053
+ *
1054
+ * @remarks
1055
+ * Retrieve the top browsers by number of clicks for a link, a domain, or the authenticated workspace.
1056
+ */
1057
+ async browsers(input, options) {
1058
+ const headers$ = new Headers();
1059
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
1060
+ headers$.set("Accept", "application/json");
1061
+ const payload$ = schemas$.parse(input, (value$) => operations.GetBrowserAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
1062
+ const body$ = null;
1063
+ const path$ = this.templateURLComponent("/analytics/browser")();
1064
+ const query$ = [
1065
+ enc$.encodeForm("browser", payload$.browser, {
1066
+ explode: true,
1067
+ charEncoding: "percent",
1068
+ }),
1069
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
1070
+ enc$.encodeForm("country", payload$.country, {
1071
+ explode: true,
1072
+ charEncoding: "percent",
1073
+ }),
1074
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
1075
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
1076
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
1077
+ explode: true,
1078
+ charEncoding: "percent",
1079
+ }),
1080
+ enc$.encodeForm("interval", payload$.interval, {
1081
+ explode: true,
1082
+ charEncoding: "percent",
1083
+ }),
1084
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
1085
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
1086
+ enc$.encodeForm("referer", payload$.referer, {
1087
+ explode: true,
1088
+ charEncoding: "percent",
1089
+ }),
1090
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
1091
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
1092
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
1093
+ explode: true,
1094
+ charEncoding: "percent",
1095
+ }),
1096
+ ]
1097
+ .filter(Boolean)
1098
+ .join("&");
1099
+ let security$;
1100
+ if (typeof this.options$.token === "function") {
1101
+ security$ = { token: await this.options$.token() };
1102
+ }
1103
+ else if (this.options$.token) {
1104
+ security$ = { token: this.options$.token };
1105
+ }
1106
+ else {
1107
+ security$ = {};
1108
+ }
1109
+ const context = {
1110
+ operationID: "getBrowserAnalytics",
1111
+ oAuth2Scopes: [],
1112
+ securitySource: this.options$.token,
1113
+ };
1114
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
1115
+ const doOptions = {
1116
+ context,
1117
+ errorCodes: [
1118
+ "400",
1119
+ "401",
1120
+ "403",
1121
+ "404",
1122
+ "409",
1123
+ "410",
1124
+ "422",
1125
+ "429",
1126
+ "4XX",
1127
+ "500",
1128
+ "5XX",
1129
+ ],
1130
+ };
1131
+ const request = this.createRequest$({
1132
+ security: securitySettings$,
1133
+ method: "GET",
1134
+ path: path$,
1135
+ headers: headers$,
1136
+ query: query$,
1137
+ body: body$,
1138
+ }, options);
1139
+ const response = await this.do$(request, doOptions);
1140
+ const responseFields$ = {
1141
+ HttpMeta: {
1142
+ Response: response,
1143
+ Request: request,
1144
+ },
1145
+ };
1146
+ if (this.matchResponse(response, 200, "application/json")) {
1147
+ const responseBody = await response.json();
1148
+ const result = schemas$.parse(responseBody, (val$) => {
1149
+ return z
1150
+ .array(operations.GetBrowserAnalyticsResponseBody$.inboundSchema)
1151
+ .parse(val$);
1152
+ }, "Response validation failed");
1153
+ return result;
1154
+ }
1155
+ else if (this.matchResponse(response, 400, "application/json")) {
1156
+ const responseBody = await response.json();
1157
+ const result = schemas$.parse(responseBody, (val$) => {
1158
+ return errors.BadRequest$.inboundSchema.parse({
1159
+ ...responseFields$,
1160
+ ...val$,
1161
+ });
1162
+ }, "Response validation failed");
1163
+ throw result;
1164
+ }
1165
+ else if (this.matchResponse(response, 401, "application/json")) {
1166
+ const responseBody = await response.json();
1167
+ const result = schemas$.parse(responseBody, (val$) => {
1168
+ return errors.Unauthorized$.inboundSchema.parse({
1169
+ ...responseFields$,
1170
+ ...val$,
1171
+ });
1172
+ }, "Response validation failed");
1173
+ throw result;
1174
+ }
1175
+ else if (this.matchResponse(response, 403, "application/json")) {
1176
+ const responseBody = await response.json();
1177
+ const result = schemas$.parse(responseBody, (val$) => {
1178
+ return errors.Forbidden$.inboundSchema.parse({
1179
+ ...responseFields$,
1180
+ ...val$,
1181
+ });
1182
+ }, "Response validation failed");
1183
+ throw result;
1184
+ }
1185
+ else if (this.matchResponse(response, 404, "application/json")) {
1186
+ const responseBody = await response.json();
1187
+ const result = schemas$.parse(responseBody, (val$) => {
1188
+ return errors.NotFound$.inboundSchema.parse({
1189
+ ...responseFields$,
1190
+ ...val$,
1191
+ });
1192
+ }, "Response validation failed");
1193
+ throw result;
1194
+ }
1195
+ else if (this.matchResponse(response, 409, "application/json")) {
1196
+ const responseBody = await response.json();
1197
+ const result = schemas$.parse(responseBody, (val$) => {
1198
+ return errors.Conflict$.inboundSchema.parse({
1199
+ ...responseFields$,
1200
+ ...val$,
1201
+ });
1202
+ }, "Response validation failed");
1203
+ throw result;
1204
+ }
1205
+ else if (this.matchResponse(response, 410, "application/json")) {
1206
+ const responseBody = await response.json();
1207
+ const result = schemas$.parse(responseBody, (val$) => {
1208
+ return errors.InviteExpired$.inboundSchema.parse({
1209
+ ...responseFields$,
1210
+ ...val$,
1211
+ });
1212
+ }, "Response validation failed");
1213
+ throw result;
1214
+ }
1215
+ else if (this.matchResponse(response, 422, "application/json")) {
1216
+ const responseBody = await response.json();
1217
+ const result = schemas$.parse(responseBody, (val$) => {
1218
+ return errors.UnprocessableEntity$.inboundSchema.parse({
1219
+ ...responseFields$,
1220
+ ...val$,
1221
+ });
1222
+ }, "Response validation failed");
1223
+ throw result;
1224
+ }
1225
+ else if (this.matchResponse(response, 429, "application/json")) {
1226
+ const responseBody = await response.json();
1227
+ const result = schemas$.parse(responseBody, (val$) => {
1228
+ return errors.RateLimitExceeded$.inboundSchema.parse({
1229
+ ...responseFields$,
1230
+ ...val$,
1231
+ });
1232
+ }, "Response validation failed");
1233
+ throw result;
1234
+ }
1235
+ else if (this.matchResponse(response, 500, "application/json")) {
1236
+ const responseBody = await response.json();
1237
+ const result = schemas$.parse(responseBody, (val$) => {
1238
+ return errors.InternalServerError$.inboundSchema.parse({
1239
+ ...responseFields$,
1240
+ ...val$,
1241
+ });
1242
+ }, "Response validation failed");
1243
+ throw result;
1244
+ }
1245
+ else {
1246
+ const responseBody = await response.text();
1247
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
1248
+ }
1249
+ }
1250
+ /**
1251
+ * Retrieve OS analytics
1252
+ *
1253
+ * @remarks
1254
+ * Retrieve the top OS by number of clicks for a link, a domain, or the authenticated workspace.
1255
+ */
1256
+ async os(input, options) {
1257
+ const headers$ = new Headers();
1258
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
1259
+ headers$.set("Accept", "application/json");
1260
+ const payload$ = schemas$.parse(input, (value$) => operations.GetOSAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
1261
+ const body$ = null;
1262
+ const path$ = this.templateURLComponent("/analytics/os")();
1263
+ const query$ = [
1264
+ enc$.encodeForm("browser", payload$.browser, {
1265
+ explode: true,
1266
+ charEncoding: "percent",
1267
+ }),
1268
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
1269
+ enc$.encodeForm("country", payload$.country, {
1270
+ explode: true,
1271
+ charEncoding: "percent",
1272
+ }),
1273
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
1274
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
1275
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
1276
+ explode: true,
1277
+ charEncoding: "percent",
1278
+ }),
1279
+ enc$.encodeForm("interval", payload$.interval, {
1280
+ explode: true,
1281
+ charEncoding: "percent",
1282
+ }),
1283
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
1284
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
1285
+ enc$.encodeForm("referer", payload$.referer, {
1286
+ explode: true,
1287
+ charEncoding: "percent",
1288
+ }),
1289
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
1290
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
1291
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
1292
+ explode: true,
1293
+ charEncoding: "percent",
1294
+ }),
1295
+ ]
1296
+ .filter(Boolean)
1297
+ .join("&");
1298
+ let security$;
1299
+ if (typeof this.options$.token === "function") {
1300
+ security$ = { token: await this.options$.token() };
1301
+ }
1302
+ else if (this.options$.token) {
1303
+ security$ = { token: this.options$.token };
1304
+ }
1305
+ else {
1306
+ security$ = {};
1307
+ }
1308
+ const context = {
1309
+ operationID: "getOSAnalytics",
1310
+ oAuth2Scopes: [],
1311
+ securitySource: this.options$.token,
1312
+ };
1313
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
1314
+ const doOptions = {
1315
+ context,
1316
+ errorCodes: [
1317
+ "400",
1318
+ "401",
1319
+ "403",
1320
+ "404",
1321
+ "409",
1322
+ "410",
1323
+ "422",
1324
+ "429",
1325
+ "4XX",
1326
+ "500",
1327
+ "5XX",
1328
+ ],
1329
+ };
1330
+ const request = this.createRequest$({
1331
+ security: securitySettings$,
1332
+ method: "GET",
1333
+ path: path$,
1334
+ headers: headers$,
1335
+ query: query$,
1336
+ body: body$,
1337
+ }, options);
1338
+ const response = await this.do$(request, doOptions);
1339
+ const responseFields$ = {
1340
+ HttpMeta: {
1341
+ Response: response,
1342
+ Request: request,
1343
+ },
1344
+ };
1345
+ if (this.matchResponse(response, 200, "application/json")) {
1346
+ const responseBody = await response.json();
1347
+ const result = schemas$.parse(responseBody, (val$) => {
1348
+ return z
1349
+ .array(operations.GetOSAnalyticsResponseBody$.inboundSchema)
1350
+ .parse(val$);
1351
+ }, "Response validation failed");
1352
+ return result;
1353
+ }
1354
+ else if (this.matchResponse(response, 400, "application/json")) {
1355
+ const responseBody = await response.json();
1356
+ const result = schemas$.parse(responseBody, (val$) => {
1357
+ return errors.BadRequest$.inboundSchema.parse({
1358
+ ...responseFields$,
1359
+ ...val$,
1360
+ });
1361
+ }, "Response validation failed");
1362
+ throw result;
1363
+ }
1364
+ else if (this.matchResponse(response, 401, "application/json")) {
1365
+ const responseBody = await response.json();
1366
+ const result = schemas$.parse(responseBody, (val$) => {
1367
+ return errors.Unauthorized$.inboundSchema.parse({
1368
+ ...responseFields$,
1369
+ ...val$,
1370
+ });
1371
+ }, "Response validation failed");
1372
+ throw result;
1373
+ }
1374
+ else if (this.matchResponse(response, 403, "application/json")) {
1375
+ const responseBody = await response.json();
1376
+ const result = schemas$.parse(responseBody, (val$) => {
1377
+ return errors.Forbidden$.inboundSchema.parse({
1378
+ ...responseFields$,
1379
+ ...val$,
1380
+ });
1381
+ }, "Response validation failed");
1382
+ throw result;
1383
+ }
1384
+ else if (this.matchResponse(response, 404, "application/json")) {
1385
+ const responseBody = await response.json();
1386
+ const result = schemas$.parse(responseBody, (val$) => {
1387
+ return errors.NotFound$.inboundSchema.parse({
1388
+ ...responseFields$,
1389
+ ...val$,
1390
+ });
1391
+ }, "Response validation failed");
1392
+ throw result;
1393
+ }
1394
+ else if (this.matchResponse(response, 409, "application/json")) {
1395
+ const responseBody = await response.json();
1396
+ const result = schemas$.parse(responseBody, (val$) => {
1397
+ return errors.Conflict$.inboundSchema.parse({
1398
+ ...responseFields$,
1399
+ ...val$,
1400
+ });
1401
+ }, "Response validation failed");
1402
+ throw result;
1403
+ }
1404
+ else if (this.matchResponse(response, 410, "application/json")) {
1405
+ const responseBody = await response.json();
1406
+ const result = schemas$.parse(responseBody, (val$) => {
1407
+ return errors.InviteExpired$.inboundSchema.parse({
1408
+ ...responseFields$,
1409
+ ...val$,
1410
+ });
1411
+ }, "Response validation failed");
1412
+ throw result;
1413
+ }
1414
+ else if (this.matchResponse(response, 422, "application/json")) {
1415
+ const responseBody = await response.json();
1416
+ const result = schemas$.parse(responseBody, (val$) => {
1417
+ return errors.UnprocessableEntity$.inboundSchema.parse({
1418
+ ...responseFields$,
1419
+ ...val$,
1420
+ });
1421
+ }, "Response validation failed");
1422
+ throw result;
1423
+ }
1424
+ else if (this.matchResponse(response, 429, "application/json")) {
1425
+ const responseBody = await response.json();
1426
+ const result = schemas$.parse(responseBody, (val$) => {
1427
+ return errors.RateLimitExceeded$.inboundSchema.parse({
1428
+ ...responseFields$,
1429
+ ...val$,
1430
+ });
1431
+ }, "Response validation failed");
1432
+ throw result;
1433
+ }
1434
+ else if (this.matchResponse(response, 500, "application/json")) {
1435
+ const responseBody = await response.json();
1436
+ const result = schemas$.parse(responseBody, (val$) => {
1437
+ return errors.InternalServerError$.inboundSchema.parse({
1438
+ ...responseFields$,
1439
+ ...val$,
1440
+ });
1441
+ }, "Response validation failed");
1442
+ throw result;
1443
+ }
1444
+ else {
1445
+ const responseBody = await response.text();
1446
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
1447
+ }
1448
+ }
1449
+ /**
1450
+ * Retrieve referer analytics
1451
+ *
1452
+ * @remarks
1453
+ * Retrieve the top referers by number of clicks for a link, a domain, or the authenticated workspace.
1454
+ */
1455
+ async referers(input, options) {
1456
+ const headers$ = new Headers();
1457
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
1458
+ headers$.set("Accept", "application/json");
1459
+ const payload$ = schemas$.parse(input, (value$) => operations.GetRefererAnalyticsRequest$.outboundSchema.parse(value$), "Input validation failed");
1460
+ const body$ = null;
1461
+ const path$ = this.templateURLComponent("/analytics/referer")();
1462
+ const query$ = [
1463
+ enc$.encodeForm("browser", payload$.browser, {
1464
+ explode: true,
1465
+ charEncoding: "percent",
1466
+ }),
1467
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
1468
+ enc$.encodeForm("country", payload$.country, {
1469
+ explode: true,
1470
+ charEncoding: "percent",
1471
+ }),
1472
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
1473
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
1474
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
1475
+ explode: true,
1476
+ charEncoding: "percent",
1477
+ }),
1478
+ enc$.encodeForm("interval", payload$.interval, {
1479
+ explode: true,
1480
+ charEncoding: "percent",
1481
+ }),
1482
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
1483
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
1484
+ enc$.encodeForm("referer", payload$.referer, {
1485
+ explode: true,
1486
+ charEncoding: "percent",
1487
+ }),
1488
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
1489
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
1490
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
1491
+ explode: true,
1492
+ charEncoding: "percent",
1493
+ }),
1494
+ ]
1495
+ .filter(Boolean)
1496
+ .join("&");
1497
+ let security$;
1498
+ if (typeof this.options$.token === "function") {
1499
+ security$ = { token: await this.options$.token() };
1500
+ }
1501
+ else if (this.options$.token) {
1502
+ security$ = { token: this.options$.token };
1503
+ }
1504
+ else {
1505
+ security$ = {};
1506
+ }
1507
+ const context = {
1508
+ operationID: "getRefererAnalytics",
1509
+ oAuth2Scopes: [],
1510
+ securitySource: this.options$.token,
1511
+ };
1512
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
1513
+ const doOptions = {
1514
+ context,
1515
+ errorCodes: [
1516
+ "400",
1517
+ "401",
1518
+ "403",
1519
+ "404",
1520
+ "409",
1521
+ "410",
1522
+ "422",
1523
+ "429",
1524
+ "4XX",
1525
+ "500",
1526
+ "5XX",
1527
+ ],
1528
+ };
1529
+ const request = this.createRequest$({
1530
+ security: securitySettings$,
1531
+ method: "GET",
1532
+ path: path$,
1533
+ headers: headers$,
1534
+ query: query$,
1535
+ body: body$,
1536
+ }, options);
1537
+ const response = await this.do$(request, doOptions);
1538
+ const responseFields$ = {
1539
+ HttpMeta: {
1540
+ Response: response,
1541
+ Request: request,
1542
+ },
1543
+ };
1544
+ if (this.matchResponse(response, 200, "application/json")) {
1545
+ const responseBody = await response.json();
1546
+ const result = schemas$.parse(responseBody, (val$) => {
1547
+ return z
1548
+ .array(operations.GetRefererAnalyticsResponseBody$.inboundSchema)
1549
+ .parse(val$);
1550
+ }, "Response validation failed");
1551
+ return result;
1552
+ }
1553
+ else if (this.matchResponse(response, 400, "application/json")) {
1554
+ const responseBody = await response.json();
1555
+ const result = schemas$.parse(responseBody, (val$) => {
1556
+ return errors.BadRequest$.inboundSchema.parse({
1557
+ ...responseFields$,
1558
+ ...val$,
1559
+ });
1560
+ }, "Response validation failed");
1561
+ throw result;
1562
+ }
1563
+ else if (this.matchResponse(response, 401, "application/json")) {
1564
+ const responseBody = await response.json();
1565
+ const result = schemas$.parse(responseBody, (val$) => {
1566
+ return errors.Unauthorized$.inboundSchema.parse({
1567
+ ...responseFields$,
1568
+ ...val$,
1569
+ });
1570
+ }, "Response validation failed");
1571
+ throw result;
1572
+ }
1573
+ else if (this.matchResponse(response, 403, "application/json")) {
1574
+ const responseBody = await response.json();
1575
+ const result = schemas$.parse(responseBody, (val$) => {
1576
+ return errors.Forbidden$.inboundSchema.parse({
1577
+ ...responseFields$,
1578
+ ...val$,
1579
+ });
1580
+ }, "Response validation failed");
1581
+ throw result;
1582
+ }
1583
+ else if (this.matchResponse(response, 404, "application/json")) {
1584
+ const responseBody = await response.json();
1585
+ const result = schemas$.parse(responseBody, (val$) => {
1586
+ return errors.NotFound$.inboundSchema.parse({
1587
+ ...responseFields$,
1588
+ ...val$,
1589
+ });
1590
+ }, "Response validation failed");
1591
+ throw result;
1592
+ }
1593
+ else if (this.matchResponse(response, 409, "application/json")) {
1594
+ const responseBody = await response.json();
1595
+ const result = schemas$.parse(responseBody, (val$) => {
1596
+ return errors.Conflict$.inboundSchema.parse({
1597
+ ...responseFields$,
1598
+ ...val$,
1599
+ });
1600
+ }, "Response validation failed");
1601
+ throw result;
1602
+ }
1603
+ else if (this.matchResponse(response, 410, "application/json")) {
1604
+ const responseBody = await response.json();
1605
+ const result = schemas$.parse(responseBody, (val$) => {
1606
+ return errors.InviteExpired$.inboundSchema.parse({
1607
+ ...responseFields$,
1608
+ ...val$,
1609
+ });
1610
+ }, "Response validation failed");
1611
+ throw result;
1612
+ }
1613
+ else if (this.matchResponse(response, 422, "application/json")) {
1614
+ const responseBody = await response.json();
1615
+ const result = schemas$.parse(responseBody, (val$) => {
1616
+ return errors.UnprocessableEntity$.inboundSchema.parse({
1617
+ ...responseFields$,
1618
+ ...val$,
1619
+ });
1620
+ }, "Response validation failed");
1621
+ throw result;
1622
+ }
1623
+ else if (this.matchResponse(response, 429, "application/json")) {
1624
+ const responseBody = await response.json();
1625
+ const result = schemas$.parse(responseBody, (val$) => {
1626
+ return errors.RateLimitExceeded$.inboundSchema.parse({
1627
+ ...responseFields$,
1628
+ ...val$,
1629
+ });
1630
+ }, "Response validation failed");
1631
+ throw result;
1632
+ }
1633
+ else if (this.matchResponse(response, 500, "application/json")) {
1634
+ const responseBody = await response.json();
1635
+ const result = schemas$.parse(responseBody, (val$) => {
1636
+ return errors.InternalServerError$.inboundSchema.parse({
1637
+ ...responseFields$,
1638
+ ...val$,
1639
+ });
1640
+ }, "Response validation failed");
1641
+ throw result;
1642
+ }
1643
+ else {
1644
+ const responseBody = await response.text();
1645
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
1646
+ }
1647
+ }
1648
+ /**
1649
+ * Retrieve top links
1650
+ *
1651
+ * @remarks
1652
+ * Retrieve the top links by number of clicks for a domain or the authenticated workspace.
1653
+ */
1654
+ async topLinks(input, options) {
1655
+ const headers$ = new Headers();
1656
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
1657
+ headers$.set("Accept", "application/json");
1658
+ const payload$ = schemas$.parse(input, (value$) => operations.GetTopLinksRequest$.outboundSchema.parse(value$), "Input validation failed");
1659
+ const body$ = null;
1660
+ const path$ = this.templateURLComponent("/analytics/top_links")();
1661
+ const query$ = [
1662
+ enc$.encodeForm("browser", payload$.browser, {
1663
+ explode: true,
1664
+ charEncoding: "percent",
1665
+ }),
1666
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
1667
+ enc$.encodeForm("country", payload$.country, {
1668
+ explode: true,
1669
+ charEncoding: "percent",
1670
+ }),
1671
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
1672
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
1673
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
1674
+ explode: true,
1675
+ charEncoding: "percent",
1676
+ }),
1677
+ enc$.encodeForm("interval", payload$.interval, {
1678
+ explode: true,
1679
+ charEncoding: "percent",
1680
+ }),
1681
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
1682
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
1683
+ enc$.encodeForm("referer", payload$.referer, {
1684
+ explode: true,
1685
+ charEncoding: "percent",
1686
+ }),
1687
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
1688
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
1689
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
1690
+ explode: true,
1691
+ charEncoding: "percent",
1692
+ }),
1693
+ ]
1694
+ .filter(Boolean)
1695
+ .join("&");
1696
+ let security$;
1697
+ if (typeof this.options$.token === "function") {
1698
+ security$ = { token: await this.options$.token() };
1699
+ }
1700
+ else if (this.options$.token) {
1701
+ security$ = { token: this.options$.token };
1702
+ }
1703
+ else {
1704
+ security$ = {};
1705
+ }
1706
+ const context = {
1707
+ operationID: "getTopLinks",
1708
+ oAuth2Scopes: [],
1709
+ securitySource: this.options$.token,
1710
+ };
1711
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
1712
+ const doOptions = {
1713
+ context,
1714
+ errorCodes: [
1715
+ "400",
1716
+ "401",
1717
+ "403",
1718
+ "404",
1719
+ "409",
1720
+ "410",
1721
+ "422",
1722
+ "429",
1723
+ "4XX",
1724
+ "500",
1725
+ "5XX",
1726
+ ],
1727
+ };
1728
+ const request = this.createRequest$({
1729
+ security: securitySettings$,
1730
+ method: "GET",
1731
+ path: path$,
1732
+ headers: headers$,
1733
+ query: query$,
1734
+ body: body$,
1735
+ }, options);
1736
+ const response = await this.do$(request, doOptions);
1737
+ const responseFields$ = {
1738
+ HttpMeta: {
1739
+ Response: response,
1740
+ Request: request,
1741
+ },
1742
+ };
1743
+ if (this.matchResponse(response, 200, "application/json")) {
1744
+ const responseBody = await response.json();
1745
+ const result = schemas$.parse(responseBody, (val$) => {
1746
+ return z.array(operations.GetTopLinksResponseBody$.inboundSchema).parse(val$);
1747
+ }, "Response validation failed");
1748
+ return result;
1749
+ }
1750
+ else if (this.matchResponse(response, 400, "application/json")) {
1751
+ const responseBody = await response.json();
1752
+ const result = schemas$.parse(responseBody, (val$) => {
1753
+ return errors.BadRequest$.inboundSchema.parse({
1754
+ ...responseFields$,
1755
+ ...val$,
1756
+ });
1757
+ }, "Response validation failed");
1758
+ throw result;
1759
+ }
1760
+ else if (this.matchResponse(response, 401, "application/json")) {
1761
+ const responseBody = await response.json();
1762
+ const result = schemas$.parse(responseBody, (val$) => {
1763
+ return errors.Unauthorized$.inboundSchema.parse({
1764
+ ...responseFields$,
1765
+ ...val$,
1766
+ });
1767
+ }, "Response validation failed");
1768
+ throw result;
1769
+ }
1770
+ else if (this.matchResponse(response, 403, "application/json")) {
1771
+ const responseBody = await response.json();
1772
+ const result = schemas$.parse(responseBody, (val$) => {
1773
+ return errors.Forbidden$.inboundSchema.parse({
1774
+ ...responseFields$,
1775
+ ...val$,
1776
+ });
1777
+ }, "Response validation failed");
1778
+ throw result;
1779
+ }
1780
+ else if (this.matchResponse(response, 404, "application/json")) {
1781
+ const responseBody = await response.json();
1782
+ const result = schemas$.parse(responseBody, (val$) => {
1783
+ return errors.NotFound$.inboundSchema.parse({
1784
+ ...responseFields$,
1785
+ ...val$,
1786
+ });
1787
+ }, "Response validation failed");
1788
+ throw result;
1789
+ }
1790
+ else if (this.matchResponse(response, 409, "application/json")) {
1791
+ const responseBody = await response.json();
1792
+ const result = schemas$.parse(responseBody, (val$) => {
1793
+ return errors.Conflict$.inboundSchema.parse({
1794
+ ...responseFields$,
1795
+ ...val$,
1796
+ });
1797
+ }, "Response validation failed");
1798
+ throw result;
1799
+ }
1800
+ else if (this.matchResponse(response, 410, "application/json")) {
1801
+ const responseBody = await response.json();
1802
+ const result = schemas$.parse(responseBody, (val$) => {
1803
+ return errors.InviteExpired$.inboundSchema.parse({
1804
+ ...responseFields$,
1805
+ ...val$,
1806
+ });
1807
+ }, "Response validation failed");
1808
+ throw result;
1809
+ }
1810
+ else if (this.matchResponse(response, 422, "application/json")) {
1811
+ const responseBody = await response.json();
1812
+ const result = schemas$.parse(responseBody, (val$) => {
1813
+ return errors.UnprocessableEntity$.inboundSchema.parse({
1814
+ ...responseFields$,
1815
+ ...val$,
1816
+ });
1817
+ }, "Response validation failed");
1818
+ throw result;
1819
+ }
1820
+ else if (this.matchResponse(response, 429, "application/json")) {
1821
+ const responseBody = await response.json();
1822
+ const result = schemas$.parse(responseBody, (val$) => {
1823
+ return errors.RateLimitExceeded$.inboundSchema.parse({
1824
+ ...responseFields$,
1825
+ ...val$,
1826
+ });
1827
+ }, "Response validation failed");
1828
+ throw result;
1829
+ }
1830
+ else if (this.matchResponse(response, 500, "application/json")) {
1831
+ const responseBody = await response.json();
1832
+ const result = schemas$.parse(responseBody, (val$) => {
1833
+ return errors.InternalServerError$.inboundSchema.parse({
1834
+ ...responseFields$,
1835
+ ...val$,
1836
+ });
1837
+ }, "Response validation failed");
1838
+ throw result;
1839
+ }
1840
+ else {
1841
+ const responseBody = await response.text();
1842
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
1843
+ }
1844
+ }
1845
+ /**
1846
+ * Retrieve top URLs
1847
+ *
1848
+ * @remarks
1849
+ * Retrieve the top URLs by number of clicks for a given short link.
1850
+ */
1851
+ async topUrls(input, options) {
1852
+ const headers$ = new Headers();
1853
+ headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
1854
+ headers$.set("Accept", "application/json");
1855
+ const payload$ = schemas$.parse(input, (value$) => operations.GetTopURLsRequest$.outboundSchema.parse(value$), "Input validation failed");
1856
+ const body$ = null;
1857
+ const path$ = this.templateURLComponent("/analytics/top_urls")();
1858
+ const query$ = [
1859
+ enc$.encodeForm("browser", payload$.browser, {
1860
+ explode: true,
1861
+ charEncoding: "percent",
1862
+ }),
1863
+ enc$.encodeForm("city", payload$.city, { explode: true, charEncoding: "percent" }),
1864
+ enc$.encodeForm("country", payload$.country, {
1865
+ explode: true,
1866
+ charEncoding: "percent",
1867
+ }),
1868
+ enc$.encodeForm("device", payload$.device, { explode: true, charEncoding: "percent" }),
1869
+ enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
1870
+ enc$.encodeForm("excludeRoot", payload$.excludeRoot, {
1871
+ explode: true,
1872
+ charEncoding: "percent",
1873
+ }),
1874
+ enc$.encodeForm("interval", payload$.interval, {
1875
+ explode: true,
1876
+ charEncoding: "percent",
1877
+ }),
1878
+ enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
1879
+ enc$.encodeForm("os", payload$.os, { explode: true, charEncoding: "percent" }),
1880
+ enc$.encodeForm("referer", payload$.referer, {
1881
+ explode: true,
1882
+ charEncoding: "percent",
1883
+ }),
1884
+ enc$.encodeForm("tagId", payload$.tagId, { explode: true, charEncoding: "percent" }),
1885
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
1886
+ enc$.encodeForm("workspaceId", this.options$.workspaceId, {
1887
+ explode: true,
1888
+ charEncoding: "percent",
1889
+ }),
1890
+ ]
1891
+ .filter(Boolean)
1892
+ .join("&");
1893
+ let security$;
1894
+ if (typeof this.options$.token === "function") {
1895
+ security$ = { token: await this.options$.token() };
1896
+ }
1897
+ else if (this.options$.token) {
1898
+ security$ = { token: this.options$.token };
1899
+ }
1900
+ else {
1901
+ security$ = {};
1902
+ }
1903
+ const context = {
1904
+ operationID: "getTopURLs",
1905
+ oAuth2Scopes: [],
1906
+ securitySource: this.options$.token,
1907
+ };
1908
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
1909
+ const doOptions = {
1910
+ context,
1911
+ errorCodes: [
1912
+ "400",
1913
+ "401",
1914
+ "403",
1915
+ "404",
1916
+ "409",
1917
+ "410",
1918
+ "422",
1919
+ "429",
1920
+ "4XX",
1921
+ "500",
1922
+ "5XX",
1923
+ ],
1924
+ };
1925
+ const request = this.createRequest$({
1926
+ security: securitySettings$,
1927
+ method: "GET",
1928
+ path: path$,
1929
+ headers: headers$,
1930
+ query: query$,
1931
+ body: body$,
1932
+ }, options);
1933
+ const response = await this.do$(request, doOptions);
1934
+ const responseFields$ = {
1935
+ HttpMeta: {
1936
+ Response: response,
1937
+ Request: request,
1938
+ },
1939
+ };
1940
+ if (this.matchResponse(response, 200, "application/json")) {
1941
+ const responseBody = await response.json();
1942
+ const result = schemas$.parse(responseBody, (val$) => {
1943
+ return z.array(operations.GetTopURLsResponseBody$.inboundSchema).parse(val$);
1944
+ }, "Response validation failed");
1945
+ return result;
1946
+ }
1947
+ else if (this.matchResponse(response, 400, "application/json")) {
1948
+ const responseBody = await response.json();
1949
+ const result = schemas$.parse(responseBody, (val$) => {
1950
+ return errors.BadRequest$.inboundSchema.parse({
1951
+ ...responseFields$,
1952
+ ...val$,
1953
+ });
1954
+ }, "Response validation failed");
1955
+ throw result;
1956
+ }
1957
+ else if (this.matchResponse(response, 401, "application/json")) {
1958
+ const responseBody = await response.json();
1959
+ const result = schemas$.parse(responseBody, (val$) => {
1960
+ return errors.Unauthorized$.inboundSchema.parse({
1961
+ ...responseFields$,
1962
+ ...val$,
1963
+ });
1964
+ }, "Response validation failed");
1965
+ throw result;
1966
+ }
1967
+ else if (this.matchResponse(response, 403, "application/json")) {
1968
+ const responseBody = await response.json();
1969
+ const result = schemas$.parse(responseBody, (val$) => {
1970
+ return errors.Forbidden$.inboundSchema.parse({
1971
+ ...responseFields$,
1972
+ ...val$,
1973
+ });
1974
+ }, "Response validation failed");
1975
+ throw result;
1976
+ }
1977
+ else if (this.matchResponse(response, 404, "application/json")) {
1978
+ const responseBody = await response.json();
1979
+ const result = schemas$.parse(responseBody, (val$) => {
1980
+ return errors.NotFound$.inboundSchema.parse({
1981
+ ...responseFields$,
1982
+ ...val$,
1983
+ });
1984
+ }, "Response validation failed");
1985
+ throw result;
1986
+ }
1987
+ else if (this.matchResponse(response, 409, "application/json")) {
1988
+ const responseBody = await response.json();
1989
+ const result = schemas$.parse(responseBody, (val$) => {
1990
+ return errors.Conflict$.inboundSchema.parse({
1991
+ ...responseFields$,
1992
+ ...val$,
1993
+ });
1994
+ }, "Response validation failed");
1995
+ throw result;
1996
+ }
1997
+ else if (this.matchResponse(response, 410, "application/json")) {
1998
+ const responseBody = await response.json();
1999
+ const result = schemas$.parse(responseBody, (val$) => {
2000
+ return errors.InviteExpired$.inboundSchema.parse({
2001
+ ...responseFields$,
2002
+ ...val$,
2003
+ });
2004
+ }, "Response validation failed");
2005
+ throw result;
2006
+ }
2007
+ else if (this.matchResponse(response, 422, "application/json")) {
2008
+ const responseBody = await response.json();
2009
+ const result = schemas$.parse(responseBody, (val$) => {
2010
+ return errors.UnprocessableEntity$.inboundSchema.parse({
2011
+ ...responseFields$,
2012
+ ...val$,
2013
+ });
2014
+ }, "Response validation failed");
2015
+ throw result;
2016
+ }
2017
+ else if (this.matchResponse(response, 429, "application/json")) {
2018
+ const responseBody = await response.json();
2019
+ const result = schemas$.parse(responseBody, (val$) => {
2020
+ return errors.RateLimitExceeded$.inboundSchema.parse({
2021
+ ...responseFields$,
2022
+ ...val$,
2023
+ });
2024
+ }, "Response validation failed");
2025
+ throw result;
2026
+ }
2027
+ else if (this.matchResponse(response, 500, "application/json")) {
2028
+ const responseBody = await response.json();
2029
+ const result = schemas$.parse(responseBody, (val$) => {
2030
+ return errors.InternalServerError$.inboundSchema.parse({
2031
+ ...responseFields$,
2032
+ ...val$,
2033
+ });
2034
+ }, "Response validation failed");
2035
+ throw result;
2036
+ }
2037
+ else {
2038
+ const responseBody = await response.text();
2039
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
2040
+ }
2041
+ }
2042
+ }
2043
+ exports.Analytics = Analytics;
2044
+ //# sourceMappingURL=analytics.js.map