attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
134 lines (118 loc) • 3.92 kB
text/typescript
/*
* 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 {
ObjectT,
ObjectT$inboundSchema,
ObjectT$Outbound,
ObjectT$outboundSchema,
} from "../components/object.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type GetV2ObjectsObjectRequest = {
object: string;
};
/**
* Success
*/
export type GetV2ObjectsObjectResponse = {
data: ObjectT;
};
/** @internal */
export const GetV2ObjectsObjectRequest$inboundSchema: z.ZodType<
GetV2ObjectsObjectRequest,
z.ZodTypeDef,
unknown
> = z.object({
object: z.string(),
});
/** @internal */
export type GetV2ObjectsObjectRequest$Outbound = {
object: string;
};
/** @internal */
export const GetV2ObjectsObjectRequest$outboundSchema: z.ZodType<
GetV2ObjectsObjectRequest$Outbound,
z.ZodTypeDef,
GetV2ObjectsObjectRequest
> = z.object({
object: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2ObjectsObjectRequest$ {
/** @deprecated use `GetV2ObjectsObjectRequest$inboundSchema` instead. */
export const inboundSchema = GetV2ObjectsObjectRequest$inboundSchema;
/** @deprecated use `GetV2ObjectsObjectRequest$outboundSchema` instead. */
export const outboundSchema = GetV2ObjectsObjectRequest$outboundSchema;
/** @deprecated use `GetV2ObjectsObjectRequest$Outbound` instead. */
export type Outbound = GetV2ObjectsObjectRequest$Outbound;
}
export function getV2ObjectsObjectRequestToJSON(
getV2ObjectsObjectRequest: GetV2ObjectsObjectRequest,
): string {
return JSON.stringify(
GetV2ObjectsObjectRequest$outboundSchema.parse(getV2ObjectsObjectRequest),
);
}
export function getV2ObjectsObjectRequestFromJSON(
jsonString: string,
): SafeParseResult<GetV2ObjectsObjectRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2ObjectsObjectRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2ObjectsObjectRequest' from JSON`,
);
}
/** @internal */
export const GetV2ObjectsObjectResponse$inboundSchema: z.ZodType<
GetV2ObjectsObjectResponse,
z.ZodTypeDef,
unknown
> = z.object({
data: ObjectT$inboundSchema,
});
/** @internal */
export type GetV2ObjectsObjectResponse$Outbound = {
data: ObjectT$Outbound;
};
/** @internal */
export const GetV2ObjectsObjectResponse$outboundSchema: z.ZodType<
GetV2ObjectsObjectResponse$Outbound,
z.ZodTypeDef,
GetV2ObjectsObjectResponse
> = z.object({
data: ObjectT$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2ObjectsObjectResponse$ {
/** @deprecated use `GetV2ObjectsObjectResponse$inboundSchema` instead. */
export const inboundSchema = GetV2ObjectsObjectResponse$inboundSchema;
/** @deprecated use `GetV2ObjectsObjectResponse$outboundSchema` instead. */
export const outboundSchema = GetV2ObjectsObjectResponse$outboundSchema;
/** @deprecated use `GetV2ObjectsObjectResponse$Outbound` instead. */
export type Outbound = GetV2ObjectsObjectResponse$Outbound;
}
export function getV2ObjectsObjectResponseToJSON(
getV2ObjectsObjectResponse: GetV2ObjectsObjectResponse,
): string {
return JSON.stringify(
GetV2ObjectsObjectResponse$outboundSchema.parse(getV2ObjectsObjectResponse),
);
}
export function getV2ObjectsObjectResponseFromJSON(
jsonString: string,
): SafeParseResult<GetV2ObjectsObjectResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetV2ObjectsObjectResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetV2ObjectsObjectResponse' from JSON`,
);
}