/*
* 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 HunkRep = {
/**
* Line number of beginning of code reference hunk
*/
startingLineNumber: number;
/**
* Contextual lines of code that include the referenced feature flag
*/
lines?: string | undefined;
/**
* The project key
*/
projKey?: string | undefined;
/**
* The feature flag key
*/
flagKey?: string | undefined;
/**
* An array of flag key aliases
*/
aliases?: Array<string> | undefined;
};
/** @internal */
export const HunkRep$inboundSchema: z.ZodType<HunkRep, z.ZodTypeDef, unknown> =
z.object({
startingLineNumber: z.number().int(),
lines: z.string().optional(),
projKey: z.string().optional(),
flagKey: z.string().optional(),
aliases: z.array(z.string()).optional(),
});
/** @internal */
export type HunkRep$Outbound = {
startingLineNumber: number;
lines?: string | undefined;
projKey?: string | undefined;
flagKey?: string | undefined;
aliases?: Array<string> | undefined;
};
/** @internal */
export const HunkRep$outboundSchema: z.ZodType<
HunkRep$Outbound,
z.ZodTypeDef,
HunkRep
> = z.object({
startingLineNumber: z.number().int(),
lines: z.string().optional(),
projKey: z.string().optional(),
flagKey: z.string().optional(),
aliases: z.array(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 HunkRep$ {
/** @deprecated use `HunkRep$inboundSchema` instead. */
export const inboundSchema = HunkRep$inboundSchema;
/** @deprecated use `HunkRep$outboundSchema` instead. */
export const outboundSchema = HunkRep$outboundSchema;
/** @deprecated use `HunkRep$Outbound` instead. */
export type Outbound = HunkRep$Outbound;
}
export function hunkRepToJSON(hunkRep: HunkRep): string {
return JSON.stringify(HunkRep$outboundSchema.parse(hunkRep));
}
export function hunkRepFromJSON(
jsonString: string,
): SafeParseResult<HunkRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => HunkRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'HunkRep' from JSON`,
);
}