Satu wrapper untuk semua endpoint. Set base URL + API key sekali, ganti path sesuka hati. Siap pakai di JavaScript, TypeScript, Python, PHP, Go, dan cURL.
// one.api(path) — ganti endpoint sesuka hati
const one = {
base: "https://your-domain.com",
key: "onepunya-xxxx",
async api(path, { method = "GET", params = {}, body } = {}) {
const u = new URL(this.base + "/api" + path);
if (method === "GET") Object.entries(params).forEach(([k, v]) => u.searchParams.set(k, v));
const res = await fetch(u, {
method,
headers: {
"x-api-key": this.key,
...(body ? { "Content-Type": "application/json" } : {}),
},
body: body ? JSON.stringify(body) : undefined,
});
const data = await res.json();
if (!data.status) throw new Error(data.message || "API_ERROR");
return data.result;
},
};
// Contoh: Cari donghua
const result = await one.api("/wibu/donghua/search", {
method: "GET",
params: {"query":"renegade immortal"},
});
console.log(result);base ke domain API kamu dan key dari dashboard.one.api("/path/endpoint", options) — path mengikuti /api/list.result saja (bukan bungkus status / creator). Error melempar exception.| Path | Method | Param | Keterangan |
|---|---|---|---|
/wibu/hidori/home | GET | limit? | Rilisan & complete terbaru |
/wibu/hidori/search | GET | query, page? | Cari anime |
/wibu/hidori/detail | GET | id, includeEpisodes? | Info + sinopsis + episode |
/wibu/hidori/episodes | GET | id | List episode saja |
/wibu/hidori/stream | GET | episode | Embed, mirror, download links |
Response dibungkus standar Onepunya: { status, creator: "Onepunya", result }. Tidak ada credit/watermark eksternal di dalam result.