membersummary.ts•2.95 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 MemberSummary = {
/**
* The location and content type of related resources
*/
links: { [k: string]: Link };
/**
* The member's ID
*/
id: string;
/**
* The member's first name
*/
firstName?: string | undefined;
/**
* The member's last name
*/
lastName?: string | undefined;
/**
* The member's base role. If the member has no additional roles, this role will be in effect.
*/
role: string;
/**
* The member's email address
*/
email: string;
};
/** @internal */
export const MemberSummary$inboundSchema: z.ZodType<
MemberSummary,
z.ZodTypeDef,
unknown
> = z.object({
_links: z.record(Link$inboundSchema),
_id: z.string(),
firstName: z.string().optional(),
lastName: z.string().optional(),
role: z.string(),
email: z.string(),
}).transform((v) => {
return remap$(v, {
"_links": "links",
"_id": "id",
});
});
/** @internal */
export type MemberSummary$Outbound = {
_links: { [k: string]: Link$Outbound };
_id: string;
firstName?: string | undefined;
lastName?: string | undefined;
role: string;
email: string;
};
/** @internal */
export const MemberSummary$outboundSchema: z.ZodType<
MemberSummary$Outbound,
z.ZodTypeDef,
MemberSummary
> = z.object({
links: z.record(Link$outboundSchema),
id: z.string(),
firstName: z.string().optional(),
lastName: z.string().optional(),
role: z.string(),
email: z.string(),
}).transform((v) => {
return remap$(v, {
links: "_links",
id: "_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace MemberSummary$ {
/** @deprecated use `MemberSummary$inboundSchema` instead. */
export const inboundSchema = MemberSummary$inboundSchema;
/** @deprecated use `MemberSummary$outboundSchema` instead. */
export const outboundSchema = MemberSummary$outboundSchema;
/** @deprecated use `MemberSummary$Outbound` instead. */
export type Outbound = MemberSummary$Outbound;
}
export function memberSummaryToJSON(memberSummary: MemberSummary): string {
return JSON.stringify(MemberSummary$outboundSchema.parse(memberSummary));
}
export function memberSummaryFromJSON(
jsonString: string,
): SafeParseResult<MemberSummary, SDKValidationError> {
return safeParse(
jsonString,
(x) => MemberSummary$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'MemberSummary' from JSON`,
);
}