@launchdarkly/mcp-server
Version:
The local [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for [LaunchDarkly](https://launchdarkly.com/) federal and European Union (EU) environments.
87 lines (81 loc) • 2.35 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
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";
import {
MetricListingRep,
MetricListingRep$inboundSchema,
MetricListingRep$Outbound,
MetricListingRep$outboundSchema,
} from "./metriclistingrep.js";
export type MetricCollectionRep = {
/**
* An array of metrics
*/
items?: Array<MetricListingRep> | undefined;
/**
* The location and content type of related resources
*/
links?: { [k: string]: Link } | undefined;
totalCount?: number | undefined;
};
/** @internal */
export const MetricCollectionRep$inboundSchema: z.ZodType<
MetricCollectionRep,
z.ZodTypeDef,
unknown
> = z.object({
items: z.array(MetricListingRep$inboundSchema).optional(),
_links: z.record(Link$inboundSchema).optional(),
totalCount: z.number().int().optional(),
}).transform((v) => {
return remap$(v, {
"_links": "links",
});
});
/** @internal */
export type MetricCollectionRep$Outbound = {
items?: Array<MetricListingRep$Outbound> | undefined;
_links?: { [k: string]: Link$Outbound } | undefined;
totalCount?: number | undefined;
};
/** @internal */
export const MetricCollectionRep$outboundSchema: z.ZodType<
MetricCollectionRep$Outbound,
z.ZodTypeDef,
MetricCollectionRep
> = z.object({
items: z.array(MetricListingRep$outboundSchema).optional(),
links: z.record(Link$outboundSchema).optional(),
totalCount: z.number().int().optional(),
}).transform((v) => {
return remap$(v, {
links: "_links",
});
});
export function metricCollectionRepToJSON(
metricCollectionRep: MetricCollectionRep,
): string {
return JSON.stringify(
MetricCollectionRep$outboundSchema.parse(metricCollectionRep),
);
}
export function metricCollectionRepFromJSON(
jsonString: string,
): SafeParseResult<MetricCollectionRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => MetricCollectionRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'MetricCollectionRep' from JSON`,
);
}