@pixam/voe
v1.0.1
Published
A production-grade API wrapper for VOE video hosting service
Maintainers
Readme
@pixam/voe
A production-grade TypeScript API wrapper for the VOE video hosting service.
Features
- 🚀 Full TypeScript support with comprehensive type definitions
- 🔒 Input validation using Zod
- 🔄 Automatic retry mechanism for failed requests
- ⚡ Rate limiting support
- 🛡️ Error handling with custom error classes
- 📝 Complete API coverage
- 🧪 Built-in TypeScript types
Installation
# Using bun
bun add @pixam/voe
# Using npm
npm install @pixam/voe
# Using yarn
yarn add @pixam/voe
# Using pnpm
pnpm add @pixam/voeUsage
import { VoeClient } from '@pixam/voe';
// Initialize the client
const client = new VoeClient({
apiKey: 'YOUR_API_KEY',
});
// Example: Get account information
const accountInfo = await client.getAccountInfo();
console.log(accountInfo);
// Example: Upload a file
const fileBuffer = await readFile('video.mp4');
const uploadResult = await client.uploadFile(fileBuffer, 'video.mp4');
console.log(uploadResult);
// Example: Add remote upload
const remoteUpload = await client.addRemoteUpload('https://example.com/video.mp4');
console.log(remoteUpload);
// Example: Get file information
const fileInfo = await client.getFileInfo('file_code');
console.log(fileInfo);
// Example: Create a folder
const folderId = await client.createFolder('My Videos');
console.log(folderId);API Reference
Account Methods
getAccountInfo(): Get account informationgetAccountStats(): Get account statistics
Upload Methods
getUploadServer(): Get upload server URLuploadFile(file: Buffer | string, filename: string): Upload a fileaddRemoteUpload(url: string, folderId?: number): Add remote uploadgetRemoteUploadList(): Get remote upload list
File Methods
cloneFile(fileCode: string, folderId?: number): Clone a filegetFileInfo(fileCodes: string | string[]): Get file informationgetFileList(params?: FileListParams): Get file listrenameFile(fileCode: string, title: string): Rename a filemoveFileToFolder(fileCode: string, folderId: number): Move file to folderdeleteFile(fileCode: string | string[]): Delete file(s)
Folder Methods
getFolderList(folderId?: number): Get folder listcreateFolder(name: string, parentId?: number): Create a folderrenameFolder(folderId: number, name: string): Rename a folder
History Methods
getDeletedFiles(params?: DMCAListParams): Get deleted filesgetDMCAList(params?: DMCAListParams): Get DMCA list
Settings Methods
getCurrentDomain(): Get current adblock domain
Premium Methods
generatePremiumKeys(params: PremiumKeyGenerationParams): Generate premium keys
Error Handling
The client includes custom error classes for better error handling:
import { VoeClient, VoeError, VoeAuthenticationError } from '@pixam/voe';
try {
const client = new VoeClient({ apiKey: 'invalid_key' });
await client.getAccountInfo();
} catch (error) {
if (error instanceof VoeAuthenticationError) {
console.error('Authentication failed:', error.message);
} else if (error instanceof VoeError) {
console.error('VOE API error:', error.message);
} else {
console.error('Unknown error:', error);
}
}Configuration
The client accepts the following configuration options:
interface VoeConfig {
apiKey: string;
baseURL?: string;
timeout?: number;
retryAttempts?: number;
retryDelay?: number;
}Rate Limiting
The client automatically handles rate limiting according to VOE's API guidelines (3-4 requests per second).
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
