attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
211 lines (191 loc) • 7.03 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 { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import {
Attribute,
Attribute$inboundSchema,
Attribute$Outbound,
Attribute$outboundSchema,
} from "../components/attribute.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* Whether the attribute is on an object or a list.
*/
export const GetV2TargetIdentifierAttributesAttributeTarget = {
Objects: "objects",
Lists: "lists",
} as const;
/**
* Whether the attribute is on an object or a list.
*/
export type GetV2TargetIdentifierAttributesAttributeTarget = ClosedEnum<
typeof GetV2TargetIdentifierAttributesAttributeTarget
>;
export type GetV2TargetIdentifierAttributesAttributeRequest = {
/**
* Whether the attribute is on an object or a list.
*/
target: GetV2TargetIdentifierAttributesAttributeTarget;
identifier: string;
attribute: string;
};
/**
* Success
*/
export type GetV2TargetIdentifierAttributesAttributeResponse = {
data: Attribute;
};
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeTarget$inboundSchema:
z.ZodNativeEnum<typeof GetV2TargetIdentifierAttributesAttributeTarget> = z
.nativeEnum(GetV2TargetIdentifierAttributesAttributeTarget);
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeTarget$outboundSchema:
z.ZodNativeEnum<typeof GetV2TargetIdentifierAttributesAttributeTarget> =
GetV2TargetIdentifierAttributesAttributeTarget$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2TargetIdentifierAttributesAttributeTarget$ {
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeTarget$inboundSchema` instead. */
export const inboundSchema =
GetV2TargetIdentifierAttributesAttributeTarget$inboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeTarget$outboundSchema` instead. */
export const outboundSchema =
GetV2TargetIdentifierAttributesAttributeTarget$outboundSchema;
}
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeRequest$inboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeRequest,
z.ZodTypeDef,
unknown
> = z.object({
target: GetV2TargetIdentifierAttributesAttributeTarget$inboundSchema,
identifier: z.string(),
attribute: z.string(),
});
/** @internal */
export type GetV2TargetIdentifierAttributesAttributeRequest$Outbound = {
target: string;
identifier: string;
attribute: string;
};
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeRequest$outboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeRequest$Outbound,
z.ZodTypeDef,
GetV2TargetIdentifierAttributesAttributeRequest
> = z.object({
target: GetV2TargetIdentifierAttributesAttributeTarget$outboundSchema,
identifier: z.string(),
attribute: 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 GetV2TargetIdentifierAttributesAttributeRequest$ {
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeRequest$inboundSchema` instead. */
export const inboundSchema =
GetV2TargetIdentifierAttributesAttributeRequest$inboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeRequest$outboundSchema` instead. */
export const outboundSchema =
GetV2TargetIdentifierAttributesAttributeRequest$outboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeRequest$Outbound` instead. */
export type Outbound =
GetV2TargetIdentifierAttributesAttributeRequest$Outbound;
}
export function getV2TargetIdentifierAttributesAttributeRequestToJSON(
getV2TargetIdentifierAttributesAttributeRequest:
GetV2TargetIdentifierAttributesAttributeRequest,
): string {
return JSON.stringify(
GetV2TargetIdentifierAttributesAttributeRequest$outboundSchema.parse(
getV2TargetIdentifierAttributesAttributeRequest,
),
);
}
export function getV2TargetIdentifierAttributesAttributeRequestFromJSON(
jsonString: string,
): SafeParseResult<
GetV2TargetIdentifierAttributesAttributeRequest,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetV2TargetIdentifierAttributesAttributeRequest$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetV2TargetIdentifierAttributesAttributeRequest' from JSON`,
);
}
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeResponse$inboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeResponse,
z.ZodTypeDef,
unknown
> = z.object({
data: Attribute$inboundSchema,
});
/** @internal */
export type GetV2TargetIdentifierAttributesAttributeResponse$Outbound = {
data: Attribute$Outbound;
};
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeResponse$outboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeResponse$Outbound,
z.ZodTypeDef,
GetV2TargetIdentifierAttributesAttributeResponse
> = z.object({
data: Attribute$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2TargetIdentifierAttributesAttributeResponse$ {
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeResponse$inboundSchema` instead. */
export const inboundSchema =
GetV2TargetIdentifierAttributesAttributeResponse$inboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeResponse$outboundSchema` instead. */
export const outboundSchema =
GetV2TargetIdentifierAttributesAttributeResponse$outboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeResponse$Outbound` instead. */
export type Outbound =
GetV2TargetIdentifierAttributesAttributeResponse$Outbound;
}
export function getV2TargetIdentifierAttributesAttributeResponseToJSON(
getV2TargetIdentifierAttributesAttributeResponse:
GetV2TargetIdentifierAttributesAttributeResponse,
): string {
return JSON.stringify(
GetV2TargetIdentifierAttributesAttributeResponse$outboundSchema.parse(
getV2TargetIdentifierAttributesAttributeResponse,
),
);
}
export function getV2TargetIdentifierAttributesAttributeResponseFromJSON(
jsonString: string,
): SafeParseResult<
GetV2TargetIdentifierAttributesAttributeResponse,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetV2TargetIdentifierAttributesAttributeResponse$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetV2TargetIdentifierAttributesAttributeResponse' from JSON`,
);
}