Enhance types including potential bots on visits summary endpoint

This commit is contained in:
Alejandro Celaya 2023-03-18 10:29:49 +01:00
parent a1b879a5b4
commit 25aa9b9bd7
2 changed files with 13 additions and 7 deletions

View file

@ -40,13 +40,24 @@ export interface ShlinkPaginator {
totalItems: number; totalItems: number;
} }
export interface ShlinkVisitsSummary {
total: number;
nonBots: number;
bots: number;
}
export interface ShlinkVisits { export interface ShlinkVisits {
data: Visit[]; data: Visit[];
pagination: ShlinkPaginator; pagination: ShlinkPaginator;
} }
export interface ShlinkVisitsOverview { export interface ShlinkVisitsOverview {
nonOrphanVisits?: ShlinkVisitsSummary; // Optional only before Shlink 3.5.0
orphanVisits?: ShlinkVisitsSummary; // Optional only before Shlink 3.5.0
/** @deprecated */
visitsCount: number; visitsCount: number;
/** @deprecated */
orphanVisitsCount: number; orphanVisitsCount: number;
} }

View file

@ -1,3 +1,4 @@
import type { ShlinkVisitsSummary } from '../../api/types';
import type { Order } from '../../utils/helpers/ordering'; import type { Order } from '../../utils/helpers/ordering';
import type { Nullable, OptionalString } from '../../utils/utils'; import type { Nullable, OptionalString } from '../../utils/utils';
@ -41,7 +42,7 @@ export interface ShortUrl {
dateCreated: string; dateCreated: string;
/** @deprecated */ /** @deprecated */
visitsCount: number; // Deprecated since Shlink 3.4.0 visitsCount: number; // Deprecated since Shlink 3.4.0
visitsSummary?: ShortUrlVisitsSummary; // Optional only before Shlink 3.4.0 visitsSummary?: ShlinkVisitsSummary; // Optional only before Shlink 3.4.0
meta: Required<Nullable<ShortUrlMeta>>; meta: Required<Nullable<ShortUrlMeta>>;
tags: string[]; tags: string[];
domain: string | null; domain: string | null;
@ -56,12 +57,6 @@ export interface ShortUrlMeta {
maxVisits?: number; maxVisits?: number;
} }
export interface ShortUrlVisitsSummary {
total: number;
nonBots: number;
bots: number;
}
export interface ShortUrlModalProps { export interface ShortUrlModalProps {
shortUrl: ShortUrl; shortUrl: ShortUrl;
isOpen: boolean; isOpen: boolean;