/* * 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 * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; import * as models from "../index.js"; export type ListWordlistsRequest = { page?: number | undefined; pageSize?: number | undefined; /** * The project to act on, when you call with an organization key. Optional when the organization has one project. A project key acts on its own project: naming another one is an error. */ projectId?: string | undefined; }; export type ListWordlistsData = { /** * Unique identifier of the wordlist */ id: string; /** * Name of the wordlist */ name: string | null; /** * Description of the wordlist */ description: string | null; /** * When the wordlist was created */ createdAt: string | null; /** * User who created the wordlist */ userId: string | null; }; /** * Successful response */ export type ListWordlistsResponseBody = { /** * The items on this page. */ data: Array; /** * Where this page is in the full list. */ pagination: models.Pagination; }; export type ListWordlistsResponse = { result: ListWordlistsResponseBody; }; /** @internal */ export type ListWordlistsRequest$Outbound = { page: number; pageSize: number; projectId?: string | undefined; }; /** @internal */ export const ListWordlistsRequest$outboundSchema: z.ZodMiniType< ListWordlistsRequest$Outbound, ListWordlistsRequest > = z.object({ page: z._default(z.int(), 1), pageSize: z._default(z.int(), 20), projectId: z.optional(z.string()), }); export function listWordlistsRequestToJSON( listWordlistsRequest: ListWordlistsRequest, ): string { return JSON.stringify( ListWordlistsRequest$outboundSchema.parse(listWordlistsRequest), ); } /** @internal */ export const ListWordlistsData$inboundSchema: z.ZodMiniType< ListWordlistsData, unknown > = z.object({ id: types.string(), name: types.nullable(types.string()), description: types.nullable(types.string()), createdAt: types.nullable(types.string()), userId: types.nullable(types.string()), }); export function listWordlistsDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListWordlistsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListWordlistsData' from JSON`, ); } /** @internal */ export const ListWordlistsResponseBody$inboundSchema: z.ZodMiniType< ListWordlistsResponseBody, unknown > = z.object({ data: z.array(z.lazy(() => ListWordlistsData$inboundSchema)), pagination: models.Pagination$inboundSchema, }); export function listWordlistsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListWordlistsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListWordlistsResponseBody' from JSON`, ); } /** @internal */ export const ListWordlistsResponse$inboundSchema: z.ZodMiniType< ListWordlistsResponse, unknown > = z.pipe( z.object({ Result: z.lazy(() => ListWordlistsResponseBody$inboundSchema), }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function listWordlistsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListWordlistsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListWordlistsResponse' from JSON`, ); }