/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 0d69ff73b9d4 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { GroupType, GroupType$inboundSchema, GroupType$outboundSchema, } from "./grouptype.js"; export type Group = { /** * The type of user group */ type: GroupType; /** * A unique identifier for the group. May be the same as name. */ id: string; /** * Name of the group. */ name?: string | undefined; /** * Datasource instance if the group belongs to one e.g. external groups. */ datasourceInstance?: string | undefined; /** * identifier for greenlist provisioning, aka sciokey */ provisioningId?: string | undefined; }; /** @internal */ export const Group$inboundSchema: z.ZodType = z .object({ type: GroupType$inboundSchema, id: z.string(), name: z.string().optional(), datasourceInstance: z.string().optional(), provisioningId: z.string().optional(), }); /** @internal */ export type Group$Outbound = { type: string; id: string; name?: string | undefined; datasourceInstance?: string | undefined; provisioningId?: string | undefined; }; /** @internal */ export const Group$outboundSchema: z.ZodType< Group$Outbound, z.ZodTypeDef, Group > = z.object({ type: GroupType$outboundSchema, id: z.string(), name: z.string().optional(), datasourceInstance: z.string().optional(), provisioningId: z.string().optional(), }); export function groupToJSON(group: Group): string { return JSON.stringify(Group$outboundSchema.parse(group)); } export function groupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Group$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Group' from JSON`, ); }