/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; /** * type of the segment */ export const SegmentCreateContractDtoType = { IdList: "id_list", RuleBased: "rule_based", AnalysisList: "analysis_list", } as const; /** * type of the segment */ export type SegmentCreateContractDtoType = ClosedEnum; export type SegmentCreateContractDtoTargetValue = Array | Array | string | number; export const SegmentCreateContractDtoRulesType = { 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 SegmentCreateContractDtoRulesType = ClosedEnum< typeof SegmentCreateContractDtoRulesType >; export type SegmentCreateContractDtoConditions = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: SegmentCreateContractDtoRulesType; }; export type SegmentCreateContractDtoRules = { /** * 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; }; export type SegmentCreateContractDto = { /** * name of the segment */ name: string; /** * optional id of the segment (defaults to name) */ id?: string | undefined; /** * description of the segment */ description?: string | undefined; /** * type of the segment */ type: SegmentCreateContractDtoType; /** * type of id */ idType?: string | undefined; /** * optional tags for categorization */ tags?: Array | undefined; /** * the Statsig ID of the creator of this experiment */ creatorID?: any | null | undefined; /** * the email of the creator of this experiment */ creatorEmail?: any | null | undefined; /** * optional identifier for the responsible team (enterprise only) */ team?: any | null | undefined; /** * Rule Object */ rules?: Array | undefined; }; /** @internal */ export const SegmentCreateContractDtoType$inboundSchema: z.ZodNativeEnum< typeof SegmentCreateContractDtoType > = z.nativeEnum(SegmentCreateContractDtoType); /** @internal */ export const SegmentCreateContractDtoType$outboundSchema: z.ZodNativeEnum< typeof SegmentCreateContractDtoType > = SegmentCreateContractDtoType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentCreateContractDtoType$ { /** @deprecated use `SegmentCreateContractDtoType$inboundSchema` instead. */ export const inboundSchema = SegmentCreateContractDtoType$inboundSchema; /** @deprecated use `SegmentCreateContractDtoType$outboundSchema` instead. */ export const outboundSchema = SegmentCreateContractDtoType$outboundSchema; } /** @internal */ export const SegmentCreateContractDtoTargetValue$inboundSchema: z.ZodType< SegmentCreateContractDtoTargetValue, z.ZodTypeDef, unknown > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** @internal */ export type SegmentCreateContractDtoTargetValue$Outbound = | Array | Array | string | number; /** @internal */ export const SegmentCreateContractDtoTargetValue$outboundSchema: z.ZodType< SegmentCreateContractDtoTargetValue$Outbound, z.ZodTypeDef, SegmentCreateContractDtoTargetValue > = 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 SegmentCreateContractDtoTargetValue$ { /** @deprecated use `SegmentCreateContractDtoTargetValue$inboundSchema` instead. */ export const inboundSchema = SegmentCreateContractDtoTargetValue$inboundSchema; /** @deprecated use `SegmentCreateContractDtoTargetValue$outboundSchema` instead. */ export const outboundSchema = SegmentCreateContractDtoTargetValue$outboundSchema; /** @deprecated use `SegmentCreateContractDtoTargetValue$Outbound` instead. */ export type Outbound = SegmentCreateContractDtoTargetValue$Outbound; } /** @internal */ export const SegmentCreateContractDtoRulesType$inboundSchema: z.ZodNativeEnum< typeof SegmentCreateContractDtoRulesType > = z.nativeEnum(SegmentCreateContractDtoRulesType); /** @internal */ export const SegmentCreateContractDtoRulesType$outboundSchema: z.ZodNativeEnum< typeof SegmentCreateContractDtoRulesType > = SegmentCreateContractDtoRulesType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentCreateContractDtoRulesType$ { /** @deprecated use `SegmentCreateContractDtoRulesType$inboundSchema` instead. */ export const inboundSchema = SegmentCreateContractDtoRulesType$inboundSchema; /** @deprecated use `SegmentCreateContractDtoRulesType$outboundSchema` instead. */ export const outboundSchema = SegmentCreateContractDtoRulesType$outboundSchema; } /** @internal */ export const SegmentCreateContractDtoConditions$inboundSchema: z.ZodType< SegmentCreateContractDtoConditions, 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: SegmentCreateContractDtoRulesType$inboundSchema, }); /** @internal */ export type SegmentCreateContractDtoConditions$Outbound = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: string; }; /** @internal */ export const SegmentCreateContractDtoConditions$outboundSchema: z.ZodType< SegmentCreateContractDtoConditions$Outbound, z.ZodTypeDef, SegmentCreateContractDtoConditions > = 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: SegmentCreateContractDtoRulesType$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentCreateContractDtoConditions$ { /** @deprecated use `SegmentCreateContractDtoConditions$inboundSchema` instead. */ export const inboundSchema = SegmentCreateContractDtoConditions$inboundSchema; /** @deprecated use `SegmentCreateContractDtoConditions$outboundSchema` instead. */ export const outboundSchema = SegmentCreateContractDtoConditions$outboundSchema; /** @deprecated use `SegmentCreateContractDtoConditions$Outbound` instead. */ export type Outbound = SegmentCreateContractDtoConditions$Outbound; } /** @internal */ export const SegmentCreateContractDtoRules$inboundSchema: z.ZodType< SegmentCreateContractDtoRules, z.ZodTypeDef, unknown > = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => SegmentCreateContractDtoConditions$inboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: z.string().optional(), }); /** @internal */ export type SegmentCreateContractDtoRules$Outbound = { name: string; passPercentage: number; conditions: Array; environments?: Array | null | undefined; id?: string | undefined; baseID?: string | undefined; }; /** @internal */ export const SegmentCreateContractDtoRules$outboundSchema: z.ZodType< SegmentCreateContractDtoRules$Outbound, z.ZodTypeDef, SegmentCreateContractDtoRules > = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => SegmentCreateContractDtoConditions$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 SegmentCreateContractDtoRules$ { /** @deprecated use `SegmentCreateContractDtoRules$inboundSchema` instead. */ export const inboundSchema = SegmentCreateContractDtoRules$inboundSchema; /** @deprecated use `SegmentCreateContractDtoRules$outboundSchema` instead. */ export const outboundSchema = SegmentCreateContractDtoRules$outboundSchema; /** @deprecated use `SegmentCreateContractDtoRules$Outbound` instead. */ export type Outbound = SegmentCreateContractDtoRules$Outbound; } /** @internal */ export const SegmentCreateContractDto$inboundSchema: z.ZodType< SegmentCreateContractDto, z.ZodTypeDef, unknown > = z.object({ name: z.string(), id: z.string().optional(), description: z.string().optional(), type: SegmentCreateContractDtoType$inboundSchema, idType: z.string().default("userID"), tags: z.array(z.string()).optional(), creatorID: z.nullable(z.any()).optional(), creatorEmail: z.nullable(z.any()).optional(), team: z.nullable(z.any()).optional(), rules: z.array(z.lazy(() => SegmentCreateContractDtoRules$inboundSchema)).optional(), }); /** @internal */ export type SegmentCreateContractDto$Outbound = { name: string; id?: string | undefined; description?: string | undefined; type: string; idType: string; tags?: Array | undefined; creatorID?: any | null | undefined; creatorEmail?: any | null | undefined; team?: any | null | undefined; rules?: Array | undefined; }; /** @internal */ export const SegmentCreateContractDto$outboundSchema: z.ZodType< SegmentCreateContractDto$Outbound, z.ZodTypeDef, SegmentCreateContractDto > = z.object({ name: z.string(), id: z.string().optional(), description: z.string().optional(), type: SegmentCreateContractDtoType$outboundSchema, idType: z.string().default("userID"), tags: z.array(z.string()).optional(), creatorID: z.nullable(z.any()).optional(), creatorEmail: z.nullable(z.any()).optional(), team: z.nullable(z.any()).optional(), rules: z.array(z.lazy(() => SegmentCreateContractDtoRules$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SegmentCreateContractDto$ { /** @deprecated use `SegmentCreateContractDto$inboundSchema` instead. */ export const inboundSchema = SegmentCreateContractDto$inboundSchema; /** @deprecated use `SegmentCreateContractDto$outboundSchema` instead. */ export const outboundSchema = SegmentCreateContractDto$outboundSchema; /** @deprecated use `SegmentCreateContractDto$Outbound` instead. */ export type Outbound = SegmentCreateContractDto$Outbound; }