/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomerOrganizationFeatureSettings, CustomerOrganizationFeatureSettings$inboundSchema, } from "./customerorganizationfeaturesettings.js"; import { OrganizationCustomerPortalSettings, OrganizationCustomerPortalSettings$inboundSchema, } from "./organizationcustomerportalsettings.js"; import { SubscriptionProrationBehavior, SubscriptionProrationBehavior$inboundSchema, } from "./subscriptionprorationbehavior.js"; export type CustomerOrganization = { /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the object. */ id: string; /** * Organization name shown in checkout, customer portal, emails etc. */ name: string; /** * Unique organization slug in checkout, customer portal and credit card statements. */ slug: string; /** * Avatar URL shown in checkout, customer portal, emails etc. */ avatarUrl: string | null; prorationBehavior: SubscriptionProrationBehavior; /** * Whether customers can update their subscriptions from the customer portal. */ allowCustomerUpdates: boolean; customerPortalSettings: OrganizationCustomerPortalSettings; /** * Feature flags exposed to the customer portal. */ organizationFeatures?: CustomerOrganizationFeatureSettings | undefined; }; /** @internal */ export const CustomerOrganization$inboundSchema: z.ZodMiniType< CustomerOrganization, unknown > = z.pipe( z.object({ created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), id: z.string(), name: z.string(), slug: z.string(), avatar_url: z.nullable(z.string()), proration_behavior: SubscriptionProrationBehavior$inboundSchema, allow_customer_updates: z.boolean(), customer_portal_settings: OrganizationCustomerPortalSettings$inboundSchema, organization_features: z.optional( CustomerOrganizationFeatureSettings$inboundSchema, ), }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "avatar_url": "avatarUrl", "proration_behavior": "prorationBehavior", "allow_customer_updates": "allowCustomerUpdates", "customer_portal_settings": "customerPortalSettings", "organization_features": "organizationFeatures", }); }), ); export function customerOrganizationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerOrganization$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerOrganization' from JSON`, ); }