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