38 lines
892 B
TypeScript
38 lines
892 B
TypeScript
import { fetchWithAuth } from "./client";
|
|
|
|
export interface CitationRecord {
|
|
id: string;
|
|
query_id: string;
|
|
platform: string;
|
|
cited: boolean;
|
|
citation_position: number | null;
|
|
citation_text: string | null;
|
|
competitor_brands: string[];
|
|
confidence: number | null;
|
|
match_type: string | null;
|
|
queried_at: string;
|
|
}
|
|
|
|
export interface CitationListResponse {
|
|
items: CitationRecord[];
|
|
total: number;
|
|
}
|
|
|
|
export interface CitationStats {
|
|
total_queries: number;
|
|
total_citations: number;
|
|
citation_rate: number;
|
|
avg_position: number | null;
|
|
}
|
|
|
|
export const citationsApi = {
|
|
list: (token: string, params?: string) =>
|
|
fetchWithAuth(
|
|
`/api/v1/citations/${params ? `?${params}` : ""}`,
|
|
{},
|
|
token
|
|
) as Promise<CitationListResponse>,
|
|
getStats: (token: string) =>
|
|
fetchWithAuth("/api/v1/citations/stats/", {}, token) as Promise<CitationStats>,
|
|
};
|