imghost
v1.2.1
Published
SDK for ImgHost
Readme
ImgHost SDK
A professional, TypeScript-first SDK for interacting with the ImgHost API. This library provides a simple and strongly-typed interface for managing images and S3 backups.
Installation
Install the package via npm, pnpm, or yarn:
npm install imghost
# or
pnpm add imghostQuick Start
Initialize the client with your configuration to start interacting with the API.
import { ImgHost } from "imghost";
const imghost = new ImgHost({
apiUrl: "https://api.yourdomain.com",
apiKey: "your_api_key_here",
});
// Example: Uploading an image
async function uploadExample() {
const file = new File(["dummy content"], "test.png", { type: "image/png" });
const response = await imghost.images.upload({
files: [file],
folder: "examples",
});
console.log(response);
}API Reference
The SDK is organized into resource-specific namespaces.
Images (imghost.images)
Manage your uploaded images and media.
upload(data: UploadImageRequest): Upload one or more image files.list(params?: { page?: number; limit?: number }): Retrieve a paginated list of images.delete(data: DeleteImageRequest): Delete a specific image by ID.
Backups (imghost.backups)
Manage system and data backups.
create(): Creates a new snapshot and uploads it to S3.list(): Retrieves a list of all available snapshots.restore(id: string): Restores the server state to a specific snapshot.delete(id: string): Deletes a specific snapshot.
License
MIT License
