/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest = { workspaceId: string; }; export type StorageByType = { fileType?: string | undefined; size?: string | undefined; fileCount?: number | undefined; }; export type GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData = { totalStorageUsed?: string | undefined; storageQuota?: string | undefined; usagePercentage?: number | undefined; storageByType?: Array | undefined; totalFiles?: number | undefined; totalFolders?: number | undefined; lastUpdated?: Date | undefined; }; export type GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody = { data: GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData; }; /** @internal */ export const GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$inboundSchema: z.ZodType< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest, z.ZodTypeDef, unknown > = z.object({ workspaceId: z.string(), }); /** @internal */ export type GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$Outbound = { workspaceId: string; }; /** @internal */ export const GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$outboundSchema: z.ZodType< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$Outbound, z.ZodTypeDef, GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest > = z.object({ workspaceId: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$ { /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$inboundSchema` instead. */ export const inboundSchema = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$inboundSchema; /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$outboundSchema` instead. */ export const outboundSchema = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$outboundSchema; /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$Outbound` instead. */ export type Outbound = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$Outbound; } export function getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequestToJSON( getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest: GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest, ): string { return JSON.stringify( GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$outboundSchema .parse(getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest), ); } export function getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequestFromJSON( jsonString: string, ): SafeParseResult< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest, SDKValidationError > { return safeParse( jsonString, (x) => GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdRequest' from JSON`, ); } /** @internal */ export const StorageByType$inboundSchema: z.ZodType< StorageByType, z.ZodTypeDef, unknown > = z.object({ fileType: z.string().optional(), size: z.string().optional(), fileCount: z.number().int().optional(), }); /** @internal */ export type StorageByType$Outbound = { fileType?: string | undefined; size?: string | undefined; fileCount?: number | undefined; }; /** @internal */ export const StorageByType$outboundSchema: z.ZodType< StorageByType$Outbound, z.ZodTypeDef, StorageByType > = z.object({ fileType: z.string().optional(), size: z.string().optional(), fileCount: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace StorageByType$ { /** @deprecated use `StorageByType$inboundSchema` instead. */ export const inboundSchema = StorageByType$inboundSchema; /** @deprecated use `StorageByType$outboundSchema` instead. */ export const outboundSchema = StorageByType$outboundSchema; /** @deprecated use `StorageByType$Outbound` instead. */ export type Outbound = StorageByType$Outbound; } export function storageByTypeToJSON(storageByType: StorageByType): string { return JSON.stringify(StorageByType$outboundSchema.parse(storageByType)); } export function storageByTypeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => StorageByType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StorageByType' from JSON`, ); } /** @internal */ export const GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$inboundSchema: z.ZodType< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData, z.ZodTypeDef, unknown > = z.object({ totalStorageUsed: z.string().optional(), storageQuota: z.string().optional(), usagePercentage: z.number().optional(), storageByType: z.array(z.lazy(() => StorageByType$inboundSchema)) .optional(), totalFiles: z.number().int().optional(), totalFolders: z.number().int().optional(), lastUpdated: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), }); /** @internal */ export type GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$Outbound = { totalStorageUsed?: string | undefined; storageQuota?: string | undefined; usagePercentage?: number | undefined; storageByType?: Array | undefined; totalFiles?: number | undefined; totalFolders?: number | undefined; lastUpdated?: string | undefined; }; /** @internal */ export const GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$outboundSchema: z.ZodType< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$Outbound, z.ZodTypeDef, GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData > = z.object({ totalStorageUsed: z.string().optional(), storageQuota: z.string().optional(), usagePercentage: z.number().optional(), storageByType: z.array(z.lazy(() => StorageByType$outboundSchema)) .optional(), totalFiles: z.number().int().optional(), totalFolders: z.number().int().optional(), lastUpdated: z.date().transform(v => v.toISOString()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$ { /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$inboundSchema` instead. */ export const inboundSchema = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$inboundSchema; /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$outboundSchema` instead. */ export const outboundSchema = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$outboundSchema; /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$Outbound` instead. */ export type Outbound = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$Outbound; } export function getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdDataToJSON( getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData: GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData, ): string { return JSON.stringify( GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$outboundSchema .parse(getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData), ); } export function getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdDataFromJSON( jsonString: string, ): SafeParseResult< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData, SDKValidationError > { return safeParse( jsonString, (x) => GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData' from JSON`, ); } /** @internal */ export const GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$inboundSchema: z.ZodType< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody, z.ZodTypeDef, unknown > = z.object({ data: z.lazy(() => GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$inboundSchema ), }); /** @internal */ export type GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$Outbound = { data: GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$Outbound; }; /** @internal */ export const GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$outboundSchema: z.ZodType< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$Outbound, z.ZodTypeDef, GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody > = z.object({ data: z.lazy(() => GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdData$outboundSchema ), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$ { /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$inboundSchema` instead. */ export const inboundSchema = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$inboundSchema; /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$outboundSchema` instead. */ export const outboundSchema = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$outboundSchema; /** @deprecated use `GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$Outbound` instead. */ export type Outbound = GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$Outbound; } export function getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBodyToJSON( getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody: GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody, ): string { return JSON.stringify( GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$outboundSchema .parse( getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody, ), ); } export function getApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBodyFromJSON( jsonString: string, ): SafeParseResult< GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody, SDKValidationError > { return safeParse( jsonString, (x) => GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GetApiWorkspaceServiceV1WorkspacesStorageStatsWorkspaceIdResponseBody' from JSON`, ); }