/*
* 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 { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export const GetApiV3CanistersFormat = {
Json: "json",
Csv: "csv",
} as const;
export type GetApiV3CanistersFormat = ClosedEnum<
typeof GetApiV3CanistersFormat
>;
export type GetApiV3CanistersRequest = {
maxCanisterIndex?: number | null | undefined;
limit?: number | undefined;
/**
* Controller ID
*/
controllerId?: string | null | undefined;
offset?: number | undefined;
/**
* Available values : id, canister_id, controllers, subnet_id
*/
sortBy?: any | undefined;
format?: GetApiV3CanistersFormat | undefined;
/**
* Subnet ID
*/
subnetId?: string | null | undefined;
};
/** @internal */
export const GetApiV3CanistersFormat$inboundSchema: z.ZodNativeEnum<
typeof GetApiV3CanistersFormat
> = z.nativeEnum(GetApiV3CanistersFormat);
/** @internal */
export const GetApiV3CanistersFormat$outboundSchema: z.ZodNativeEnum<
typeof GetApiV3CanistersFormat
> = GetApiV3CanistersFormat$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetApiV3CanistersFormat$ {
/** @deprecated use `GetApiV3CanistersFormat$inboundSchema` instead. */
export const inboundSchema = GetApiV3CanistersFormat$inboundSchema;
/** @deprecated use `GetApiV3CanistersFormat$outboundSchema` instead. */
export const outboundSchema = GetApiV3CanistersFormat$outboundSchema;
}
/** @internal */
export const GetApiV3CanistersRequest$inboundSchema: z.ZodType<
GetApiV3CanistersRequest,
z.ZodTypeDef,
unknown
> = z.object({
max_canister_index: z.nullable(z.number().int()).default(null),
limit: z.number().int().default(50),
controller_id: z.nullable(z.string()).default(null),
offset: z.number().int().default(0),
sort_by: z.any(),
format: GetApiV3CanistersFormat$inboundSchema.default("json"),
subnet_id: z.nullable(z.string()).default(null),
}).transform((v) => {
return remap$(v, {
"max_canister_index": "maxCanisterIndex",
"controller_id": "controllerId",
"sort_by": "sortBy",
"subnet_id": "subnetId",
});
});
/** @internal */
export type GetApiV3CanistersRequest$Outbound = {
max_canister_index: number | null;
limit: number;
controller_id: string | null;
offset: number;
sort_by?: any;
format: string;
subnet_id: string | null;
};
/** @internal */
export const GetApiV3CanistersRequest$outboundSchema: z.ZodType<
GetApiV3CanistersRequest$Outbound,
z.ZodTypeDef,
GetApiV3CanistersRequest
> = z.object({
maxCanisterIndex: z.nullable(z.number().int()).default(null),
limit: z.number().int().default(50),
controllerId: z.nullable(z.string()).default(null),
offset: z.number().int().default(0),
sortBy: z.any(),
format: GetApiV3CanistersFormat$outboundSchema.default("json"),
subnetId: z.nullable(z.string()).default(null),
}).transform((v) => {
return remap$(v, {
maxCanisterIndex: "max_canister_index",
controllerId: "controller_id",
sortBy: "sort_by",
subnetId: "subnet_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetApiV3CanistersRequest$ {
/** @deprecated use `GetApiV3CanistersRequest$inboundSchema` instead. */
export const inboundSchema = GetApiV3CanistersRequest$inboundSchema;
/** @deprecated use `GetApiV3CanistersRequest$outboundSchema` instead. */
export const outboundSchema = GetApiV3CanistersRequest$outboundSchema;
/** @deprecated use `GetApiV3CanistersRequest$Outbound` instead. */
export type Outbound = GetApiV3CanistersRequest$Outbound;
}
export function getApiV3CanistersRequestToJSON(
getApiV3CanistersRequest: GetApiV3CanistersRequest,
): string {
return JSON.stringify(
GetApiV3CanistersRequest$outboundSchema.parse(getApiV3CanistersRequest),
);
}
export function getApiV3CanistersRequestFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => GetApiV3CanistersRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetApiV3CanistersRequest' from JSON`,
);
}