@kohost/api-client 1.0.0-alpha.4 → 1.0.0-beta.1

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 (59) hide show
  1. package/bitbucket-pipelines.yml +18 -8
  2. package/commands/CheckInReservationCommand.js +23 -0
  3. package/commands/DiscoverReservationsCommand.js +24 -0
  4. package/commands/DiscoverRoomsCommand.js +21 -0
  5. package/commands/DiscoverUsersCommand.js +2 -2
  6. package/commands/{VerifyDocumentCommand.js → OCRDocumentCommand.js} +4 -8
  7. package/commands/SendEmailCommand.js +24 -0
  8. package/commands/SendSMSCommand.js +21 -0
  9. package/commands/index.js +10 -4
  10. package/defs/http.js +1 -1
  11. package/events/EmailSentEvent.js +17 -0
  12. package/events/Event.js +20 -1
  13. package/events/SMSSentEvent.js +17 -0
  14. package/events/ShortLinkCreatedEvent.js +17 -0
  15. package/events/index.js +7 -0
  16. package/http/handleResponseError.js +9 -29
  17. package/http/index.js +12 -8
  18. package/models/credential.js +29 -0
  19. package/models/gateway.js +0 -8
  20. package/models/identification.js +32 -0
  21. package/models/index.js +9 -9
  22. package/models/kohost.js +4 -3
  23. package/models/product.js +30 -0
  24. package/models/reservation.js +47 -0
  25. package/models/room.js +1 -12
  26. package/models/shortLink.js +29 -0
  27. package/models/space.js +1 -1
  28. package/models/thermostat.js +3 -3
  29. package/models/user.js +0 -2
  30. package/models/windowCovering.js +1 -1
  31. package/package.json +1 -1
  32. package/schemas/admin/property.json +7 -1
  33. package/schemas/camera.json +3 -3
  34. package/schemas/courtesy.json +3 -3
  35. package/schemas/credential.json +28 -0
  36. package/schemas/definitions/common.json +53 -0
  37. package/schemas/definitions/device.json +13 -2
  38. package/schemas/dimmer.json +3 -3
  39. package/schemas/gateway.json +16 -47
  40. package/schemas/identification.json +18 -4
  41. package/schemas/lock.json +6 -3
  42. package/schemas/mediaSource.json +3 -3
  43. package/schemas/motionSensor.json +3 -3
  44. package/schemas/payment.json +3 -1
  45. package/schemas/product.json +36 -0
  46. package/schemas/reservation.json +8 -3
  47. package/schemas/room.json +1 -8
  48. package/schemas/shortLink.json +30 -0
  49. package/schemas/switch.json +3 -3
  50. package/schemas/thermostat.json +11 -10
  51. package/schemas/user.json +57 -5
  52. package/schemas/windowCovering.json +3 -3
  53. package/useCases/http.json +152 -44
  54. package/utils/schema.js +2 -2
  55. package/models/iotGateway.js +0 -29
  56. package/models/sceneController.js +0 -29
  57. package/schemas/iotGateway.json +0 -29
  58. package/schemas/sceneController.json +0 -58
  59. package/vite.config.js +0 -22
@@ -17,6 +17,53 @@ class Reservation extends Kohost {
17
17
  get hasPayment() {
18
18
  return this.paymentId?.length > 0;
19
19
  }
20
+
21
+ range(tz) {
22
+ const start = new Date(this.checkInDateTime);
23
+ const end = new Date(this.checkOutDateTime);
24
+
25
+ // output Dec 19-23 if same month and year
26
+ if (
27
+ start.getMonth() === end.getMonth() &&
28
+ start.getFullYear() === end.getFullYear()
29
+ ) {
30
+ return `${start.toLocaleString("default", {
31
+ month: "short",
32
+ timeZone: tz,
33
+ })} ${start.toLocaleString("default", {
34
+ timeZone: tz,
35
+ day: "numeric",
36
+ })}-${end.toLocaleString("default", {
37
+ timeZone: tz,
38
+ day: "numeric",
39
+ })}`;
40
+ }
41
+
42
+ // output Dec 19 - Jan 2 if different month and year
43
+ return `${start.toLocaleString("default", {
44
+ month: "short",
45
+ timeZone: tz,
46
+ })} ${start.getDate()} - ${end.toLocaleString("default", {
47
+ month: "short",
48
+ timeZone: tz,
49
+ })} ${end.getDate()}`;
50
+ }
51
+
52
+ checkInTime(tz) {
53
+ return new Date(this.checkInDateTime).toLocaleString("default", {
54
+ hour: "numeric",
55
+ minute: "numeric",
56
+ timeZone: tz,
57
+ });
58
+ }
59
+
60
+ checkOutTime(tz) {
61
+ return new Date(this.checkOutDateTime).toLocaleString("default", {
62
+ hour: "numeric",
63
+ minute: "numeric",
64
+ timeZone: tz,
65
+ });
66
+ }
20
67
  }
21
68
 
22
69
  Object.defineProperty(Reservation.prototype, "schema", {
package/models/room.js CHANGED
@@ -11,7 +11,6 @@ const Thermostat = require("./thermostat");
11
11
  const Lock = require("./lock");
12
12
  const WindowCovering = require("./windowCovering");
13
13
  const Courtesy = require("./courtesy");
14
- const SceneController = require("./sceneController");
15
14
  const Camera = require("./camera");
16
15
  const Alarm = require("./alarm");
17
16
  const Source = require("./mediaSource");
@@ -37,7 +36,6 @@ class Room extends Kohost {
37
36
  "lock",
38
37
  "windowCovering",
39
38
  "courtesy",
40
- "sceneController",
41
39
  "camera",
42
40
  "source",
43
41
  "motionSensor",
@@ -79,10 +77,6 @@ class Room extends Kohost {
79
77
  return this.courtesy?.length > 0;
80
78
  }
81
79
 
82
- get hasSceneController() {
83
- return this.sceneControllers?.length > 0;
84
- }
85
-
86
80
  get hasCamera() {
87
81
  return this.cameras?.length > 0;
88
82
  }
@@ -135,7 +129,7 @@ function mapRoomData(data) {
135
129
  });
136
130
 
137
131
  roomData.thermostats?.map((thermostat) => {
138
- if (thermostat instanceof Thermostat) return thermostat;
132
+ if (thermostat instanceof Thermostat) return thermostat;
139
133
  else return new Thermostat(thermostat);
140
134
  });
141
135
 
@@ -154,11 +148,6 @@ function mapRoomData(data) {
154
148
  else return new Source(source);
155
149
  });
156
150
 
157
- roomData.sceneControllers?.map((sceneController) => {
158
- if (sceneController instanceof SceneController) return sceneController;
159
- else return new SceneController(sceneController);
160
- });
161
-
162
151
  roomData.cameras?.map((camera) => {
163
152
  if (camera instanceof Camera) return camera;
164
153
  else return new Camera(camera);
@@ -0,0 +1,29 @@
1
+ // Create the Lock Model
2
+ const schemas = require("../utils/schema");
3
+ const schema = require("../schemas/shortLink.json");
4
+ const Kohost = require("./kohost");
5
+
6
+ schemas.add(schema);
7
+ const validator = schemas.compile(schema);
8
+
9
+ class ShortLink extends Kohost {
10
+ constructor(data) {
11
+ super(data);
12
+ }
13
+ }
14
+
15
+ Object.defineProperty(ShortLink.prototype, "schema", {
16
+ value: schema,
17
+ });
18
+
19
+ Object.defineProperty(ShortLink.prototype, "validator", {
20
+ get: function () {
21
+ return validator;
22
+ },
23
+ });
24
+
25
+ Object.defineProperty(ShortLink, "validProperties", {
26
+ value: Object.keys(schema.properties),
27
+ });
28
+
29
+ module.exports = ShortLink;
package/models/space.js CHANGED
@@ -10,7 +10,7 @@ const Room = require("./room");
10
10
  schemas.add(schema);
11
11
  const validator = schemas.compile(schema);
12
12
 
13
- class Space extends Kohost {
13
+ class Space extends Kohost {
14
14
  constructor(data) {
15
15
  const spaceData = mapSpaceData(data);
16
16
  super(spaceData);
@@ -11,16 +11,16 @@ class Thermostat extends Kohost {
11
11
  }
12
12
 
13
13
  toCelsius() {
14
- if (this.temperatureScale === "farenheit")
14
+ if (this.temperatureScale === "fahrenheit")
15
15
  this.currentTemperature = ((this.currentTemperature - 32) * 5) / 9;
16
16
  this.temperatureScale = "celsius";
17
17
  return this.currentTemperature;
18
18
  }
19
19
 
20
- toFarenheit() {
20
+ toFahrenheit() {
21
21
  if (this.temperatureScale === "celsius")
22
22
  this.currentTemperature = (this.currentTemperature * 9) / 5 + 32;
23
- this.temperatureScale = "farenheit";
23
+ this.temperatureScale = "fahrenheit";
24
24
  return this.currentTemperature;
25
25
  }
26
26
 
package/models/user.js CHANGED
@@ -1,13 +1,11 @@
1
1
  // Create the User Model
2
2
  const schemas = require("../utils/schema");
3
3
  const schema = require("../schemas/user.json");
4
- const idSchema = require("../schemas/identification.json");
5
4
  const paymentSchema = require("../schemas/payment.json");
6
5
  const Kohost = require("./kohost");
7
6
 
8
7
  const { nanoid } = require("nanoid/async");
9
8
 
10
- schemas.add(idSchema);
11
9
  schemas.add(paymentSchema);
12
10
  schemas.add(schema);
13
11
 
@@ -11,7 +11,7 @@ class WindowCovering extends Kohost {
11
11
  super(data);
12
12
  }
13
13
 
14
- static getActionDelta(old, _new) {
14
+ static getActionDelta(old, _new) {
15
15
  const delta = {};
16
16
  for (const action in _new) {
17
17
  if (this.actionProperties?.includes(action)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kohost/api-client",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "API client for Kohost utils",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -4,7 +4,7 @@
4
4
  "title": "Property",
5
5
  "type": "object",
6
6
  "description": "A property is a physical asset or building",
7
- "required": ["id", "name", "type"],
7
+ "required": ["id", "name", "type", "hostname"],
8
8
  "properties": {
9
9
  "id": {
10
10
  "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
@@ -19,6 +19,12 @@
19
19
  "timezone": {
20
20
  "type": "string"
21
21
  },
22
+ "smsNumber": {
23
+ "type": "string"
24
+ },
25
+ "hostname": {
26
+ "type": "string"
27
+ },
22
28
  "address": {
23
29
  "type": "object",
24
30
  "properties": {
@@ -11,9 +11,6 @@
11
11
  "type": {
12
12
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
13
  },
14
- "systemData": {
15
- "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
16
- },
17
14
  "supportedNotifications": {
18
15
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
16
  },
@@ -34,6 +31,9 @@
34
31
  "type": ["string", "null"]
35
32
  }
36
33
  }
34
+ },
35
+ "systemData": {
36
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
37
37
  }
38
38
  },
39
39
  "additionalProperties": false,
@@ -11,9 +11,6 @@
11
11
  "type": {
12
12
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
13
  },
14
- "systemData": {
15
- "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
16
- },
17
14
  "supportedNotifications": {
18
15
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
16
  },
@@ -30,6 +27,9 @@
30
27
  "state": {
31
28
  "type": "string",
32
29
  "$ref": "#/properties/supportedStates/items"
30
+ },
31
+ "systemData": {
32
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
33
33
  }
34
34
  },
35
35
  "additionalProperties": false,
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/credential.json",
4
+ "title": "Credential",
5
+ "type": "object",
6
+ "required": ["type", "credential", "expires"],
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
+ },
11
+ "type": {
12
+ "type": "string",
13
+ "enum": ["verificationCode", "token"]
14
+ },
15
+ "credential": {
16
+ "type": "string"
17
+ },
18
+ "user": {
19
+ "type": "string"
20
+ },
21
+ "userAgent": {
22
+ "type": "string"
23
+ },
24
+ "expires": {
25
+ "string": "string"
26
+ }
27
+ }
28
+ }
@@ -9,6 +9,10 @@
9
9
  "type": "object",
10
10
  "default": {}
11
11
  },
12
+ "metadata": {
13
+ "type": "object",
14
+ "default": {}
15
+ },
12
16
  "createdAt": {
13
17
  "type": ["string", "object"],
14
18
  "format": "date-time"
@@ -16,6 +20,55 @@
16
20
  "updatedAt": {
17
21
  "type": ["string", "object"],
18
22
  "format": "date-time"
23
+ },
24
+ "file": {
25
+ "type":"object",
26
+ "required": ["name", "type", "data"],
27
+ "properties": {
28
+ "name": {
29
+ "type":"string",
30
+ "description": "Name of the file."
31
+ },
32
+ "type": {
33
+ "type":"string",
34
+ "description": "MIME type of the file (e.g. application/pdf)."
35
+ },
36
+ "data": {
37
+ "type":"string",
38
+ "description": "Base64-encoded data of the file."
39
+ }
40
+ }
41
+ },
42
+ "address": {
43
+ "type":"object",
44
+ "properties": {
45
+ "id": {
46
+ "type":"string"
47
+ },
48
+ "line1": {
49
+ "type":"string"
50
+ },
51
+ "line2": {
52
+ "type":"string"
53
+ },
54
+ "line3": {
55
+ "type":"string"
56
+ },
57
+ "city": {
58
+ "type":"string"
59
+ },
60
+ "state": {
61
+ "type":"string"
62
+ },
63
+ "postalCode": {
64
+ "type":"string"
65
+ },
66
+ "countryCode": {
67
+ "type":"string",
68
+ "minLength": 2,
69
+ "maxLength": 2
70
+ }
71
+ }
19
72
  }
20
73
  }
21
74
  }
@@ -20,10 +20,11 @@
20
20
  "thermostat",
21
21
  "lock",
22
22
  "courtesy",
23
- "sceneController"
23
+ "sceneController",
24
+ "gateway"
24
25
  ]
25
26
  },
26
- "name": {
27
+ "name": {
27
28
  "type": "string"
28
29
  },
29
30
  "subType": {
@@ -34,6 +35,11 @@
34
35
  "uniqueItems": true,
35
36
  "items": {
36
37
  "enum": [
38
+ "button 1",
39
+ "button 2",
40
+ "button 3",
41
+ "button 4",
42
+ "button 5",
37
43
  "idle",
38
44
  "powerHasBeedApplied",
39
45
  "acMainsDisconnected",
@@ -60,6 +66,11 @@
60
66
  "minimum": 1655907956593
61
67
  }
62
68
  }
69
+ },
70
+ "batteryLevel": {
71
+ "type":"number",
72
+ "minimum": 0,
73
+ "maximum": 100
63
74
  }
64
75
  }
65
76
  }
@@ -14,9 +14,6 @@
14
14
  "subType": {
15
15
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
16
16
  },
17
- "systemData": {
18
- "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
19
- },
20
17
  "supportedNotifications": {
21
18
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
22
19
  },
@@ -27,6 +24,9 @@
27
24
  "type": "number",
28
25
  "minimum": 0,
29
26
  "maximum": 100
27
+ },
28
+ "systemData": {
29
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
30
30
  }
31
31
  },
32
32
  "additionalProperties": false,
@@ -1,61 +1,30 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "https://api.kohost.app/schemas/v3/gateway.json",
4
- "title": "Gateway",
5
- "description": "Any Kohost gateway",
3
+ "$id": "https://api.kohost.app/schemas/v3/iotGateway.json",
4
+ "title": "IoT Gateway",
5
+ "description": "Any smart gateway that is an entrypoint for controlling devices",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "id": {
9
- "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
10
10
  },
11
- "name": {
12
- "type": "string"
13
- },
14
- "hashedAuthKey": {
15
- "type": "string"
11
+ "type": {
12
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
16
13
  },
17
- "integrations": {
18
- "type": "array",
19
- "items": {
20
- "oneOf": [
21
- {
22
- "$ref": "https://api.kohost.app/schemas/v3/integration.json"
23
- },
24
- {
25
- "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
26
- }
27
- ]
28
- },
29
- "default": []
14
+
15
+ "supportedNotifications": {
16
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
30
17
  },
31
- "health": {
32
- "type": "object",
33
- "properties": {
34
- "upSince": {
35
- "type": "string",
36
- "format": "date-time"
37
- },
38
- "lastSeen": {
39
- "type": "string",
40
- "format": "date-time"
41
- }
42
- },
43
- "additionalProperties": false
18
+ "notification": {
19
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
44
20
  },
45
- "roles": {
46
- "type": "array",
47
- "items": {
48
- "type": "string"
49
- },
50
- "default": ["Gateway"]
51
- },
52
- "createdAt": {
53
- "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
21
+ "status": {
22
+ "type": "string"
54
23
  },
55
- "updatedAt": {
56
- "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
24
+ "systemData": {
25
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
57
26
  }
58
27
  },
59
28
  "additionalProperties": false,
60
- "required": ["id", "name", "hashedAuthKey", "integrations", "health"]
29
+ "required": ["id", "type", "systemData", "status"]
61
30
  }
@@ -3,26 +3,40 @@
3
3
  "$id": "https://api.kohost.app/schemas/v3/identification.json",
4
4
  "title": "Identification",
5
5
  "type": "object",
6
- "required": ["type", "number", "expires", "issuingCountry"],
6
+ "required": ["type", "number", "expires"],
7
7
  "properties": {
8
8
  "id": {
9
9
  "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
10
  },
11
11
  "type": {
12
12
  "type": "string",
13
- "enum": ["driversLicense", "passport", "identityCard"]
13
+ "enum": ["driversLicense", "passport", "identityCard", "visa"]
14
14
  },
15
15
  "number": {
16
16
  "string": "string"
17
17
  },
18
18
  "issued": {
19
- "string": "string",
19
+ "type": ["string", "object"],
20
20
  "format": "date-time"
21
21
  },
22
22
  "expires": {
23
- "string": "string",
23
+ "type": ["string", "object"],
24
24
  "format": "date-time"
25
25
  },
26
+ "verified": {
27
+ "type": "boolean",
28
+ "default": false
29
+ },
30
+ "matched": {
31
+ "type": "boolean",
32
+ "default": false
33
+ },
34
+ "firstName": {
35
+ "type": "string"
36
+ },
37
+ "lastName": {
38
+ "type": "string"
39
+ },
26
40
  "issuingCountry": {
27
41
  "string": "string",
28
42
  "minLength": 2,
package/schemas/lock.json CHANGED
@@ -8,15 +8,15 @@
8
8
  "id": {
9
9
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
10
10
  },
11
+ "name": {
12
+ "type": "string"
13
+ },
11
14
  "type": {
12
15
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
16
  },
14
17
  "subType": {
15
18
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
16
19
  },
17
- "systemData": {
18
- "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
19
- },
20
20
  "supportedNotifications": {
21
21
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
22
22
  },
@@ -26,6 +26,9 @@
26
26
  "state": {
27
27
  "type": "string",
28
28
  "enum": ["locked", "unlocked"]
29
+ },
30
+ "systemData": {
31
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
29
32
  }
30
33
  },
31
34
  "additionalProperties": false,
@@ -136,14 +136,14 @@
136
136
  "mtsSap"
137
137
  ]
138
138
  },
139
- "systemData": {
140
- "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
141
- },
142
139
  "supportedNotifications": {
143
140
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
144
141
  },
145
142
  "notification": {
146
143
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
144
+ },
145
+ "systemData": {
146
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
147
147
  }
148
148
  },
149
149
  "additionalProperties": false,
@@ -12,14 +12,14 @@
12
12
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
13
  },
14
14
  "systemData": {
15
- "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
16
- },
17
15
  "supportedNotifications": {
18
16
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
17
  },
20
18
  "notification": {
21
19
  "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
22
- }
20
+ },
21
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
22
+ }
23
23
  },
24
24
  "additionalProperties": false,
25
25
  "required": ["id", "type", "systemData"]
@@ -14,12 +14,14 @@
14
14
  "amex",
15
15
  "visa",
16
16
  "masterCard",
17
+ "maestro",
17
18
  "discover",
18
19
  "diners",
19
20
  "jcb",
20
21
  "applePay",
21
22
  "alipay",
22
- "chinaUnionPay"
23
+ "chinaUnionPay",
24
+ "vpay"
23
25
  ]
24
26
  },
25
27
  "maskedNumber": {
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/product.json",
4
+ "title": "Product",
5
+ "type": "object",
6
+ "required": ["name", "description", "price", "currency"],
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
+ },
11
+ "type": {
12
+ "type": "string"
13
+ },
14
+ "name": {
15
+ "type": "string"
16
+ },
17
+ "description": {
18
+ "string": "string"
19
+ },
20
+ "price": {
21
+ "type": "number"
22
+ },
23
+ "currency": {
24
+ "type": "string",
25
+ "description": "ISO 4217 format",
26
+ "minLength": 3,
27
+ "maxLength": 3
28
+ },
29
+ "image": {
30
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
31
+ },
32
+ "systemData": {
33
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
34
+ }
35
+ }
36
+ }