/*
* 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 { SDKValidationError } from "./errors/sdkvalidationerror.js";
import {
NetworkIdentifier,
NetworkIdentifier$inboundSchema,
NetworkIdentifier$Outbound,
NetworkIdentifier$outboundSchema,
} from "./networkidentifier.js";
/**
* A NetworkListResponse contains all NetworkIdentifiers that the node can serve information for.
*/
export type NetworkListResponse = {
networkIdentifiers: Array<NetworkIdentifier>;
};
/** @internal */
export const NetworkListResponse$inboundSchema: z.ZodType<
NetworkListResponse,
z.ZodTypeDef,
unknown
> = z.object({
network_identifiers: z.array(NetworkIdentifier$inboundSchema),
}).transform((v) => {
return remap$(v, {
"network_identifiers": "networkIdentifiers",
});
});
/** @internal */
export type NetworkListResponse$Outbound = {
network_identifiers: Array<NetworkIdentifier$Outbound>;
};
/** @internal */
export const NetworkListResponse$outboundSchema: z.ZodType<
NetworkListResponse$Outbound,
z.ZodTypeDef,
NetworkListResponse
> = z.object({
networkIdentifiers: z.array(NetworkIdentifier$outboundSchema),
}).transform((v) => {
return remap$(v, {
networkIdentifiers: "network_identifiers",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace NetworkListResponse$ {
/** @deprecated use `NetworkListResponse$inboundSchema` instead. */
export const inboundSchema = NetworkListResponse$inboundSchema;
/** @deprecated use `NetworkListResponse$outboundSchema` instead. */
export const outboundSchema = NetworkListResponse$outboundSchema;
/** @deprecated use `NetworkListResponse$Outbound` instead. */
export type Outbound = NetworkListResponse$Outbound;
}
export function networkListResponseToJSON(
networkListResponse: NetworkListResponse,
): string {
return JSON.stringify(
NetworkListResponse$outboundSchema.parse(networkListResponse),
);
}
export function networkListResponseFromJSON(
jsonString: string,
): SafeParseResult<NetworkListResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => NetworkListResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'NetworkListResponse' from JSON`,
);
}