@kohost/api-client 3.8.3 → 3.9.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.
@@ -0,0 +1,17 @@
1
+ export = Vendor;
2
+ declare class Vendor extends Entity {
3
+ /**
4
+ * @typedef {import("../schemas/VendorSchema").Vendor} VendorType
5
+ * Create a Product instance.
6
+ * @constructor
7
+ * @param {Vendor} vendor - The vendor object of type Vendor.
8
+ */
9
+ constructor(vendor: Vendor);
10
+ readonly schema: any;
11
+ get validator(): any;
12
+ }
13
+ declare namespace Vendor {
14
+ let validProperties: string[];
15
+ }
16
+ import Entity = require("./Entity");
17
+ //# sourceMappingURL=Vendor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Vendor.d.ts","sourceRoot":"","sources":["../../../src/Models/Vendor.js"],"names":[],"mappings":";AAQA;IACE;;;;;OAKG;IACH,oBAFW,MAAM,EAIhB;;;CACF"}
@@ -36,5 +36,6 @@ import Announcement = require("./Announcement");
36
36
  import TimeSheet = require("./TimeSheet");
37
37
  import Policy = require("./Policy");
38
38
  import Issue = require("./Issue");
39
- export { Entity, Organization, Property, MediaFile, Gateway, Switch, Alarm, Dimmer, Lock, Courtesy, Camera, MotionSensor, Thermostat, WindowCovering, MediaSource, Identification, Product, User, SystemUser, Room, Space, Category, Ticket, Scene, DiscoveredDevice, DeviceRouter, Reservation, Credential, ShortLink, EnergyReportShard, EnergyReport, SMSMessage, EmailMessage, Order, Announcement, TimeSheet, Policy, Issue };
39
+ import Vendor = require("./Vendor");
40
+ export { Entity, Organization, Property, MediaFile, Gateway, Switch, Alarm, Dimmer, Lock, Courtesy, Camera, MotionSensor, Thermostat, WindowCovering, MediaSource, Identification, Product, User, SystemUser, Room, Space, Category, Ticket, Scene, DiscoveredDevice, DeviceRouter, Reservation, Credential, ShortLink, EnergyReportShard, EnergyReport, SMSMessage, EmailMessage, Order, Announcement, TimeSheet, Policy, Issue, Vendor };
40
41
  //# sourceMappingURL=index.d.ts.map
@@ -16,9 +16,11 @@ export interface Issue {
16
16
  department: string;
17
17
  autoAssign?: {
18
18
  userId?: string;
19
+ vendorId?: string;
19
20
  priority?: "low" | "normal" | "high";
20
21
  tags?: string[];
21
22
  [k: string]: unknown;
22
23
  };
24
+ systemKey?: string;
23
25
  [k: string]: unknown;
24
26
  }
@@ -45,6 +45,9 @@ export interface Ticket {
45
45
  userId?: string;
46
46
  userName?: string;
47
47
  userPhoto?: MediaFile | null | string;
48
+ vendorId?: string;
49
+ vendorName?: string;
50
+ vendorPhoto?: MediaFile | null | string;
48
51
  [k: string]: unknown;
49
52
  };
50
53
  status: "open" | "pending" | "solved" | "closed";
@@ -26,7 +26,7 @@ export interface Vendor {
26
26
  type?: "vendor";
27
27
  name: string;
28
28
  phone?: string | null;
29
- email?: string | null;
29
+ email: string | null;
30
30
  address?: Address;
31
31
  photo?: MediaFile;
32
32
  createdAt?: CreatedAt;
@@ -1 +1 @@
1
- {"version":3,"file":"entityFactory.d.ts","sourceRoot":"","sources":["../../../src/utils/entityFactory.js"],"names":[],"mappings":"AAEiB,0DA+EhB"}
1
+ {"version":3,"file":"entityFactory.d.ts","sourceRoot":"","sources":["../../../src/utils/entityFactory.js"],"names":[],"mappings":"AAEiB,0DAiFhB"}
@@ -0,0 +1,28 @@
1
+ module.exports = function CreateVendor(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData) requestData = {};
3
+ const pathParams = null;
4
+ const { data, query, headers } = requestData;
5
+ let url = "/vendors";
6
+ if (pathParams && data) {
7
+ for (const param of pathParams) {
8
+ const paramName = param.replace(":", "");
9
+ url = url.replace(param, data[paramName]);
10
+ }
11
+ }
12
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
13
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
14
+ const missing = missingParams.map((param) => param.replace(":", ""));
15
+ return Promise.reject(
16
+ new Error("Missing parameters: " + missing.join(", "))
17
+ );
18
+ }
19
+ const config = {
20
+ method: "post",
21
+ url,
22
+ ...httpConfigOptions
23
+ };
24
+ if (data) config.data = data;
25
+ if (query) config.params = query;
26
+ if (headers) config.headers = headers;
27
+ return this._http.request(config);
28
+ };
@@ -0,0 +1,28 @@
1
+ module.exports = function DeleteVendor(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData) requestData = {};
3
+ const pathParams = [":id"];
4
+ const { data, query, headers } = requestData;
5
+ let url = "/vendors/:id";
6
+ if (pathParams && data) {
7
+ for (const param of pathParams) {
8
+ const paramName = param.replace(":", "");
9
+ url = url.replace(param, data[paramName]);
10
+ }
11
+ }
12
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
13
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
14
+ const missing = missingParams.map((param) => param.replace(":", ""));
15
+ return Promise.reject(
16
+ new Error("Missing parameters: " + missing.join(", "))
17
+ );
18
+ }
19
+ const config = {
20
+ method: "delete",
21
+ url,
22
+ ...httpConfigOptions
23
+ };
24
+ if (data) config.data = data;
25
+ if (query) config.params = query;
26
+ if (headers) config.headers = headers;
27
+ return this._http.request(config);
28
+ };
@@ -0,0 +1,28 @@
1
+ module.exports = function DescribeVendor(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData) requestData = {};
3
+ const pathParams = [":id"];
4
+ const { data, query, headers } = requestData;
5
+ let url = "/vendors/:id";
6
+ if (pathParams && data) {
7
+ for (const param of pathParams) {
8
+ const paramName = param.replace(":", "");
9
+ url = url.replace(param, data[paramName]);
10
+ }
11
+ }
12
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
13
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
14
+ const missing = missingParams.map((param) => param.replace(":", ""));
15
+ return Promise.reject(
16
+ new Error("Missing parameters: " + missing.join(", "))
17
+ );
18
+ }
19
+ const config = {
20
+ method: "get",
21
+ url,
22
+ ...httpConfigOptions
23
+ };
24
+ if (data) config.data = data;
25
+ if (query) config.params = query;
26
+ if (headers) config.headers = headers;
27
+ return this._http.request(config);
28
+ };
@@ -0,0 +1,28 @@
1
+ module.exports = function ListVendors(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData) requestData = {};
3
+ const pathParams = null;
4
+ const { data, query, headers } = requestData;
5
+ let url = "/vendors";
6
+ if (pathParams && data) {
7
+ for (const param of pathParams) {
8
+ const paramName = param.replace(":", "");
9
+ url = url.replace(param, data[paramName]);
10
+ }
11
+ }
12
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
13
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
14
+ const missing = missingParams.map((param) => param.replace(":", ""));
15
+ return Promise.reject(
16
+ new Error("Missing parameters: " + missing.join(", "))
17
+ );
18
+ }
19
+ const config = {
20
+ method: "get",
21
+ url,
22
+ ...httpConfigOptions
23
+ };
24
+ if (data) config.data = data;
25
+ if (query) config.params = query;
26
+ if (headers) config.headers = headers;
27
+ return this._http.request(config);
28
+ };
@@ -0,0 +1,28 @@
1
+ module.exports = function UpdateVendor(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData) requestData = {};
3
+ const pathParams = [":id"];
4
+ const { data, query, headers } = requestData;
5
+ let url = "/vendors/:id";
6
+ if (pathParams && data) {
7
+ for (const param of pathParams) {
8
+ const paramName = param.replace(":", "");
9
+ url = url.replace(param, data[paramName]);
10
+ }
11
+ }
12
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
13
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
14
+ const missing = missingParams.map((param) => param.replace(":", ""));
15
+ return Promise.reject(
16
+ new Error("Missing parameters: " + missing.join(", "))
17
+ );
18
+ }
19
+ const config = {
20
+ method: "put",
21
+ url,
22
+ ...httpConfigOptions
23
+ };
24
+ if (data) config.data = data;
25
+ if (query) config.params = query;
26
+ if (headers) config.headers = headers;
27
+ return this._http.request(config);
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kohost/api-client",
3
- "version": "3.8.3",
3
+ "version": "3.9.1",
4
4
  "description": "API client, models, schemas, commands, and events for Kohost applications",
5
5
  "author": "Ian Rogers",
6
6
  "readme": "README.md",