unithub 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +30 -0
  2. package/index.js +45 -0
  3. package/package.json +26 -0
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # UnitHub SDK
2
+
3
+ JavaScript SDK for the [UnitHub](https://unithub.ai) property management API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install unithub
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ const UnitHub = require('unithub');
15
+
16
+ const client = new UnitHub('your-api-key');
17
+
18
+ // List properties
19
+ const properties = await client.listProperties();
20
+
21
+ // Get a property
22
+ const property = await client.getProperty('property-id');
23
+
24
+ // List tenants
25
+ const tenants = await client.listTenants('property-id');
26
+ ```
27
+
28
+ ## License
29
+
30
+ MIT
package/index.js ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * UnitHub SDK
3
+ * JavaScript SDK for the UnitHub property management API.
4
+ * @see https://unithub.ai
5
+ */
6
+
7
+ class UnitHub {
8
+ constructor(apiKey, options = {}) {
9
+ this.apiKey = apiKey;
10
+ this.baseUrl = options.baseUrl || 'https://unithub.ai/api/v1';
11
+ }
12
+
13
+ async _request(method, path, body) {
14
+ const url = `${this.baseUrl}${path}`;
15
+ const res = await fetch(url, {
16
+ method,
17
+ headers: {
18
+ 'Authorization': `Bearer ${this.apiKey}`,
19
+ 'Content-Type': 'application/json',
20
+ 'Accept': 'application/json',
21
+ },
22
+ body: body ? JSON.stringify(body) : undefined,
23
+ });
24
+ if (!res.ok) throw new Error(`UnitHub API error: ${res.status}`);
25
+ return res.json();
26
+ }
27
+
28
+ listProperties() {
29
+ return this._request('GET', '/properties');
30
+ }
31
+
32
+ getProperty(id) {
33
+ return this._request('GET', `/properties/${id}`);
34
+ }
35
+
36
+ listTenants(propertyId) {
37
+ return this._request('GET', `/properties/${propertyId}/tenants`);
38
+ }
39
+
40
+ listMaintenanceRequests(propertyId) {
41
+ return this._request('GET', `/properties/${propertyId}/maintenance`);
42
+ }
43
+ }
44
+
45
+ module.exports = UnitHub;
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "unithub",
3
+ "version": "1.0.0",
4
+ "description": "JavaScript SDK for the UnitHub property management API. Simplifies integration with UnitHub's AI-powered property management platform.",
5
+ "main": "index.js",
6
+ "homepage": "https://unithub.ai",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/tom-mcIvor/unithub-sdk"
10
+ },
11
+ "keywords": [
12
+ "unithub",
13
+ "property-management",
14
+ "landlord",
15
+ "rental",
16
+ "proptech",
17
+ "api",
18
+ "sdk",
19
+ "real-estate"
20
+ ],
21
+ "author": "UnitHub <contact@unithub.ai> (https://unithub.ai)",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/tom-mcIvor/unithub-sdk/issues"
25
+ }
26
+ }