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