/* * 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 UpsertPartnerLinkTagIds = string | Array; /** * The unique name of the tags assigned to the short link (case insensitive). */ export type UpsertPartnerLinkTagNames = string | Array; export type UpsertPartnerLinkTestVariants = { 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 UpsertPartnerLinkLinkProps = { /** * 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 UpsertPartnerLinkRequestBody = { /** * 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 upsert for. Will throw an error if the domain doesn't match the program's default URL domain. */ url: string; /** * 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?: UpsertPartnerLinkLinkProps | undefined; }; /** @internal */ export type UpsertPartnerLinkTagIds$Outbound = string | Array; /** @internal */ export const UpsertPartnerLinkTagIds$outboundSchema: z.ZodType< UpsertPartnerLinkTagIds$Outbound, z.ZodTypeDef, UpsertPartnerLinkTagIds > = z.union([z.string(), z.array(z.string())]); export function upsertPartnerLinkTagIdsToJSON( upsertPartnerLinkTagIds: UpsertPartnerLinkTagIds, ): string { return JSON.stringify( UpsertPartnerLinkTagIds$outboundSchema.parse(upsertPartnerLinkTagIds), ); } /** @internal */ export type UpsertPartnerLinkTagNames$Outbound = string | Array; /** @internal */ export const UpsertPartnerLinkTagNames$outboundSchema: z.ZodType< UpsertPartnerLinkTagNames$Outbound, z.ZodTypeDef, UpsertPartnerLinkTagNames > = z.union([z.string(), z.array(z.string())]); export function upsertPartnerLinkTagNamesToJSON( upsertPartnerLinkTagNames: UpsertPartnerLinkTagNames, ): string { return JSON.stringify( UpsertPartnerLinkTagNames$outboundSchema.parse(upsertPartnerLinkTagNames), ); } /** @internal */ export type UpsertPartnerLinkTestVariants$Outbound = { url: string; percentage: number; }; /** @internal */ export const UpsertPartnerLinkTestVariants$outboundSchema: z.ZodType< UpsertPartnerLinkTestVariants$Outbound, z.ZodTypeDef, UpsertPartnerLinkTestVariants > = z.object({ url: z.string(), percentage: z.number(), }); export function upsertPartnerLinkTestVariantsToJSON( upsertPartnerLinkTestVariants: UpsertPartnerLinkTestVariants, ): string { return JSON.stringify( UpsertPartnerLinkTestVariants$outboundSchema.parse( upsertPartnerLinkTestVariants, ), ); } /** @internal */ export type UpsertPartnerLinkLinkProps$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 UpsertPartnerLinkLinkProps$outboundSchema: z.ZodType< UpsertPartnerLinkLinkProps$Outbound, z.ZodTypeDef, UpsertPartnerLinkLinkProps > = 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(() => UpsertPartnerLinkTestVariants$outboundSchema)), ).optional(), testStartedAt: z.nullable(z.string()).optional(), testCompletedAt: z.nullable(z.string()).optional(), }); export function upsertPartnerLinkLinkPropsToJSON( upsertPartnerLinkLinkProps: UpsertPartnerLinkLinkProps, ): string { return JSON.stringify( UpsertPartnerLinkLinkProps$outboundSchema.parse(upsertPartnerLinkLinkProps), ); } /** @internal */ export type UpsertPartnerLinkRequestBody$Outbound = { partnerId?: string | null | undefined; tenantId?: string | null | undefined; url: string; key?: string | undefined; comments?: string | null | undefined; linkProps?: UpsertPartnerLinkLinkProps$Outbound | undefined; }; /** @internal */ export const UpsertPartnerLinkRequestBody$outboundSchema: z.ZodType< UpsertPartnerLinkRequestBody$Outbound, z.ZodTypeDef, UpsertPartnerLinkRequestBody > = z.object({ partnerId: z.nullable(z.string()).optional(), tenantId: z.nullable(z.string()).optional(), url: z.string(), key: z.string().optional(), comments: z.nullable(z.string()).optional(), linkProps: z.lazy(() => UpsertPartnerLinkLinkProps$outboundSchema).optional(), }); export function upsertPartnerLinkRequestBodyToJSON( upsertPartnerLinkRequestBody: UpsertPartnerLinkRequestBody, ): string { return JSON.stringify( UpsertPartnerLinkRequestBody$outboundSchema.parse( upsertPartnerLinkRequestBody, ), ); }