pyrus-api 3.3.2 → 3.4.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/README.md +86 -2
- package/build/cjs/index.cjs +78 -2
- package/build/esm/index.js +77 -3
- package/build/types/index.d.ts +95 -1
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -283,11 +283,95 @@ const announcementResponse = await client.announcements.addComment(
|
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
* Create an announcement
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
```typescript
|
|
288
288
|
const announcementResponse = await client.announcements.create(
|
|
289
289
|
{
|
|
290
290
|
text: "New announcement"
|
|
291
291
|
}
|
|
292
292
|
);
|
|
293
|
-
```
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Knowledge Base
|
|
296
|
+
|
|
297
|
+
* Get a knowledge base entity (article or topic)
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
const response = await client.knowledgeBase.get("LMcleQRnRqB");
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
* Create an article
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
import {KnowledgeBaseEntityType} from "pyrus-api";
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
const response = await client.knowledgeBase.create(
|
|
311
|
+
{
|
|
312
|
+
type: KnowledgeBaseEntityType.Article,
|
|
313
|
+
title: "My Article",
|
|
314
|
+
body: "Article content in MD format",
|
|
315
|
+
parent_topic_id: "KoSjtyL9EWm"
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
* Create a topic
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
const response = await client.knowledgeBase.create(
|
|
324
|
+
{
|
|
325
|
+
type: KnowledgeBaseEntityType.Topic,
|
|
326
|
+
title: "My Topic"
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
* Update a knowledge base entity
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const response = await client.knowledgeBase.update(
|
|
335
|
+
"LMcleQRnRqB",
|
|
336
|
+
{
|
|
337
|
+
title: "Updated Title",
|
|
338
|
+
body: "Updated content in MD format"
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
* Delete a knowledge base entity
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
const response = await client.knowledgeBase.delete("LMcleQRnRqB", true);
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
* Get knowledge base structure
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
const response = await client.knowledgeBase.getStructure(
|
|
353
|
+
{
|
|
354
|
+
parent_topic_id: "KoSjtyL9EWm",
|
|
355
|
+
depth: 2
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
* Get knowledge base entity permissions
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
const response = await client.knowledgeBase.getPermissions("KoSjtyL9EWm");
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
* Update knowledge base entity permissions
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
const response = await client.knowledgeBase.updatePermissions(
|
|
370
|
+
"KoSjtyL9EWm",
|
|
371
|
+
{
|
|
372
|
+
inherit: false,
|
|
373
|
+
readers: [1732, 4368],
|
|
374
|
+
editors: [2434]
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
```
|
package/build/cjs/index.cjs
CHANGED
|
@@ -45,6 +45,8 @@ const allDateAndTimeResponseKeys = [
|
|
|
45
45
|
"scheduled_date",
|
|
46
46
|
"scheduled_datetime_utc",
|
|
47
47
|
"close_date",
|
|
48
|
+
"created_at",
|
|
49
|
+
"updated_at",
|
|
48
50
|
];
|
|
49
51
|
const dateRequestKeys = ["due_date", "scheduled_date"];
|
|
50
52
|
const dateTimeRequestKeys = [
|
|
@@ -60,6 +62,8 @@ const dateTimeRequestKeys = [
|
|
|
60
62
|
"scheduled_datetime_utc",
|
|
61
63
|
"start_time",
|
|
62
64
|
"end_time",
|
|
65
|
+
"created_at",
|
|
66
|
+
"updated_at",
|
|
63
67
|
];
|
|
64
68
|
|
|
65
69
|
exports.OperatorId = void 0;
|
|
@@ -100,10 +104,10 @@ function extractDates(key, value) {
|
|
|
100
104
|
}
|
|
101
105
|
function packDates(key, value) {
|
|
102
106
|
if (dateRequestKeys.includes(key)) {
|
|
103
|
-
return
|
|
107
|
+
return this[key] && toDateString(this[key]);
|
|
104
108
|
}
|
|
105
109
|
if (dateTimeRequestKeys.includes(key)) {
|
|
106
|
-
return
|
|
110
|
+
return this[key] && toDateTimeString(this[key]);
|
|
107
111
|
}
|
|
108
112
|
if (value instanceof Object && value.type && value.value) {
|
|
109
113
|
if (dateTimeFieldTypes.includes(value.type)) {
|
|
@@ -129,16 +133,22 @@ function trimTrailingSlash(url) {
|
|
|
129
133
|
function toDateTimeString(date) {
|
|
130
134
|
if (typeof date === "string")
|
|
131
135
|
return date;
|
|
136
|
+
if (date == null || typeof date.toISOString !== "function")
|
|
137
|
+
return String(date);
|
|
132
138
|
return date.toISOString().split(".")[0] + "Z";
|
|
133
139
|
}
|
|
134
140
|
function toDateString(date) {
|
|
135
141
|
if (typeof date === "string")
|
|
136
142
|
return date;
|
|
143
|
+
if (date == null || typeof date.toISOString !== "function")
|
|
144
|
+
return String(date);
|
|
137
145
|
return date.toISOString().split("T")[0];
|
|
138
146
|
}
|
|
139
147
|
function toTimeString(date) {
|
|
140
148
|
if (typeof date === "string")
|
|
141
149
|
return date;
|
|
150
|
+
if (date == null || typeof date.toISOString !== "function")
|
|
151
|
+
return String(date);
|
|
142
152
|
return date.toISOString().split("T")[1].slice(0, 5);
|
|
143
153
|
}
|
|
144
154
|
function processFilters(filters) {
|
|
@@ -187,6 +197,17 @@ class ApiError extends Error {
|
|
|
187
197
|
}
|
|
188
198
|
}
|
|
189
199
|
|
|
200
|
+
const KnowledgeBaseEntityType = {
|
|
201
|
+
Article: "article",
|
|
202
|
+
Topic: "topic",
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const KnowledgeBasePermissionLevel = {
|
|
206
|
+
None: "none",
|
|
207
|
+
Read: "read",
|
|
208
|
+
Write: "write",
|
|
209
|
+
};
|
|
210
|
+
|
|
190
211
|
const FilterMask = {
|
|
191
212
|
Due: 0x1,
|
|
192
213
|
DueDate: 0x2,
|
|
@@ -555,6 +576,9 @@ var Endpoints;
|
|
|
555
576
|
Endpoints["Call"] = "/call";
|
|
556
577
|
Endpoints["AttachCallRecord"] = "/attachcallrecord";
|
|
557
578
|
Endpoints["Bots"] = "/bots";
|
|
579
|
+
Endpoints["KnowledgeBase"] = "/knowledgebase";
|
|
580
|
+
Endpoints["Structure"] = "/structure";
|
|
581
|
+
Endpoints["Permissions"] = "/permissions";
|
|
558
582
|
})(Endpoints || (Endpoints = {}));
|
|
559
583
|
|
|
560
584
|
class RoleApi extends BaseApi {
|
|
@@ -941,6 +965,51 @@ class BotApi extends BaseApi {
|
|
|
941
965
|
}
|
|
942
966
|
}
|
|
943
967
|
|
|
968
|
+
class KnowledgeBaseApi extends BaseApi {
|
|
969
|
+
constructor() {
|
|
970
|
+
super(...arguments);
|
|
971
|
+
this._moduleSubPath = Endpoints.KnowledgeBase;
|
|
972
|
+
}
|
|
973
|
+
get(id) {
|
|
974
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
975
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}`, "GET");
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
create(request) {
|
|
979
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
980
|
+
return yield this.fetchApi(yield this.getModulePath(), "POST", JSON.stringify(request));
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
update(id, request) {
|
|
984
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
985
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}`, "PUT", JSON.stringify(request));
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
delete(id_1) {
|
|
989
|
+
return __awaiter(this, arguments, void 0, function* (id, deleteWithChildren = false) {
|
|
990
|
+
return yield this.fetchApi((yield this.getModulePath()) +
|
|
991
|
+
`/${id}?delete_with_children=${deleteWithChildren}`, "DELETE");
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
getStructure(request) {
|
|
995
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
996
|
+
const basePath = (yield this.getModulePath()) + Endpoints.Structure;
|
|
997
|
+
const url = request ? basePath + toSearchParams(request) : basePath;
|
|
998
|
+
return yield this.fetchApi(url, "GET");
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
getPermissions(id) {
|
|
1002
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1003
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}` + Endpoints.Permissions, "GET");
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
updatePermissions(id, request) {
|
|
1007
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1008
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}` + Endpoints.Permissions, "PUT", JSON.stringify(request));
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
944
1013
|
class PyrusApiClient extends BaseApi {
|
|
945
1014
|
constructor(auth, settings) {
|
|
946
1015
|
const currentSettings = !!settings
|
|
@@ -1048,6 +1117,11 @@ class PyrusApiClient extends BaseApi {
|
|
|
1048
1117
|
this._bot = new BotApi(this.initParams);
|
|
1049
1118
|
return this._bot;
|
|
1050
1119
|
}
|
|
1120
|
+
get knowledgeBase() {
|
|
1121
|
+
if (!this._knowledgeBase)
|
|
1122
|
+
this._knowledgeBase = new KnowledgeBaseApi(this.initParams);
|
|
1123
|
+
return this._knowledgeBase;
|
|
1124
|
+
}
|
|
1051
1125
|
}
|
|
1052
1126
|
|
|
1053
1127
|
exports.ActivityAction = ActivityAction;
|
|
@@ -1058,6 +1132,8 @@ exports.ErrorCodeType = ErrorCodeType;
|
|
|
1058
1132
|
exports.FilterMask = FilterMask;
|
|
1059
1133
|
exports.Flag = Flag;
|
|
1060
1134
|
exports.FormFieldType = FormFieldType;
|
|
1135
|
+
exports.KnowledgeBaseEntityType = KnowledgeBaseEntityType;
|
|
1136
|
+
exports.KnowledgeBasePermissionLevel = KnowledgeBasePermissionLevel;
|
|
1061
1137
|
exports.ListType = ListType;
|
|
1062
1138
|
exports.PermissionLevel = PermissionLevel;
|
|
1063
1139
|
exports.PersonType = PersonType;
|
package/build/esm/index.js
CHANGED
|
@@ -43,6 +43,8 @@ const allDateAndTimeResponseKeys = [
|
|
|
43
43
|
"scheduled_date",
|
|
44
44
|
"scheduled_datetime_utc",
|
|
45
45
|
"close_date",
|
|
46
|
+
"created_at",
|
|
47
|
+
"updated_at",
|
|
46
48
|
];
|
|
47
49
|
const dateRequestKeys = ["due_date", "scheduled_date"];
|
|
48
50
|
const dateTimeRequestKeys = [
|
|
@@ -58,6 +60,8 @@ const dateTimeRequestKeys = [
|
|
|
58
60
|
"scheduled_datetime_utc",
|
|
59
61
|
"start_time",
|
|
60
62
|
"end_time",
|
|
63
|
+
"created_at",
|
|
64
|
+
"updated_at",
|
|
61
65
|
];
|
|
62
66
|
|
|
63
67
|
var OperatorId;
|
|
@@ -98,10 +102,10 @@ function extractDates(key, value) {
|
|
|
98
102
|
}
|
|
99
103
|
function packDates(key, value) {
|
|
100
104
|
if (dateRequestKeys.includes(key)) {
|
|
101
|
-
return
|
|
105
|
+
return this[key] && toDateString(this[key]);
|
|
102
106
|
}
|
|
103
107
|
if (dateTimeRequestKeys.includes(key)) {
|
|
104
|
-
return
|
|
108
|
+
return this[key] && toDateTimeString(this[key]);
|
|
105
109
|
}
|
|
106
110
|
if (value instanceof Object && value.type && value.value) {
|
|
107
111
|
if (dateTimeFieldTypes.includes(value.type)) {
|
|
@@ -127,16 +131,22 @@ function trimTrailingSlash(url) {
|
|
|
127
131
|
function toDateTimeString(date) {
|
|
128
132
|
if (typeof date === "string")
|
|
129
133
|
return date;
|
|
134
|
+
if (date == null || typeof date.toISOString !== "function")
|
|
135
|
+
return String(date);
|
|
130
136
|
return date.toISOString().split(".")[0] + "Z";
|
|
131
137
|
}
|
|
132
138
|
function toDateString(date) {
|
|
133
139
|
if (typeof date === "string")
|
|
134
140
|
return date;
|
|
141
|
+
if (date == null || typeof date.toISOString !== "function")
|
|
142
|
+
return String(date);
|
|
135
143
|
return date.toISOString().split("T")[0];
|
|
136
144
|
}
|
|
137
145
|
function toTimeString(date) {
|
|
138
146
|
if (typeof date === "string")
|
|
139
147
|
return date;
|
|
148
|
+
if (date == null || typeof date.toISOString !== "function")
|
|
149
|
+
return String(date);
|
|
140
150
|
return date.toISOString().split("T")[1].slice(0, 5);
|
|
141
151
|
}
|
|
142
152
|
function processFilters(filters) {
|
|
@@ -185,6 +195,17 @@ class ApiError extends Error {
|
|
|
185
195
|
}
|
|
186
196
|
}
|
|
187
197
|
|
|
198
|
+
const KnowledgeBaseEntityType = {
|
|
199
|
+
Article: "article",
|
|
200
|
+
Topic: "topic",
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const KnowledgeBasePermissionLevel = {
|
|
204
|
+
None: "none",
|
|
205
|
+
Read: "read",
|
|
206
|
+
Write: "write",
|
|
207
|
+
};
|
|
208
|
+
|
|
188
209
|
const FilterMask = {
|
|
189
210
|
Due: 0x1,
|
|
190
211
|
DueDate: 0x2,
|
|
@@ -553,6 +574,9 @@ var Endpoints;
|
|
|
553
574
|
Endpoints["Call"] = "/call";
|
|
554
575
|
Endpoints["AttachCallRecord"] = "/attachcallrecord";
|
|
555
576
|
Endpoints["Bots"] = "/bots";
|
|
577
|
+
Endpoints["KnowledgeBase"] = "/knowledgebase";
|
|
578
|
+
Endpoints["Structure"] = "/structure";
|
|
579
|
+
Endpoints["Permissions"] = "/permissions";
|
|
556
580
|
})(Endpoints || (Endpoints = {}));
|
|
557
581
|
|
|
558
582
|
class RoleApi extends BaseApi {
|
|
@@ -939,6 +963,51 @@ class BotApi extends BaseApi {
|
|
|
939
963
|
}
|
|
940
964
|
}
|
|
941
965
|
|
|
966
|
+
class KnowledgeBaseApi extends BaseApi {
|
|
967
|
+
constructor() {
|
|
968
|
+
super(...arguments);
|
|
969
|
+
this._moduleSubPath = Endpoints.KnowledgeBase;
|
|
970
|
+
}
|
|
971
|
+
get(id) {
|
|
972
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
973
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}`, "GET");
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
create(request) {
|
|
977
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
978
|
+
return yield this.fetchApi(yield this.getModulePath(), "POST", JSON.stringify(request));
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
update(id, request) {
|
|
982
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
983
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}`, "PUT", JSON.stringify(request));
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
delete(id_1) {
|
|
987
|
+
return __awaiter(this, arguments, void 0, function* (id, deleteWithChildren = false) {
|
|
988
|
+
return yield this.fetchApi((yield this.getModulePath()) +
|
|
989
|
+
`/${id}?delete_with_children=${deleteWithChildren}`, "DELETE");
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
getStructure(request) {
|
|
993
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
994
|
+
const basePath = (yield this.getModulePath()) + Endpoints.Structure;
|
|
995
|
+
const url = request ? basePath + toSearchParams(request) : basePath;
|
|
996
|
+
return yield this.fetchApi(url, "GET");
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
getPermissions(id) {
|
|
1000
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1001
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}` + Endpoints.Permissions, "GET");
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
updatePermissions(id, request) {
|
|
1005
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1006
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${id}` + Endpoints.Permissions, "PUT", JSON.stringify(request));
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
942
1011
|
class PyrusApiClient extends BaseApi {
|
|
943
1012
|
constructor(auth, settings) {
|
|
944
1013
|
const currentSettings = !!settings
|
|
@@ -1046,6 +1115,11 @@ class PyrusApiClient extends BaseApi {
|
|
|
1046
1115
|
this._bot = new BotApi(this.initParams);
|
|
1047
1116
|
return this._bot;
|
|
1048
1117
|
}
|
|
1118
|
+
get knowledgeBase() {
|
|
1119
|
+
if (!this._knowledgeBase)
|
|
1120
|
+
this._knowledgeBase = new KnowledgeBaseApi(this.initParams);
|
|
1121
|
+
return this._knowledgeBase;
|
|
1122
|
+
}
|
|
1049
1123
|
}
|
|
1050
1124
|
|
|
1051
|
-
export { ActivityAction, ApiError, ApprovalChoice, CallEventType, ErrorCodeType, FilterMask, Flag, FormFieldType, ListType, OperatorId, PermissionLevel, PersonRights, PersonType, PyrusApiClient, SendSmsError, SendSmsStatus, SourceType, fromJson, prepareHeadersForCatalogApiRequest, toDateString, toDateTimeString, toJson, toTimeString };
|
|
1125
|
+
export { ActivityAction, ApiError, ApprovalChoice, CallEventType, ErrorCodeType, FilterMask, Flag, FormFieldType, KnowledgeBaseEntityType, KnowledgeBasePermissionLevel, ListType, OperatorId, PermissionLevel, PersonRights, PersonType, PyrusApiClient, SendSmsError, SendSmsStatus, SourceType, fromJson, prepareHeadersForCatalogApiRequest, toDateString, toDateTimeString, toJson, toTimeString };
|
package/build/types/index.d.ts
CHANGED
|
@@ -165,6 +165,17 @@ declare module "pyrus-api" {
|
|
|
165
165
|
error: ErrorResponse;
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
+
export const KnowledgeBaseEntityType: {
|
|
169
|
+
readonly Article: "article";
|
|
170
|
+
readonly Topic: "topic";
|
|
171
|
+
};
|
|
172
|
+
export type KnowledgeBaseEntityType = typeof KnowledgeBaseEntityType[keyof typeof KnowledgeBaseEntityType];
|
|
173
|
+
export const KnowledgeBasePermissionLevel: {
|
|
174
|
+
readonly None: "none";
|
|
175
|
+
readonly Read: "read";
|
|
176
|
+
readonly Write: "write";
|
|
177
|
+
};
|
|
178
|
+
export type KnowledgeBasePermissionLevel = typeof KnowledgeBasePermissionLevel[keyof typeof KnowledgeBasePermissionLevel];
|
|
168
179
|
export const FilterMask: {
|
|
169
180
|
/**
|
|
170
181
|
* Events whose deadline is indicated in UTC+0
|
|
@@ -303,6 +314,74 @@ declare module "pyrus-api" {
|
|
|
303
314
|
readonly SendFailed: "send_failed";
|
|
304
315
|
};
|
|
305
316
|
export type SendSmsStatus = typeof SendSmsStatus[keyof typeof SendSmsStatus];
|
|
317
|
+
export type KnowledgeBasePersonInfo = {
|
|
318
|
+
id: number;
|
|
319
|
+
first_name: string;
|
|
320
|
+
last_name: string;
|
|
321
|
+
email: string;
|
|
322
|
+
type: string;
|
|
323
|
+
};
|
|
324
|
+
export type KnowledgeBaseStructureItem = {
|
|
325
|
+
id: string;
|
|
326
|
+
title: string;
|
|
327
|
+
type: KnowledgeBaseEntityType;
|
|
328
|
+
parent_topic_id: string;
|
|
329
|
+
created_at: Date;
|
|
330
|
+
updated_at: Date;
|
|
331
|
+
access_right: KnowledgeBasePermissionLevel;
|
|
332
|
+
is_open_for_organization: boolean;
|
|
333
|
+
children: KnowledgeBaseStructureItem[];
|
|
334
|
+
};
|
|
335
|
+
export type CreateKnowledgeBaseEntityRequest = {
|
|
336
|
+
type: KnowledgeBaseEntityType;
|
|
337
|
+
title: string;
|
|
338
|
+
body?: string;
|
|
339
|
+
parent_topic_id?: string;
|
|
340
|
+
};
|
|
341
|
+
export type UpdateKnowledgeBaseEntityRequest = {
|
|
342
|
+
title?: string;
|
|
343
|
+
body?: string;
|
|
344
|
+
parent_topic_id_changed?: boolean;
|
|
345
|
+
parent_topic_id?: string;
|
|
346
|
+
};
|
|
347
|
+
export type UpdateKnowledgeBasePermissionsRequest = {
|
|
348
|
+
inherit?: boolean;
|
|
349
|
+
readers?: number[];
|
|
350
|
+
editors?: number[];
|
|
351
|
+
};
|
|
352
|
+
export type GetKnowledgeBaseStructureRequest = {
|
|
353
|
+
parent_topic_id?: string;
|
|
354
|
+
depth?: number;
|
|
355
|
+
};
|
|
356
|
+
export type KnowledgeBaseEntityResponse = {
|
|
357
|
+
id: string;
|
|
358
|
+
title: string;
|
|
359
|
+
type: KnowledgeBaseEntityType;
|
|
360
|
+
body: string;
|
|
361
|
+
parent_topic_id: string;
|
|
362
|
+
author: KnowledgeBasePersonInfo;
|
|
363
|
+
created_at: Date;
|
|
364
|
+
updated_at: Date;
|
|
365
|
+
last_edited_by: KnowledgeBasePersonInfo;
|
|
366
|
+
version: number;
|
|
367
|
+
access_right: KnowledgeBasePermissionLevel;
|
|
368
|
+
is_open_for_organization: boolean;
|
|
369
|
+
is_public: boolean;
|
|
370
|
+
};
|
|
371
|
+
export type KnowledgeBaseDeleteResponse = {
|
|
372
|
+
deleted: boolean;
|
|
373
|
+
};
|
|
374
|
+
export type KnowledgeBaseStructureResponse = {
|
|
375
|
+
parent_topic_id?: string;
|
|
376
|
+
depth?: number;
|
|
377
|
+
items: KnowledgeBaseStructureItem[];
|
|
378
|
+
};
|
|
379
|
+
export type KnowledgeBasePermissionsResponse = {
|
|
380
|
+
global_permission: KnowledgeBasePermissionLevel;
|
|
381
|
+
inherit: boolean;
|
|
382
|
+
readers: KnowledgeBasePersonInfo[];
|
|
383
|
+
editors: KnowledgeBasePersonInfo[];
|
|
384
|
+
};
|
|
306
385
|
export type NewFile = {
|
|
307
386
|
guid?: string;
|
|
308
387
|
root_id?: number;
|
|
@@ -834,7 +913,10 @@ declare module "pyrus-api" {
|
|
|
834
913
|
Integrations = "/integrations",
|
|
835
914
|
Call = "/call",
|
|
836
915
|
AttachCallRecord = "/attachcallrecord",
|
|
837
|
-
Bots = "/bots"
|
|
916
|
+
Bots = "/bots",
|
|
917
|
+
KnowledgeBase = "/knowledgebase",
|
|
918
|
+
Structure = "/structure",
|
|
919
|
+
Permissions = "/permissions"
|
|
838
920
|
}
|
|
839
921
|
export type RolesResponse = {
|
|
840
922
|
roles: Role[];
|
|
@@ -1428,6 +1510,16 @@ declare module "pyrus-api" {
|
|
|
1428
1510
|
update(request: UpdateBotRequest): Promise<Bot>;
|
|
1429
1511
|
delete(request: DeleteBotRequest): Promise<Bot>;
|
|
1430
1512
|
}
|
|
1513
|
+
class KnowledgeBaseApi extends BaseApi {
|
|
1514
|
+
protected _moduleSubPath: Endpoints;
|
|
1515
|
+
get(id: string): Promise<KnowledgeBaseEntityResponse>;
|
|
1516
|
+
create(request: CreateKnowledgeBaseEntityRequest): Promise<KnowledgeBaseEntityResponse>;
|
|
1517
|
+
update(id: string, request: UpdateKnowledgeBaseEntityRequest): Promise<KnowledgeBaseEntityResponse>;
|
|
1518
|
+
delete(id: string, deleteWithChildren?: boolean): Promise<KnowledgeBaseDeleteResponse>;
|
|
1519
|
+
getStructure(request?: GetKnowledgeBaseStructureRequest): Promise<KnowledgeBaseStructureResponse>;
|
|
1520
|
+
getPermissions(id: string): Promise<KnowledgeBasePermissionsResponse>;
|
|
1521
|
+
updatePermissions(id: string, request: UpdateKnowledgeBasePermissionsRequest): Promise<KnowledgeBasePermissionsResponse>;
|
|
1522
|
+
}
|
|
1431
1523
|
export class PyrusApiClient extends BaseApi {
|
|
1432
1524
|
private _role;
|
|
1433
1525
|
private _profile;
|
|
@@ -1443,6 +1535,7 @@ declare module "pyrus-api" {
|
|
|
1443
1535
|
private _logs;
|
|
1444
1536
|
private _call;
|
|
1445
1537
|
private _bot;
|
|
1538
|
+
private _knowledgeBase;
|
|
1446
1539
|
/**
|
|
1447
1540
|
*
|
|
1448
1541
|
* @param auth
|
|
@@ -1468,6 +1561,7 @@ declare module "pyrus-api" {
|
|
|
1468
1561
|
get logs(): LogsApi;
|
|
1469
1562
|
get call(): CallApi;
|
|
1470
1563
|
get bot(): BotApi;
|
|
1564
|
+
get knowledgeBase(): KnowledgeBaseApi;
|
|
1471
1565
|
}
|
|
1472
1566
|
|
|
1473
1567
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pyrus-api",
|
|
3
|
-
"version": "3.3.2",
|
|
4
3
|
"description": "Pyrus API client for TypeScript",
|
|
4
|
+
"version": "3.4.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Pyrus",
|
|
7
|
+
"email": "contact@pyrus.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
5
10
|
"repository": {
|
|
6
11
|
"type": "git",
|
|
7
12
|
"url": "git+https://github.com/simplygoodsoftware/pyrusapi-typescript.git"
|
|
@@ -23,13 +28,10 @@
|
|
|
23
28
|
},
|
|
24
29
|
"scripts": {
|
|
25
30
|
"build": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript && dts-bundle-generator --project tsconfig.types.json --no-banner -o ./build/types/index.d.ts index.ts && node ./module-wrapper.js",
|
|
26
|
-
"
|
|
31
|
+
"tsc": "tsc --noEmit",
|
|
32
|
+
"check:version": "node .husky/check-version.mjs",
|
|
33
|
+
"test": "vitest"
|
|
27
34
|
},
|
|
28
|
-
"author": {
|
|
29
|
-
"name": "Pyrus",
|
|
30
|
-
"email": "contact@pyrus.com"
|
|
31
|
-
},
|
|
32
|
-
"license": "MIT",
|
|
33
35
|
"devDependencies": {
|
|
34
36
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
35
37
|
"@types/node": "^22.5.4",
|
|
@@ -38,9 +40,11 @@
|
|
|
38
40
|
"husky": "^9.1.6",
|
|
39
41
|
"lint-staged": "^15.2.10",
|
|
40
42
|
"prettier": "2.5.1",
|
|
41
|
-
"rollup": "
|
|
43
|
+
"rollup": "4.59.0",
|
|
42
44
|
"rollup-plugin-cleandir": "^3.0.0",
|
|
43
|
-
"rollup-plugin-typescript2": "^0.36.0"
|
|
45
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
46
|
+
"typescript": "^5.9.3",
|
|
47
|
+
"vitest": "^4.0.18"
|
|
44
48
|
},
|
|
45
49
|
"lint-staged": {
|
|
46
50
|
"**/*": "prettier --write --ignore-unknown"
|