https://github.com/dubisdev/crtm-api
A type-safe, lightweight API client for CRTM (Consorcio Regional de Transportes de Madrid) public transport data.
https://github.com/dubisdev/crtm-api
api-client crtm crtm-api
Last synced: 2 months ago
JSON representation
A type-safe, lightweight API client for CRTM (Consorcio Regional de Transportes de Madrid) public transport data.
- Host: GitHub
- URL: https://github.com/dubisdev/crtm-api
- Owner: dubisdev
- License: mit
- Created: 2025-12-10T20:33:15.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-12-24T23:53:24.000Z (3 months ago)
- Last Synced: 2025-12-26T12:50:38.821Z (3 months ago)
- Topics: api-client, crtm, crtm-api
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@dubisdev/crtm-api
- Size: 70.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @dubisdev/crtm-api
A type-safe, lightweight API client for CRTM (Consorcio Regional de Transportes de Madrid) public transport data.
## Features
- 🚀 **Lightweight** - Minimal dependencies, tree-shakeable
- 🔒 **Type-safe** - Full TypeScript support with runtime validation
- 🎯 **Simple API** - Clean, intuitive interface
- 📦 **Modular** - Import only what you need
- ✅ **Tested** - Comprehensive test coverage
## Installation
```bash
npm install @dubisdev/crtm-api
```
## Quick Start
```typescript
import { getStopByCode, getLineByCode, getStopTimesByStopCode } from '@dubisdev/crtm-api';
// Get stop information
const stop = await getStopByCode('8_21044');
// Get line information
const line = await getLineByCode('123');
// Get stop times
const times = await getStopTimesByStopCode('8_21044');
```
## Error Handling
```typescript
import { NotFoundError, NetworkError } from '@dubisdev/crtm-api';
try {
const stop = await getStopByCode('INVALID_CODE');
} catch (error) {
if (error instanceof NotFoundError) {
console.error('Resource not found');
} else if (error instanceof NetworkError) {
console.error('Network error occurred');
}
}
```
## Documentation
Full API documentation is available at [https://dubisdev.github.io/crtm-api/](https://dubisdev.github.io/crtm-api/)
## Development
```bash
# Install dependencies
bun install
# Run tests
bun test
# Run tests in watch mode
bun test:watch
# Run tests with coverage
bun test:coverage
# Build
bun run build
```
## License
MIT © [David Jiménez](https://github.com/dubisdev)