import type { TopupItem } from "@new-api-key-usage/core"; import { adminHttp } from "../http.ts"; export type TopupBody = { upstream_id?: number | null; amount: number; money: number; trade_no?: string | null; payment_method?: string | null; payment_provider?: string | null; status?: string | null; paid_at: string; remark?: string; }; export async function fetchTopups(): Promise { const { data } = await adminHttp.get("/topups"); return data; } export async function createTopup(body: TopupBody): Promise { const { data } = await adminHttp.post("/topups", body); return data; } export async function updateTopup( id: number, body: TopupBody, ): Promise { const { data } = await adminHttp.put(`/topups/${id}`, body); return data; } export async function deleteTopup(id: number): Promise { await adminHttp.delete(`/topups/${id}`); }