/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d0609d049099 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { TimeRange, TimeRange$inboundSchema, TimeRange$Outbound, TimeRange$outboundSchema, } from "./timerange.js"; /** * The type of time period for which to filter findings. */ export const TimeRangeFilterTimePeriodType = { PastDay: "PAST_DAY", PastWeek: "PAST_WEEK", PastMonth: "PAST_MONTH", PastYear: "PAST_YEAR", Custom: "CUSTOM", } as const; /** * The type of time period for which to filter findings. */ export type TimeRangeFilterTimePeriodType = OpenEnum< typeof TimeRangeFilterTimePeriodType >; export type TimeRangeFilter = { /** * The type of time period for which to filter findings. */ timePeriodType?: TimeRangeFilterTimePeriodType | undefined; customTimeRange?: TimeRange | undefined; }; /** @internal */ export const TimeRangeFilterTimePeriodType$inboundSchema: z.ZodType< TimeRangeFilterTimePeriodType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(TimeRangeFilterTimePeriodType); /** @internal */ export const TimeRangeFilterTimePeriodType$outboundSchema: z.ZodType< string, z.ZodTypeDef, TimeRangeFilterTimePeriodType > = openEnums.outboundSchema(TimeRangeFilterTimePeriodType); /** @internal */ export const TimeRangeFilter$inboundSchema: z.ZodType< TimeRangeFilter, z.ZodTypeDef, unknown > = z.object({ timePeriodType: TimeRangeFilterTimePeriodType$inboundSchema.optional(), customTimeRange: TimeRange$inboundSchema.optional(), }); /** @internal */ export type TimeRangeFilter$Outbound = { timePeriodType?: string | undefined; customTimeRange?: TimeRange$Outbound | undefined; }; /** @internal */ export const TimeRangeFilter$outboundSchema: z.ZodType< TimeRangeFilter$Outbound, z.ZodTypeDef, TimeRangeFilter > = z.object({ timePeriodType: TimeRangeFilterTimePeriodType$outboundSchema.optional(), customTimeRange: TimeRange$outboundSchema.optional(), }); export function timeRangeFilterToJSON( timeRangeFilter: TimeRangeFilter, ): string { return JSON.stringify(TimeRangeFilter$outboundSchema.parse(timeRangeFilter)); } export function timeRangeFilterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TimeRangeFilter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TimeRangeFilter' from JSON`, ); }