The `PawchiveAPI` class provides a simple and efficient way to interact with the Pawchive API.
The PawchiveAPI JavaScript library provides a clean, simple, and efficient wrapper for interacting with the Pawchive API. Designed specifically for UserScripts and web applications, it supports direct global access (window.PawchiveAPI / globalThis.PawchiveAPI), making it seamless to import via @require or dynamic script loaders.
GM_xmlhttpRequest and @connect permissions to securely bypass CORS restrictions when fetching data from the server."custom"), preventing parsing errors.unsafeWindow, window, and globalThis for maximum compatibility and smooth debugging in browser developer consoles.@require (Recommended)Add the following directive to your UserScript Header:
// @require https://greasyfork.org/scripts/591303-pawchiveapi/code/PawChiveAPI.user.js
const APIClass = window.PawchiveAPI || window.pawchiveAPI;
const api = new APIClass();
// Initialize the API client (Debug logs enabled by default)
const api = new PawchiveAPI();
// Fetch recent posts using Async/Await
async function loadContent() {
try {
const posts = await api.getRecentPosts();
console.log('Recent Posts:', posts);
const creators = await api.getCreators();
console.log('Creators:', creators);
} catch (error) {
console.error('Failed to fetch data from Pawchive API:', error);
}
}
loadContent();
Distributed under the MIT License. Free to use and modify in personal projects and UserScripts.