/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ 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 { ApplicationScope, ApplicationScope$inboundSchema, ApplicationScope$outboundSchema, } from "./applicationscope.js"; /** * Describes the scopes being shared from a subject account to a principal account. */ export type ShareScopes = { /** * The account ID that will receive access to the scopes. */ principalAccountID: string; /** * The list of scopes to share with the principal account. If none are provided, all intersecting scopes are added. */ allowScopes?: Array | undefined; }; /** @internal */ export const ShareScopes$inboundSchema: z.ZodType< ShareScopes, z.ZodTypeDef, unknown > = z.object({ principalAccountID: z.string(), allowScopes: z.array(ApplicationScope$inboundSchema).optional(), }); /** @internal */ export type ShareScopes$Outbound = { principalAccountID: string; allowScopes?: Array | undefined; }; /** @internal */ export const ShareScopes$outboundSchema: z.ZodType< ShareScopes$Outbound, z.ZodTypeDef, ShareScopes > = z.object({ principalAccountID: z.string(), allowScopes: z.array(ApplicationScope$outboundSchema).optional(), }); export function shareScopesToJSON(shareScopes: ShareScopes): string { return JSON.stringify(ShareScopes$outboundSchema.parse(shareScopes)); } export function shareScopesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShareScopes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShareScopes' from JSON`, ); }