Arifzyn API Client
A TypeScript/JavaScript client for the Arifzyn API, providing a simple and intuitive way to interact with all Arifzyn API endpoints.
Installation
npm install @arifzyn/api
Quick Start
import { ArifzynAPI } from '@arifzyn/api';
const api = new ArifzynAPI({
baseURL: 'https://api.arifzyn.site',
apiKey: 'YOUR_API_KEY',
timeout: 30000
});
async function example() {
const response = await api.get('ai/alicia', {
text: 'Hello!'
});
console.log(response.result);
}
Features
- Full TypeScript support
- Support for all HTTP methods (GET, POST, PUT, DELETE)
- Built-in endpoint filtering by category
- Automatic error handling
- Configurable base URL and API key
- File upload support
Configuration
interface ArifzynConfig {
baseURL?: string;
apiKey?: string;
timeout?: number;
}
API Methods
Making Requests
await api.get(endpoint, params);
await api.post(endpoint, data);
await api.put(endpoint, data);
await api.delete(endpoint);
await api.call(endpoint, method, data);
Endpoint Management
const endpoints = await api.getEndpoints();
const aiEndpoints = await api.getEndpointsByCategory('ai');
const categories = await api.getCategories();
Examples
Basic Usage
const aliciaResponse = await api.get('ai/alicia', {
text: 'Hello!'
});
const postResponse = await api.post('some/endpoint', {
data: 'value'
});
File Upload
const formData = new FormData();
formData.append('file', fileObject);
const uploadResponse = await api.post('upload/endpoint', formData);
Error Handling
try {
const response = await api.get('some/endpoint');
} catch (error) {
console.error('API Error:', error.message);
}
Response Type
interface ApiResponse<T = any> {
creator: string;
status: number;
result: T;
}
Endpoint Type
interface Endpoint {
category: string;
base_code: string;
name: string;
path: string;
example: Record<string, string>;
parameters: string[];
method: string;
uri: string;
files: boolean;
error: boolean;
}
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Credits
Created by @arifzyn.site
Support
For support, please open an issue on the GitHub repository or contact the maintainers.