/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { smartUnion } from "../../types/smartUnion.js"; /** * Wildcard indicating all resources and fields when Data Scopes is disabled */ export const Two = { Wildcard: "*", } as const; /** * Wildcard indicating all resources and fields when Data Scopes is disabled */ export type Two = OpenEnum; export type One = { /** * Whether the field can be read */ read?: boolean | undefined; /** * Whether the field can be written to */ write?: boolean | undefined; }; export type UpdateConsentRequestResources = { [k: string]: { [k: string]: One }; } | Two; export type UpdateConsentRequest = { resources: { [k: string]: { [k: string]: One } } | Two; /** * Whether consent is being granted (true) or denied/revoked (false) */ granted: boolean; }; /** @internal */ export const Two$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(Two)); /** @internal */ export type One$Outbound = { read?: boolean | undefined; write?: boolean | undefined; }; /** @internal */ export const One$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ read: z.boolean().optional(), write: z.boolean().optional(), }) ); export function oneToJSON(one: One): string { return JSON.stringify(One$outboundSchema.parse(one)); } /** @internal */ export type UpdateConsentRequestResources$Outbound = { [k: string]: { [k: string]: One$Outbound }; } | string; /** @internal */ export const UpdateConsentRequestResources$outboundSchema: z.ZodType< UpdateConsentRequestResources$Outbound, z.ZodTypeDef, UpdateConsentRequestResources > = /* @__PURE__ */ lazySchema$(() => smartUnion([ z.record(z.record(z.lazy(() => One$outboundSchema))), Two$outboundSchema, ]) ); export function updateConsentRequestResourcesToJSON( updateConsentRequestResources: UpdateConsentRequestResources, ): string { return JSON.stringify( UpdateConsentRequestResources$outboundSchema.parse( updateConsentRequestResources, ), ); } /** @internal */ export type UpdateConsentRequest$Outbound = { resources: { [k: string]: { [k: string]: One$Outbound } } | string; granted: boolean; }; /** @internal */ export const UpdateConsentRequest$outboundSchema: z.ZodType< UpdateConsentRequest$Outbound, z.ZodTypeDef, UpdateConsentRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ resources: smartUnion([ z.record(z.record(z.lazy(() => One$outboundSchema))), Two$outboundSchema, ]), granted: z.boolean(), }) ); export function updateConsentRequestToJSON( updateConsentRequest: UpdateConsentRequest, ): string { return JSON.stringify( UpdateConsentRequest$outboundSchema.parse(updateConsentRequest), ); }