Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

mark the response as components

Kiran K3facd94e7688
diff --git a/apps/web/lib/zod/schemas/clicks-analytics.ts b/apps/web/lib/zod/schemas/clicks-analytics.ts
index c0ebbfc6aa..1dd708fd4f 100644
--- a/apps/web/lib/zod/schemas/clicks-analytics.ts
+++ b/apps/web/lib/zod/schemas/clicks-analytics.ts
@@ -4,13 +4,19 @@ import { eventTrigger } from "./analytics";
// Click analytics response schemas
export const clickAnalyticsResponse = {
- count: z.object({
- clicks: z.number().describe("The total number of clicks"),
- }),
- timeseries: z.object({
- start: z.string().describe("The starting timestamp of the interval"),
- clicks: z.number().describe("The number of clicks in the interval"),
- }),
+ count: z
+ .object({
+ clicks: z.number().describe("The total number of clicks"),
+ })
+ .openapi({ ref: "ClicksCount" }),
+
+ timeseries: z
+ .object({
+ start: z.string().describe("The starting timestamp of the interval"),
+ clicks: z.number().describe("The number of clicks in the interval"),
+ })
+ .openapi({ ref: "ClicksTimeseries" }),
+
countries: z
.object({
country: z
@@ -18,7 +24,8 @@ export const clickAnalyticsResponse = {
.describe("The 2-letter country code: https://d.to/geo"),
clicks: z.number().describe("The number of clicks from this country"),
})
- .openapi({ ref: "clicksByCountry" }),
+ .openapi({ ref: "ClicksCountries" }),
+
cities: z
.object({
city: z.string().describe("The name of the city"),
@@ -27,38 +34,60 @@ export const clickAnalyticsResponse = {
.describe("The 2-letter country code of the city: https://d.to/geo"),
clicks: z.number().describe("The number of clicks from this city"),
})
- .openapi({ ref: "clicksByCities" }),
- devices: z.object({
- device: z.string().describe("The name of the device"),
- clicks: z.number().describe("The number of clicks from this device"),
- }),
- browsers: z.object({
- browser: z.string().describe("The name of the browser"),
- clicks: z.number().describe("The number of clicks from this browser"),
- }),
- os: z.object({
- os: z.string().describe("The name of the OS"),
- clicks: z.number().describe("The number of clicks from this OS"),
- }),
- referers: z.object({
- referer: z
- .string()
- .describe("The name of the referer. If unknown, this will be `(direct)`"),
- clicks: z.number().describe("The number of clicks from this referer"),
- }),
- top_links: z.object({
- link: z.string().describe("The unique ID of the short link"),
- clicks: z.number().describe("The number of clicks from this link"),
- }),
- top_urls: z.object({
- url: z.string().describe("The destination URL"),
- clicks: z.number().describe("The number of clicks from this URL"),
- }),
+ .openapi({ ref: "ClicksCities" }),
- trigger: z.object({
- trigger: eventTrigger,
- clicks: z
- .number()
- .describe("The number of clicks from this trigger method."),
- }),
+ devices: z
+ .object({
+ device: z.string().describe("The name of the device"),
+ clicks: z.number().describe("The number of clicks from this device"),
+ })
+ .openapi({ ref: "ClicksDevices" }),
+
+ browsers: z
+ .object({
+ browser: z.string().describe("The name of the browser"),
+ clicks: z.number().describe("The number of clicks from this browser"),
+ })
+ .openapi({ ref: "ClicksBrowsers" }),
+
+ os: z
+ .object({
+ os: z.string().describe("The name of the OS"),
+ clicks: z.number().describe("The number of clicks from this OS"),
+ })
+ .openapi({ ref: "ClicksOS" }),
+
+ referers: z
+ .object({
+ referer: z
+ .string()
+ .describe(
+ "The name of the referer. If unknown, this will be `(direct)`",
+ ),
+ clicks: z.number().describe("The number of clicks from this referer"),
+ })
+ .openapi({ ref: "ClicksReferers" }),
+
+ top_links: z
+ .object({
+ link: z.string().describe("The unique ID of the short link"),
+ clicks: z.number().describe("The number of clicks from this link"),
+ })
+ .openapi({ ref: "ClicksTopLinks" }),
+
+ top_urls: z
+ .object({
+ url: z.string().describe("The destination URL"),
+ clicks: z.number().describe("The number of clicks from this URL"),
+ })
+ .openapi({ ref: "ClicksTopUrls" }),
+
+ trigger: z
+ .object({
+ trigger: eventTrigger,
+ clicks: z
+ .number()
+ .describe("The number of clicks from this trigger method."),
+ })
+ .openapi({ ref: "ClicksTrigger" }),
} as const;
diff --git a/apps/web/lib/zod/schemas/leads-analytics.ts b/apps/web/lib/zod/schemas/leads-analytics.ts
index e6f00f27aa..e8e1a5c9f0 100644
--- a/apps/web/lib/zod/schemas/leads-analytics.ts
+++ b/apps/web/lib/zod/schemas/leads-analytics.ts
@@ -3,14 +3,18 @@ import { COUNTRY_CODES } from "@dub/utils";
import { eventTrigger } from "./analytics";
export const leadAnalyticsResponse = {
- count: z.object({
- leads: z.number().describe("The total number of leads"),
- }),
+ count: z
+ .object({
+ leads: z.number().describe("The total number of leads"),
+ })
+ .openapi({ ref: "LeadsCount" }),
- timeseries: z.object({
- start: z.string().describe("The starting timestamp of the interval"),
- leads: z.number().describe("The number of leads in the interval"),
- }),
+ timeseries: z
+ .object({
+ start: z.string().describe("The starting timestamp of the interval"),
+ leads: z.number().describe("The number of leads in the interval"),
+ })
+ .openapi({ ref: "LeadsTimeseries" }),
countries: z
.object({
@@ -19,7 +23,7 @@ export const leadAnalyticsResponse = {
.describe("The 2-letter country code: https://d.to/geo"),
leads: z.number().describe("The number of leads from this country"),
})
- .openapi({ ref: "leadsByCountry" }),
+ .openapi({ ref: "LeadsCountries" }),
cities: z
.object({
@@ -29,42 +33,60 @@ export const leadAnalyticsResponse = {
.describe("The 2-letter country code of the city: https://d.to/geo"),
leads: z.number().describe("The number of leads from this city"),
})
- .openapi({ ref: "leadsByCities" }),
+ .openapi({ ref: "LeadsCities" }),
- devices: z.object({
- device: z.string().describe("The name of the device"),
- leads: z.number().describe("The number of leads from this device"),
- }),
+ devices: z
+ .object({
+ device: z.string().describe("The name of the device"),
+ leads: z.number().describe("The number of leads from this device"),
+ })
+ .openapi({ ref: "LeadsDevices" }),
- browsers: z.object({
- browser: z.string().describe("The name of the browser"),
- leads: z.number().describe("The number of leads from this browser"),
- }),
+ browsers: z
+ .object({
+ browser: z.string().describe("The name of the browser"),
+ leads: z.number().describe("The number of leads from this browser"),
+ })
+ .openapi({ ref: "LeadsBrowsers" }),
- os: z.object({
- os: z.string().describe("The name of the OS"),
- leads: z.number().describe("The number of leads from this OS"),
- }),
+ os: z
+ .object({
+ os: z.string().describe("The name of the OS"),
+ leads: z.number().describe("The number of leads from this OS"),
+ })
+ .openapi({ ref: "LeadsOS" }),
- referers: z.object({
- referer: z
- .string()
- .describe("The name of the referer. If unknown, this will be `(direct)`"),
- leads: z.number().describe("The number of leads from this referer"),
- }),
+ referers: z
+ .object({
+ referer: z
+ .string()
+ .describe(
+ "The name of the referer. If unknown, this will be `(direct)`",
+ ),
+ leads: z.number().describe("The number of leads from this referer"),
+ })
+ .openapi({ ref: "LeadsReferers" }),
- top_links: z.object({
- link: z.string().describe("The unique ID of the short link"),
- leads: z.number().describe("The number of leads from this link"),
- }),
+ top_links: z
+ .object({
+ link: z.string().describe("The unique ID of the short link"),
+ leads: z.number().describe("The number of leads from this link"),
+ })
+ .openapi({ ref: "LeadsTopLinks" }),
- top_urls: z.object({
- url: z.string().describe("The destination URL"),
- leads: z.number().describe("The number of leads from this URL"),
- }),
+ top_urls: z
+ .object({
+ url: z.string().describe("The destination URL"),
+ leads: z.number().describe("The number of leads from this URL"),
+ })
+ .openapi({ ref: "LeadsTopUrls" }),
- trigger: z.object({
- trigger: eventTrigger,
- leads: z.number().describe("The number of leads from this trigger method."),
- }),
+ trigger: z
+ .object({
+ trigger: eventTrigger,
+ leads: z
+ .number()
+ .describe("The number of leads from this trigger method."),
+ })
+ .openapi({ ref: "LeadsTrigger" }),
} as const;
diff --git a/apps/web/lib/zod/schemas/sales-analytics.ts b/apps/web/lib/zod/schemas/sales-analytics.ts
index 3f5adb923f..26c2412129 100644
--- a/apps/web/lib/zod/schemas/sales-analytics.ts
+++ b/apps/web/lib/zod/schemas/sales-analytics.ts
@@ -3,16 +3,20 @@ import { COUNTRY_CODES } from "@dub/utils";
import { eventTrigger } from "./analytics";
export const saleAnalyticsResponse = {
- count: z.object({
- sales: z.number().describe("The total number of sales"),
- amount: z.number().describe("The total amount of sales"),
- }),
+ count: z
+ .object({
+ sales: z.number().describe("The total number of sales"),
+ amount: z.number().describe("The total amount of sales"),
+ })
+ .openapi({ ref: "SalesCount" }),
- timeseries: z.object({
- start: z.string().describe("The starting timestamp of the interval"),
- sales: z.number().describe("The number of sales in the interval"),
- amount: z.number().describe("The total amount of sales in the interval"),
- }),
+ timeseries: z
+ .object({
+ start: z.string().describe("The starting timestamp of the interval"),
+ sales: z.number().describe("The number of sales in the interval"),
+ amount: z.number().describe("The total amount of sales in the interval"),
+ })
+ .openapi({ ref: "SalesTimeseries" }),
countries: z
.object({
@@ -24,7 +28,7 @@ export const saleAnalyticsResponse = {
.number()
.describe("The total amount of sales from this country"),
})
- .openapi({ ref: "salesByCountry" }),
+ .openapi({ ref: "SalesCountries" }),
cities: z
.object({
@@ -35,51 +39,73 @@ export const saleAnalyticsResponse = {
sales: z.number().describe("The number of sales from this city"),
amount: z.number().describe("The total amount of sales from this city"),
})
- .openapi({ ref: "salesByCities" }),
+ .openapi({ ref: "SalesCities" }),
- devices: z.object({
- device: z.string().describe("The name of the device"),
- sales: z.number().describe("The number of sales from this device"),
- amount: z.number().describe("The total amount of sales from this device"),
- }),
+ devices: z
+ .object({
+ device: z.string().describe("The name of the device"),
+ sales: z.number().describe("The number of sales from this device"),
+ amount: z.number().describe("The total amount of sales from this device"),
+ })
+ .openapi({ ref: "SalesDevices" }),
- browsers: z.object({
- browser: z.string().describe("The name of the browser"),
- sales: z.number().describe("The number of sales from this browser"),
- amount: z.number().describe("The total amount of sales from this browser"),
- }),
+ browsers: z
+ .object({
+ browser: z.string().describe("The name of the browser"),
+ sales: z.number().describe("The number of sales from this browser"),
+ amount: z
+ .number()
+ .describe("The total amount of sales from this browser"),
+ })
+ .openapi({ ref: "SalesBrowsers" }),
- os: z.object({
- os: z.string().describe("The name of the OS"),
- sales: z.number().describe("The number of sales from this OS"),
- amount: z.number().describe("The total amount of sales from this OS"),
- }),
+ os: z
+ .object({
+ os: z.string().describe("The name of the OS"),
+ sales: z.number().describe("The number of sales from this OS"),
+ amount: z.number().describe("The total amount of sales from this OS"),
+ })
+ .openapi({ ref: "SalesOS" }),
- referers: z.object({
- referer: z
- .string()
- .describe("The name of the referer. If unknown, this will be `(direct)`"),
- sales: z.number().describe("The number of sales from this referer"),
- amount: z.number().describe("The total amount of sales from this referer"),
- }),
+ referers: z
+ .object({
+ referer: z
+ .string()
+ .describe(
+ "The name of the referer. If unknown, this will be `(direct)`",
+ ),
+ sales: z.number().describe("The number of sales from this referer"),
+ amount: z
+ .number()
+ .describe("The total amount of sales from this referer"),
+ })
+ .openapi({ ref: "SalesReferers" }),
- top_links: z.object({
- link: z.string().describe("The unique ID of the short link"),
- sales: z.number().describe("The number of sales from this link"),
- amount: z.number().describe("The total amount of sales from this link"),
- }),
+ top_links: z
+ .object({
+ link: z.string().describe("The unique ID of the short link"),
+ sales: z.number().describe("The number of sales from this link"),
+ amount: z.number().describe("The total amount of sales from this link"),
+ })
+ .openapi({ ref: "SalesTopLinks" }),
- top_urls: z.object({
- url: z.string().describe("The destination URL"),
- sales: z.number().describe("The number of sales from this URL"),
- amount: z.number().describe("The total amount of sales from this URL"),
- }),
+ top_urls: z
+ .object({
+ url: z.string().describe("The destination URL"),
+ sales: z.number().describe("The number of sales from this URL"),
+ amount: z.number().describe("The total amount of sales from this URL"),
+ })
+ .openapi({ ref: "SalesTopUrls" }),
- trigger: z.object({
- trigger: eventTrigger,
- sales: z.number().describe("The number of sales from this trigger method."),
- amount: z
- .number()
- .describe("The total amount of sales from this trigger method."),
- }),
+ trigger: z
+ .object({
+ trigger: eventTrigger,
+ sales: z
+ .number()
+ .describe("The number of sales from this trigger method."),
+ amount: z
+ .number()
+ .describe("The total amount of sales from this trigger method."),
+ })
+ .openapi({ ref: "SalesTrigger" }),
} as const;