/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AccountsCreateRestrictionRequest = { /** * The account id. */ accountId: string; restrictionCreate: components.RestrictionCreate; }; export type AccountsCreateRestrictionResponse = { httpMeta: components.HTTPMetadata; /** * OK */ restriction?: components.Restriction | undefined; /** * INVALID_ARGUMENT: The request is not valid, additional information may be present in the BadRequest details. */ status?: components.Status | undefined; }; /** @internal */ export const AccountsCreateRestrictionRequest$inboundSchema: z.ZodType< AccountsCreateRestrictionRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), RestrictionCreate: components.RestrictionCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "RestrictionCreate": "restrictionCreate", }); }); /** @internal */ export type AccountsCreateRestrictionRequest$Outbound = { account_id: string; RestrictionCreate: components.RestrictionCreate$Outbound; }; /** @internal */ export const AccountsCreateRestrictionRequest$outboundSchema: z.ZodType< AccountsCreateRestrictionRequest$Outbound, z.ZodTypeDef, AccountsCreateRestrictionRequest > = z.object({ accountId: z.string(), restrictionCreate: components.RestrictionCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", restrictionCreate: "RestrictionCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountsCreateRestrictionRequest$ { /** @deprecated use `AccountsCreateRestrictionRequest$inboundSchema` instead. */ export const inboundSchema = AccountsCreateRestrictionRequest$inboundSchema; /** @deprecated use `AccountsCreateRestrictionRequest$outboundSchema` instead. */ export const outboundSchema = AccountsCreateRestrictionRequest$outboundSchema; /** @deprecated use `AccountsCreateRestrictionRequest$Outbound` instead. */ export type Outbound = AccountsCreateRestrictionRequest$Outbound; } export function accountsCreateRestrictionRequestToJSON( accountsCreateRestrictionRequest: AccountsCreateRestrictionRequest, ): string { return JSON.stringify( AccountsCreateRestrictionRequest$outboundSchema.parse( accountsCreateRestrictionRequest, ), ); } export function accountsCreateRestrictionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountsCreateRestrictionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountsCreateRestrictionRequest' from JSON`, ); } /** @internal */ export const AccountsCreateRestrictionResponse$inboundSchema: z.ZodType< AccountsCreateRestrictionResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, Restriction: components.Restriction$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Restriction": "restriction", "Status": "status", }); }); /** @internal */ export type AccountsCreateRestrictionResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; Restriction?: components.Restriction$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const AccountsCreateRestrictionResponse$outboundSchema: z.ZodType< AccountsCreateRestrictionResponse$Outbound, z.ZodTypeDef, AccountsCreateRestrictionResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, restriction: components.Restriction$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", restriction: "Restriction", status: "Status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountsCreateRestrictionResponse$ { /** @deprecated use `AccountsCreateRestrictionResponse$inboundSchema` instead. */ export const inboundSchema = AccountsCreateRestrictionResponse$inboundSchema; /** @deprecated use `AccountsCreateRestrictionResponse$outboundSchema` instead. */ export const outboundSchema = AccountsCreateRestrictionResponse$outboundSchema; /** @deprecated use `AccountsCreateRestrictionResponse$Outbound` instead. */ export type Outbound = AccountsCreateRestrictionResponse$Outbound; } export function accountsCreateRestrictionResponseToJSON( accountsCreateRestrictionResponse: AccountsCreateRestrictionResponse, ): string { return JSON.stringify( AccountsCreateRestrictionResponse$outboundSchema.parse( accountsCreateRestrictionResponse, ), ); } export function accountsCreateRestrictionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountsCreateRestrictionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountsCreateRestrictionResponse' from JSON`, ); }