/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { InformationRequestApprovalStatus, InformationRequestApprovalStatus$inboundSchema, } from "./informationrequestapprovalstatus.js"; import { InformationRequestType, InformationRequestType$inboundSchema, } from "./informationrequesttype.js"; /** * How frequently this information request recurs (e.g., annual password * * @remarks * policy reviews). Null for one-time requests. */ export const Cadence = { Annually: "ANNUALLY", Biannually: "BIANNUALLY", Monthly: "MONTHLY", Quarterly: "QUARTERLY", } as const; /** * How frequently this information request recurs (e.g., annual password * * @remarks * policy reviews). Null for one-time requests. */ export type Cadence = ClosedEnum; export type Two = { displayName: string; id: string; type: "team"; }; export type One = { displayName: string; id: string; type: "user"; }; /** * Resource owner (user or team) assigned to this information request. * * @remarks * Returns null if no resource owner is assigned. */ export type OwnerAssignment = One | Two; /** * Information Request resource representing a single request for audit evidence from a customer. * * @remarks * * An information request is created by an auditor and shared with the customer organization. * The customer then uploads evidence, which the auditor reviews and either approves or flags * for issues. */ export type InformationRequest = { /** * The unique identifier for the information request within Vanta's system. * * @remarks * This is the primary identifier used in all API endpoints. * Format: ObjectId as a string (e.g., "6890e473dce1da5d8406f5e7") */ id: string; /** * External unique ID to prevent duplicates across different audit systems. * * @remarks * Used for idempotency when syncing data between external audit management * systems and Vanta. Unlike `id`, this value is provided by the external system. */ uniqueId: string; /** * Deprecated control-linkage field retained for response compatibility. It * * @remarks * may contain control IDs supplied directly to the request, but it is not a * complete or guaranteed-current list of controls linked to the request. Use * `linkedControlIds` for the complete current list. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ additionalControlIds: Array; /** * The complete current set of control IDs linked to this request, including * * @remarks * controls linked through framework codes and controls added directly. Each * ID is returned by the audit controls endpoint. */ linkedControlIds: Array; /** * Current approval status of the information request, tracking its lifecycle through the audit process. * * @remarks * * The status progresses through the workflow: initial state → awaiting review → approved or flagged. * Status can move between awaiting review and flagged states as evidence is reviewed and resubmitted. */ approvalStatus: InformationRequestApprovalStatus; /** * How frequently this information request recurs (e.g., annual password * * @remarks * policy reviews). Null for one-time requests. */ cadence: Cadence | null; /** * Always empty on read. Use `linkedControlIds` for control linkage and * * @remarks * `segmentIds` for request assignment. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ frameworkCodes: Array; /** * Audit segments this request is assigned to. Empty means unassigned. * * @remarks * Resolved against the current audit scope — stale IDs are dropped. * * This field is a current-scope projection, not a stored watermark. An * audit-scope change that drops or adds IDs here does not update * creationDate, modificationDate, or deletionDate, so it does not appear in * `changedSinceDate` delta sync on its own. Re-fetch the list without that * parameter, or GET the request by id, to see the current projection. */ segmentIds: Array; /** * Detailed description explaining what evidence is needed and why. * * @remarks * Should provide clear instructions to help the customer understand what * to submit. */ description: string | null; /** * The deadline by which the customer must fulfill this request. * * @remarks * Null if no specific deadline is set. Format: ISO 8601 UTC timestamp. */ dueDate: Date | null; /** * The earliest date for which evidence should be captured. * * @remarks * Evidence dated before this date may not be accepted. * Null if not restricted. Format: ISO 8601 UTC timestamp. */ evidenceCaptureDate: Date | null; /** * Non-unique external reference ID for this request. * * @remarks * Unlike `uniqueId` which must be unique, `requestId` is for display/reference * purposes only (e.g., "REQ-123"). Null if not provided. */ requestId: string | null; /** * Type of information request, defining what scope of evidence is needed. * * @remarks * * - POINT_IN_TIME: Evidence for a specific moment (e.g., current state of a policy) * - POPULATION: Evidence covering all items in a category (e.g., all employees) * - SAMPLE: Evidence for a representative sample (e.g., 10 random customer records) */ requestType: InformationRequestType; /** * Short, descriptive title summarizing what is being requested. */ title: string; /** * Timestamp when the request was created in the system. * * @remarks * Format: ISO 8601 UTC timestamp. */ creationDate: Date; /** * Timestamp when the request was last modified. * * @remarks * Format: ISO 8601 UTC timestamp. */ modificationDate: Date; /** * Timestamp when the request was soft-deleted. Null if the request has not * * @remarks * been deleted. Soft deletes allow retaining history while hiding the request * from normal operations. * Format: ISO 8601 UTC timestamp. */ deletionDate: Date | null; /** * Resource owner (user or team) assigned to this information request. * * @remarks * Returns null if no resource owner is assigned. */ ownerAssignment: One | Two | null; }; /** @internal */ export const Cadence$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Cadence); /** @internal */ export const Two$inboundSchema: z.ZodType = z .object({ displayName: z.string(), id: z.string(), type: z.literal("team"), }); export function twoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Two$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Two' from JSON`, ); } /** @internal */ export const One$inboundSchema: z.ZodType = z .object({ displayName: z.string(), id: z.string(), type: z.literal("user"), }); export function oneFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => One$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'One' from JSON`, ); } /** @internal */ export const OwnerAssignment$inboundSchema: z.ZodType< OwnerAssignment, z.ZodTypeDef, unknown > = z.union([z.lazy(() => One$inboundSchema), z.lazy(() => Two$inboundSchema)]); export function ownerAssignmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OwnerAssignment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OwnerAssignment' from JSON`, ); } /** @internal */ export const InformationRequest$inboundSchema: z.ZodType< InformationRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), uniqueId: z.string(), additionalControlIds: z.array(z.string()), linkedControlIds: z.array(z.string()), approvalStatus: InformationRequestApprovalStatus$inboundSchema, cadence: z.nullable(Cadence$inboundSchema), frameworkCodes: z.array(z.string()), segmentIds: z.array(z.string()), description: z.nullable(z.string()), dueDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), evidenceCaptureDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), requestId: z.nullable(z.string()), requestType: InformationRequestType$inboundSchema, title: z.string(), creationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), modificationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), deletionDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), ownerAssignment: z.nullable( z.union([z.lazy(() => One$inboundSchema), z.lazy(() => Two$inboundSchema)]), ), }); export function informationRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InformationRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InformationRequest' from JSON`, ); }