/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d051406e6bc9 */ 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 { ScopeType, ScopeType$inboundSchema, ScopeType$outboundSchema, } from "./scopetype.js"; /** * Describes the grant permission level that a user has for a specific feature */ export type GrantPermission = { /** * Describes the scope for a ReadPermission, WritePermission, or GrantPermission object */ scopeType?: ScopeType | undefined; }; /** @internal */ export const GrantPermission$inboundSchema: z.ZodType< GrantPermission, z.ZodTypeDef, unknown > = z.object({ scopeType: ScopeType$inboundSchema.optional(), }); /** @internal */ export type GrantPermission$Outbound = { scopeType?: string | undefined; }; /** @internal */ export const GrantPermission$outboundSchema: z.ZodType< GrantPermission$Outbound, z.ZodTypeDef, GrantPermission > = z.object({ scopeType: ScopeType$outboundSchema.optional(), }); export function grantPermissionToJSON( grantPermission: GrantPermission, ): string { return JSON.stringify(GrantPermission$outboundSchema.parse(grantPermission)); } export function grantPermissionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GrantPermission$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GrantPermission' from JSON`, ); }