1.0.0 • Published 12 months ago

@akomalabs/voe v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Voe Client

A robust, fully-typed TypeScript client for interacting with the Voe.sx API. Built with modularity, type safety, and developer experience in mind.

npm version TypeScript

Features

  • 🔒 Full TypeScript support with comprehensive type definitions
  • 🚦 Built-in rate limiting (3-4 requests/second)
  • 🔄 Automatic request retries and error handling
  • 📦 Modular architecture for maintainability
  • 📝 Detailed error messages and stack traces
  • 🔍 Extensive JSDoc documentation
  • ⚡ Built with Bun for optimal performance

Installation

Using bun (recommended)

bun add @akomalabs/voe

Using npm

npm install @akomalabs/voe

Using yarn

yarn add @akomalabs/voe

Using pnpm

pnpm add @akomalabs/voe

Usage

import { VoeClient } from "@akomalabs/voe"

const client = new VoeClient({
  apiKey: "your-api-key", // Get from Account -> Settings -> API Details
})

// Basic usage
try {
  // Get account info
  const accountInfo = await client.account.getInfo()
  // Upload a file
  const uploadResult = await client.upload.uploadFile(file)
  // List files in a folder
  const files = await client.folders.listContents(0)
} catch (error) {
  if (error instanceof VoeError) {
    console.error(`API Error: ${error.message} (Code: ${error.code})`)
  }
}

API Documentation

Account Operations

// Get account information
const info = await client.account.getInfo()
// Get account statistics
const stats = await client.account.getStats()

Upload Operations

// Get upload server
const serverUrl = await client.upload.getServer()
// Upload file
const uploadResult = await client.upload.uploadFile(file)
// Remote upload
const remoteUpload = await client.upload.addRemoteUpload(
  "https://example.com/file.mp4",
)
// List remote uploads
const uploads = await client.upload.getRemoteUploadList()

Folder Operations

// List folder contents
const contents = await client.folders.listContents(folderId)
// Create folder
const newFolder = await client.folders.create("New Folder", parentId)
// Rename folder
await client.folders.rename(folderId, "New Name")

Misc Operations

// Get deleted files
const deletedFiles = await client.misc.getDeletedFiles({
  last: 100,
  pagination: true,
})
// Get DMCA list
const dmcaList = await client.misc.getDmcaList({
  pending: true,
})
// Get domain settings
const domainSettings = await client.misc.getDomainSettings()

Error Handling

The client includes a custom VoeError class for detailed error information:

try {
  await client.files.delete("invalid-code")
} catch (error) {
  if (error instanceof VoeError) {
    console.error(
      `Message: ${error.message} Code: ${error.code} Status: ${error.statusCode}`,
    )
  }
}

Rate Limiting

The client automatically handles rate limiting (3-4 requests per second) to prevent API throttling. Requests exceeding this limit are automatically queued.

TypeScript Support

This package includes comprehensive TypeScript definitions. All methods and responses are fully typed for the best development experience.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see the LICENSE file for details

Support

Acknowledgments

  • Built with TypeScript
  • Powered by Bun
  • Uses Axios for HTTP requests

voe-client

1.0.0

12 months ago