/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type GetEnvironmentsByProjectRequest = {
/**
* The project key
*/
projectKey: string;
/**
* The number of environments to return in the response. Defaults to 20.
*/
limit?: number | undefined;
/**
* Where to start in the list. This is for use with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`.
*/
offset?: number | undefined;
/**
* A comma-separated list of filters. Each filter is of the form `field:value`.
*/
filter?: string | undefined;
/**
* A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order.
*/
sort?: string | undefined;
};
/** @internal */
export const GetEnvironmentsByProjectRequest$inboundSchema: z.ZodType<
GetEnvironmentsByProjectRequest,
z.ZodTypeDef,
unknown
> = z.object({
projectKey: z.string(),
limit: z.number().int().optional(),
offset: z.number().int().optional(),
filter: z.string().optional(),
sort: z.string().optional(),
});
/** @internal */
export type GetEnvironmentsByProjectRequest$Outbound = {
projectKey: string;
limit?: number | undefined;
offset?: number | undefined;
filter?: string | undefined;
sort?: string | undefined;
};
/** @internal */
export const GetEnvironmentsByProjectRequest$outboundSchema: z.ZodType<
GetEnvironmentsByProjectRequest$Outbound,
z.ZodTypeDef,
GetEnvironmentsByProjectRequest
> = z.object({
projectKey: z.string(),
limit: z.number().int().optional(),
offset: z.number().int().optional(),
filter: z.string().optional(),
sort: z.string().optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetEnvironmentsByProjectRequest$ {
/** @deprecated use `GetEnvironmentsByProjectRequest$inboundSchema` instead. */
export const inboundSchema = GetEnvironmentsByProjectRequest$inboundSchema;
/** @deprecated use `GetEnvironmentsByProjectRequest$outboundSchema` instead. */
export const outboundSchema = GetEnvironmentsByProjectRequest$outboundSchema;
/** @deprecated use `GetEnvironmentsByProjectRequest$Outbound` instead. */
export type Outbound = GetEnvironmentsByProjectRequest$Outbound;
}
export function getEnvironmentsByProjectRequestToJSON(
getEnvironmentsByProjectRequest: GetEnvironmentsByProjectRequest,
): string {
return JSON.stringify(
GetEnvironmentsByProjectRequest$outboundSchema.parse(
getEnvironmentsByProjectRequest,
),
);
}
export function getEnvironmentsByProjectRequestFromJSON(
jsonString: string,
): SafeParseResult<GetEnvironmentsByProjectRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetEnvironmentsByProjectRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetEnvironmentsByProjectRequest' from JSON`,
);
}