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.

Update OpenAPI definitions

Steven Teyeb1246f6fa90
diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.ts
index afadbee257..c301b27a07 100644
--- a/apps/web/lib/zod/schemas/leads.ts
+++ b/apps/web/lib/zod/schemas/leads.ts
@@ -21,12 +21,6 @@ export const trackLeadRequestSchema = z.object({
"The name of the lead event to track. Can also be used as a unique identifier to associate a given lead event for a customer for a subsequent sale event (via the `leadEventName` prop in `/track/sale`).",
)
.openapi({ example: "Sign up" }),
- eventQuantity: z
- .number()
- .nullish()
- .describe(
- "The numerical value associated with this lead event (e.g., number of provisioned seats in a free trial). If defined as N, the lead event will be tracked N times.",
- ),
externalId: z
.string()
.trim()
@@ -54,6 +48,12 @@ export const trackLeadRequestSchema = z.object({
.nullish()
.default(null)
.describe("The avatar URL of the customer."),
+ eventQuantity: z
+ .number()
+ .nullish()
+ .describe(
+ "The numerical value associated with this lead event (e.g., number of provisioned seats in a free trial). If defined as N, the lead event will be tracked N times.",
+ ),
mode: z
.enum(["async", "wait"])
.default("async")
diff --git a/apps/web/lib/zod/schemas/sales.ts b/apps/web/lib/zod/schemas/sales.ts
index 9695569932..223b5f6602 100644
--- a/apps/web/lib/zod/schemas/sales.ts
+++ b/apps/web/lib/zod/schemas/sales.ts
@@ -16,17 +16,28 @@ export const trackSaleRequestSchema = z.object({
.number({ required_error: "amount is required" })
.int()
.min(0, "amount cannot be negative")
- .describe("The amount of the sale in cents."),
- paymentProcessor: z
- .enum(["stripe", "shopify", "polar", "paddle", "custom"])
- .describe("The payment processor via which the sale was made."),
+ .describe(
+ "The amount of the sale in cents (for all two-decimal currencies). If the sale is in a zero-decimal currency, pass the full integer value (e.g. `1437` JPY). Learn more: https://d.to/currency",
+ ),
+ currency: z
+ .string()
+ .default("usd")
+ .transform((val) => val.toLowerCase())
+ .describe(
+ "The currency of the sale. Accepts ISO 4217 currency codes. Sales will be automatically converted and stored as USD at the latest exchange rates. Learn more: https://d.to/currency",
+ ),
eventName: z
.string()
.max(255)
.optional()
.default("Purchase")
- .describe("The name of the sale event.")
+ .describe(
+ "The name of the sale event. Recommended format: `Invoice paid` or `Subscription created`.",
+ )
.openapi({ example: "Invoice paid" }),
+ paymentProcessor: z
+ .enum(["stripe", "shopify", "polar", "paddle", "custom"])
+ .describe("The payment processor via which the sale was made."),
invoiceId: z
.string()
.nullish()
@@ -34,17 +45,12 @@ export const trackSaleRequestSchema = z.object({
.describe(
"The invoice ID of the sale. Can be used as a idempotency key – only one sale event can be recorded for a given invoice ID.",
),
- currency: z
- .string()
- .default("usd")
- .transform((val) => val.toLowerCase())
- .describe("The currency of the sale. Accepts ISO 4217 currency codes."),
leadEventName: z
.string()
.nullish()
.default(null)
.describe(
- "The name of the lead event that occurred before the sale (case-sensitive). This is used to associate the sale event with a particular lead event (instead of the latest lead event, which is the default behavior).",
+ "The name of the lead event that occurred before the sale (case-sensitive). This is used to associate the sale event with a particular lead event (instead of the latest lead event for a link-customer combination, which is the default behavior).",
)
.openapi({ example: "Cloned template 1481267" }),
metadata: z
@@ -55,7 +61,7 @@ export const trackSaleRequestSchema = z.object({
message: "Metadata must be less than 10,000 characters when stringified",
})
.describe(
- "Additional metadata to be stored with the sale event. Max 10,000 characters.",
+ "Additional metadata to be stored with the sale event. Max 10,000 characters when stringified.",
),
});