maintainerteam.ts•2.48 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
Link,
Link$inboundSchema,
Link$Outbound,
Link$outboundSchema,
} from "./link.js";
export type MaintainerTeam = {
/**
* The key of the maintainer team
*/
key: string;
/**
* A human-friendly name for the maintainer team
*/
name: string;
/**
* The location and content type of related resources
*/
links?: { [k: string]: Link } | undefined;
};
/** @internal */
export const MaintainerTeam$inboundSchema: z.ZodType<
MaintainerTeam,
z.ZodTypeDef,
unknown
> = z.object({
key: z.string(),
name: z.string(),
_links: z.record(Link$inboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
"_links": "links",
});
});
/** @internal */
export type MaintainerTeam$Outbound = {
key: string;
name: string;
_links?: { [k: string]: Link$Outbound } | undefined;
};
/** @internal */
export const MaintainerTeam$outboundSchema: z.ZodType<
MaintainerTeam$Outbound,
z.ZodTypeDef,
MaintainerTeam
> = z.object({
key: z.string(),
name: z.string(),
links: z.record(Link$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
links: "_links",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace MaintainerTeam$ {
/** @deprecated use `MaintainerTeam$inboundSchema` instead. */
export const inboundSchema = MaintainerTeam$inboundSchema;
/** @deprecated use `MaintainerTeam$outboundSchema` instead. */
export const outboundSchema = MaintainerTeam$outboundSchema;
/** @deprecated use `MaintainerTeam$Outbound` instead. */
export type Outbound = MaintainerTeam$Outbound;
}
export function maintainerTeamToJSON(maintainerTeam: MaintainerTeam): string {
return JSON.stringify(MaintainerTeam$outboundSchema.parse(maintainerTeam));
}
export function maintainerTeamFromJSON(
jsonString: string,
): SafeParseResult<MaintainerTeam, SDKValidationError> {
return safeParse(
jsonString,
(x) => MaintainerTeam$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'MaintainerTeam' from JSON`,
);
}