attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
225 lines (205 loc) • 8.23 kB
text/typescript
/*
* 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 { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import {
Status,
Status$inboundSchema,
Status$Outbound,
Status$outboundSchema,
} from "../components/status.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* Whether the attribute is on an object or a list. Please note that the company and people objects do not support status attributes at this time.
*/
export const GetV2TargetIdentifierAttributesAttributeStatusesTarget = {
Lists: "lists",
Objects: "objects",
} as const;
/**
* Whether the attribute is on an object or a list. Please note that the company and people objects do not support status attributes at this time.
*/
export type GetV2TargetIdentifierAttributesAttributeStatusesTarget = ClosedEnum<
typeof GetV2TargetIdentifierAttributesAttributeStatusesTarget
>;
export type GetV2TargetIdentifierAttributesAttributeStatusesRequest = {
/**
* Whether the attribute is on an object or a list. Please note that the company and people objects do not support status attributes at this time.
*/
target: GetV2TargetIdentifierAttributesAttributeStatusesTarget;
identifier: string;
attribute: string;
showArchived?: boolean | undefined;
};
/**
* Success
*/
export type GetV2TargetIdentifierAttributesAttributeStatusesResponse = {
data: Array<Status>;
};
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema:
z.ZodNativeEnum<
typeof GetV2TargetIdentifierAttributesAttributeStatusesTarget
> = z.nativeEnum(GetV2TargetIdentifierAttributesAttributeStatusesTarget);
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema:
z.ZodNativeEnum<
typeof GetV2TargetIdentifierAttributesAttributeStatusesTarget
> = GetV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2TargetIdentifierAttributesAttributeStatusesTarget$ {
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema` instead. */
export const inboundSchema =
GetV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema` instead. */
export const outboundSchema =
GetV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema;
}
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeStatusesRequest,
z.ZodTypeDef,
unknown
> = z.object({
target:
GetV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema,
identifier: z.string(),
attribute: z.string(),
show_archived: z.boolean().default(false),
}).transform((v) => {
return remap$(v, {
"show_archived": "showArchived",
});
});
/** @internal */
export type GetV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound = {
target: string;
identifier: string;
attribute: string;
show_archived: boolean;
};
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound,
z.ZodTypeDef,
GetV2TargetIdentifierAttributesAttributeStatusesRequest
> = z.object({
target:
GetV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema,
identifier: z.string(),
attribute: z.string(),
showArchived: z.boolean().default(false),
}).transform((v) => {
return remap$(v, {
showArchived: "show_archived",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2TargetIdentifierAttributesAttributeStatusesRequest$ {
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema` instead. */
export const inboundSchema =
GetV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema` instead. */
export const outboundSchema =
GetV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound` instead. */
export type Outbound =
GetV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound;
}
export function getV2TargetIdentifierAttributesAttributeStatusesRequestToJSON(
getV2TargetIdentifierAttributesAttributeStatusesRequest:
GetV2TargetIdentifierAttributesAttributeStatusesRequest,
): string {
return JSON.stringify(
GetV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema
.parse(getV2TargetIdentifierAttributesAttributeStatusesRequest),
);
}
export function getV2TargetIdentifierAttributesAttributeStatusesRequestFromJSON(
jsonString: string,
): SafeParseResult<
GetV2TargetIdentifierAttributesAttributeStatusesRequest,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'GetV2TargetIdentifierAttributesAttributeStatusesRequest' from JSON`,
);
}
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeStatusesResponse,
z.ZodTypeDef,
unknown
> = z.object({
data: z.array(Status$inboundSchema),
});
/** @internal */
export type GetV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound =
{
data: Array<Status$Outbound>;
};
/** @internal */
export const GetV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema:
z.ZodType<
GetV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound,
z.ZodTypeDef,
GetV2TargetIdentifierAttributesAttributeStatusesResponse
> = z.object({
data: z.array(Status$outboundSchema),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetV2TargetIdentifierAttributesAttributeStatusesResponse$ {
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema` instead. */
export const inboundSchema =
GetV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema` instead. */
export const outboundSchema =
GetV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema;
/** @deprecated use `GetV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound` instead. */
export type Outbound =
GetV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound;
}
export function getV2TargetIdentifierAttributesAttributeStatusesResponseToJSON(
getV2TargetIdentifierAttributesAttributeStatusesResponse:
GetV2TargetIdentifierAttributesAttributeStatusesResponse,
): string {
return JSON.stringify(
GetV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema
.parse(getV2TargetIdentifierAttributesAttributeStatusesResponse),
);
}
export function getV2TargetIdentifierAttributesAttributeStatusesResponseFromJSON(
jsonString: string,
): SafeParseResult<
GetV2TargetIdentifierAttributesAttributeStatusesResponse,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'GetV2TargetIdentifierAttributesAttributeStatusesResponse' from JSON`,
);
}