/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; /** * The unique IDs of the tags assigned to the short link. */ export type CreatePartnerLinkTagIds = string | Array; /** * The unique name of the tags assigned to the short link (case insensitive). */ export type CreatePartnerLinkTagNames = string | Array; export type CreatePartnerLinkTestVariants = { url: string; percentage: number; }; /** * Additional properties that you can pass to the partner's short link. Will be used to override the default link properties for this partner. */ export type CreatePartnerLinkLinkProps = { /** * The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace. */ externalId?: string | null | undefined; /** * The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant. */ tenantId?: string | null | undefined; /** * Path prefix for each default referral link slug (e.g. `/c/` → `https://{domain}/c/{identity}`). If the group has multiple default links, a short random suffix is appended to the identity segment for uniqueness (e.g. `c/jane-a7f2`). */ prefix?: string | undefined; /** * Whether the short link is archived. Defaults to `false` if not provided. */ archived?: boolean | undefined; /** * The unique IDs of the tags assigned to the short link. */ tagIds?: string | Array | undefined; /** * The unique name of the tags assigned to the short link (case insensitive). */ tagNames?: string | Array | undefined; /** * The comments for the short link. */ comments?: string | null | undefined; /** * The date and time when the short link will expire at. */ expiresAt?: string | null | undefined; /** * The URL to redirect to when the short link has expired. */ expiredUrl?: string | null | undefined; /** * The password required to access the destination URL of the short link. */ password?: string | null | undefined; /** * Whether the short link uses Custom Link Previews feature. Defaults to `false` if not provided. */ proxy?: boolean | undefined; /** * The custom link preview title (og:title). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og */ title?: string | null | undefined; /** * The custom link preview description (og:description). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og */ description?: string | null | undefined; /** * The custom link preview image (og:image). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og */ image?: string | null | undefined; /** * The custom link preview video (og:video). Will be used for Custom Link Previews if `proxy` is true. Learn more: https://d.to/og */ video?: string | null | undefined; /** * Whether the short link uses link cloaking. Defaults to `false` if not provided. */ rewrite?: boolean | undefined; /** * The iOS destination URL for the short link for iOS device targeting. */ ios?: string | null | undefined; /** * The Android destination URL for the short link for Android device targeting. */ android?: string | null | undefined; /** * Allow search engines to index your short link. Defaults to `false` if not provided. Learn more: https://d.to/noindex */ doIndex?: boolean | undefined; /** * An array of A/B test URLs and the percentage of traffic to send to each URL. */ testVariants?: Array | null | undefined; /** * The date and time when the tests started. */ testStartedAt?: string | null | undefined; /** * The date and time when the tests were or will be completed. */ testCompletedAt?: string | null | undefined; }; export type CreatePartnerLinkRequestBody = { /** * The ID of the partner to create a link for. Will take precedence over `tenantId` if provided. */ partnerId?: string | null | undefined; /** * The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown. */ tenantId?: string | null | undefined; /** * The URL to shorten (if not provided, the program's default URL will be used). Will throw an error if the domain doesn't match the program's default URL domain. */ url?: string | null | undefined; /** * The short link slug. If not provided, a random 7-character slug will be generated. */ key?: string | undefined; /** * The comments for the short link. */ comments?: string | null | undefined; /** * Additional properties that you can pass to the partner's short link. Will be used to override the default link properties for this partner. */ linkProps?: CreatePartnerLinkLinkProps | undefined; }; /** @internal */ export type CreatePartnerLinkTagIds$Outbound = string | Array; /** @internal */ export const CreatePartnerLinkTagIds$outboundSchema: z.ZodType< CreatePartnerLinkTagIds$Outbound, z.ZodTypeDef, CreatePartnerLinkTagIds > = z.union([z.string(), z.array(z.string())]); export function createPartnerLinkTagIdsToJSON( createPartnerLinkTagIds: CreatePartnerLinkTagIds, ): string { return JSON.stringify( CreatePartnerLinkTagIds$outboundSchema.parse(createPartnerLinkTagIds), ); } /** @internal */ export type CreatePartnerLinkTagNames$Outbound = string | Array; /** @internal */ export const CreatePartnerLinkTagNames$outboundSchema: z.ZodType< CreatePartnerLinkTagNames$Outbound, z.ZodTypeDef, CreatePartnerLinkTagNames > = z.union([z.string(), z.array(z.string())]); export function createPartnerLinkTagNamesToJSON( createPartnerLinkTagNames: CreatePartnerLinkTagNames, ): string { return JSON.stringify( CreatePartnerLinkTagNames$outboundSchema.parse(createPartnerLinkTagNames), ); } /** @internal */ export type CreatePartnerLinkTestVariants$Outbound = { url: string; percentage: number; }; /** @internal */ export const CreatePartnerLinkTestVariants$outboundSchema: z.ZodType< CreatePartnerLinkTestVariants$Outbound, z.ZodTypeDef, CreatePartnerLinkTestVariants > = z.object({ url: z.string(), percentage: z.number(), }); export function createPartnerLinkTestVariantsToJSON( createPartnerLinkTestVariants: CreatePartnerLinkTestVariants, ): string { return JSON.stringify( CreatePartnerLinkTestVariants$outboundSchema.parse( createPartnerLinkTestVariants, ), ); } /** @internal */ export type CreatePartnerLinkLinkProps$Outbound = { externalId?: string | null | undefined; tenantId?: string | null | undefined; prefix?: string | undefined; archived?: boolean | undefined; tagIds?: string | Array | undefined; tagNames?: string | Array | undefined; comments?: string | null | undefined; expiresAt?: string | null | undefined; expiredUrl?: string | null | undefined; password?: string | null | undefined; proxy?: boolean | undefined; title?: string | null | undefined; description?: string | null | undefined; image?: string | null | undefined; video?: string | null | undefined; rewrite?: boolean | undefined; ios?: string | null | undefined; android?: string | null | undefined; doIndex?: boolean | undefined; testVariants?: | Array | null | undefined; testStartedAt?: string | null | undefined; testCompletedAt?: string | null | undefined; }; /** @internal */ export const CreatePartnerLinkLinkProps$outboundSchema: z.ZodType< CreatePartnerLinkLinkProps$Outbound, z.ZodTypeDef, CreatePartnerLinkLinkProps > = z.object({ externalId: z.nullable(z.string()).optional(), tenantId: z.nullable(z.string()).optional(), prefix: z.string().optional(), archived: z.boolean().optional(), tagIds: z.union([z.string(), z.array(z.string())]).optional(), tagNames: z.union([z.string(), z.array(z.string())]).optional(), comments: z.nullable(z.string()).optional(), expiresAt: z.nullable(z.string()).optional(), expiredUrl: z.nullable(z.string()).optional(), password: z.nullable(z.string()).optional(), proxy: z.boolean().optional(), title: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), image: z.nullable(z.string()).optional(), video: z.nullable(z.string()).optional(), rewrite: z.boolean().optional(), ios: z.nullable(z.string()).optional(), android: z.nullable(z.string()).optional(), doIndex: z.boolean().optional(), testVariants: z.nullable( z.array(z.lazy(() => CreatePartnerLinkTestVariants$outboundSchema)), ).optional(), testStartedAt: z.nullable(z.string()).optional(), testCompletedAt: z.nullable(z.string()).optional(), }); export function createPartnerLinkLinkPropsToJSON( createPartnerLinkLinkProps: CreatePartnerLinkLinkProps, ): string { return JSON.stringify( CreatePartnerLinkLinkProps$outboundSchema.parse(createPartnerLinkLinkProps), ); } /** @internal */ export type CreatePartnerLinkRequestBody$Outbound = { partnerId?: string | null | undefined; tenantId?: string | null | undefined; url?: string | null | undefined; key?: string | undefined; comments?: string | null | undefined; linkProps?: CreatePartnerLinkLinkProps$Outbound | undefined; }; /** @internal */ export const CreatePartnerLinkRequestBody$outboundSchema: z.ZodType< CreatePartnerLinkRequestBody$Outbound, z.ZodTypeDef, CreatePartnerLinkRequestBody > = z.object({ partnerId: z.nullable(z.string()).optional(), tenantId: z.nullable(z.string()).optional(), url: z.nullable(z.string()).optional(), key: z.string().optional(), comments: z.nullable(z.string()).optional(), linkProps: z.lazy(() => CreatePartnerLinkLinkProps$outboundSchema).optional(), }); export function createPartnerLinkRequestBodyToJSON( createPartnerLinkRequestBody: CreatePartnerLinkRequestBody, ): string { return JSON.stringify( CreatePartnerLinkRequestBody$outboundSchema.parse( createPartnerLinkRequestBody, ), ); }