/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: a1868165edb8
 */

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  PaginatedResultDatasetPreview,
  PaginatedResultDatasetPreview$inboundSchema,
} from "./paginatedresultdatasetpreview.js";

export type ListDatasetsResponse = {
  datasets: PaginatedResultDatasetPreview;
};

/** @internal */
export const ListDatasetsResponse$inboundSchema: z.ZodType<
  ListDatasetsResponse,
  unknown
> = z.object({
  datasets: PaginatedResultDatasetPreview$inboundSchema,
});

export function listDatasetsResponseFromJSON(
  jsonString: string,
): SafeParseResult<ListDatasetsResponse, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ListDatasetsResponse$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ListDatasetsResponse' from JSON`,
  );
}
