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