getfeatureflag.ts•2.53 kB
/*
* 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 GetFeatureFlagRequest = {
/**
* The project key
*/
projectKey: string;
/**
* The feature flag key
*/
featureFlagKey: string;
/**
* Filter configurations by environment
*/
env?: string | undefined;
/**
* A comma-separated list of fields to expand in the response. Supported fields are explained above.
*/
expand?: string | undefined;
};
/** @internal */
export const GetFeatureFlagRequest$inboundSchema: z.ZodType<
GetFeatureFlagRequest,
z.ZodTypeDef,
unknown
> = z.object({
projectKey: z.string(),
featureFlagKey: z.string(),
env: z.string().optional(),
expand: z.string().optional(),
});
/** @internal */
export type GetFeatureFlagRequest$Outbound = {
projectKey: string;
featureFlagKey: string;
env?: string | undefined;
expand?: string | undefined;
};
/** @internal */
export const GetFeatureFlagRequest$outboundSchema: z.ZodType<
GetFeatureFlagRequest$Outbound,
z.ZodTypeDef,
GetFeatureFlagRequest
> = z.object({
projectKey: z.string(),
featureFlagKey: z.string(),
env: z.string().optional(),
expand: 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 GetFeatureFlagRequest$ {
/** @deprecated use `GetFeatureFlagRequest$inboundSchema` instead. */
export const inboundSchema = GetFeatureFlagRequest$inboundSchema;
/** @deprecated use `GetFeatureFlagRequest$outboundSchema` instead. */
export const outboundSchema = GetFeatureFlagRequest$outboundSchema;
/** @deprecated use `GetFeatureFlagRequest$Outbound` instead. */
export type Outbound = GetFeatureFlagRequest$Outbound;
}
export function getFeatureFlagRequestToJSON(
getFeatureFlagRequest: GetFeatureFlagRequest,
): string {
return JSON.stringify(
GetFeatureFlagRequest$outboundSchema.parse(getFeatureFlagRequest),
);
}
export function getFeatureFlagRequestFromJSON(
jsonString: string,
): SafeParseResult<GetFeatureFlagRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetFeatureFlagRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetFeatureFlagRequest' from JSON`,
);
}