/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; export type SegmentRulesDtoTargetValue = Array | Array | string | number; export const SegmentRulesDtoType = { AppVersion: "app_version", BrowserName: "browser_name", BrowserVersion: "browser_version", Country: "country", CustomField: "custom_field", Email: "email", EnvironmentTier: "environment_tier", FailsSegment: "fails_segment", IpAddress: "ip_address", OsName: "os_name", OsVersion: "os_version", PassesSegment: "passes_segment", UnitId: "unit_id", UserId: "user_id", } as const; export type SegmentRulesDtoType = ClosedEnum; export type SegmentRulesDtoConditions = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: SegmentRulesDtoType; }; export type SegmentRulesDto = { /** * The name of this rule. */ name: string; /** * Of the users that meet the conditions of this rule, what percent should return true. */ passPercentage: number; conditions: Array; /** * The environments this rule is enabled for. */ environments?: Array | null | undefined; /** * The Statsig ID of this rule. */ id?: string | undefined; /** * The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout */ baseID?: string | undefined; }; /** @internal */ export const SegmentRulesDtoTargetValue$inboundSchema: z.ZodType< SegmentRulesDtoTargetValue, z.ZodTypeDef, unknown > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** @internal */ export type SegmentRulesDtoTargetValue$Outbound = Array | Array | string | number; /** @internal */ export const SegmentRulesDtoTargetValue$outboundSchema: z.ZodType< SegmentRulesDtoTargetValue$Outbound, z.ZodTypeDef, SegmentRulesDtoTargetValue > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentRulesDtoTargetValue$ { /** @deprecated use `SegmentRulesDtoTargetValue$inboundSchema` instead. */ export const inboundSchema = SegmentRulesDtoTargetValue$inboundSchema; /** @deprecated use `SegmentRulesDtoTargetValue$outboundSchema` instead. */ export const outboundSchema = SegmentRulesDtoTargetValue$outboundSchema; /** @deprecated use `SegmentRulesDtoTargetValue$Outbound` instead. */ export type Outbound = SegmentRulesDtoTargetValue$Outbound; } /** @internal */ export const SegmentRulesDtoType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(SegmentRulesDtoType); /** @internal */ export const SegmentRulesDtoType$outboundSchema: z.ZodNativeEnum = SegmentRulesDtoType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentRulesDtoType$ { /** @deprecated use `SegmentRulesDtoType$inboundSchema` instead. */ export const inboundSchema = SegmentRulesDtoType$inboundSchema; /** @deprecated use `SegmentRulesDtoType$outboundSchema` instead. */ export const outboundSchema = SegmentRulesDtoType$outboundSchema; } /** @internal */ export const SegmentRulesDtoConditions$inboundSchema: z.ZodType< SegmentRulesDtoConditions, z.ZodTypeDef, unknown > = z.object({ targetValue: z .nullable(z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()])) .optional(), operator: z.string().optional(), field: z.nullable(z.any()).optional(), customID: z.nullable(z.any()).optional(), type: SegmentRulesDtoType$inboundSchema, }); /** @internal */ export type SegmentRulesDtoConditions$Outbound = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: string; }; /** @internal */ export const SegmentRulesDtoConditions$outboundSchema: z.ZodType< SegmentRulesDtoConditions$Outbound, z.ZodTypeDef, SegmentRulesDtoConditions > = z.object({ targetValue: z .nullable(z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()])) .optional(), operator: z.string().optional(), field: z.nullable(z.any()).optional(), customID: z.nullable(z.any()).optional(), type: SegmentRulesDtoType$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentRulesDtoConditions$ { /** @deprecated use `SegmentRulesDtoConditions$inboundSchema` instead. */ export const inboundSchema = SegmentRulesDtoConditions$inboundSchema; /** @deprecated use `SegmentRulesDtoConditions$outboundSchema` instead. */ export const outboundSchema = SegmentRulesDtoConditions$outboundSchema; /** @deprecated use `SegmentRulesDtoConditions$Outbound` instead. */ export type Outbound = SegmentRulesDtoConditions$Outbound; } /** @internal */ export const SegmentRulesDto$inboundSchema: z.ZodType = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => SegmentRulesDtoConditions$inboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: z.string().optional(), }); /** @internal */ export type SegmentRulesDto$Outbound = { name: string; passPercentage: number; conditions: Array; environments?: Array | null | undefined; id?: string | undefined; baseID?: string | undefined; }; /** @internal */ export const SegmentRulesDto$outboundSchema: z.ZodType< SegmentRulesDto$Outbound, z.ZodTypeDef, SegmentRulesDto > = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => SegmentRulesDtoConditions$outboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentRulesDto$ { /** @deprecated use `SegmentRulesDto$inboundSchema` instead. */ export const inboundSchema = SegmentRulesDto$inboundSchema; /** @deprecated use `SegmentRulesDto$outboundSchema` instead. */ export const outboundSchema = SegmentRulesDto$outboundSchema; /** @deprecated use `SegmentRulesDto$Outbound` instead. */ export type Outbound = SegmentRulesDto$Outbound; }