@kohost/api-client 3.0.0-beta.89 → 3.0.0-beta.90

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,32 @@
1
+ module.exports = function CreateAnnouncement(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData)
3
+ requestData = {};
4
+ const pathParams = null;
5
+ const { data, query, headers } = requestData;
6
+ let url = "/announcements";
7
+ if (pathParams && data) {
8
+ for (const param of pathParams) {
9
+ const paramName = param.replace(":", "");
10
+ url = url.replace(param, data[paramName]);
11
+ }
12
+ }
13
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
14
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
15
+ const missing = missingParams.map((param) => param.replace(":", ""));
16
+ return Promise.reject(
17
+ new Error("Missing parameters: " + missing.join(", "))
18
+ );
19
+ }
20
+ const config = {
21
+ method: "post",
22
+ url,
23
+ ...httpConfigOptions
24
+ };
25
+ if (data)
26
+ config.data = data;
27
+ if (query)
28
+ config.params = query;
29
+ if (headers)
30
+ config.headers = headers;
31
+ return this._http.request(config);
32
+ };
@@ -0,0 +1,32 @@
1
+ module.exports = function DeleteAnnouncement(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData)
3
+ requestData = {};
4
+ const pathParams = [":id"];
5
+ const { data, query, headers } = requestData;
6
+ let url = "/announcements/:id";
7
+ if (pathParams && data) {
8
+ for (const param of pathParams) {
9
+ const paramName = param.replace(":", "");
10
+ url = url.replace(param, data[paramName]);
11
+ }
12
+ }
13
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
14
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
15
+ const missing = missingParams.map((param) => param.replace(":", ""));
16
+ return Promise.reject(
17
+ new Error("Missing parameters: " + missing.join(", "))
18
+ );
19
+ }
20
+ const config = {
21
+ method: "delete",
22
+ url,
23
+ ...httpConfigOptions
24
+ };
25
+ if (data)
26
+ config.data = data;
27
+ if (query)
28
+ config.params = query;
29
+ if (headers)
30
+ config.headers = headers;
31
+ return this._http.request(config);
32
+ };
@@ -0,0 +1,32 @@
1
+ module.exports = function DescribeAnnouncement(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData)
3
+ requestData = {};
4
+ const pathParams = [":id"];
5
+ const { data, query, headers } = requestData;
6
+ let url = "/announcements/:id";
7
+ if (pathParams && data) {
8
+ for (const param of pathParams) {
9
+ const paramName = param.replace(":", "");
10
+ url = url.replace(param, data[paramName]);
11
+ }
12
+ }
13
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
14
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
15
+ const missing = missingParams.map((param) => param.replace(":", ""));
16
+ return Promise.reject(
17
+ new Error("Missing parameters: " + missing.join(", "))
18
+ );
19
+ }
20
+ const config = {
21
+ method: "get",
22
+ url,
23
+ ...httpConfigOptions
24
+ };
25
+ if (data)
26
+ config.data = data;
27
+ if (query)
28
+ config.params = query;
29
+ if (headers)
30
+ config.headers = headers;
31
+ return this._http.request(config);
32
+ };
@@ -0,0 +1,32 @@
1
+ module.exports = function ListAnnouncements(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData)
3
+ requestData = {};
4
+ const pathParams = null;
5
+ const { data, query, headers } = requestData;
6
+ let url = "/announcements";
7
+ if (pathParams && data) {
8
+ for (const param of pathParams) {
9
+ const paramName = param.replace(":", "");
10
+ url = url.replace(param, data[paramName]);
11
+ }
12
+ }
13
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
14
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
15
+ const missing = missingParams.map((param) => param.replace(":", ""));
16
+ return Promise.reject(
17
+ new Error("Missing parameters: " + missing.join(", "))
18
+ );
19
+ }
20
+ const config = {
21
+ method: "get",
22
+ url,
23
+ ...httpConfigOptions
24
+ };
25
+ if (data)
26
+ config.data = data;
27
+ if (query)
28
+ config.params = query;
29
+ if (headers)
30
+ config.headers = headers;
31
+ return this._http.request(config);
32
+ };
@@ -0,0 +1,32 @@
1
+ module.exports = function SendCheckOutSMS(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData)
3
+ requestData = {};
4
+ const pathParams = [":id"];
5
+ const { data, query, headers } = requestData;
6
+ let url = "/reservations/:id/sendCheckOutSMS";
7
+ if (pathParams && data) {
8
+ for (const param of pathParams) {
9
+ const paramName = param.replace(":", "");
10
+ url = url.replace(param, data[paramName]);
11
+ }
12
+ }
13
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
14
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
15
+ const missing = missingParams.map((param) => param.replace(":", ""));
16
+ return Promise.reject(
17
+ new Error("Missing parameters: " + missing.join(", "))
18
+ );
19
+ }
20
+ const config = {
21
+ method: "post",
22
+ url,
23
+ ...httpConfigOptions
24
+ };
25
+ if (data)
26
+ config.data = data;
27
+ if (query)
28
+ config.params = query;
29
+ if (headers)
30
+ config.headers = headers;
31
+ return this._http.request(config);
32
+ };
@@ -0,0 +1,32 @@
1
+ module.exports = function UpdateAnnouncement(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
2
+ if (!requestData)
3
+ requestData = {};
4
+ const pathParams = [":id"];
5
+ const { data, query, headers } = requestData;
6
+ let url = "/announcements/:id";
7
+ if (pathParams && data) {
8
+ for (const param of pathParams) {
9
+ const paramName = param.replace(":", "");
10
+ url = url.replace(param, data[paramName]);
11
+ }
12
+ }
13
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
14
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
15
+ const missing = missingParams.map((param) => param.replace(":", ""));
16
+ return Promise.reject(
17
+ new Error("Missing parameters: " + missing.join(", "))
18
+ );
19
+ }
20
+ const config = {
21
+ method: "put",
22
+ url,
23
+ ...httpConfigOptions
24
+ };
25
+ if (data)
26
+ config.data = data;
27
+ if (query)
28
+ config.params = query;
29
+ if (headers)
30
+ config.headers = headers;
31
+ return this._http.request(config);
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kohost/api-client",
3
- "version": "3.0.0-beta.89",
3
+ "version": "3.0.0-beta.90",
4
4
  "description": "API client, models, schemas, commands, and events for Kohost applications",
5
5
  "author": "Ian Rogers",
6
6
  "readme": "README.md",
@@ -1,34 +0,0 @@
1
- const schemas = require("../utils/schema");
2
- const schema = require("../schemas/notification.json");
3
- const Kohost = require("./Kohost");
4
-
5
- schemas.add(schema);
6
- const validator = schemas.compile(schema);
7
-
8
- class Notification extends Kohost {
9
- /**
10
- * @typedef {import("../schemas/NotificationSchema").Notification} NotificationType
11
- * Create a Notification instance.
12
- * @constructor
13
- * @param {NotificationType} property - The property object of type Notification.
14
- */
15
- constructor(notification) {
16
- super(notification);
17
- }
18
- }
19
-
20
- Object.defineProperty(Notification.prototype, "schema", {
21
- value: schema,
22
- });
23
-
24
- Object.defineProperty(Notification.prototype, "validator", {
25
- get: function () {
26
- return validator;
27
- },
28
- });
29
-
30
- Object.defineProperty(Notification, "validProperties", {
31
- value: Object.keys(schema.properties),
32
- });
33
-
34
- module.exports = Notification;
@@ -1,29 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "notification.json",
4
- "title ": "Notification",
5
- "description": "Notification sent to users",
6
- "type": "object",
7
- "properties": {
8
- "id": { "$ref": "definitions.json#/definitions/id" },
9
- "title": {
10
- "type": "string",
11
- "maxLength": 30
12
- },
13
- "body": {
14
- "type": "string",
15
- "maxLength": 85
16
- },
17
- "image": {
18
- "$ref": "mediaFile.json"
19
- },
20
- "tag": {
21
- "type": "string"
22
- },
23
- "createdAt": {
24
- "$ref": "definitions.json#/definitions/date"
25
- }
26
- },
27
- "required": ["title", "body"],
28
- "additionalProperties": false
29
- }