TypeScript API client library with generic HTTP utilities for Omnia projects
bash
npm install omnia-client-api
`
Usage
$3
`typescript
import { GenericApiClient } from 'omnia-client-api';
const client = new GenericApiClient('https://api.example.com');
// GET request
const users = await client.get('/users');
// POST request
const newUser = await client.post('/users', { name: 'John', email: 'john@example.com' });
// PUT request
const updatedUser = await client.put('/users/1', { name: 'John Doe' });
// DELETE request
await client.delete('/users/1');
`
$3
`typescript
import { formatDate, parseDate } from 'omnia-client-api/utility';
const formattedDate = formatDate(new Date());
const parsedDate = parseDate('2023-12-01');
`
API Reference
$3
The main API client class for making HTTP requests.
#### Constructor
`typescript
new GenericApiClient(baseURL: string, options?: AxiosRequestConfig)
`
#### Methods
- get
- post
- put
- patch
- delete