bedloop 0.1.0-alpha.4 → 0.1.0-alpha.6

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.
package/dist/index.cjs CHANGED
@@ -110,10 +110,10 @@ async function getMessages(baseUrl, token, bookingId) {
110
110
  };
111
111
  const response = await import_axios3.default.get(url, { headers });
112
112
  if (!response.data) {
113
- throw new Error("No data received from getBookingByDate");
113
+ throw new Error("No data received from getMessages");
114
114
  }
115
115
  if (!Array.isArray(response.data.data)) {
116
- throw new Error("Invalid data format received from getBookingByDate");
116
+ throw new Error("Invalid data format received from getMessages");
117
117
  }
118
118
  return response.data.data;
119
119
  }
@@ -309,6 +309,42 @@ async function getDestinations(baseUrl, token) {
309
309
  return response.data.data;
310
310
  }
311
311
 
312
+ // src/client/request/getListings.ts
313
+ var import_axios5 = __toESM(require("axios"), 1);
314
+ async function getListings(baseUrl, token) {
315
+ const url = `${baseUrl}/api/v1/listings`;
316
+ const headers = {
317
+ Accept: "application/json",
318
+ Authorization: `Bearer ${token}`
319
+ };
320
+ const response = await import_axios5.default.get(url, { headers });
321
+ if (!response.data) {
322
+ throw new Error("No data received from getListings");
323
+ }
324
+ if (!Array.isArray(response.data.data)) {
325
+ throw new Error("Invalid data format received from getListings");
326
+ }
327
+ return response.data.data;
328
+ }
329
+
330
+ // src/client/request/getPhotosByListing.ts
331
+ var import_axios6 = __toESM(require("axios"), 1);
332
+ async function getPhotosByListing(baseUrl, token, id) {
333
+ const url = `${baseUrl}/api/v1/photos?listing_id=${id}`;
334
+ const headers = {
335
+ Accept: "application/json",
336
+ Authorization: `Bearer ${token}`
337
+ };
338
+ const response = await import_axios6.default.get(url, { headers });
339
+ if (!response.data) {
340
+ throw new Error("No data received from getPhotosByListing");
341
+ }
342
+ if (!Array.isArray(response.data.data)) {
343
+ throw new Error("Invalid data format received from getPhotosByListing");
344
+ }
345
+ return response.data.data;
346
+ }
347
+
312
348
  // src/client/client.ts
313
349
  var defaultPollingOptions = {
314
350
  interval: 5e3,
@@ -364,6 +400,14 @@ var Client = class {
364
400
  const auth = await this.getAuthorization();
365
401
  return getDestinations(this.options.url, auth.token);
366
402
  }
403
+ async getListings() {
404
+ const auth = await this.getAuthorization();
405
+ return getListings(this.options.url, auth.token);
406
+ }
407
+ async getPhotosByListing(listingId) {
408
+ const auth = await this.getAuthorization();
409
+ return getPhotosByListing(this.options.url, auth.token, listingId);
410
+ }
367
411
  disconnect() {
368
412
  if (this.tokenRefreshInterval) {
369
413
  clearInterval(this.tokenRefreshInterval);
package/dist/index.d.cts CHANGED
@@ -32,6 +32,65 @@ interface Destination {
32
32
  max_days?: number;
33
33
  }
34
34
 
35
+ interface Listing {
36
+ id: number;
37
+ active: number;
38
+ name?: string;
39
+ mu?: string;
40
+ destination: number;
41
+ street?: string;
42
+ floor?: string;
43
+ door?: string;
44
+ city?: string;
45
+ state?: {
46
+ id?: number;
47
+ region_id?: number;
48
+ name?: string;
49
+ };
50
+ country?: number;
51
+ zipcode?: string;
52
+ license?: string;
53
+ lat?: string;
54
+ lng?: string;
55
+ person_capacity?: number;
56
+ bathrooms?: number;
57
+ bath?: number;
58
+ bedrooms?: number;
59
+ m2?: number;
60
+ longstay?: number;
61
+ checkinfrom?: string;
62
+ checkinto?: string;
63
+ checkout?: string;
64
+ latecheckinfrom?: string;
65
+ latecheckinto?: string;
66
+ price_latecheckin?: string;
67
+ entry_limit_time?: string;
68
+ deposit?: number;
69
+ intercom_number?: string;
70
+ key_number?: string;
71
+ wifi_network?: string;
72
+ wifi_password?: string;
73
+ description?: Record<string, unknown>;
74
+ short_description: string[];
75
+ property_type?: number;
76
+ url?: string;
77
+ num_sofa_beds?: number;
78
+ fees?: Record<string, unknown>[];
79
+ services?: number[];
80
+ tourist_tax?: string;
81
+ }
82
+
83
+ interface Photo {
84
+ id: number;
85
+ listing_id: number;
86
+ name: string;
87
+ zone: string;
88
+ type: number;
89
+ position: number;
90
+ alt_text: string;
91
+ title: string;
92
+ }
93
+
35
94
  interface ClientOptions {
36
95
  user: string;
37
96
  password: string;
@@ -59,6 +118,8 @@ declare class Client {
59
118
  getAuthorization(): Promise<Authorization>;
60
119
  connect(callback: (events: BedloopEvent[]) => void): Promise<void>;
61
120
  getDestinations(): Promise<Destination[]>;
121
+ getListings(): Promise<Listing[]>;
122
+ getPhotosByListing(listingId: string): Promise<Photo[]>;
62
123
  disconnect(): void;
63
124
  }
64
125
 
package/dist/index.d.ts CHANGED
@@ -32,6 +32,65 @@ interface Destination {
32
32
  max_days?: number;
33
33
  }
34
34
 
35
+ interface Listing {
36
+ id: number;
37
+ active: number;
38
+ name?: string;
39
+ mu?: string;
40
+ destination: number;
41
+ street?: string;
42
+ floor?: string;
43
+ door?: string;
44
+ city?: string;
45
+ state?: {
46
+ id?: number;
47
+ region_id?: number;
48
+ name?: string;
49
+ };
50
+ country?: number;
51
+ zipcode?: string;
52
+ license?: string;
53
+ lat?: string;
54
+ lng?: string;
55
+ person_capacity?: number;
56
+ bathrooms?: number;
57
+ bath?: number;
58
+ bedrooms?: number;
59
+ m2?: number;
60
+ longstay?: number;
61
+ checkinfrom?: string;
62
+ checkinto?: string;
63
+ checkout?: string;
64
+ latecheckinfrom?: string;
65
+ latecheckinto?: string;
66
+ price_latecheckin?: string;
67
+ entry_limit_time?: string;
68
+ deposit?: number;
69
+ intercom_number?: string;
70
+ key_number?: string;
71
+ wifi_network?: string;
72
+ wifi_password?: string;
73
+ description?: Record<string, unknown>;
74
+ short_description: string[];
75
+ property_type?: number;
76
+ url?: string;
77
+ num_sofa_beds?: number;
78
+ fees?: Record<string, unknown>[];
79
+ services?: number[];
80
+ tourist_tax?: string;
81
+ }
82
+
83
+ interface Photo {
84
+ id: number;
85
+ listing_id: number;
86
+ name: string;
87
+ zone: string;
88
+ type: number;
89
+ position: number;
90
+ alt_text: string;
91
+ title: string;
92
+ }
93
+
35
94
  interface ClientOptions {
36
95
  user: string;
37
96
  password: string;
@@ -59,6 +118,8 @@ declare class Client {
59
118
  getAuthorization(): Promise<Authorization>;
60
119
  connect(callback: (events: BedloopEvent[]) => void): Promise<void>;
61
120
  getDestinations(): Promise<Destination[]>;
121
+ getListings(): Promise<Listing[]>;
122
+ getPhotosByListing(listingId: string): Promise<Photo[]>;
62
123
  disconnect(): void;
63
124
  }
64
125
 
package/dist/index.js CHANGED
@@ -73,10 +73,10 @@ async function getMessages(baseUrl, token, bookingId) {
73
73
  };
74
74
  const response = await axios3.get(url, { headers });
75
75
  if (!response.data) {
76
- throw new Error("No data received from getBookingByDate");
76
+ throw new Error("No data received from getMessages");
77
77
  }
78
78
  if (!Array.isArray(response.data.data)) {
79
- throw new Error("Invalid data format received from getBookingByDate");
79
+ throw new Error("Invalid data format received from getMessages");
80
80
  }
81
81
  return response.data.data;
82
82
  }
@@ -272,6 +272,42 @@ async function getDestinations(baseUrl, token) {
272
272
  return response.data.data;
273
273
  }
274
274
 
275
+ // src/client/request/getListings.ts
276
+ import axios5 from "axios";
277
+ async function getListings(baseUrl, token) {
278
+ const url = `${baseUrl}/api/v1/listings`;
279
+ const headers = {
280
+ Accept: "application/json",
281
+ Authorization: `Bearer ${token}`
282
+ };
283
+ const response = await axios5.get(url, { headers });
284
+ if (!response.data) {
285
+ throw new Error("No data received from getListings");
286
+ }
287
+ if (!Array.isArray(response.data.data)) {
288
+ throw new Error("Invalid data format received from getListings");
289
+ }
290
+ return response.data.data;
291
+ }
292
+
293
+ // src/client/request/getPhotosByListing.ts
294
+ import axios6 from "axios";
295
+ async function getPhotosByListing(baseUrl, token, id) {
296
+ const url = `${baseUrl}/api/v1/photos?listing_id=${id}`;
297
+ const headers = {
298
+ Accept: "application/json",
299
+ Authorization: `Bearer ${token}`
300
+ };
301
+ const response = await axios6.get(url, { headers });
302
+ if (!response.data) {
303
+ throw new Error("No data received from getPhotosByListing");
304
+ }
305
+ if (!Array.isArray(response.data.data)) {
306
+ throw new Error("Invalid data format received from getPhotosByListing");
307
+ }
308
+ return response.data.data;
309
+ }
310
+
275
311
  // src/client/client.ts
276
312
  var defaultPollingOptions = {
277
313
  interval: 5e3,
@@ -327,6 +363,14 @@ var Client = class {
327
363
  const auth = await this.getAuthorization();
328
364
  return getDestinations(this.options.url, auth.token);
329
365
  }
366
+ async getListings() {
367
+ const auth = await this.getAuthorization();
368
+ return getListings(this.options.url, auth.token);
369
+ }
370
+ async getPhotosByListing(listingId) {
371
+ const auth = await this.getAuthorization();
372
+ return getPhotosByListing(this.options.url, auth.token, listingId);
373
+ }
330
374
  disconnect() {
331
375
  if (this.tokenRefreshInterval) {
332
376
  clearInterval(this.tokenRefreshInterval);
package/package.json CHANGED
@@ -1,70 +1,72 @@
1
- {
2
- "name": "bedloop",
3
- "version": "0.1.0-alpha.4",
4
- "type": "module",
5
- "description": "TypeScript client for Bedloop API with real-time messaging and booking management",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "require": {
12
- "types": "./dist/index.d.cts",
13
- "default": "./dist/index.cjs"
14
- },
15
- "import": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
18
- }
19
- }
20
- },
21
- "files": [
22
- "dist",
23
- "README.md",
24
- "LICENSE"
25
- ],
26
- "devDependencies": {
27
- "@types/node": "24.10.1",
28
- "@typescript-eslint/eslint-plugin": "8.48.0",
29
- "@typescript-eslint/parser": "8.48.0",
30
- "eslint": "9.39.1",
31
- "eslint-config-prettier": "10.1.8",
32
- "eslint-plugin-prettier": "5.5.4",
33
- "prettier": "3.7.3",
34
- "tsup": "8.5.1",
35
- "tsx": "4.20.6",
36
- "typescript": "5.9.3"
37
- },
38
- "keywords": [
39
- "bedloop",
40
- "api",
41
- "client",
42
- "typescript",
43
- "messaging",
44
- "booking",
45
- "real-time",
46
- "polling"
47
- ],
48
- "repository": {
49
- "type": "git",
50
- "url": "https://github.com/johan12361/bedloop.git"
51
- },
52
- "bugs": {
53
- "url": "https://github.com/johan12361/bedloop/issues"
54
- },
55
- "homepage": "https://github.com/johan12361/bedloop#readme",
56
- "author": "johan12361",
57
- "license": "MIT",
58
- "dependencies": {
59
- "axios": "1.13.2"
60
- },
61
- "scripts": {
62
- "build": "tsup",
63
- "dev": "tsc --watch",
64
- "playground": "tsx playground/playground.ts",
65
- "lint": "eslint src/**/*.ts",
66
- "lint:fix": "eslint src/**/*.ts --fix",
67
- "format": "prettier --write \"src/**/*.ts\"",
68
- "typecheck": "tsc --noEmit"
69
- }
70
- }
1
+ {
2
+ "name": "bedloop",
3
+ "version": "0.1.0-alpha.6",
4
+ "type": "module",
5
+ "description": "TypeScript client for Bedloop API with real-time messaging and booking management",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "require": {
12
+ "types": "./dist/index.d.cts",
13
+ "default": "./dist/index.cjs"
14
+ },
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsup",
28
+ "dev": "tsc --watch",
29
+ "playground": "tsx playground/playground.ts",
30
+ "lint": "eslint src/**/*.ts",
31
+ "lint:fix": "eslint src/**/*.ts --fix",
32
+ "format": "prettier --write \"src/**/*.ts\"",
33
+ "typecheck": "tsc --noEmit",
34
+ "prepublishOnly": "pnpm build"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "24.10.1",
38
+ "@typescript-eslint/eslint-plugin": "8.48.0",
39
+ "@typescript-eslint/parser": "8.48.0",
40
+ "eslint": "9.39.1",
41
+ "eslint-config-prettier": "10.1.8",
42
+ "eslint-plugin-prettier": "5.5.4",
43
+ "prettier": "3.7.3",
44
+ "tsup": "8.5.1",
45
+ "tsx": "4.20.6",
46
+ "typescript": "5.9.3"
47
+ },
48
+ "keywords": [
49
+ "bedloop",
50
+ "api",
51
+ "client",
52
+ "typescript",
53
+ "messaging",
54
+ "booking",
55
+ "real-time",
56
+ "polling"
57
+ ],
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "https://github.com/johan12361/bedloop.git"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/johan12361/bedloop/issues"
64
+ },
65
+ "homepage": "https://github.com/johan12361/bedloop#readme",
66
+ "author": "johan12361",
67
+ "license": "MIT",
68
+ "packageManager": "pnpm@10.18.3",
69
+ "dependencies": {
70
+ "axios": "1.13.2"
71
+ }
72
+ }