feat(characters): support character-scoped conversations
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const CharacterSchema = z.object({
|
||||
id: z.string().min(1).max(64),
|
||||
slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
||||
displayName: z.string().trim().min(1).max(80),
|
||||
avatarUrl: z.url().refine((url) => url.startsWith("https://"), {
|
||||
message: "avatarUrl must use HTTPS",
|
||||
}),
|
||||
});
|
||||
|
||||
export type CharacterInput = z.input<typeof CharacterSchema>;
|
||||
export type CharacterData = z.output<typeof CharacterSchema>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { CharacterSchema } from "./character";
|
||||
|
||||
export const CharactersResponseSchema = z.object({
|
||||
items: z.array(CharacterSchema).default([]),
|
||||
});
|
||||
|
||||
export type CharactersResponseInput = z.input<typeof CharactersResponseSchema>;
|
||||
export type CharactersResponseData = z.output<typeof CharactersResponseSchema>;
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./character";
|
||||
export * from "./characters_response";
|
||||
@@ -4,3 +4,4 @@
|
||||
|
||||
export * from "./send_message_request";
|
||||
export * from "./unlock_private_request";
|
||||
export * from "./unlock_history_request";
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from "../../nullable-defaults";
|
||||
|
||||
export const SendMessageRequestSchema = z.object({
|
||||
characterId: z.string().min(1),
|
||||
message: stringOrEmpty,
|
||||
image: stringOrEmpty,
|
||||
imageId: stringOrEmpty,
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const UnlockHistoryRequestSchema = z.object({
|
||||
characterId: z.string().min(1),
|
||||
});
|
||||
|
||||
export type UnlockHistoryRequestInput = z.input<
|
||||
typeof UnlockHistoryRequestSchema
|
||||
>;
|
||||
export type UnlockHistoryRequestData = z.output<
|
||||
typeof UnlockHistoryRequestSchema
|
||||
>;
|
||||
@@ -7,6 +7,7 @@ import { ChatLockTypeSchema } from "../chat_lock_type";
|
||||
|
||||
export const UnlockPrivateRequestSchema = z
|
||||
.object({
|
||||
characterId: z.string().min(1),
|
||||
messageId: z.string().min(1).optional(),
|
||||
lockType: ChatLockTypeSchema.optional(),
|
||||
clientLockId: z.string().min(1).optional(),
|
||||
|
||||
Reference in New Issue
Block a user