@akomalabs/kemono
Version:
A production-grade TypeScript API wrapper for the Kemono/Coomer platforms
372 lines (371 loc) • 10.8 kB
TypeScript
import { z } from 'zod';
/**
* Base URL schema
*/
export declare const KemonoBaseUrlSchema: z.ZodEnum<["https://kemono.su/api/v1", "https://coomer.su/api/v1"]>;
/**
* Service schema
*/
export declare const KemonoServiceSchema: z.ZodEnum<["fanbox", "patreon", "gumroad", "subscribestar", "dlsite", "fantia", "onlyfans", "fansly"]>;
/**
* Redis configuration schema
*/
export declare const RedisConfigSchema: z.ZodObject<{
host: z.ZodString;
port: z.ZodNumber;
password: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
host: string;
port: number;
password?: string | undefined;
}, {
host: string;
port: number;
password?: string | undefined;
}>;
/**
* Cache configuration schema
*/
export declare const CacheConfigSchema: z.ZodObject<{
enabled: z.ZodBoolean;
ttl: z.ZodOptional<z.ZodNumber>;
redis: z.ZodOptional<z.ZodObject<{
host: z.ZodString;
port: z.ZodNumber;
password: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
host: string;
port: number;
password?: string | undefined;
}, {
host: string;
port: number;
password?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
redis?: {
host: string;
port: number;
password?: string | undefined;
} | undefined;
ttl?: number | undefined;
}, {
enabled: boolean;
redis?: {
host: string;
port: number;
password?: string | undefined;
} | undefined;
ttl?: number | undefined;
}>;
/**
* Rate limit configuration schema
*/
export declare const RateLimitConfigSchema: z.ZodObject<{
maxRequests: z.ZodNumber;
windowMs: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
maxRequests: number;
windowMs: number;
}, {
maxRequests: number;
windowMs: number;
}>;
/**
* Logger configuration schema
*/
export declare const LoggerConfigSchema: z.ZodObject<{
enabled: z.ZodBoolean;
level: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug"]>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
level?: "error" | "warn" | "info" | "debug" | undefined;
}, {
enabled: boolean;
level?: "error" | "warn" | "info" | "debug" | undefined;
}>;
/**
* Main configuration schema
*/
export declare const KemonoConfigSchema: z.ZodObject<{
baseUrl: z.ZodOptional<z.ZodEnum<["https://kemono.su/api/v1", "https://coomer.su/api/v1"]>>;
sessionKey: z.ZodOptional<z.ZodString>;
cache: z.ZodOptional<z.ZodObject<{
enabled: z.ZodBoolean;
ttl: z.ZodOptional<z.ZodNumber>;
redis: z.ZodOptional<z.ZodObject<{
host: z.ZodString;
port: z.ZodNumber;
password: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
host: string;
port: number;
password?: string | undefined;
}, {
host: string;
port: number;
password?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
redis?: {
host: string;
port: number;
password?: string | undefined;
} | undefined;
ttl?: number | undefined;
}, {
enabled: boolean;
redis?: {
host: string;
port: number;
password?: string | undefined;
} | undefined;
ttl?: number | undefined;
}>>;
rateLimit: z.ZodOptional<z.ZodObject<{
maxRequests: z.ZodNumber;
windowMs: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
maxRequests: number;
windowMs: number;
}, {
maxRequests: number;
windowMs: number;
}>>;
logging: z.ZodOptional<z.ZodObject<{
enabled: z.ZodBoolean;
level: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug"]>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
level?: "error" | "warn" | "info" | "debug" | undefined;
}, {
enabled: boolean;
level?: "error" | "warn" | "info" | "debug" | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
logging?: {
enabled: boolean;
level?: "error" | "warn" | "info" | "debug" | undefined;
} | undefined;
cache?: {
enabled: boolean;
redis?: {
host: string;
port: number;
password?: string | undefined;
} | undefined;
ttl?: number | undefined;
} | undefined;
rateLimit?: {
maxRequests: number;
windowMs: number;
} | undefined;
baseUrl?: "https://kemono.su/api/v1" | "https://coomer.su/api/v1" | undefined;
sessionKey?: string | undefined;
}, {
logging?: {
enabled: boolean;
level?: "error" | "warn" | "info" | "debug" | undefined;
} | undefined;
cache?: {
enabled: boolean;
redis?: {
host: string;
port: number;
password?: string | undefined;
} | undefined;
ttl?: number | undefined;
} | undefined;
rateLimit?: {
maxRequests: number;
windowMs: number;
} | undefined;
baseUrl?: "https://kemono.su/api/v1" | "https://coomer.su/api/v1" | undefined;
sessionKey?: string | undefined;
}>;
/**
* File schema
*/
export declare const FileSchema: z.ZodObject<{
name: z.ZodString;
path: z.ZodString;
hash: z.ZodOptional<z.ZodString>;
size: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
}, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
}>;
/**
* Attachment schema (extends File)
*/
export declare const AttachmentSchema: z.ZodObject<z.objectUtil.extendShape<{
name: z.ZodString;
path: z.ZodString;
hash: z.ZodOptional<z.ZodString>;
size: z.ZodOptional<z.ZodNumber>;
}, {
mimeType: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
mimeType?: string | undefined;
}, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
mimeType?: string | undefined;
}>;
/**
* Post schema
*/
export declare const PostSchema: z.ZodObject<{
id: z.ZodString;
user: z.ZodString;
service: z.ZodEnum<["fanbox", "patreon", "gumroad", "subscribestar", "dlsite", "fantia", "onlyfans", "fansly"]>;
title: z.ZodString;
content: z.ZodString;
published: z.ZodString;
edited: z.ZodOptional<z.ZodString>;
file: z.ZodOptional<z.ZodObject<{
name: z.ZodString;
path: z.ZodString;
hash: z.ZodOptional<z.ZodString>;
size: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
}, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
}>>;
attachments: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
name: z.ZodString;
path: z.ZodString;
hash: z.ZodOptional<z.ZodString>;
size: z.ZodOptional<z.ZodNumber>;
}, {
mimeType: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
mimeType?: string | undefined;
}, {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
mimeType?: string | undefined;
}>, "many">;
embed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strip", z.ZodTypeAny, {
id: string;
user: string;
service: "fanbox" | "patreon" | "gumroad" | "subscribestar" | "dlsite" | "fantia" | "onlyfans" | "fansly";
title: string;
content: string;
published: string;
attachments: {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
mimeType?: string | undefined;
}[];
edited?: string | undefined;
file?: {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
} | undefined;
embed?: Record<string, unknown> | undefined;
}, {
id: string;
user: string;
service: "fanbox" | "patreon" | "gumroad" | "subscribestar" | "dlsite" | "fantia" | "onlyfans" | "fansly";
title: string;
content: string;
published: string;
attachments: {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
mimeType?: string | undefined;
}[];
edited?: string | undefined;
file?: {
path: string;
name: string;
hash?: string | undefined;
size?: number | undefined;
} | undefined;
embed?: Record<string, unknown> | undefined;
}>;
/**
* Creator schema
*/
export declare const CreatorSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
service: z.ZodEnum<["fanbox", "patreon", "gumroad", "subscribestar", "dlsite", "fantia", "onlyfans", "fansly"]>;
indexed: z.ZodString;
updated: z.ZodString;
favorited: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
name: string;
id: string;
service: "fanbox" | "patreon" | "gumroad" | "subscribestar" | "dlsite" | "fantia" | "onlyfans" | "fansly";
indexed: string;
updated: string;
favorited?: boolean | undefined;
}, {
name: string;
id: string;
service: "fanbox" | "patreon" | "gumroad" | "subscribestar" | "dlsite" | "fantia" | "onlyfans" | "fansly";
indexed: string;
updated: string;
favorited?: boolean | undefined;
}>;
/**
* Search parameters schema
*/
export declare const SearchParamsSchema: z.ZodObject<{
q: z.ZodOptional<z.ZodString>;
o: z.ZodOptional<z.ZodNumber>;
limit: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
q?: string | undefined;
o?: number | undefined;
limit?: number | undefined;
}, {
q?: string | undefined;
o?: number | undefined;
limit?: number | undefined;
}>;
export type KemonoBaseUrl = z.infer<typeof KemonoBaseUrlSchema>;
export type KemonoService = z.infer<typeof KemonoServiceSchema>;
export type KemonoConfig = z.infer<typeof KemonoConfigSchema>;
export type File = z.infer<typeof FileSchema>;
export type Attachment = z.infer<typeof AttachmentSchema>;
export type Post = z.infer<typeof PostSchema>;
export type Creator = z.infer<typeof CreatorSchema>;
export type SearchParams = z.infer<typeof SearchParamsSchema>;