xquik-types.ts file.
Types
// ─── Monitors ────────────────────────────────────────────
interface Monitor {
id: string;
username: string;
xUserId: string;
eventTypes: EventType[];
isActive: boolean;
createdAt: string;
nextBillingAt: string;
}
interface KeywordMonitor {
id: string;
query: string;
eventTypes: EventType[];
isActive: boolean;
createdAt: string;
nextBillingAt: string;
}
interface PostMetricReading {
current: number | null;
gain: number | null;
}
type PostMetric = "views" | "likes" | "retweets" | "replies" | "quotes" | "bookmarks";
interface PostMonitor {
id: string;
name?: string;
postId: string;
postUrl: string;
authorId: string;
authorUsername: string;
authorName: string;
text: string;
postedAt: string;
eventTypes: PostEventType[];
isActive: boolean;
createdAt: string;
nextBillingAt: string;
pausedReason?:
"insufficient_credits" | "x_post_deleted" | "x_post_protected" | "x_post_unavailable";
pausedAt?: string;
metrics: Record<PostMetric, PostMetricReading>;
}
// ─── Events ──────────────────────────────────────────────
interface Event {
id: string;
type: EventType | PostEventType;
monitorId: string;
monitorType: "account" | "keyword" | "post";
occurredAt: string;
data: EventData;
username?: string;
query?: string;
keywordMonitorId?: string;
postId?: string;
postUrl?: string;
authorId?: string;
authorUsername?: string;
xEventId?: string;
}
interface EventList {
events: Event[];
hasMore: boolean;
nextCursor?: string;
}
// ─── Webhooks ────────────────────────────────────────────
// Returned when creating a webhook (includes signing secret)
interface WebhookCreated {
id: string;
url: string;
eventTypes: EventType[];
secret: string;
createdAt: string;
}
// Returned when listing webhooks (secret is never exposed)
interface Webhook {
id: string;
url: string;
eventTypes: EventType[];
isActive: boolean;
createdAt: string;
}
// ─── Deliveries ──────────────────────────────────────────
interface Delivery {
id: string;
streamEventId: string;
status: "pending" | "delivered" | "failed" | "exhausted";
attempts: number;
lastStatusCode?: number;
lastError?: string;
createdAt: string;
deliveredAt?: string;
}
// ─── Webhook Payload ─────────────────────────────────────
interface WebhookPayload {
eventType: EventType;
schemaVersion: 1;
deliveryId: string;
streamEventId: string;
occurredAt: string;
data: EventData;
username?: string;
query?: string;
}
interface WebhookTestPayload {
eventType: "webhook.test";
data: { message: string };
timestamp: string;
}