@kohost/api-client 3.1.23 → 3.2.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.
- package/dist/cjs/Client/index.js +471 -62
- package/dist/cjs/Models/Policy.js +34 -0
- package/dist/cjs/Models/User.js +17 -2
- package/dist/cjs/Models/index.js +2 -2
- package/dist/cjs/SocketIoClient/index.js +4 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/schemas/AnnouncementSchema.d.ts +1 -1
- package/dist/cjs/schemas/CategorySchema.d.ts +1 -1
- package/dist/cjs/schemas/CredentialSchema.d.ts +3 -3
- package/dist/cjs/schemas/DeviceRouterSchema.d.ts +1 -1
- package/dist/cjs/schemas/EmailMessageSchema.d.ts +1 -1
- package/dist/cjs/schemas/MediaFileSchema.d.ts +1 -1
- package/dist/cjs/schemas/MediaSourceSchema.d.ts +6 -1
- package/dist/cjs/schemas/OrderSchema.d.ts +7 -2
- package/dist/cjs/schemas/OrganizationSchema.d.ts +1 -1
- package/dist/cjs/schemas/PolicySchema.d.ts +25 -0
- package/dist/cjs/schemas/ProductSchema.d.ts +2 -2
- package/dist/cjs/schemas/PropertySchema.d.ts +2 -2
- package/dist/cjs/schemas/ReservationSchema.d.ts +1 -1
- package/dist/cjs/schemas/RoomSchema.d.ts +7 -1
- package/dist/cjs/schemas/SceneSchema.d.ts +1 -0
- package/dist/cjs/schemas/ShortLinkSchema.d.ts +1 -1
- package/dist/cjs/schemas/SmsMessageSchema.d.ts +1 -1
- package/dist/cjs/schemas/SpaceSchema.d.ts +1 -1
- package/dist/cjs/schemas/SystemUserSchema.d.ts +3 -3
- package/dist/cjs/schemas/TicketSchema.d.ts +2 -1
- package/dist/cjs/schemas/TimeSheetSchema.d.ts +1 -1
- package/dist/cjs/schemas/UserSchema.d.ts +26 -12
- package/dist/cjs/schemas/camera.json +2 -1
- package/dist/cjs/schemas/credential.json +3 -3
- package/dist/cjs/schemas/deviceRouter.json +2 -1
- package/dist/cjs/schemas/emailMessage.json +2 -1
- package/dist/cjs/schemas/mediaFile.json +2 -1
- package/dist/cjs/schemas/mediaSource.json +7 -1
- package/dist/cjs/schemas/order.json +10 -2
- package/dist/cjs/schemas/organization.json +2 -1
- package/dist/cjs/schemas/policy.json +62 -0
- package/dist/cjs/schemas/product.json +2 -1
- package/dist/cjs/schemas/property.json +3 -2
- package/dist/cjs/schemas/reservation.json +2 -1
- package/dist/cjs/schemas/room.json +5 -0
- package/dist/cjs/schemas/scene.json +5 -0
- package/dist/cjs/schemas/shortLink.json +2 -1
- package/dist/cjs/schemas/smsMessage.json +2 -1
- package/dist/cjs/schemas/space.json +2 -1
- package/dist/cjs/schemas/systemUser.json +10 -2
- package/dist/cjs/schemas/ticket.json +5 -0
- package/dist/cjs/schemas/timeSheet.json +1 -1
- package/dist/cjs/schemas/user.json +23 -26
- package/dist/cjs/utils/entityFactory.js +80 -0
- package/dist/cjs/utils/index.js +2 -0
- package/dist/esm/Client.js +473 -64
- package/dist/esm/Client.js.map +3 -3
- package/dist/esm/Models.js +215 -50
- package/dist/esm/Models.js.map +3 -3
- package/dist/esm/SocketIoClient.js +41 -17
- package/dist/esm/SocketIoClient.js.map +2 -2
- package/dist/esm/defs.js +33 -24
- package/dist/esm/defs.js.map +2 -2
- package/dist/esm/utils.js +5975 -1
- package/dist/esm/utils.js.map +4 -4
- package/dist/useCases/CreatePolicy.js +32 -0
- package/dist/useCases/DeletePolicy.js +32 -0
- package/dist/useCases/{SetCustomScene.js → DescribePolicy.js} +3 -3
- package/dist/useCases/DescribeReservationPetProducts.js +32 -0
- package/dist/useCases/DescribeReservationPromos.js +32 -0
- package/dist/useCases/ListPolicies.js +32 -0
- package/dist/useCases/ListProducts.js +32 -0
- package/dist/useCases/PurchaseReservationPetProducts.js +32 -0
- package/dist/useCases/PurchaseReservationPromos.js +32 -0
- package/dist/useCases/SetScene.js +32 -0
- package/dist/useCases/UpdatePolicy.js +32 -0
- package/package.json +4 -4
package/dist/cjs/Client/index.js
CHANGED
|
@@ -1031,6 +1031,196 @@ var require_ListUserMobileKeys = __commonJS({
|
|
|
1031
1031
|
}
|
|
1032
1032
|
});
|
|
1033
1033
|
|
|
1034
|
+
// dist/useCases/CreatePolicy.js
|
|
1035
|
+
var require_CreatePolicy = __commonJS({
|
|
1036
|
+
"dist/useCases/CreatePolicy.js"(exports2, module2) {
|
|
1037
|
+
module2.exports = /* @__PURE__ */ __name(function CreatePolicy2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
1038
|
+
if (!requestData)
|
|
1039
|
+
requestData = {};
|
|
1040
|
+
const pathParams = null;
|
|
1041
|
+
const { data, query, headers } = requestData;
|
|
1042
|
+
let url = "/policies";
|
|
1043
|
+
if (pathParams && data) {
|
|
1044
|
+
for (const param of pathParams) {
|
|
1045
|
+
const paramName = param.replace(":", "");
|
|
1046
|
+
url = url.replace(param, data[paramName]);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
1050
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
1051
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
1052
|
+
return Promise.reject(
|
|
1053
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
const config = {
|
|
1057
|
+
method: "post",
|
|
1058
|
+
url,
|
|
1059
|
+
...httpConfigOptions
|
|
1060
|
+
};
|
|
1061
|
+
if (data)
|
|
1062
|
+
config.data = data;
|
|
1063
|
+
if (query)
|
|
1064
|
+
config.params = query;
|
|
1065
|
+
if (headers)
|
|
1066
|
+
config.headers = headers;
|
|
1067
|
+
return this._http.request(config);
|
|
1068
|
+
}, "CreatePolicy");
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
// dist/useCases/ListPolicies.js
|
|
1073
|
+
var require_ListPolicies = __commonJS({
|
|
1074
|
+
"dist/useCases/ListPolicies.js"(exports2, module2) {
|
|
1075
|
+
module2.exports = /* @__PURE__ */ __name(function ListPolicies2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
1076
|
+
if (!requestData)
|
|
1077
|
+
requestData = {};
|
|
1078
|
+
const pathParams = null;
|
|
1079
|
+
const { data, query, headers } = requestData;
|
|
1080
|
+
let url = "/policies";
|
|
1081
|
+
if (pathParams && data) {
|
|
1082
|
+
for (const param of pathParams) {
|
|
1083
|
+
const paramName = param.replace(":", "");
|
|
1084
|
+
url = url.replace(param, data[paramName]);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
1088
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
1089
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
1090
|
+
return Promise.reject(
|
|
1091
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
const config = {
|
|
1095
|
+
method: "get",
|
|
1096
|
+
url,
|
|
1097
|
+
...httpConfigOptions
|
|
1098
|
+
};
|
|
1099
|
+
if (data)
|
|
1100
|
+
config.data = data;
|
|
1101
|
+
if (query)
|
|
1102
|
+
config.params = query;
|
|
1103
|
+
if (headers)
|
|
1104
|
+
config.headers = headers;
|
|
1105
|
+
return this._http.request(config);
|
|
1106
|
+
}, "ListPolicies");
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
// dist/useCases/UpdatePolicy.js
|
|
1111
|
+
var require_UpdatePolicy = __commonJS({
|
|
1112
|
+
"dist/useCases/UpdatePolicy.js"(exports2, module2) {
|
|
1113
|
+
module2.exports = /* @__PURE__ */ __name(function UpdatePolicy2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
1114
|
+
if (!requestData)
|
|
1115
|
+
requestData = {};
|
|
1116
|
+
const pathParams = [":id"];
|
|
1117
|
+
const { data, query, headers } = requestData;
|
|
1118
|
+
let url = "/policies/:id";
|
|
1119
|
+
if (pathParams && data) {
|
|
1120
|
+
for (const param of pathParams) {
|
|
1121
|
+
const paramName = param.replace(":", "");
|
|
1122
|
+
url = url.replace(param, data[paramName]);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
1126
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
1127
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
1128
|
+
return Promise.reject(
|
|
1129
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
const config = {
|
|
1133
|
+
method: "put",
|
|
1134
|
+
url,
|
|
1135
|
+
...httpConfigOptions
|
|
1136
|
+
};
|
|
1137
|
+
if (data)
|
|
1138
|
+
config.data = data;
|
|
1139
|
+
if (query)
|
|
1140
|
+
config.params = query;
|
|
1141
|
+
if (headers)
|
|
1142
|
+
config.headers = headers;
|
|
1143
|
+
return this._http.request(config);
|
|
1144
|
+
}, "UpdatePolicy");
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
|
|
1148
|
+
// dist/useCases/DeletePolicy.js
|
|
1149
|
+
var require_DeletePolicy = __commonJS({
|
|
1150
|
+
"dist/useCases/DeletePolicy.js"(exports2, module2) {
|
|
1151
|
+
module2.exports = /* @__PURE__ */ __name(function DeletePolicy2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
1152
|
+
if (!requestData)
|
|
1153
|
+
requestData = {};
|
|
1154
|
+
const pathParams = [":id"];
|
|
1155
|
+
const { data, query, headers } = requestData;
|
|
1156
|
+
let url = "/policies/:id";
|
|
1157
|
+
if (pathParams && data) {
|
|
1158
|
+
for (const param of pathParams) {
|
|
1159
|
+
const paramName = param.replace(":", "");
|
|
1160
|
+
url = url.replace(param, data[paramName]);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
1164
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
1165
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
1166
|
+
return Promise.reject(
|
|
1167
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1170
|
+
const config = {
|
|
1171
|
+
method: "delete",
|
|
1172
|
+
url,
|
|
1173
|
+
...httpConfigOptions
|
|
1174
|
+
};
|
|
1175
|
+
if (data)
|
|
1176
|
+
config.data = data;
|
|
1177
|
+
if (query)
|
|
1178
|
+
config.params = query;
|
|
1179
|
+
if (headers)
|
|
1180
|
+
config.headers = headers;
|
|
1181
|
+
return this._http.request(config);
|
|
1182
|
+
}, "DeletePolicy");
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
// dist/useCases/DescribePolicy.js
|
|
1187
|
+
var require_DescribePolicy = __commonJS({
|
|
1188
|
+
"dist/useCases/DescribePolicy.js"(exports2, module2) {
|
|
1189
|
+
module2.exports = /* @__PURE__ */ __name(function DescribePolicy2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
1190
|
+
if (!requestData)
|
|
1191
|
+
requestData = {};
|
|
1192
|
+
const pathParams = [":id"];
|
|
1193
|
+
const { data, query, headers } = requestData;
|
|
1194
|
+
let url = "/policies/:id";
|
|
1195
|
+
if (pathParams && data) {
|
|
1196
|
+
for (const param of pathParams) {
|
|
1197
|
+
const paramName = param.replace(":", "");
|
|
1198
|
+
url = url.replace(param, data[paramName]);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
1202
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
1203
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
1204
|
+
return Promise.reject(
|
|
1205
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
const config = {
|
|
1209
|
+
method: "get",
|
|
1210
|
+
url,
|
|
1211
|
+
...httpConfigOptions
|
|
1212
|
+
};
|
|
1213
|
+
if (data)
|
|
1214
|
+
config.data = data;
|
|
1215
|
+
if (query)
|
|
1216
|
+
config.params = query;
|
|
1217
|
+
if (headers)
|
|
1218
|
+
config.headers = headers;
|
|
1219
|
+
return this._http.request(config);
|
|
1220
|
+
}, "DescribePolicy");
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1034
1224
|
// dist/useCases/ListSpaces.js
|
|
1035
1225
|
var require_ListSpaces = __commonJS({
|
|
1036
1226
|
"dist/useCases/ListSpaces.js"(exports2, module2) {
|
|
@@ -3919,44 +4109,6 @@ var require_SetRoomScene = __commonJS({
|
|
|
3919
4109
|
}
|
|
3920
4110
|
});
|
|
3921
4111
|
|
|
3922
|
-
// dist/useCases/SetCustomScene.js
|
|
3923
|
-
var require_SetCustomScene = __commonJS({
|
|
3924
|
-
"dist/useCases/SetCustomScene.js"(exports2, module2) {
|
|
3925
|
-
module2.exports = /* @__PURE__ */ __name(function SetCustomScene2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
3926
|
-
if (!requestData)
|
|
3927
|
-
requestData = {};
|
|
3928
|
-
const pathParams = [":id"];
|
|
3929
|
-
const { data, query, headers } = requestData;
|
|
3930
|
-
let url = "/scenes/:id";
|
|
3931
|
-
if (pathParams && data) {
|
|
3932
|
-
for (const param of pathParams) {
|
|
3933
|
-
const paramName = param.replace(":", "");
|
|
3934
|
-
url = url.replace(param, data[paramName]);
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
3938
|
-
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
3939
|
-
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
3940
|
-
return Promise.reject(
|
|
3941
|
-
new Error("Missing parameters: " + missing.join(", "))
|
|
3942
|
-
);
|
|
3943
|
-
}
|
|
3944
|
-
const config = {
|
|
3945
|
-
method: "post",
|
|
3946
|
-
url,
|
|
3947
|
-
...httpConfigOptions
|
|
3948
|
-
};
|
|
3949
|
-
if (data)
|
|
3950
|
-
config.data = data;
|
|
3951
|
-
if (query)
|
|
3952
|
-
config.params = query;
|
|
3953
|
-
if (headers)
|
|
3954
|
-
config.headers = headers;
|
|
3955
|
-
return this._http.request(config);
|
|
3956
|
-
}, "SetCustomScene");
|
|
3957
|
-
}
|
|
3958
|
-
});
|
|
3959
|
-
|
|
3960
4112
|
// dist/useCases/AddScenesToRoom.js
|
|
3961
4113
|
var require_AddScenesToRoom = __commonJS({
|
|
3962
4114
|
"dist/useCases/AddScenesToRoom.js"(exports2, module2) {
|
|
@@ -4527,6 +4679,44 @@ var require_CreateDefaultScenes = __commonJS({
|
|
|
4527
4679
|
}
|
|
4528
4680
|
});
|
|
4529
4681
|
|
|
4682
|
+
// dist/useCases/SetScene.js
|
|
4683
|
+
var require_SetScene = __commonJS({
|
|
4684
|
+
"dist/useCases/SetScene.js"(exports2, module2) {
|
|
4685
|
+
module2.exports = /* @__PURE__ */ __name(function SetScene2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
4686
|
+
if (!requestData)
|
|
4687
|
+
requestData = {};
|
|
4688
|
+
const pathParams = [":id"];
|
|
4689
|
+
const { data, query, headers } = requestData;
|
|
4690
|
+
let url = "/scenes/:id";
|
|
4691
|
+
if (pathParams && data) {
|
|
4692
|
+
for (const param of pathParams) {
|
|
4693
|
+
const paramName = param.replace(":", "");
|
|
4694
|
+
url = url.replace(param, data[paramName]);
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
4698
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
4699
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
4700
|
+
return Promise.reject(
|
|
4701
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
4702
|
+
);
|
|
4703
|
+
}
|
|
4704
|
+
const config = {
|
|
4705
|
+
method: "post",
|
|
4706
|
+
url,
|
|
4707
|
+
...httpConfigOptions
|
|
4708
|
+
};
|
|
4709
|
+
if (data)
|
|
4710
|
+
config.data = data;
|
|
4711
|
+
if (query)
|
|
4712
|
+
config.params = query;
|
|
4713
|
+
if (headers)
|
|
4714
|
+
config.headers = headers;
|
|
4715
|
+
return this._http.request(config);
|
|
4716
|
+
}, "SetScene");
|
|
4717
|
+
}
|
|
4718
|
+
});
|
|
4719
|
+
|
|
4530
4720
|
// dist/useCases/CreateDiscoveredDevice.js
|
|
4531
4721
|
var require_CreateDiscoveredDevice = __commonJS({
|
|
4532
4722
|
"dist/useCases/CreateDiscoveredDevice.js"(exports2, module2) {
|
|
@@ -5781,6 +5971,158 @@ var require_UpdateReservationExpectedArrivalTime = __commonJS({
|
|
|
5781
5971
|
}
|
|
5782
5972
|
});
|
|
5783
5973
|
|
|
5974
|
+
// dist/useCases/DescribeReservationPetProducts.js
|
|
5975
|
+
var require_DescribeReservationPetProducts = __commonJS({
|
|
5976
|
+
"dist/useCases/DescribeReservationPetProducts.js"(exports2, module2) {
|
|
5977
|
+
module2.exports = /* @__PURE__ */ __name(function DescribeReservationPetProducts2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
5978
|
+
if (!requestData)
|
|
5979
|
+
requestData = {};
|
|
5980
|
+
const pathParams = [":id"];
|
|
5981
|
+
const { data, query, headers } = requestData;
|
|
5982
|
+
let url = "/reservations/:id/products/pet";
|
|
5983
|
+
if (pathParams && data) {
|
|
5984
|
+
for (const param of pathParams) {
|
|
5985
|
+
const paramName = param.replace(":", "");
|
|
5986
|
+
url = url.replace(param, data[paramName]);
|
|
5987
|
+
}
|
|
5988
|
+
}
|
|
5989
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
5990
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
5991
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
5992
|
+
return Promise.reject(
|
|
5993
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
5994
|
+
);
|
|
5995
|
+
}
|
|
5996
|
+
const config = {
|
|
5997
|
+
method: "get",
|
|
5998
|
+
url,
|
|
5999
|
+
...httpConfigOptions
|
|
6000
|
+
};
|
|
6001
|
+
if (data)
|
|
6002
|
+
config.data = data;
|
|
6003
|
+
if (query)
|
|
6004
|
+
config.params = query;
|
|
6005
|
+
if (headers)
|
|
6006
|
+
config.headers = headers;
|
|
6007
|
+
return this._http.request(config);
|
|
6008
|
+
}, "DescribeReservationPetProducts");
|
|
6009
|
+
}
|
|
6010
|
+
});
|
|
6011
|
+
|
|
6012
|
+
// dist/useCases/PurchaseReservationPetProducts.js
|
|
6013
|
+
var require_PurchaseReservationPetProducts = __commonJS({
|
|
6014
|
+
"dist/useCases/PurchaseReservationPetProducts.js"(exports2, module2) {
|
|
6015
|
+
module2.exports = /* @__PURE__ */ __name(function PurchaseReservationPetProducts2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
6016
|
+
if (!requestData)
|
|
6017
|
+
requestData = {};
|
|
6018
|
+
const pathParams = [":id"];
|
|
6019
|
+
const { data, query, headers } = requestData;
|
|
6020
|
+
let url = "/reservations/:id/products/pet";
|
|
6021
|
+
if (pathParams && data) {
|
|
6022
|
+
for (const param of pathParams) {
|
|
6023
|
+
const paramName = param.replace(":", "");
|
|
6024
|
+
url = url.replace(param, data[paramName]);
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
6027
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
6028
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
6029
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
6030
|
+
return Promise.reject(
|
|
6031
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
6032
|
+
);
|
|
6033
|
+
}
|
|
6034
|
+
const config = {
|
|
6035
|
+
method: "post",
|
|
6036
|
+
url,
|
|
6037
|
+
...httpConfigOptions
|
|
6038
|
+
};
|
|
6039
|
+
if (data)
|
|
6040
|
+
config.data = data;
|
|
6041
|
+
if (query)
|
|
6042
|
+
config.params = query;
|
|
6043
|
+
if (headers)
|
|
6044
|
+
config.headers = headers;
|
|
6045
|
+
return this._http.request(config);
|
|
6046
|
+
}, "PurchaseReservationPetProducts");
|
|
6047
|
+
}
|
|
6048
|
+
});
|
|
6049
|
+
|
|
6050
|
+
// dist/useCases/DescribeReservationPromos.js
|
|
6051
|
+
var require_DescribeReservationPromos = __commonJS({
|
|
6052
|
+
"dist/useCases/DescribeReservationPromos.js"(exports2, module2) {
|
|
6053
|
+
module2.exports = /* @__PURE__ */ __name(function DescribeReservationPromos2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
6054
|
+
if (!requestData)
|
|
6055
|
+
requestData = {};
|
|
6056
|
+
const pathParams = [":id"];
|
|
6057
|
+
const { data, query, headers } = requestData;
|
|
6058
|
+
let url = "/reservations/:id/products/promo";
|
|
6059
|
+
if (pathParams && data) {
|
|
6060
|
+
for (const param of pathParams) {
|
|
6061
|
+
const paramName = param.replace(":", "");
|
|
6062
|
+
url = url.replace(param, data[paramName]);
|
|
6063
|
+
}
|
|
6064
|
+
}
|
|
6065
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
6066
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
6067
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
6068
|
+
return Promise.reject(
|
|
6069
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
6070
|
+
);
|
|
6071
|
+
}
|
|
6072
|
+
const config = {
|
|
6073
|
+
method: "get",
|
|
6074
|
+
url,
|
|
6075
|
+
...httpConfigOptions
|
|
6076
|
+
};
|
|
6077
|
+
if (data)
|
|
6078
|
+
config.data = data;
|
|
6079
|
+
if (query)
|
|
6080
|
+
config.params = query;
|
|
6081
|
+
if (headers)
|
|
6082
|
+
config.headers = headers;
|
|
6083
|
+
return this._http.request(config);
|
|
6084
|
+
}, "DescribeReservationPromos");
|
|
6085
|
+
}
|
|
6086
|
+
});
|
|
6087
|
+
|
|
6088
|
+
// dist/useCases/PurchaseReservationPromos.js
|
|
6089
|
+
var require_PurchaseReservationPromos = __commonJS({
|
|
6090
|
+
"dist/useCases/PurchaseReservationPromos.js"(exports2, module2) {
|
|
6091
|
+
module2.exports = /* @__PURE__ */ __name(function PurchaseReservationPromos2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
6092
|
+
if (!requestData)
|
|
6093
|
+
requestData = {};
|
|
6094
|
+
const pathParams = [":id"];
|
|
6095
|
+
const { data, query, headers } = requestData;
|
|
6096
|
+
let url = "/reservations/:id/products/promo";
|
|
6097
|
+
if (pathParams && data) {
|
|
6098
|
+
for (const param of pathParams) {
|
|
6099
|
+
const paramName = param.replace(":", "");
|
|
6100
|
+
url = url.replace(param, data[paramName]);
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6103
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
6104
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
6105
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
6106
|
+
return Promise.reject(
|
|
6107
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
6108
|
+
);
|
|
6109
|
+
}
|
|
6110
|
+
const config = {
|
|
6111
|
+
method: "post",
|
|
6112
|
+
url,
|
|
6113
|
+
...httpConfigOptions
|
|
6114
|
+
};
|
|
6115
|
+
if (data)
|
|
6116
|
+
config.data = data;
|
|
6117
|
+
if (query)
|
|
6118
|
+
config.params = query;
|
|
6119
|
+
if (headers)
|
|
6120
|
+
config.headers = headers;
|
|
6121
|
+
return this._http.request(config);
|
|
6122
|
+
}, "PurchaseReservationPromos");
|
|
6123
|
+
}
|
|
6124
|
+
});
|
|
6125
|
+
|
|
5784
6126
|
// dist/useCases/OCRDocument.js
|
|
5785
6127
|
var require_OCRDocument = __commonJS({
|
|
5786
6128
|
"dist/useCases/OCRDocument.js"(exports2, module2) {
|
|
@@ -6389,6 +6731,44 @@ var require_DescribeProduct = __commonJS({
|
|
|
6389
6731
|
}
|
|
6390
6732
|
});
|
|
6391
6733
|
|
|
6734
|
+
// dist/useCases/ListProducts.js
|
|
6735
|
+
var require_ListProducts = __commonJS({
|
|
6736
|
+
"dist/useCases/ListProducts.js"(exports2, module2) {
|
|
6737
|
+
module2.exports = /* @__PURE__ */ __name(function ListProducts2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
|
|
6738
|
+
if (!requestData)
|
|
6739
|
+
requestData = {};
|
|
6740
|
+
const pathParams = null;
|
|
6741
|
+
const { data, query, headers } = requestData;
|
|
6742
|
+
let url = "/products";
|
|
6743
|
+
if (pathParams && data) {
|
|
6744
|
+
for (const param of pathParams) {
|
|
6745
|
+
const paramName = param.replace(":", "");
|
|
6746
|
+
url = url.replace(param, data[paramName]);
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
if (url.match(/:[a-zA-Z0-9]+/g)) {
|
|
6750
|
+
const missingParams = url.match(/:[a-zA-Z0-9]+/g);
|
|
6751
|
+
const missing = missingParams.map((param) => param.replace(":", ""));
|
|
6752
|
+
return Promise.reject(
|
|
6753
|
+
new Error("Missing parameters: " + missing.join(", "))
|
|
6754
|
+
);
|
|
6755
|
+
}
|
|
6756
|
+
const config = {
|
|
6757
|
+
method: "get",
|
|
6758
|
+
url,
|
|
6759
|
+
...httpConfigOptions
|
|
6760
|
+
};
|
|
6761
|
+
if (data)
|
|
6762
|
+
config.data = data;
|
|
6763
|
+
if (query)
|
|
6764
|
+
config.params = query;
|
|
6765
|
+
if (headers)
|
|
6766
|
+
config.headers = headers;
|
|
6767
|
+
return this._http.request(config);
|
|
6768
|
+
}, "ListProducts");
|
|
6769
|
+
}
|
|
6770
|
+
});
|
|
6771
|
+
|
|
6392
6772
|
// dist/useCases/ListOrders.js
|
|
6393
6773
|
var require_ListOrders = __commonJS({
|
|
6394
6774
|
"dist/useCases/ListOrders.js"(exports2, module2) {
|
|
@@ -7177,6 +7557,11 @@ var TipUser = require_TipUser();
|
|
|
7177
7557
|
var CreateUserMobileKey = require_CreateUserMobileKey();
|
|
7178
7558
|
var DescribeMyMobileKeyApp = require_DescribeMyMobileKeyApp();
|
|
7179
7559
|
var ListUserMobileKeys = require_ListUserMobileKeys();
|
|
7560
|
+
var CreatePolicy = require_CreatePolicy();
|
|
7561
|
+
var ListPolicies = require_ListPolicies();
|
|
7562
|
+
var UpdatePolicy = require_UpdatePolicy();
|
|
7563
|
+
var DeletePolicy = require_DeletePolicy();
|
|
7564
|
+
var DescribePolicy = require_DescribePolicy();
|
|
7180
7565
|
var ListSpaces = require_ListSpaces();
|
|
7181
7566
|
var ListMySpaces = require_ListMySpaces();
|
|
7182
7567
|
var ListRoomsInSpace = require_ListRoomsInSpace();
|
|
@@ -7253,7 +7638,6 @@ var DeleteWindowCovering = require_DeleteWindowCovering();
|
|
|
7253
7638
|
var DescribeWindowCovering = require_DescribeWindowCovering();
|
|
7254
7639
|
var SetWindowCovering = require_SetWindowCovering();
|
|
7255
7640
|
var SetRoomScene = require_SetRoomScene();
|
|
7256
|
-
var SetCustomScene = require_SetCustomScene();
|
|
7257
7641
|
var AddScenesToRoom = require_AddScenesToRoom();
|
|
7258
7642
|
var AddDefaultScenesToRooms = require_AddDefaultScenesToRooms();
|
|
7259
7643
|
var DescribeTicketStats = require_DescribeTicketStats();
|
|
@@ -7269,6 +7653,7 @@ var UpdateTicketStatus = require_UpdateTicketStatus();
|
|
|
7269
7653
|
var ListScenes = require_ListScenes();
|
|
7270
7654
|
var CreateScene = require_CreateScene();
|
|
7271
7655
|
var CreateDefaultScenes = require_CreateDefaultScenes();
|
|
7656
|
+
var SetScene = require_SetScene();
|
|
7272
7657
|
var CreateDiscoveredDevice = require_CreateDiscoveredDevice();
|
|
7273
7658
|
var ListDiscoveredDevices = require_ListDiscoveredDevices();
|
|
7274
7659
|
var UpdateDiscoveredDevice = require_UpdateDiscoveredDevice();
|
|
@@ -7302,6 +7687,10 @@ var PurchaseReservationRoomUpgrades = require_PurchaseReservationRoomUpgrades();
|
|
|
7302
7687
|
var DescribeReservationLateCheckOutProducts = require_DescribeReservationLateCheckOutProducts();
|
|
7303
7688
|
var PurchaseReservationLateCheckOutProducts = require_PurchaseReservationLateCheckOutProducts();
|
|
7304
7689
|
var UpdateReservationExpectedArrivalTime = require_UpdateReservationExpectedArrivalTime();
|
|
7690
|
+
var DescribeReservationPetProducts = require_DescribeReservationPetProducts();
|
|
7691
|
+
var PurchaseReservationPetProducts = require_PurchaseReservationPetProducts();
|
|
7692
|
+
var DescribeReservationPromos = require_DescribeReservationPromos();
|
|
7693
|
+
var PurchaseReservationPromos = require_PurchaseReservationPromos();
|
|
7305
7694
|
var OCRDocument = require_OCRDocument();
|
|
7306
7695
|
var DescribeMyOrganization = require_DescribeMyOrganization();
|
|
7307
7696
|
var CreateOrganization = require_CreateOrganization();
|
|
@@ -7318,6 +7707,7 @@ var CreateImageUploadEndpoint = require_CreateImageUploadEndpoint();
|
|
|
7318
7707
|
var DeleteMediaFile = require_DeleteMediaFile();
|
|
7319
7708
|
var UploadImage = require_UploadImage();
|
|
7320
7709
|
var DescribeProduct = require_DescribeProduct();
|
|
7710
|
+
var ListProducts = require_ListProducts();
|
|
7321
7711
|
var ListOrders = require_ListOrders();
|
|
7322
7712
|
var ListMyOrders = require_ListMyOrders();
|
|
7323
7713
|
var CreateAnnouncement = require_CreateAnnouncement();
|
|
@@ -7344,26 +7734,31 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
|
|
|
7344
7734
|
static {
|
|
7345
7735
|
__name(this, "KohostApiClient");
|
|
7346
7736
|
}
|
|
7737
|
+
#onSuccess;
|
|
7738
|
+
#onError;
|
|
7347
7739
|
/**
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7740
|
+
@param {Object} options - The options to create the client
|
|
7741
|
+
@param {String} options.organizationId - The organization ID
|
|
7742
|
+
@param {String} options.propertyId - The property ID
|
|
7743
|
+
@param {String} options.url - The base URL for the API endpint
|
|
7744
|
+
@param {Object} options.headers - Additional headers to send with each request
|
|
7745
|
+
@param {String} options.apiKey - The API key to use for requests
|
|
7746
|
+
@param {Function} options.onSuccess - A callback to handle successful responses
|
|
7747
|
+
@param {Function} options.onError - A callback to handle errors
|
|
7748
|
+
*/
|
|
7355
7749
|
constructor(options = {
|
|
7356
7750
|
url: "",
|
|
7357
7751
|
propertyId: "",
|
|
7358
7752
|
organizationId: "",
|
|
7359
7753
|
apiKey: "",
|
|
7360
|
-
headers: {}
|
|
7754
|
+
headers: {},
|
|
7755
|
+
onSuccess: (response) => response,
|
|
7756
|
+
onError: (error) => error
|
|
7361
7757
|
}) {
|
|
7362
7758
|
super();
|
|
7363
7759
|
if (!options.url)
|
|
7364
7760
|
throw new Error("options.url is required");
|
|
7365
7761
|
this.options = options;
|
|
7366
|
-
this.isBrowser = typeof window !== "undefined";
|
|
7367
7762
|
this.isRefreshingToken = false;
|
|
7368
7763
|
const config = {
|
|
7369
7764
|
baseURL: options.url,
|
|
@@ -7384,10 +7779,12 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
|
|
|
7384
7779
|
if (options.organizationId) {
|
|
7385
7780
|
config.headers[_KohostApiClient.defs.organizationHeader] = options.organizationId;
|
|
7386
7781
|
}
|
|
7782
|
+
this.#onSuccess = options.onSuccess ? options.onSuccess : (response) => response;
|
|
7783
|
+
this.#onError = options.onError ? options.onError : (error) => error;
|
|
7387
7784
|
this._http = axios.create(config);
|
|
7388
7785
|
this._http.interceptors.response.use(
|
|
7389
|
-
this.
|
|
7390
|
-
this.
|
|
7786
|
+
this.#handleResponse.bind(this),
|
|
7787
|
+
this.#handleResponseError.bind(this)
|
|
7391
7788
|
);
|
|
7392
7789
|
}
|
|
7393
7790
|
/**
|
|
@@ -7419,19 +7816,26 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
|
|
|
7419
7816
|
organizationHeader: "X-Organization-Id"
|
|
7420
7817
|
};
|
|
7421
7818
|
}
|
|
7422
|
-
|
|
7819
|
+
#onLoginRequired() {
|
|
7820
|
+
this.emit("LoginRequired");
|
|
7821
|
+
}
|
|
7822
|
+
#onPhoneVerificationRequired() {
|
|
7823
|
+
this.emit("PhoneVerificationRequired");
|
|
7824
|
+
}
|
|
7825
|
+
#handleResponse(response) {
|
|
7423
7826
|
try {
|
|
7424
7827
|
if (response?.data?.data) {
|
|
7425
7828
|
response.query = response.data.query;
|
|
7426
7829
|
response.pagination = response.data.pagination;
|
|
7427
7830
|
response.data = response.data.data;
|
|
7428
7831
|
}
|
|
7832
|
+
response = this.#onSuccess(response);
|
|
7429
7833
|
return response;
|
|
7430
7834
|
} catch (error) {
|
|
7431
7835
|
return Promise.reject(error);
|
|
7432
7836
|
}
|
|
7433
7837
|
}
|
|
7434
|
-
|
|
7838
|
+
#handleResponseError(error) {
|
|
7435
7839
|
const { config: originalReq } = error;
|
|
7436
7840
|
if (!error.response)
|
|
7437
7841
|
return Promise.reject(error);
|
|
@@ -7442,15 +7846,15 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
|
|
|
7442
7846
|
const expectedError = status >= 400 && status < 500;
|
|
7443
7847
|
const newTokensNeeded = expectedError && errorType === "TokenExpiredError";
|
|
7444
7848
|
if (expectedError && errorMessage === "Phone Verification is required") {
|
|
7445
|
-
this
|
|
7849
|
+
this.#onPhoneVerificationRequired();
|
|
7446
7850
|
return Promise.reject(error);
|
|
7447
7851
|
}
|
|
7448
7852
|
if (expectedError && errorMessage === "Login Required") {
|
|
7449
|
-
this
|
|
7853
|
+
this.#onLoginRequired();
|
|
7450
7854
|
return Promise.reject(error);
|
|
7451
7855
|
}
|
|
7452
7856
|
if (expectedError && errorMessage === "No auth header or cookie provided") {
|
|
7453
|
-
this
|
|
7857
|
+
this.#onLoginRequired();
|
|
7454
7858
|
return Promise.reject(error);
|
|
7455
7859
|
}
|
|
7456
7860
|
if (expectedError && newTokensNeeded) {
|
|
@@ -7468,14 +7872,9 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
|
|
|
7468
7872
|
} catch (error2) {
|
|
7469
7873
|
console.log(error2);
|
|
7470
7874
|
}
|
|
7875
|
+
error = this.#onError(error);
|
|
7471
7876
|
return Promise.reject(error);
|
|
7472
7877
|
}
|
|
7473
|
-
_onLoginRequired() {
|
|
7474
|
-
this.emit("LoginRequired");
|
|
7475
|
-
}
|
|
7476
|
-
_onPhoneVerificationRequired() {
|
|
7477
|
-
this.emit("PhoneVerificationRequired");
|
|
7478
|
-
}
|
|
7479
7878
|
};
|
|
7480
7879
|
KohostApiClient.prototype.LoginStart = LoginStart;
|
|
7481
7880
|
KohostApiClient.prototype.RefreshToken = RefreshToken;
|
|
@@ -7504,6 +7903,11 @@ KohostApiClient.prototype.TipUser = TipUser;
|
|
|
7504
7903
|
KohostApiClient.prototype.CreateUserMobileKey = CreateUserMobileKey;
|
|
7505
7904
|
KohostApiClient.prototype.DescribeMyMobileKeyApp = DescribeMyMobileKeyApp;
|
|
7506
7905
|
KohostApiClient.prototype.ListUserMobileKeys = ListUserMobileKeys;
|
|
7906
|
+
KohostApiClient.prototype.CreatePolicy = CreatePolicy;
|
|
7907
|
+
KohostApiClient.prototype.ListPolicies = ListPolicies;
|
|
7908
|
+
KohostApiClient.prototype.UpdatePolicy = UpdatePolicy;
|
|
7909
|
+
KohostApiClient.prototype.DeletePolicy = DeletePolicy;
|
|
7910
|
+
KohostApiClient.prototype.DescribePolicy = DescribePolicy;
|
|
7507
7911
|
KohostApiClient.prototype.ListSpaces = ListSpaces;
|
|
7508
7912
|
KohostApiClient.prototype.ListMySpaces = ListMySpaces;
|
|
7509
7913
|
KohostApiClient.prototype.ListRoomsInSpace = ListRoomsInSpace;
|
|
@@ -7580,7 +7984,6 @@ KohostApiClient.prototype.DeleteWindowCovering = DeleteWindowCovering;
|
|
|
7580
7984
|
KohostApiClient.prototype.DescribeWindowCovering = DescribeWindowCovering;
|
|
7581
7985
|
KohostApiClient.prototype.SetWindowCovering = SetWindowCovering;
|
|
7582
7986
|
KohostApiClient.prototype.SetRoomScene = SetRoomScene;
|
|
7583
|
-
KohostApiClient.prototype.SetCustomScene = SetCustomScene;
|
|
7584
7987
|
KohostApiClient.prototype.AddScenesToRoom = AddScenesToRoom;
|
|
7585
7988
|
KohostApiClient.prototype.AddDefaultScenesToRooms = AddDefaultScenesToRooms;
|
|
7586
7989
|
KohostApiClient.prototype.DescribeTicketStats = DescribeTicketStats;
|
|
@@ -7596,6 +7999,7 @@ KohostApiClient.prototype.UpdateTicketStatus = UpdateTicketStatus;
|
|
|
7596
7999
|
KohostApiClient.prototype.ListScenes = ListScenes;
|
|
7597
8000
|
KohostApiClient.prototype.CreateScene = CreateScene;
|
|
7598
8001
|
KohostApiClient.prototype.CreateDefaultScenes = CreateDefaultScenes;
|
|
8002
|
+
KohostApiClient.prototype.SetScene = SetScene;
|
|
7599
8003
|
KohostApiClient.prototype.CreateDiscoveredDevice = CreateDiscoveredDevice;
|
|
7600
8004
|
KohostApiClient.prototype.ListDiscoveredDevices = ListDiscoveredDevices;
|
|
7601
8005
|
KohostApiClient.prototype.UpdateDiscoveredDevice = UpdateDiscoveredDevice;
|
|
@@ -7629,6 +8033,10 @@ KohostApiClient.prototype.PurchaseReservationRoomUpgrades = PurchaseReservationR
|
|
|
7629
8033
|
KohostApiClient.prototype.DescribeReservationLateCheckOutProducts = DescribeReservationLateCheckOutProducts;
|
|
7630
8034
|
KohostApiClient.prototype.PurchaseReservationLateCheckOutProducts = PurchaseReservationLateCheckOutProducts;
|
|
7631
8035
|
KohostApiClient.prototype.UpdateReservationExpectedArrivalTime = UpdateReservationExpectedArrivalTime;
|
|
8036
|
+
KohostApiClient.prototype.DescribeReservationPetProducts = DescribeReservationPetProducts;
|
|
8037
|
+
KohostApiClient.prototype.PurchaseReservationPetProducts = PurchaseReservationPetProducts;
|
|
8038
|
+
KohostApiClient.prototype.DescribeReservationPromos = DescribeReservationPromos;
|
|
8039
|
+
KohostApiClient.prototype.PurchaseReservationPromos = PurchaseReservationPromos;
|
|
7632
8040
|
KohostApiClient.prototype.OCRDocument = OCRDocument;
|
|
7633
8041
|
KohostApiClient.prototype.DescribeMyOrganization = DescribeMyOrganization;
|
|
7634
8042
|
KohostApiClient.prototype.CreateOrganization = CreateOrganization;
|
|
@@ -7645,6 +8053,7 @@ KohostApiClient.prototype.CreateImageUploadEndpoint = CreateImageUploadEndpoint;
|
|
|
7645
8053
|
KohostApiClient.prototype.DeleteMediaFile = DeleteMediaFile;
|
|
7646
8054
|
KohostApiClient.prototype.UploadImage = UploadImage;
|
|
7647
8055
|
KohostApiClient.prototype.DescribeProduct = DescribeProduct;
|
|
8056
|
+
KohostApiClient.prototype.ListProducts = ListProducts;
|
|
7648
8057
|
KohostApiClient.prototype.ListOrders = ListOrders;
|
|
7649
8058
|
KohostApiClient.prototype.ListMyOrders = ListMyOrders;
|
|
7650
8059
|
KohostApiClient.prototype.CreateAnnouncement = CreateAnnouncement;
|