mirror of
https://github.com/LukeHagar/dub-node.git
synced 2025-12-06 04:19:37 +00:00
305 lines
11 KiB
TypeScript
305 lines
11 KiB
TypeScript
/*
|
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
*/
|
|
|
|
import { ClosedEnum } from "../../types";
|
|
import * as components from "../components";
|
|
import * as z from "zod";
|
|
|
|
export type GetOSByClicksDeprecatedGlobals = {
|
|
workspaceId: string;
|
|
/**
|
|
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
*/
|
|
projectSlug?: string | undefined;
|
|
};
|
|
|
|
/**
|
|
* The interval to retrieve analytics for. Takes precedence over start and end. If undefined, defaults to 24h.
|
|
*/
|
|
export const GetOSByClicksDeprecatedQueryParamInterval = {
|
|
Oneh: "1h",
|
|
TwentyFourh: "24h",
|
|
Sevend: "7d",
|
|
Thirtyd: "30d",
|
|
Ninetyd: "90d",
|
|
Ytd: "ytd",
|
|
Oney: "1y",
|
|
All: "all",
|
|
} as const;
|
|
/**
|
|
* The interval to retrieve analytics for. Takes precedence over start and end. If undefined, defaults to 24h.
|
|
*/
|
|
export type GetOSByClicksDeprecatedQueryParamInterval = ClosedEnum<
|
|
typeof GetOSByClicksDeprecatedQueryParamInterval
|
|
>;
|
|
|
|
export type GetOSByClicksDeprecatedRequest = {
|
|
/**
|
|
* The domain to filter analytics for.
|
|
*/
|
|
domain?: string | undefined;
|
|
/**
|
|
* The short link slug.
|
|
*/
|
|
key?: string | undefined;
|
|
/**
|
|
* The unique ID of the short link on Dub.
|
|
*/
|
|
linkId?: string | undefined;
|
|
/**
|
|
* This is the ID of the link in the your database. Must be prefixed with 'ext_' when passed as a query parameter.
|
|
*/
|
|
externalId?: string | undefined;
|
|
/**
|
|
* The interval to retrieve analytics for. Takes precedence over start and end. If undefined, defaults to 24h.
|
|
*/
|
|
interval?: GetOSByClicksDeprecatedQueryParamInterval | undefined;
|
|
/**
|
|
* The start date and time when to retrieve analytics from.
|
|
*/
|
|
start?: string | undefined;
|
|
/**
|
|
* The end date and time when to retrieve analytics from. If not provided, defaults to the current date.
|
|
*/
|
|
end?: string | undefined;
|
|
/**
|
|
* The country to retrieve analytics for.
|
|
*/
|
|
country?: components.CountryCode | undefined;
|
|
/**
|
|
* The city to retrieve analytics for.
|
|
*/
|
|
city?: string | undefined;
|
|
/**
|
|
* The device to retrieve analytics for.
|
|
*/
|
|
device?: string | undefined;
|
|
/**
|
|
* The browser to retrieve analytics for.
|
|
*/
|
|
browser?: string | undefined;
|
|
/**
|
|
* The OS to retrieve analytics for.
|
|
*/
|
|
os?: string | undefined;
|
|
/**
|
|
* The referer to retrieve analytics for.
|
|
*/
|
|
referer?: string | undefined;
|
|
/**
|
|
* The URL to retrieve analytics for.
|
|
*/
|
|
url?: string | undefined;
|
|
/**
|
|
* The tag ID to retrieve analytics for.
|
|
*/
|
|
tagId?: string | undefined;
|
|
/**
|
|
* Filter for QR code scans. If true, filter for QR codes only. If false, filter for links only. If undefined, return both.
|
|
*/
|
|
qr?: boolean | undefined;
|
|
/**
|
|
* Filter for root domains. If true, filter for domains only. If false, filter for links only. If undefined, return both.
|
|
*/
|
|
root?: boolean | undefined;
|
|
};
|
|
|
|
export type GetOSByClicksDeprecatedResponseBody = {
|
|
/**
|
|
* The name of the OS
|
|
*/
|
|
os: string;
|
|
/**
|
|
* The number of clicks from this OS
|
|
*/
|
|
clicks: number;
|
|
};
|
|
|
|
/** @internal */
|
|
export namespace GetOSByClicksDeprecatedGlobals$ {
|
|
export const inboundSchema: z.ZodType<GetOSByClicksDeprecatedGlobals, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
workspaceId: z.string(),
|
|
projectSlug: z.string().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return {
|
|
workspaceId: v.workspaceId,
|
|
...(v.projectSlug === undefined ? null : { projectSlug: v.projectSlug }),
|
|
};
|
|
});
|
|
|
|
export type Outbound = {
|
|
workspaceId: string;
|
|
projectSlug?: string | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetOSByClicksDeprecatedGlobals> =
|
|
z
|
|
.object({
|
|
workspaceId: z.string(),
|
|
projectSlug: z.string().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return {
|
|
workspaceId: v.workspaceId,
|
|
...(v.projectSlug === undefined ? null : { projectSlug: v.projectSlug }),
|
|
};
|
|
});
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetOSByClicksDeprecatedQueryParamInterval$ {
|
|
export const inboundSchema = z.nativeEnum(GetOSByClicksDeprecatedQueryParamInterval);
|
|
export const outboundSchema = inboundSchema;
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetOSByClicksDeprecatedRequest$ {
|
|
export const inboundSchema: z.ZodType<GetOSByClicksDeprecatedRequest, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
domain: z.string().optional(),
|
|
key: z.string().optional(),
|
|
linkId: z.string().optional(),
|
|
externalId: z.string().optional(),
|
|
interval: GetOSByClicksDeprecatedQueryParamInterval$.inboundSchema.optional(),
|
|
start: z.string().optional(),
|
|
end: z.string().optional(),
|
|
country: components.CountryCode$.inboundSchema.optional(),
|
|
city: z.string().optional(),
|
|
device: z.string().optional(),
|
|
browser: z.string().optional(),
|
|
os: z.string().optional(),
|
|
referer: z.string().optional(),
|
|
url: z.string().optional(),
|
|
tagId: z.string().optional(),
|
|
qr: z.boolean().optional(),
|
|
root: z.boolean().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return {
|
|
...(v.domain === undefined ? null : { domain: v.domain }),
|
|
...(v.key === undefined ? null : { key: v.key }),
|
|
...(v.linkId === undefined ? null : { linkId: v.linkId }),
|
|
...(v.externalId === undefined ? null : { externalId: v.externalId }),
|
|
...(v.interval === undefined ? null : { interval: v.interval }),
|
|
...(v.start === undefined ? null : { start: v.start }),
|
|
...(v.end === undefined ? null : { end: v.end }),
|
|
...(v.country === undefined ? null : { country: v.country }),
|
|
...(v.city === undefined ? null : { city: v.city }),
|
|
...(v.device === undefined ? null : { device: v.device }),
|
|
...(v.browser === undefined ? null : { browser: v.browser }),
|
|
...(v.os === undefined ? null : { os: v.os }),
|
|
...(v.referer === undefined ? null : { referer: v.referer }),
|
|
...(v.url === undefined ? null : { url: v.url }),
|
|
...(v.tagId === undefined ? null : { tagId: v.tagId }),
|
|
...(v.qr === undefined ? null : { qr: v.qr }),
|
|
...(v.root === undefined ? null : { root: v.root }),
|
|
};
|
|
});
|
|
|
|
export type Outbound = {
|
|
domain?: string | undefined;
|
|
key?: string | undefined;
|
|
linkId?: string | undefined;
|
|
externalId?: string | undefined;
|
|
interval?: string | undefined;
|
|
start?: string | undefined;
|
|
end?: string | undefined;
|
|
country?: string | undefined;
|
|
city?: string | undefined;
|
|
device?: string | undefined;
|
|
browser?: string | undefined;
|
|
os?: string | undefined;
|
|
referer?: string | undefined;
|
|
url?: string | undefined;
|
|
tagId?: string | undefined;
|
|
qr?: boolean | undefined;
|
|
root?: boolean | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetOSByClicksDeprecatedRequest> =
|
|
z
|
|
.object({
|
|
domain: z.string().optional(),
|
|
key: z.string().optional(),
|
|
linkId: z.string().optional(),
|
|
externalId: z.string().optional(),
|
|
interval: GetOSByClicksDeprecatedQueryParamInterval$.outboundSchema.optional(),
|
|
start: z.string().optional(),
|
|
end: z.string().optional(),
|
|
country: components.CountryCode$.outboundSchema.optional(),
|
|
city: z.string().optional(),
|
|
device: z.string().optional(),
|
|
browser: z.string().optional(),
|
|
os: z.string().optional(),
|
|
referer: z.string().optional(),
|
|
url: z.string().optional(),
|
|
tagId: z.string().optional(),
|
|
qr: z.boolean().optional(),
|
|
root: z.boolean().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return {
|
|
...(v.domain === undefined ? null : { domain: v.domain }),
|
|
...(v.key === undefined ? null : { key: v.key }),
|
|
...(v.linkId === undefined ? null : { linkId: v.linkId }),
|
|
...(v.externalId === undefined ? null : { externalId: v.externalId }),
|
|
...(v.interval === undefined ? null : { interval: v.interval }),
|
|
...(v.start === undefined ? null : { start: v.start }),
|
|
...(v.end === undefined ? null : { end: v.end }),
|
|
...(v.country === undefined ? null : { country: v.country }),
|
|
...(v.city === undefined ? null : { city: v.city }),
|
|
...(v.device === undefined ? null : { device: v.device }),
|
|
...(v.browser === undefined ? null : { browser: v.browser }),
|
|
...(v.os === undefined ? null : { os: v.os }),
|
|
...(v.referer === undefined ? null : { referer: v.referer }),
|
|
...(v.url === undefined ? null : { url: v.url }),
|
|
...(v.tagId === undefined ? null : { tagId: v.tagId }),
|
|
...(v.qr === undefined ? null : { qr: v.qr }),
|
|
...(v.root === undefined ? null : { root: v.root }),
|
|
};
|
|
});
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetOSByClicksDeprecatedResponseBody$ {
|
|
export const inboundSchema: z.ZodType<
|
|
GetOSByClicksDeprecatedResponseBody,
|
|
z.ZodTypeDef,
|
|
unknown
|
|
> = z
|
|
.object({
|
|
os: z.string(),
|
|
clicks: z.number(),
|
|
})
|
|
.transform((v) => {
|
|
return {
|
|
os: v.os,
|
|
clicks: v.clicks,
|
|
};
|
|
});
|
|
|
|
export type Outbound = {
|
|
os: string;
|
|
clicks: number;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<
|
|
Outbound,
|
|
z.ZodTypeDef,
|
|
GetOSByClicksDeprecatedResponseBody
|
|
> = z
|
|
.object({
|
|
os: z.string(),
|
|
clicks: z.number(),
|
|
})
|
|
.transform((v) => {
|
|
return {
|
|
os: v.os,
|
|
clicks: v.clicks,
|
|
};
|
|
});
|
|
}
|