attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
993 lines (890 loc) • 31.7 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 {
Comment,
Comment$inboundSchema,
Comment$Outbound,
Comment$outboundSchema,
} from "../components/comment.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
export const PostV2CommentsFormat3 = {
Plaintext: "plaintext",
} as const;
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
export type PostV2CommentsFormat3 = ClosedEnum<typeof PostV2CommentsFormat3>;
export const PostV2CommentsType3 = {
WorkspaceMember: "workspace-member",
} as const;
export type PostV2CommentsType3 = ClosedEnum<typeof PostV2CommentsType3>;
/**
* The workspace member who wrote this comment. Note that other types of actors are not currently supported.
*/
export type Author3 = {
type: PostV2CommentsType3;
id: string;
};
export type Entry = {
/**
* If creating a top-level comment on a list entry, this is the slug or ID of that list.
*/
list: string;
/**
* If creating a top-level comment on a list entry, this is the ID of that entry.
*/
entryId: string;
};
export type PostV2CommentsDataPlaintext3 = {
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
format: PostV2CommentsFormat3;
/**
* The content of the comment itself. Workspace members can be mentioned using their email address, otherwise email addresses will be presented to users as clickable mailto links.
*/
content: string;
/**
* The workspace member who wrote this comment. Note that other types of actors are not currently supported.
*/
author: Author3;
/**
* `created_at` will default to the current time. However, if you wish to backdate a comment for migration or other purposes, you can override with a custom `created_at` value. Note that dates before 1970 or in the future are not allowed.
*/
createdAt?: string | undefined;
entry: Entry;
};
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
export const PostV2CommentsFormat2 = {
Plaintext: "plaintext",
} as const;
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
export type PostV2CommentsFormat2 = ClosedEnum<typeof PostV2CommentsFormat2>;
export const PostV2CommentsType2 = {
WorkspaceMember: "workspace-member",
} as const;
export type PostV2CommentsType2 = ClosedEnum<typeof PostV2CommentsType2>;
/**
* The workspace member who wrote this comment. Note that other types of actors are not currently supported.
*/
export type Author2 = {
type: PostV2CommentsType2;
id: string;
};
export type RecordT = {
/**
* If creating a top-level comment on a record, this is the slug or ID of that object.
*/
object: string;
/**
* If creating a top-level comment on a record, this is the ID of that record.
*/
recordId: string;
};
export type PostV2CommentsDataPlaintext2 = {
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
format: PostV2CommentsFormat2;
/**
* The content of the comment itself. Workspace members can be mentioned using their email address, otherwise email addresses will be presented to users as clickable mailto links.
*/
content: string;
/**
* The workspace member who wrote this comment. Note that other types of actors are not currently supported.
*/
author: Author2;
/**
* `created_at` will default to the current time. However, if you wish to backdate a comment for migration or other purposes, you can override with a custom `created_at` value. Note that dates before 1970 or in the future are not allowed.
*/
createdAt?: string | undefined;
record: RecordT;
};
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
export const PostV2CommentsFormat1 = {
Plaintext: "plaintext",
} as const;
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
export type PostV2CommentsFormat1 = ClosedEnum<typeof PostV2CommentsFormat1>;
export const PostV2CommentsType1 = {
WorkspaceMember: "workspace-member",
} as const;
export type PostV2CommentsType1 = ClosedEnum<typeof PostV2CommentsType1>;
/**
* The workspace member who wrote this comment. Note that other types of actors are not currently supported.
*/
export type Author1 = {
type: PostV2CommentsType1;
id: string;
};
export type PostV2CommentsDataPlaintext1 = {
/**
* The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported.
*/
format: PostV2CommentsFormat1;
/**
* The content of the comment itself. Workspace members can be mentioned using their email address, otherwise email addresses will be presented to users as clickable mailto links.
*/
content: string;
/**
* The workspace member who wrote this comment. Note that other types of actors are not currently supported.
*/
author: Author1;
/**
* `created_at` will default to the current time. However, if you wish to backdate a comment for migration or other purposes, you can override with a custom `created_at` value. Note that dates before 1970 or in the future are not allowed.
*/
createdAt?: string | undefined;
/**
* If responding to an existing thread, this would be the ID of that thread.
*/
threadId: string;
};
export type PostV2CommentsDataUnion =
| PostV2CommentsDataPlaintext1
| PostV2CommentsDataPlaintext2
| PostV2CommentsDataPlaintext3;
export type PostV2CommentsRequest = {
data:
| PostV2CommentsDataPlaintext1
| PostV2CommentsDataPlaintext2
| PostV2CommentsDataPlaintext3;
};
/**
* Success
*/
export type PostV2CommentsResponse = {
data: Comment;
};
/** @internal */
export const PostV2CommentsFormat3$inboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsFormat3
> = z.nativeEnum(PostV2CommentsFormat3);
/** @internal */
export const PostV2CommentsFormat3$outboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsFormat3
> = PostV2CommentsFormat3$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsFormat3$ {
/** @deprecated use `PostV2CommentsFormat3$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsFormat3$inboundSchema;
/** @deprecated use `PostV2CommentsFormat3$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsFormat3$outboundSchema;
}
/** @internal */
export const PostV2CommentsType3$inboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsType3
> = z.nativeEnum(PostV2CommentsType3);
/** @internal */
export const PostV2CommentsType3$outboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsType3
> = PostV2CommentsType3$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsType3$ {
/** @deprecated use `PostV2CommentsType3$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsType3$inboundSchema;
/** @deprecated use `PostV2CommentsType3$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsType3$outboundSchema;
}
/** @internal */
export const Author3$inboundSchema: z.ZodType<Author3, z.ZodTypeDef, unknown> =
z.object({
type: PostV2CommentsType3$inboundSchema,
id: z.string(),
});
/** @internal */
export type Author3$Outbound = {
type: string;
id: string;
};
/** @internal */
export const Author3$outboundSchema: z.ZodType<
Author3$Outbound,
z.ZodTypeDef,
Author3
> = z.object({
type: PostV2CommentsType3$outboundSchema,
id: 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 Author3$ {
/** @deprecated use `Author3$inboundSchema` instead. */
export const inboundSchema = Author3$inboundSchema;
/** @deprecated use `Author3$outboundSchema` instead. */
export const outboundSchema = Author3$outboundSchema;
/** @deprecated use `Author3$Outbound` instead. */
export type Outbound = Author3$Outbound;
}
export function author3ToJSON(author3: Author3): string {
return JSON.stringify(Author3$outboundSchema.parse(author3));
}
export function author3FromJSON(
jsonString: string,
): SafeParseResult<Author3, SDKValidationError> {
return safeParse(
jsonString,
(x) => Author3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Author3' from JSON`,
);
}
/** @internal */
export const Entry$inboundSchema: z.ZodType<Entry, z.ZodTypeDef, unknown> = z
.object({
list: z.string(),
entry_id: z.string(),
}).transform((v) => {
return remap$(v, {
"entry_id": "entryId",
});
});
/** @internal */
export type Entry$Outbound = {
list: string;
entry_id: string;
};
/** @internal */
export const Entry$outboundSchema: z.ZodType<
Entry$Outbound,
z.ZodTypeDef,
Entry
> = z.object({
list: z.string(),
entryId: z.string(),
}).transform((v) => {
return remap$(v, {
entryId: "entry_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace Entry$ {
/** @deprecated use `Entry$inboundSchema` instead. */
export const inboundSchema = Entry$inboundSchema;
/** @deprecated use `Entry$outboundSchema` instead. */
export const outboundSchema = Entry$outboundSchema;
/** @deprecated use `Entry$Outbound` instead. */
export type Outbound = Entry$Outbound;
}
export function entryToJSON(entry: Entry): string {
return JSON.stringify(Entry$outboundSchema.parse(entry));
}
export function entryFromJSON(
jsonString: string,
): SafeParseResult<Entry, SDKValidationError> {
return safeParse(
jsonString,
(x) => Entry$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Entry' from JSON`,
);
}
/** @internal */
export const PostV2CommentsDataPlaintext3$inboundSchema: z.ZodType<
PostV2CommentsDataPlaintext3,
z.ZodTypeDef,
unknown
> = z.object({
format: PostV2CommentsFormat3$inboundSchema,
content: z.string(),
author: z.lazy(() => Author3$inboundSchema),
created_at: z.string().optional(),
entry: z.lazy(() => Entry$inboundSchema),
}).transform((v) => {
return remap$(v, {
"created_at": "createdAt",
});
});
/** @internal */
export type PostV2CommentsDataPlaintext3$Outbound = {
format: string;
content: string;
author: Author3$Outbound;
created_at?: string | undefined;
entry: Entry$Outbound;
};
/** @internal */
export const PostV2CommentsDataPlaintext3$outboundSchema: z.ZodType<
PostV2CommentsDataPlaintext3$Outbound,
z.ZodTypeDef,
PostV2CommentsDataPlaintext3
> = z.object({
format: PostV2CommentsFormat3$outboundSchema,
content: z.string(),
author: z.lazy(() => Author3$outboundSchema),
createdAt: z.string().optional(),
entry: z.lazy(() => Entry$outboundSchema),
}).transform((v) => {
return remap$(v, {
createdAt: "created_at",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsDataPlaintext3$ {
/** @deprecated use `PostV2CommentsDataPlaintext3$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsDataPlaintext3$inboundSchema;
/** @deprecated use `PostV2CommentsDataPlaintext3$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsDataPlaintext3$outboundSchema;
/** @deprecated use `PostV2CommentsDataPlaintext3$Outbound` instead. */
export type Outbound = PostV2CommentsDataPlaintext3$Outbound;
}
export function postV2CommentsDataPlaintext3ToJSON(
postV2CommentsDataPlaintext3: PostV2CommentsDataPlaintext3,
): string {
return JSON.stringify(
PostV2CommentsDataPlaintext3$outboundSchema.parse(
postV2CommentsDataPlaintext3,
),
);
}
export function postV2CommentsDataPlaintext3FromJSON(
jsonString: string,
): SafeParseResult<PostV2CommentsDataPlaintext3, SDKValidationError> {
return safeParse(
jsonString,
(x) => PostV2CommentsDataPlaintext3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PostV2CommentsDataPlaintext3' from JSON`,
);
}
/** @internal */
export const PostV2CommentsFormat2$inboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsFormat2
> = z.nativeEnum(PostV2CommentsFormat2);
/** @internal */
export const PostV2CommentsFormat2$outboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsFormat2
> = PostV2CommentsFormat2$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsFormat2$ {
/** @deprecated use `PostV2CommentsFormat2$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsFormat2$inboundSchema;
/** @deprecated use `PostV2CommentsFormat2$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsFormat2$outboundSchema;
}
/** @internal */
export const PostV2CommentsType2$inboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsType2
> = z.nativeEnum(PostV2CommentsType2);
/** @internal */
export const PostV2CommentsType2$outboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsType2
> = PostV2CommentsType2$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsType2$ {
/** @deprecated use `PostV2CommentsType2$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsType2$inboundSchema;
/** @deprecated use `PostV2CommentsType2$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsType2$outboundSchema;
}
/** @internal */
export const Author2$inboundSchema: z.ZodType<Author2, z.ZodTypeDef, unknown> =
z.object({
type: PostV2CommentsType2$inboundSchema,
id: z.string(),
});
/** @internal */
export type Author2$Outbound = {
type: string;
id: string;
};
/** @internal */
export const Author2$outboundSchema: z.ZodType<
Author2$Outbound,
z.ZodTypeDef,
Author2
> = z.object({
type: PostV2CommentsType2$outboundSchema,
id: 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 Author2$ {
/** @deprecated use `Author2$inboundSchema` instead. */
export const inboundSchema = Author2$inboundSchema;
/** @deprecated use `Author2$outboundSchema` instead. */
export const outboundSchema = Author2$outboundSchema;
/** @deprecated use `Author2$Outbound` instead. */
export type Outbound = Author2$Outbound;
}
export function author2ToJSON(author2: Author2): string {
return JSON.stringify(Author2$outboundSchema.parse(author2));
}
export function author2FromJSON(
jsonString: string,
): SafeParseResult<Author2, SDKValidationError> {
return safeParse(
jsonString,
(x) => Author2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Author2' from JSON`,
);
}
/** @internal */
export const RecordT$inboundSchema: z.ZodType<RecordT, z.ZodTypeDef, unknown> =
z.object({
object: z.string(),
record_id: z.string(),
}).transform((v) => {
return remap$(v, {
"record_id": "recordId",
});
});
/** @internal */
export type RecordT$Outbound = {
object: string;
record_id: string;
};
/** @internal */
export const RecordT$outboundSchema: z.ZodType<
RecordT$Outbound,
z.ZodTypeDef,
RecordT
> = z.object({
object: z.string(),
recordId: z.string(),
}).transform((v) => {
return remap$(v, {
recordId: "record_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace RecordT$ {
/** @deprecated use `RecordT$inboundSchema` instead. */
export const inboundSchema = RecordT$inboundSchema;
/** @deprecated use `RecordT$outboundSchema` instead. */
export const outboundSchema = RecordT$outboundSchema;
/** @deprecated use `RecordT$Outbound` instead. */
export type Outbound = RecordT$Outbound;
}
export function recordToJSON(recordT: RecordT): string {
return JSON.stringify(RecordT$outboundSchema.parse(recordT));
}
export function recordFromJSON(
jsonString: string,
): SafeParseResult<RecordT, SDKValidationError> {
return safeParse(
jsonString,
(x) => RecordT$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'RecordT' from JSON`,
);
}
/** @internal */
export const PostV2CommentsDataPlaintext2$inboundSchema: z.ZodType<
PostV2CommentsDataPlaintext2,
z.ZodTypeDef,
unknown
> = z.object({
format: PostV2CommentsFormat2$inboundSchema,
content: z.string(),
author: z.lazy(() => Author2$inboundSchema),
created_at: z.string().optional(),
record: z.lazy(() => RecordT$inboundSchema),
}).transform((v) => {
return remap$(v, {
"created_at": "createdAt",
});
});
/** @internal */
export type PostV2CommentsDataPlaintext2$Outbound = {
format: string;
content: string;
author: Author2$Outbound;
created_at?: string | undefined;
record: RecordT$Outbound;
};
/** @internal */
export const PostV2CommentsDataPlaintext2$outboundSchema: z.ZodType<
PostV2CommentsDataPlaintext2$Outbound,
z.ZodTypeDef,
PostV2CommentsDataPlaintext2
> = z.object({
format: PostV2CommentsFormat2$outboundSchema,
content: z.string(),
author: z.lazy(() => Author2$outboundSchema),
createdAt: z.string().optional(),
record: z.lazy(() => RecordT$outboundSchema),
}).transform((v) => {
return remap$(v, {
createdAt: "created_at",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsDataPlaintext2$ {
/** @deprecated use `PostV2CommentsDataPlaintext2$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsDataPlaintext2$inboundSchema;
/** @deprecated use `PostV2CommentsDataPlaintext2$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsDataPlaintext2$outboundSchema;
/** @deprecated use `PostV2CommentsDataPlaintext2$Outbound` instead. */
export type Outbound = PostV2CommentsDataPlaintext2$Outbound;
}
export function postV2CommentsDataPlaintext2ToJSON(
postV2CommentsDataPlaintext2: PostV2CommentsDataPlaintext2,
): string {
return JSON.stringify(
PostV2CommentsDataPlaintext2$outboundSchema.parse(
postV2CommentsDataPlaintext2,
),
);
}
export function postV2CommentsDataPlaintext2FromJSON(
jsonString: string,
): SafeParseResult<PostV2CommentsDataPlaintext2, SDKValidationError> {
return safeParse(
jsonString,
(x) => PostV2CommentsDataPlaintext2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PostV2CommentsDataPlaintext2' from JSON`,
);
}
/** @internal */
export const PostV2CommentsFormat1$inboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsFormat1
> = z.nativeEnum(PostV2CommentsFormat1);
/** @internal */
export const PostV2CommentsFormat1$outboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsFormat1
> = PostV2CommentsFormat1$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsFormat1$ {
/** @deprecated use `PostV2CommentsFormat1$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsFormat1$inboundSchema;
/** @deprecated use `PostV2CommentsFormat1$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsFormat1$outboundSchema;
}
/** @internal */
export const PostV2CommentsType1$inboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsType1
> = z.nativeEnum(PostV2CommentsType1);
/** @internal */
export const PostV2CommentsType1$outboundSchema: z.ZodNativeEnum<
typeof PostV2CommentsType1
> = PostV2CommentsType1$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsType1$ {
/** @deprecated use `PostV2CommentsType1$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsType1$inboundSchema;
/** @deprecated use `PostV2CommentsType1$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsType1$outboundSchema;
}
/** @internal */
export const Author1$inboundSchema: z.ZodType<Author1, z.ZodTypeDef, unknown> =
z.object({
type: PostV2CommentsType1$inboundSchema,
id: z.string(),
});
/** @internal */
export type Author1$Outbound = {
type: string;
id: string;
};
/** @internal */
export const Author1$outboundSchema: z.ZodType<
Author1$Outbound,
z.ZodTypeDef,
Author1
> = z.object({
type: PostV2CommentsType1$outboundSchema,
id: 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 Author1$ {
/** @deprecated use `Author1$inboundSchema` instead. */
export const inboundSchema = Author1$inboundSchema;
/** @deprecated use `Author1$outboundSchema` instead. */
export const outboundSchema = Author1$outboundSchema;
/** @deprecated use `Author1$Outbound` instead. */
export type Outbound = Author1$Outbound;
}
export function author1ToJSON(author1: Author1): string {
return JSON.stringify(Author1$outboundSchema.parse(author1));
}
export function author1FromJSON(
jsonString: string,
): SafeParseResult<Author1, SDKValidationError> {
return safeParse(
jsonString,
(x) => Author1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Author1' from JSON`,
);
}
/** @internal */
export const PostV2CommentsDataPlaintext1$inboundSchema: z.ZodType<
PostV2CommentsDataPlaintext1,
z.ZodTypeDef,
unknown
> = z.object({
format: PostV2CommentsFormat1$inboundSchema,
content: z.string(),
author: z.lazy(() => Author1$inboundSchema),
created_at: z.string().optional(),
thread_id: z.string(),
}).transform((v) => {
return remap$(v, {
"created_at": "createdAt",
"thread_id": "threadId",
});
});
/** @internal */
export type PostV2CommentsDataPlaintext1$Outbound = {
format: string;
content: string;
author: Author1$Outbound;
created_at?: string | undefined;
thread_id: string;
};
/** @internal */
export const PostV2CommentsDataPlaintext1$outboundSchema: z.ZodType<
PostV2CommentsDataPlaintext1$Outbound,
z.ZodTypeDef,
PostV2CommentsDataPlaintext1
> = z.object({
format: PostV2CommentsFormat1$outboundSchema,
content: z.string(),
author: z.lazy(() => Author1$outboundSchema),
createdAt: z.string().optional(),
threadId: z.string(),
}).transform((v) => {
return remap$(v, {
createdAt: "created_at",
threadId: "thread_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsDataPlaintext1$ {
/** @deprecated use `PostV2CommentsDataPlaintext1$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsDataPlaintext1$inboundSchema;
/** @deprecated use `PostV2CommentsDataPlaintext1$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsDataPlaintext1$outboundSchema;
/** @deprecated use `PostV2CommentsDataPlaintext1$Outbound` instead. */
export type Outbound = PostV2CommentsDataPlaintext1$Outbound;
}
export function postV2CommentsDataPlaintext1ToJSON(
postV2CommentsDataPlaintext1: PostV2CommentsDataPlaintext1,
): string {
return JSON.stringify(
PostV2CommentsDataPlaintext1$outboundSchema.parse(
postV2CommentsDataPlaintext1,
),
);
}
export function postV2CommentsDataPlaintext1FromJSON(
jsonString: string,
): SafeParseResult<PostV2CommentsDataPlaintext1, SDKValidationError> {
return safeParse(
jsonString,
(x) => PostV2CommentsDataPlaintext1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PostV2CommentsDataPlaintext1' from JSON`,
);
}
/** @internal */
export const PostV2CommentsDataUnion$inboundSchema: z.ZodType<
PostV2CommentsDataUnion,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => PostV2CommentsDataPlaintext1$inboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext2$inboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext3$inboundSchema),
]);
/** @internal */
export type PostV2CommentsDataUnion$Outbound =
| PostV2CommentsDataPlaintext1$Outbound
| PostV2CommentsDataPlaintext2$Outbound
| PostV2CommentsDataPlaintext3$Outbound;
/** @internal */
export const PostV2CommentsDataUnion$outboundSchema: z.ZodType<
PostV2CommentsDataUnion$Outbound,
z.ZodTypeDef,
PostV2CommentsDataUnion
> = z.union([
z.lazy(() => PostV2CommentsDataPlaintext1$outboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext2$outboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext3$outboundSchema),
]);
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsDataUnion$ {
/** @deprecated use `PostV2CommentsDataUnion$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsDataUnion$inboundSchema;
/** @deprecated use `PostV2CommentsDataUnion$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsDataUnion$outboundSchema;
/** @deprecated use `PostV2CommentsDataUnion$Outbound` instead. */
export type Outbound = PostV2CommentsDataUnion$Outbound;
}
export function postV2CommentsDataUnionToJSON(
postV2CommentsDataUnion: PostV2CommentsDataUnion,
): string {
return JSON.stringify(
PostV2CommentsDataUnion$outboundSchema.parse(postV2CommentsDataUnion),
);
}
export function postV2CommentsDataUnionFromJSON(
jsonString: string,
): SafeParseResult<PostV2CommentsDataUnion, SDKValidationError> {
return safeParse(
jsonString,
(x) => PostV2CommentsDataUnion$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PostV2CommentsDataUnion' from JSON`,
);
}
/** @internal */
export const PostV2CommentsRequest$inboundSchema: z.ZodType<
PostV2CommentsRequest,
z.ZodTypeDef,
unknown
> = z.object({
data: z.union([
z.lazy(() => PostV2CommentsDataPlaintext1$inboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext2$inboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext3$inboundSchema),
]),
});
/** @internal */
export type PostV2CommentsRequest$Outbound = {
data:
| PostV2CommentsDataPlaintext1$Outbound
| PostV2CommentsDataPlaintext2$Outbound
| PostV2CommentsDataPlaintext3$Outbound;
};
/** @internal */
export const PostV2CommentsRequest$outboundSchema: z.ZodType<
PostV2CommentsRequest$Outbound,
z.ZodTypeDef,
PostV2CommentsRequest
> = z.object({
data: z.union([
z.lazy(() => PostV2CommentsDataPlaintext1$outboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext2$outboundSchema),
z.lazy(() => PostV2CommentsDataPlaintext3$outboundSchema),
]),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsRequest$ {
/** @deprecated use `PostV2CommentsRequest$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsRequest$inboundSchema;
/** @deprecated use `PostV2CommentsRequest$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsRequest$outboundSchema;
/** @deprecated use `PostV2CommentsRequest$Outbound` instead. */
export type Outbound = PostV2CommentsRequest$Outbound;
}
export function postV2CommentsRequestToJSON(
postV2CommentsRequest: PostV2CommentsRequest,
): string {
return JSON.stringify(
PostV2CommentsRequest$outboundSchema.parse(postV2CommentsRequest),
);
}
export function postV2CommentsRequestFromJSON(
jsonString: string,
): SafeParseResult<PostV2CommentsRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => PostV2CommentsRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PostV2CommentsRequest' from JSON`,
);
}
/** @internal */
export const PostV2CommentsResponse$inboundSchema: z.ZodType<
PostV2CommentsResponse,
z.ZodTypeDef,
unknown
> = z.object({
data: Comment$inboundSchema,
});
/** @internal */
export type PostV2CommentsResponse$Outbound = {
data: Comment$Outbound;
};
/** @internal */
export const PostV2CommentsResponse$outboundSchema: z.ZodType<
PostV2CommentsResponse$Outbound,
z.ZodTypeDef,
PostV2CommentsResponse
> = z.object({
data: Comment$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace PostV2CommentsResponse$ {
/** @deprecated use `PostV2CommentsResponse$inboundSchema` instead. */
export const inboundSchema = PostV2CommentsResponse$inboundSchema;
/** @deprecated use `PostV2CommentsResponse$outboundSchema` instead. */
export const outboundSchema = PostV2CommentsResponse$outboundSchema;
/** @deprecated use `PostV2CommentsResponse$Outbound` instead. */
export type Outbound = PostV2CommentsResponse$Outbound;
}
export function postV2CommentsResponseToJSON(
postV2CommentsResponse: PostV2CommentsResponse,
): string {
return JSON.stringify(
PostV2CommentsResponse$outboundSchema.parse(postV2CommentsResponse),
);
}
export function postV2CommentsResponseFromJSON(
jsonString: string,
): SafeParseResult<PostV2CommentsResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => PostV2CommentsResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PostV2CommentsResponse' from JSON`,
);
}