Skip to content

Commit 9722ff5

Browse files
committed
Initial commit
0 parents  commit 9722ff5

18 files changed

+12620
-0
lines changed

.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"prettier"
9+
],
10+
"env": {
11+
"es2020": true,
12+
"node": true
13+
},
14+
"ignorePatterns": [
15+
"dist/",
16+
"node_modules/"
17+
]
18+
}

.github/docs/README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# TenantOS API Documentation
2+
3+
This directory contains the generated TypeScript documentation for the TenantOS API wrapper library.
4+
5+
## Official Documentation
6+
7+
For the complete TenantOS API reference, please visit the [official TenantOS API documentation](https://api.tenantos.com/docs/).
8+
9+
## Wrapper Documentation
10+
11+
This TypeScript wrapper provides:
12+
13+
- **Type-safe API calls** with full IntelliSense support
14+
- **Comprehensive error handling** with custom error types
15+
- **Automatic retry logic** for transient failures
16+
- **Resource-based organization** for intuitive API usage
17+
- **Complete TypeScript definitions** for all API endpoints
18+
19+
## Quick Start
20+
21+
```typescript
22+
import { TenantosClient } from '@tenantos/api';
23+
24+
const client = new TenantosClient({
25+
baseUrl: 'https://your-tenant.tenantos.com',
26+
apiKey: 'your-api-key'
27+
});
28+
29+
// List servers
30+
const servers = await client.servers.list();
31+
32+
// Get server details
33+
const server = await client.servers.get(123);
34+
35+
// Server power management
36+
await client.servers.power.on(123);
37+
```
38+
39+
## API Coverage
40+
41+
This wrapper covers 100% of the TenantOS API endpoints as documented in the [official API docs](https://api.tenantos.com/docs/), including:
42+
43+
### Core Resources
44+
- **Servers** - Complete server lifecycle management
45+
- **Network Devices** - Network infrastructure management
46+
- **Users & Roles** - User account and permission management
47+
- **IP Management** - IP address allocation and management
48+
- **Inventory** - Hardware inventory tracking
49+
50+
### Server Extensions
51+
- **BMC Users** - Baseboard Management Controller user management
52+
- **Backups** - Server backup operations
53+
- **Snapshots** - VM snapshot management
54+
- **Statistics** - Performance monitoring and metrics
55+
- **Console** - Remote console access
56+
- **Provisioning** - OS installation and configuration
57+
58+
### System Management
59+
- **PXE Profiles** - Boot profile configuration
60+
- **Remote Agents** - Agent management and monitoring
61+
- **Subnets** - Network subnet configuration
62+
- **RDNS** - Reverse DNS management
63+
- **System Settings** - Global system configuration
64+
65+
## Error Handling
66+
67+
The wrapper provides comprehensive error handling with specific error types:
68+
69+
```typescript
70+
import { isTenantosApiError, isTenantosNetworkError } from '@tenantos/api';
71+
72+
try {
73+
const server = await client.servers.get(999);
74+
} catch (error) {
75+
if (isTenantosApiError(error)) {
76+
console.log(`API Error ${error.statusCode}: ${error.message}`);
77+
if (error.isNotFound()) {
78+
console.log('Server not found');
79+
}
80+
} else if (isTenantosNetworkError(error)) {
81+
console.log('Network connectivity issue');
82+
}
83+
}
84+
```
85+
86+
## License
87+
88+
This TypeScript wrapper library was created by **Salim Shadman** and is released under the **MIT License**. The underlying TenantOS API is managed by TenantOS.
89+

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Generate Documentation
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
docs:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '18'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Build project
27+
run: npm run build
28+
29+
- name: Generate documentation
30+
run: npm run docs
31+
32+
- name: Deploy to GitHub Pages
33+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
34+
uses: peaceiris/actions-gh-pages@v3
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./.github/docs
38+
destination_dir: docs

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Compiled output
5+
dist/
6+
7+
# Examples and playground
8+
examples/
9+
**/node_modules/
10+
11+
# Logs
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+
16+
# Environment variables
17+
.env
18+
19+
src/schema.ts
20+
21+
# Documentation (generated)
22+
docs/*
23+
!docs/README.md
24+
25+
# Keep .github/docs for GitHub Pages
26+
!.github/

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 100
6+
}

0 commit comments

Comments
 (0)