mirror of
https://github.com/ThisTine/Snip.git
synced 2026-08-18 23:18:47 +07:00
51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
export type UrlMode = "random" | "memorable" | "custom";
|
|
|
|
export interface DayCount {
|
|
/** ISO date (YYYY-MM-DD) */
|
|
date: string;
|
|
count: number;
|
|
}
|
|
|
|
export interface ShortLink {
|
|
id: string;
|
|
code: string;
|
|
longUrl: string;
|
|
mode: UrlMode;
|
|
/** Whether a PIN protects the destination. PIN itself is never returned by the API. */
|
|
hasPin: boolean;
|
|
createdAt: string;
|
|
totalClicks: number;
|
|
/** Click counts for the last 7 days, oldest → newest. */
|
|
last7Days: DayCount[];
|
|
/** Present only for links the current user owns. */
|
|
owned?: boolean;
|
|
}
|
|
|
|
export interface CreateLinkInput {
|
|
longUrl: string;
|
|
mode: UrlMode;
|
|
/** Required when mode === "custom". */
|
|
customAlias?: string;
|
|
/** 6-digit string, authenticated users only. */
|
|
pin?: string;
|
|
}
|
|
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
name: string;
|
|
}
|
|
|
|
export interface OwnerStats {
|
|
totalLinks: number;
|
|
totalClicks: number;
|
|
weekClicks: number;
|
|
}
|
|
|
|
export interface LinkPage {
|
|
items: ShortLink[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|