/*
* 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";
export type NetworkRequestMetadata = {};
/**
* A NetworkRequest is utilized to retrieve some data specific exclusively to a NetworkIdentifier.
*/
export type NetworkRequest = {
/**
* The network_identifier specifies which network a particular object is associated with.
*/
networkIdentifier: NetworkIdentifier;
metadata?: NetworkRequestMetadata | undefined;
};
/** @internal */
export const NetworkRequestMetadata$inboundSchema: z.ZodType<
NetworkRequestMetadata,
z.ZodTypeDef,
unknown
> = z.object({});
/** @internal */
export type NetworkRequestMetadata$Outbound = {};
/** @internal */
export const NetworkRequestMetadata$outboundSchema: z.ZodType<
NetworkRequestMetadata$Outbound,
z.ZodTypeDef,
NetworkRequestMetadata
> = z.object({});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace NetworkRequestMetadata$ {
/** @deprecated use `NetworkRequestMetadata$inboundSchema` instead. */
export const inboundSchema = NetworkRequestMetadata$inboundSchema;
/** @deprecated use `NetworkRequestMetadata$outboundSchema` instead. */
export const outboundSchema = NetworkRequestMetadata$outboundSchema;
/** @deprecated use `NetworkRequestMetadata$Outbound` instead. */
export type Outbound = NetworkRequestMetadata$Outbound;
}
export function networkRequestMetadataToJSON(
networkRequestMetadata: NetworkRequestMetadata,
): string {
return JSON.stringify(
NetworkRequestMetadata$outboundSchema.parse(networkRequestMetadata),
);
}
export function networkRequestMetadataFromJSON(
jsonString: string,
): SafeParseResult<NetworkRequestMetadata, SDKValidationError> {
return safeParse(
jsonString,
(x) => NetworkRequestMetadata$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'NetworkRequestMetadata' from JSON`,
);
}
/** @internal */
export const NetworkRequest$inboundSchema: z.ZodType<
NetworkRequest,
z.ZodTypeDef,
unknown
> = z.object({
network_identifier: NetworkIdentifier$inboundSchema,
metadata: z.lazy(() => NetworkRequestMetadata$inboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
"network_identifier": "networkIdentifier",
});
});
/** @internal */
export type NetworkRequest$Outbound = {
network_identifier: NetworkIdentifier$Outbound;
metadata?: NetworkRequestMetadata$Outbound | undefined;
};
/** @internal */
export const NetworkRequest$outboundSchema: z.ZodType<
NetworkRequest$Outbound,
z.ZodTypeDef,
NetworkRequest
> = z.object({
networkIdentifier: NetworkIdentifier$outboundSchema,
metadata: z.lazy(() => NetworkRequestMetadata$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
networkIdentifier: "network_identifier",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace NetworkRequest$ {
/** @deprecated use `NetworkRequest$inboundSchema` instead. */
export const inboundSchema = NetworkRequest$inboundSchema;
/** @deprecated use `NetworkRequest$outboundSchema` instead. */
export const outboundSchema = NetworkRequest$outboundSchema;
/** @deprecated use `NetworkRequest$Outbound` instead. */
export type Outbound = NetworkRequest$Outbound;
}
export function networkRequestToJSON(networkRequest: NetworkRequest): string {
return JSON.stringify(NetworkRequest$outboundSchema.parse(networkRequest));
}
export function networkRequestFromJSON(
jsonString: string,
): SafeParseResult<NetworkRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => NetworkRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'NetworkRequest' from JSON`,
);
}