patchfeatureflag.ts•3.03 kB
/*
* 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 * as components from "../components/index.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type PatchFeatureFlagRequest = {
/**
* The project key
*/
projectKey: string;
/**
* The feature flag key. The key identifies the flag in your code.
*/
featureFlagKey: string;
/**
* If true, the patch will be applied even if it causes a pending scheduled change or approval request to fail.
*/
ignoreConflicts?: boolean | undefined;
patchWithComment: components.PatchWithComment;
};
/** @internal */
export const PatchFeatureFlagRequest$inboundSchema: z.ZodType<
PatchFeatureFlagRequest,
z.ZodTypeDef,
unknown
> = z.object({
projectKey: z.string(),
featureFlagKey: z.string(),
ignoreConflicts: z.boolean().optional(),
PatchWithComment: components.PatchWithComment$inboundSchema,
}).transform((v) => {
return remap$(v, {
"PatchWithComment": "patchWithComment",
});
});
/** @internal */
export type PatchFeatureFlagRequest$Outbound = {
projectKey: string;
featureFlagKey: string;
ignoreConflicts?: boolean | undefined;
PatchWithComment: components.PatchWithComment$Outbound;
};
/** @internal */
export const PatchFeatureFlagRequest$outboundSchema: z.ZodType<
PatchFeatureFlagRequest$Outbound,
z.ZodTypeDef,
PatchFeatureFlagRequest
> = z.object({
projectKey: z.string(),
featureFlagKey: z.string(),
ignoreConflicts: z.boolean().optional(),
patchWithComment: components.PatchWithComment$outboundSchema,
}).transform((v) => {
return remap$(v, {
patchWithComment: "PatchWithComment",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PatchFeatureFlagRequest$ {
/** @deprecated use `PatchFeatureFlagRequest$inboundSchema` instead. */
export const inboundSchema = PatchFeatureFlagRequest$inboundSchema;
/** @deprecated use `PatchFeatureFlagRequest$outboundSchema` instead. */
export const outboundSchema = PatchFeatureFlagRequest$outboundSchema;
/** @deprecated use `PatchFeatureFlagRequest$Outbound` instead. */
export type Outbound = PatchFeatureFlagRequest$Outbound;
}
export function patchFeatureFlagRequestToJSON(
patchFeatureFlagRequest: PatchFeatureFlagRequest,
): string {
return JSON.stringify(
PatchFeatureFlagRequest$outboundSchema.parse(patchFeatureFlagRequest),
);
}
export function patchFeatureFlagRequestFromJSON(
jsonString: string,
): SafeParseResult<PatchFeatureFlagRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => PatchFeatureFlagRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PatchFeatureFlagRequest' from JSON`,
);
}