@bwi-mentorspaces/application-utils-npm 0.0.4
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/chat/index.d.ts +36 -0
- package/chat/index.js +59 -0
- package/chat/index.js.map +1 -0
- package/chat/stream/enum/index.d.ts +27 -0
- package/chat/stream/enum/index.js +35 -0
- package/chat/stream/enum/index.js.map +1 -0
- package/chat/stream/index.d.ts +9 -0
- package/chat/stream/index.js +18 -0
- package/chat/stream/index.js.map +1 -0
- package/chat/stream/models/_/channel.data.d.ts +19 -0
- package/chat/stream/models/_/channel.data.js +3 -0
- package/chat/stream/models/_/channel.data.js.map +1 -0
- package/chat/stream/models/_/channel.member.d.ts +14 -0
- package/chat/stream/models/_/channel.member.js +12 -0
- package/chat/stream/models/_/channel.member.js.map +1 -0
- package/chat/stream/models/_/channel.response.d.ts +8 -0
- package/chat/stream/models/_/channel.response.js +3 -0
- package/chat/stream/models/_/channel.response.js.map +1 -0
- package/chat/stream/models/_/message.response.d.ts +8 -0
- package/chat/stream/models/_/message.response.js +3 -0
- package/chat/stream/models/_/message.response.js.map +1 -0
- package/chat/stream/models/_/stream.config.d.ts +22 -0
- package/chat/stream/models/_/stream.config.js +3 -0
- package/chat/stream/models/_/stream.config.js.map +1 -0
- package/chat/stream/models/_/user.response.d.ts +8 -0
- package/chat/stream/models/_/user.response.js +3 -0
- package/chat/stream/models/_/user.response.js.map +1 -0
- package/chat/stream/models/index.d.ts +7 -0
- package/chat/stream/models/index.js +6 -0
- package/chat/stream/models/index.js.map +1 -0
- package/chat/stream/stream.api.d.ts +63 -0
- package/chat/stream/stream.api.js +77 -0
- package/chat/stream/stream.api.js.map +1 -0
- package/chat/stream/stream.auth.d.ts +70 -0
- package/chat/stream/stream.auth.js +81 -0
- package/chat/stream/stream.auth.js.map +1 -0
- package/chat/stream/stream.base.d.ts +56 -0
- package/chat/stream/stream.base.js +94 -0
- package/chat/stream/stream.base.js.map +1 -0
- package/chat/stream/stream.channel.d.ts +118 -0
- package/chat/stream/stream.channel.js +275 -0
- package/chat/stream/stream.channel.js.map +1 -0
- package/chat/stream/stream.error.d.ts +19 -0
- package/chat/stream/stream.error.js +18 -0
- package/chat/stream/stream.error.js.map +1 -0
- package/chat/stream/stream.media.d.ts +0 -0
- package/chat/stream/stream.media.js +1 -0
- package/chat/stream/stream.media.js.map +1 -0
- package/chat/stream/stream.member.d.ts +75 -0
- package/chat/stream/stream.member.js +176 -0
- package/chat/stream/stream.member.js.map +1 -0
- package/chat/stream/stream.message.d.ts +59 -0
- package/chat/stream/stream.message.js +113 -0
- package/chat/stream/stream.message.js.map +1 -0
- package/chat/stream/stream.user.d.ts +49 -0
- package/chat/stream/stream.user.js +91 -0
- package/chat/stream/stream.user.js.map +1 -0
- package/core/_/api-error.d.ts +24 -0
- package/core/_/api-error.js +22 -0
- package/core/_/api-error.js.map +1 -0
- package/core/_/api-response.d.ts +25 -0
- package/core/_/api-response.js +22 -0
- package/core/_/api-response.js.map +1 -0
- package/core/_/cors-headers.d.ts +16 -0
- package/core/_/cors-headers.js +33 -0
- package/core/_/cors-headers.js.map +1 -0
- package/core/_/model.d.ts +31 -0
- package/core/_/model.js +3 -0
- package/core/_/model.js.map +1 -0
- package/core/_/service-request.d.ts +66 -0
- package/core/_/service-request.js +105 -0
- package/core/_/service-request.js.map +1 -0
- package/core/index.d.ts +10 -0
- package/core/index.js +12 -0
- package/core/index.js.map +1 -0
- package/deployment/_/serverless.d.ts +26 -0
- package/deployment/_/serverless.js +44 -0
- package/deployment/_/serverless.js.map +1 -0
- package/deployment/index.d.ts +2 -0
- package/deployment/index.js +6 -0
- package/deployment/index.js.map +1 -0
- package/endpoint-test-factory/_/test-factory.d.ts +45 -0
- package/endpoint-test-factory/_/test-factory.js +92 -0
- package/endpoint-test-factory/_/test-factory.js.map +1 -0
- package/endpoint-test-factory/index.d.ts +2 -0
- package/endpoint-test-factory/index.js +6 -0
- package/endpoint-test-factory/index.js.map +1 -0
- package/enums/index.d.ts +92 -0
- package/enums/index.js +3 -0
- package/enums/index.js.map +1 -0
- package/meet/index.d.ts +36 -0
- package/meet/index.js +59 -0
- package/meet/index.js.map +1 -0
- package/meet/twilio/enum/index.d.ts +6 -0
- package/meet/twilio/enum/index.js +11 -0
- package/meet/twilio/enum/index.js.map +1 -0
- package/meet/twilio/index.d.ts +5 -0
- package/meet/twilio/index.js +12 -0
- package/meet/twilio/index.js.map +1 -0
- package/meet/twilio/models/_/room.data.d.ts +6 -0
- package/meet/twilio/models/_/room.data.js +3 -0
- package/meet/twilio/models/_/room.data.js.map +1 -0
- package/meet/twilio/models/_/twilio.config.d.ts +29 -0
- package/meet/twilio/models/_/twilio.config.js +3 -0
- package/meet/twilio/models/_/twilio.config.js.map +1 -0
- package/meet/twilio/models/index.d.ts +3 -0
- package/meet/twilio/models/index.js +3 -0
- package/meet/twilio/models/index.js.map +1 -0
- package/meet/twilio/twilio.api.d.ts +28 -0
- package/meet/twilio/twilio.api.js +46 -0
- package/meet/twilio/twilio.api.js.map +1 -0
- package/meet/twilio/twilio.auth.d.ts +55 -0
- package/meet/twilio/twilio.auth.js +84 -0
- package/meet/twilio/twilio.auth.js.map +1 -0
- package/meet/twilio/twilio.base.d.ts +41 -0
- package/meet/twilio/twilio.base.js +54 -0
- package/meet/twilio/twilio.base.js.map +1 -0
- package/meet/twilio/twilio.room.d.ts +46 -0
- package/meet/twilio/twilio.room.js +125 -0
- package/meet/twilio/twilio.room.js.map +1 -0
- package/package.json +57 -0
- package/swagger/_/swagger.config.d.ts +21 -0
- package/swagger/_/swagger.config.js +3 -0
- package/swagger/_/swagger.config.js.map +1 -0
- package/swagger/_/swagger.d.ts +37 -0
- package/swagger/_/swagger.js +79 -0
- package/swagger/_/swagger.js.map +1 -0
- package/swagger/index.d.ts +3 -0
- package/swagger/index.js +6 -0
- package/swagger/index.js.map +1 -0
- package/types/index.d.ts +19 -0
- package/types/index.js +3 -0
- package/types/index.js.map +1 -0
- package/utils/_/encoder.d.ts +19 -0
- package/utils/_/encoder.js +28 -0
- package/utils/_/encoder.js.map +1 -0
- package/utils/_/encryptor.d.ts +26 -0
- package/utils/_/encryptor.js +68 -0
- package/utils/_/encryptor.js.map +1 -0
- package/utils/_/hasher.d.ts +25 -0
- package/utils/_/hasher.js +64 -0
- package/utils/_/hasher.js.map +1 -0
- package/utils/_/object-mapper.d.ts +12 -0
- package/utils/_/object-mapper.js +23 -0
- package/utils/_/object-mapper.js.map +1 -0
- package/utils/_/string-formatter.d.ts +34 -0
- package/utils/_/string-formatter.js +50 -0
- package/utils/_/string-formatter.js.map +1 -0
- package/utils/_/utc-date.d.ts +35 -0
- package/utils/_/utc-date.js +85 -0
- package/utils/_/utc-date.js.map +1 -0
- package/utils/index.d.ts +7 -0
- package/utils/index.js +16 -0
- package/utils/index.js.map +1 -0
- package/validators/_/checker.d.ts +62 -0
- package/validators/_/checker.js +99 -0
- package/validators/_/checker.js.map +1 -0
- package/validators/_/regex.d.ts +98 -0
- package/validators/_/regex.js +143 -0
- package/validators/_/regex.js.map +1 -0
- package/validators/index.d.ts +3 -0
- package/validators/index.js +8 -0
- package/validators/index.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.error.js","sourceRoot":"","sources":["../../../chat/stream/stream.error.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACH,MAAa,mBAAmB;IAI5B;;;;OAIG;IACH,YAAY,GAAW;QACnB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACvB,CAAC;CACJ;AAZD,kDAYC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=stream.media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.media.js","sourceRoot":"","sources":["../../../chat/stream/stream.media.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { StreamChat } from "stream-chat";
|
|
2
|
+
import { IChannelData } from "./models";
|
|
3
|
+
import { StreamBase } from "./stream.base";
|
|
4
|
+
/**
|
|
5
|
+
* Channel Api declarations
|
|
6
|
+
*/
|
|
7
|
+
interface IStreamMember {
|
|
8
|
+
/**
|
|
9
|
+
* Add Members to a specific channel
|
|
10
|
+
*/
|
|
11
|
+
inviteMembers(data: IChannelData): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Add new members into a specific channel. *
|
|
14
|
+
*/
|
|
15
|
+
addMembers(data: IChannelData): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Add new moderator into a specific channel.
|
|
18
|
+
*/
|
|
19
|
+
assignModerators(data: IChannelData): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Demote moderator on a specific channel.
|
|
22
|
+
*/
|
|
23
|
+
demoteModerators(data: IChannelData): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Remove Members to a specific channel
|
|
26
|
+
*/
|
|
27
|
+
removeMembers(data: IChannelData): Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
31
|
+
*/
|
|
32
|
+
export declare class StreamMember extends StreamBase implements IStreamMember {
|
|
33
|
+
/**
|
|
34
|
+
* Stream member constructor
|
|
35
|
+
*
|
|
36
|
+
* @param {StreamChat} server Stream API server
|
|
37
|
+
*/
|
|
38
|
+
constructor(server: StreamChat);
|
|
39
|
+
/**
|
|
40
|
+
* Add new members into a specific channel.
|
|
41
|
+
*
|
|
42
|
+
* @param {IChannelData} data channel data object
|
|
43
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
44
|
+
*/
|
|
45
|
+
inviteMembers(data: IChannelData): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Add new members into a specific channel.
|
|
48
|
+
*
|
|
49
|
+
* @param {IChannelData} data channel data object
|
|
50
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
51
|
+
*/
|
|
52
|
+
addMembers(data: IChannelData): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Add new moderator into a specific channel.
|
|
55
|
+
*
|
|
56
|
+
* @param {IChannelData} data channel data object
|
|
57
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
58
|
+
*/
|
|
59
|
+
assignModerators(data: IChannelData): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Add new members into a specific channel.
|
|
62
|
+
*
|
|
63
|
+
* @param {IChannelData} data channel data object
|
|
64
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
65
|
+
*/
|
|
66
|
+
demoteModerators(data: IChannelData): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Remove members into a specific channel.
|
|
69
|
+
*
|
|
70
|
+
* @param {IChannelData} data channel data object
|
|
71
|
+
* @returns {Promise<boolean>} promise of the result to remove members
|
|
72
|
+
*/
|
|
73
|
+
removeMembers(data: IChannelData): Promise<boolean>;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StreamMember = void 0;
|
|
13
|
+
const models_1 = require("./models");
|
|
14
|
+
const stream_base_1 = require("./stream.base");
|
|
15
|
+
/**
|
|
16
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
17
|
+
*/
|
|
18
|
+
class StreamMember extends stream_base_1.StreamBase {
|
|
19
|
+
// properties
|
|
20
|
+
/**
|
|
21
|
+
* Stream member constructor
|
|
22
|
+
*
|
|
23
|
+
* @param {StreamChat} server Stream API server
|
|
24
|
+
*/
|
|
25
|
+
constructor(server) {
|
|
26
|
+
super();
|
|
27
|
+
super.server = server;
|
|
28
|
+
}
|
|
29
|
+
// methods
|
|
30
|
+
/**
|
|
31
|
+
* Add new members into a specific channel.
|
|
32
|
+
*
|
|
33
|
+
* @param {IChannelData} data channel data object
|
|
34
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
35
|
+
*/
|
|
36
|
+
inviteMembers(data) {
|
|
37
|
+
const _super = Object.create(null, {
|
|
38
|
+
getChannelById: { get: () => super.getChannelById }
|
|
39
|
+
});
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
//Retrieve the channel
|
|
42
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
43
|
+
//get the channel from the response
|
|
44
|
+
const channel = rChannel[0];
|
|
45
|
+
//retrieve the data for members
|
|
46
|
+
const existingMemberCount = channel.data.member_count;
|
|
47
|
+
//Create the message if is necessary
|
|
48
|
+
let message = undefined;
|
|
49
|
+
//Add message text if is necessary
|
|
50
|
+
if (data.inviteMessage !== undefined) {
|
|
51
|
+
message = { text: data.inviteMessage, user_id: channel.data.created_by["id"] };
|
|
52
|
+
}
|
|
53
|
+
//Send the invite request to stream
|
|
54
|
+
const r = yield channel.inviteMembers(data.members, message);
|
|
55
|
+
//check the result
|
|
56
|
+
if (existingMemberCount == r.members.length) {
|
|
57
|
+
// error, did not add members
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
//Members invited successfully
|
|
61
|
+
return true;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Add new members into a specific channel.
|
|
66
|
+
*
|
|
67
|
+
* @param {IChannelData} data channel data object
|
|
68
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
69
|
+
*/
|
|
70
|
+
addMembers(data) {
|
|
71
|
+
const _super = Object.create(null, {
|
|
72
|
+
getChannelById: { get: () => super.getChannelById }
|
|
73
|
+
});
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
//Retrieve the channel
|
|
76
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
77
|
+
//get the channel from the response
|
|
78
|
+
const channel = rChannel[0];
|
|
79
|
+
//retrieve the data for members
|
|
80
|
+
const existingMemberCount = channel.data.member_count;
|
|
81
|
+
//Create the message if is necessary
|
|
82
|
+
let message = undefined;
|
|
83
|
+
//Add message text if is necessary
|
|
84
|
+
if (data.inviteMessage !== undefined) {
|
|
85
|
+
message = { text: data.inviteMessage, user_id: channel.data.created_by["id"] };
|
|
86
|
+
}
|
|
87
|
+
//Send the invite request to stream
|
|
88
|
+
const r = yield channel.addMembers(data.members, message);
|
|
89
|
+
//check the result
|
|
90
|
+
if (existingMemberCount == r.members.length) {
|
|
91
|
+
// error, did not add members
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
//Members invited successfully
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Add new moderator into a specific channel.
|
|
100
|
+
*
|
|
101
|
+
* @param {IChannelData} data channel data object
|
|
102
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
103
|
+
*/
|
|
104
|
+
assignModerators(data) {
|
|
105
|
+
const _super = Object.create(null, {
|
|
106
|
+
getChannelById: { get: () => super.getChannelById }
|
|
107
|
+
});
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
//Retrieve the channel
|
|
110
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
111
|
+
//get the channel from the response
|
|
112
|
+
const channel = rChannel[0];
|
|
113
|
+
const moderators = [];
|
|
114
|
+
data.members.forEach((member) => {
|
|
115
|
+
moderators.push({ user_id: member, channel_role: models_1.StreamDefaultChannelRole.channel_moderator });
|
|
116
|
+
});
|
|
117
|
+
const r = yield channel.assignRoles(moderators);
|
|
118
|
+
//Members invited successfully
|
|
119
|
+
return (r === null || r === void 0 ? void 0 : r.channel) !== undefined;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Add new members into a specific channel.
|
|
124
|
+
*
|
|
125
|
+
* @param {IChannelData} data channel data object
|
|
126
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
127
|
+
*/
|
|
128
|
+
demoteModerators(data) {
|
|
129
|
+
const _super = Object.create(null, {
|
|
130
|
+
getChannelById: { get: () => super.getChannelById }
|
|
131
|
+
});
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
//Retrieve the channel
|
|
134
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
135
|
+
//get the channel from the response
|
|
136
|
+
const channel = rChannel[0];
|
|
137
|
+
const moderators = [];
|
|
138
|
+
data.members.forEach((member) => {
|
|
139
|
+
moderators.push({ user_id: member, channel_role: models_1.StreamDefaultChannelRole.channel_member });
|
|
140
|
+
});
|
|
141
|
+
const r = yield channel.assignRoles(moderators);
|
|
142
|
+
//Members invited successfully
|
|
143
|
+
return (r === null || r === void 0 ? void 0 : r.channel) !== undefined;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Remove members into a specific channel.
|
|
148
|
+
*
|
|
149
|
+
* @param {IChannelData} data channel data object
|
|
150
|
+
* @returns {Promise<boolean>} promise of the result to remove members
|
|
151
|
+
*/
|
|
152
|
+
removeMembers(data) {
|
|
153
|
+
const _super = Object.create(null, {
|
|
154
|
+
getChannelById: { get: () => super.getChannelById }
|
|
155
|
+
});
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
//Retrieve the channel
|
|
158
|
+
const rChannel = yield _super.getChannelById.call(this, data.channelId);
|
|
159
|
+
//get the channel from the response
|
|
160
|
+
const channel = rChannel[0];
|
|
161
|
+
//retrieve the data for members
|
|
162
|
+
const existingMemberCount = channel.data.member_count;
|
|
163
|
+
//Send the remove member request to stream
|
|
164
|
+
const r = yield channel.removeMembers(data.members);
|
|
165
|
+
//check the result
|
|
166
|
+
if (existingMemberCount == r.members.length) {
|
|
167
|
+
// error, did not remove members
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
//Members removed successfully
|
|
171
|
+
return true;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.StreamMember = StreamMember;
|
|
176
|
+
//# sourceMappingURL=stream.member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.member.js","sourceRoot":"","sources":["../../../chat/stream/stream.member.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qCAA+E;AAE/E,+CAA2C;AAgC3C;;GAEG;AACH,MAAa,YAAa,SAAQ,wBAAU;IACxC,aAAa;IAEb;;;;OAIG;IACH,YAAY,MAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,UAAU;IAEV;;;;;OAKG;IACG,aAAa,CAAC,IAAkB;;;;;YAClC,sBAAsB;YACtB,MAAM,QAAQ,GAAG,MAAM,OAAM,cAAc,YAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5D,mCAAmC;YACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,+BAA+B;YAC/B,MAAM,mBAAmB,GAAW,OAAO,CAAC,IAAI,CAAC,YAAsB,CAAC;YACxE,oCAAoC;YACpC,IAAI,OAAO,GAAY,SAAS,CAAC;YACjC,kCAAkC;YAClC,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE;gBAClC,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,O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CAAC;QACpC,CAAC;KAAA;IAED;;;;;OAKG;IACG,aAAa,CAAC,IAAkB;;;;;YAClC,sBAAsB;YACtB,MAAM,QAAQ,GAAG,MAAM,OAAM,cAAc,YAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5D,mCAAmC;YACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,+BAA+B;YAC/B,MAAM,mBAAmB,GAAW,OAAO,CAAC,IAAI,CAAC,YAAsB,CAAC;YACxE,0CAA0C;YAC1C,MAAM,CAAC,GAA6B,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9E,kBAAkB;YAClB,IAAI,mBAAmB,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE;gBACzC,gCAAgC;gBAChC,OAAO,KAAK,CAAC;aAChB;YACD,8BAA8B;YAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AA9ID,oCA8IC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { MessageResponse, SearchAPIResponse, StreamChat } from "stream-chat";
|
|
2
|
+
import { StreamBase } from "./stream.base";
|
|
3
|
+
/**
|
|
4
|
+
* Messages Api declarations
|
|
5
|
+
*/
|
|
6
|
+
interface IStreamMessage {
|
|
7
|
+
/**
|
|
8
|
+
* Send a message through a specific channel
|
|
9
|
+
*/
|
|
10
|
+
send(channelId: string, messageText: string, userId?: string, custom?: object): Promise<MessageResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Delete a message
|
|
13
|
+
*/
|
|
14
|
+
delete(messageId: string, isHard: boolean): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Search messages by members
|
|
17
|
+
*/
|
|
18
|
+
search(userRef: string, keyword: string, limit?: number, offset?: number): Promise<SearchAPIResponse>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
22
|
+
*/
|
|
23
|
+
export declare class StreamMessage extends StreamBase implements IStreamMessage {
|
|
24
|
+
/**
|
|
25
|
+
* Stream message constructor
|
|
26
|
+
*
|
|
27
|
+
* @param {StreamChat} server Stream API server
|
|
28
|
+
*/
|
|
29
|
+
constructor(server: StreamChat);
|
|
30
|
+
/**
|
|
31
|
+
* Send a message through a specific channel
|
|
32
|
+
*
|
|
33
|
+
* @param {string} channelId channel id
|
|
34
|
+
* @param {string} messageText message text
|
|
35
|
+
* @param {string} userId user who send the message text
|
|
36
|
+
* @param {object} custom custom fields that needs to be part of the message
|
|
37
|
+
* @returns {Promise<MessageResponse>} promise of the result to send a message
|
|
38
|
+
*/
|
|
39
|
+
send(channelId: string, messageText: string, userId?: string, custom?: object): Promise<MessageResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* This will be delete a specific message from Stream
|
|
42
|
+
*
|
|
43
|
+
* @param {string} messageId channel id of the channel
|
|
44
|
+
* @param {boolean} isHard is Hard delete
|
|
45
|
+
* @returns {Promise<boolean>} promise of the result to delete channel
|
|
46
|
+
*/
|
|
47
|
+
delete(messageId: string, isHard?: boolean): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Search messages by members
|
|
50
|
+
*
|
|
51
|
+
* @param {string} userRef user ref to filter channels
|
|
52
|
+
* @param {string} keyword Text to be searched
|
|
53
|
+
* @param {number} limit The number of messages to return
|
|
54
|
+
* @param {number} offset The pagination offset.
|
|
55
|
+
* @returns {Promise<SearchAPIResponse>} return search object
|
|
56
|
+
*/
|
|
57
|
+
search(userRef: string, keyword: string, limit?: number, offset?: number): Promise<SearchAPIResponse>;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StreamMessage = void 0;
|
|
13
|
+
const stream_base_1 = require("./stream.base");
|
|
14
|
+
/**
|
|
15
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
16
|
+
*/
|
|
17
|
+
class StreamMessage extends stream_base_1.StreamBase {
|
|
18
|
+
// properties
|
|
19
|
+
/**
|
|
20
|
+
* Stream message constructor
|
|
21
|
+
*
|
|
22
|
+
* @param {StreamChat} server Stream API server
|
|
23
|
+
*/
|
|
24
|
+
constructor(server) {
|
|
25
|
+
super();
|
|
26
|
+
super.server = server;
|
|
27
|
+
}
|
|
28
|
+
// methods
|
|
29
|
+
/**
|
|
30
|
+
* Send a message through a specific channel
|
|
31
|
+
*
|
|
32
|
+
* @param {string} channelId channel id
|
|
33
|
+
* @param {string} messageText message text
|
|
34
|
+
* @param {string} userId user who send the message text
|
|
35
|
+
* @param {object} custom custom fields that needs to be part of the message
|
|
36
|
+
* @returns {Promise<MessageResponse>} promise of the result to send a message
|
|
37
|
+
*/
|
|
38
|
+
send(channelId, messageText, userId, custom) {
|
|
39
|
+
const _super = Object.create(null, {
|
|
40
|
+
getChannelById: { get: () => super.getChannelById }
|
|
41
|
+
});
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
let messageResponse = null;
|
|
44
|
+
//get the channel from stream
|
|
45
|
+
const rChannel = yield _super.getChannelById.call(this, channelId);
|
|
46
|
+
//verify if the channel exist
|
|
47
|
+
if (rChannel && rChannel.length > 0) {
|
|
48
|
+
//Retrieve the channel instance
|
|
49
|
+
const channel = rChannel[0];
|
|
50
|
+
//if the user id is undefined is a system message
|
|
51
|
+
userId = userId === undefined ? channel.data.created_by["id"] : userId;
|
|
52
|
+
//Create the Stream new message instance
|
|
53
|
+
const newMessage = { text: messageText, user_id: userId, custom: custom };
|
|
54
|
+
//Send the message
|
|
55
|
+
const r = yield channel.sendMessage(newMessage);
|
|
56
|
+
//Check the result
|
|
57
|
+
if (r.message !== undefined) {
|
|
58
|
+
messageResponse = r.message;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return messageResponse;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* This will be delete a specific message from Stream
|
|
66
|
+
*
|
|
67
|
+
* @param {string} messageId channel id of the channel
|
|
68
|
+
* @param {boolean} isHard is Hard delete
|
|
69
|
+
* @returns {Promise<boolean>} promise of the result to delete channel
|
|
70
|
+
*/
|
|
71
|
+
delete(messageId, isHard = false) {
|
|
72
|
+
const _super = Object.create(null, {
|
|
73
|
+
server: { get: () => super.server }
|
|
74
|
+
});
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
//Call the delete Message in stream
|
|
77
|
+
const destroy = yield _super.server.deleteMessage(messageId, isHard);
|
|
78
|
+
//Check the response
|
|
79
|
+
if (destroy.message === undefined) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
//Message deleted successfully
|
|
83
|
+
return true;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Search messages by members
|
|
88
|
+
*
|
|
89
|
+
* @param {string} userRef user ref to filter channels
|
|
90
|
+
* @param {string} keyword Text to be searched
|
|
91
|
+
* @param {number} limit The number of messages to return
|
|
92
|
+
* @param {number} offset The pagination offset.
|
|
93
|
+
* @returns {Promise<SearchAPIResponse>} return search object
|
|
94
|
+
*/
|
|
95
|
+
search(userRef, keyword, limit, offset) {
|
|
96
|
+
const _super = Object.create(null, {
|
|
97
|
+
server: { get: () => super.server }
|
|
98
|
+
});
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
//Create a filter to retrieve all messages where the members are included.
|
|
101
|
+
const filters = { members: { $in: [userRef] } };
|
|
102
|
+
//Message filter
|
|
103
|
+
const messageFilters = { text: { $q: keyword } };
|
|
104
|
+
//Retrieve messages
|
|
105
|
+
return _super.server.search(filters, messageFilters, {
|
|
106
|
+
limit: limit === undefined ? 10 : limit,
|
|
107
|
+
offset: offset === undefined ? 0 : offset
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.StreamMessage = StreamMessage;
|
|
113
|
+
//# sourceMappingURL=stream.message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.message.js","sourceRoot":"","sources":["../../../chat/stream/stream.message.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+CAA2C;AAsB3C;;GAEG;AACH,MAAa,aAAc,SAAQ,wBAAU;IACzC,aAAa;IAEb;;;;OAIG;IACH,YAAY,MAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC;IACD,UAAU;IAEV;;;;;;;;OAQG;IACG,IAAI,CAAC,SAAiB,EAAE,WAAmB,EAAE,MAAe,EAAE,MAAe;;;;;YAC/E,IAAI,eAAe,GAAoB,IAAI,CAAC;YAC5C,6BAA6B;YAC7B,MAAM,QAAQ,GAAG,MAAM,OAAM,cAAc,YAAC,SAAS,CAAC,CAAC;YACvD,6BAA6B;YAC7B,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACjC,+BAA+B;gBAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC5B,iDAAiD;gBACjD,MAAM,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC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KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;aAC5C,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AApFD,sCAoFC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { User, StreamChat, PartialUserUpdate, UserFilters } from "stream-chat";
|
|
2
|
+
import { IUserResponse } from "./models";
|
|
3
|
+
import { StreamBase } from "./stream.base";
|
|
4
|
+
/**
|
|
5
|
+
* Channel Api declarations
|
|
6
|
+
*/
|
|
7
|
+
interface IStreamUser {
|
|
8
|
+
/**
|
|
9
|
+
* Sync users to stream
|
|
10
|
+
*/
|
|
11
|
+
syncUser(users: User[]): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Partial users update
|
|
14
|
+
*/
|
|
15
|
+
partialUpdateUsers(usersUpdate: PartialUserUpdate[]): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
19
|
+
*/
|
|
20
|
+
export declare class StreamUser extends StreamBase implements IStreamUser {
|
|
21
|
+
/**
|
|
22
|
+
* Stream user constructor
|
|
23
|
+
*
|
|
24
|
+
* @param {StreamChat} server Stream API server
|
|
25
|
+
*/
|
|
26
|
+
constructor(server: StreamChat);
|
|
27
|
+
/**
|
|
28
|
+
* Sync a user list
|
|
29
|
+
*
|
|
30
|
+
* @param {User[]} users user stream list
|
|
31
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
32
|
+
*/
|
|
33
|
+
syncUser(users: User[]): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Partial users update
|
|
36
|
+
*
|
|
37
|
+
* @param {PartialUserUpdate[]} usersUpdate user stream list
|
|
38
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
39
|
+
*/
|
|
40
|
+
partialUpdateUsers(usersUpdate: PartialUserUpdate[]): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Query stream users.
|
|
43
|
+
*
|
|
44
|
+
* @param {IChannelData} data channel data object
|
|
45
|
+
* @returns {Promise<boolean>} promise of the result to remove members
|
|
46
|
+
*/
|
|
47
|
+
queryUsers(data: UserFilters): Promise<IUserResponse[]>;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StreamUser = void 0;
|
|
13
|
+
const stream_base_1 = require("./stream.base");
|
|
14
|
+
/**
|
|
15
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
16
|
+
*/
|
|
17
|
+
class StreamUser extends stream_base_1.StreamBase {
|
|
18
|
+
// properties
|
|
19
|
+
/**
|
|
20
|
+
* Stream user constructor
|
|
21
|
+
*
|
|
22
|
+
* @param {StreamChat} server Stream API server
|
|
23
|
+
*/
|
|
24
|
+
constructor(server) {
|
|
25
|
+
super();
|
|
26
|
+
super.server = server;
|
|
27
|
+
}
|
|
28
|
+
// methods
|
|
29
|
+
/**
|
|
30
|
+
* Sync a user list
|
|
31
|
+
*
|
|
32
|
+
* @param {User[]} users user stream list
|
|
33
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
34
|
+
*/
|
|
35
|
+
syncUser(users) {
|
|
36
|
+
const _super = Object.create(null, {
|
|
37
|
+
server: { get: () => super.server }
|
|
38
|
+
});
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
//Execute the sync
|
|
41
|
+
const r = yield _super.server.upsertUsers(users);
|
|
42
|
+
//check the result
|
|
43
|
+
if (r) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Partial users update
|
|
53
|
+
*
|
|
54
|
+
* @param {PartialUserUpdate[]} usersUpdate user stream list
|
|
55
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
56
|
+
*/
|
|
57
|
+
partialUpdateUsers(usersUpdate) {
|
|
58
|
+
const _super = Object.create(null, {
|
|
59
|
+
server: { get: () => super.server }
|
|
60
|
+
});
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
//Execute the sync
|
|
63
|
+
const r = yield _super.server.partialUpdateUsers(usersUpdate);
|
|
64
|
+
//check the result
|
|
65
|
+
if (r) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Query stream users.
|
|
75
|
+
*
|
|
76
|
+
* @param {IChannelData} data channel data object
|
|
77
|
+
* @returns {Promise<boolean>} promise of the result to remove members
|
|
78
|
+
*/
|
|
79
|
+
queryUsers(data) {
|
|
80
|
+
const _super = Object.create(null, {
|
|
81
|
+
server: { get: () => super.server }
|
|
82
|
+
});
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
//Query user information
|
|
85
|
+
const r = yield _super.server.queryUsers(data);
|
|
86
|
+
return r.users;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.StreamUser = StreamUser;
|
|
91
|
+
//# sourceMappingURL=stream.user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.user.js","sourceRoot":"","sources":["../../../chat/stream/stream.user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+CAA2C;AAiB3C;;GAEG;AACH,MAAa,UAAW,SAAQ,wBAAU;IACtC,aAAa;IAEb;;;;OAIG;IACH,YAAY,MAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,UAAU;IAEV;;;;;OAKG;IACG,QAAQ,CAAC,KAAa;;;;;YACxB,kBAAkB;YAClB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAChD,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACG,kBAAkB,CAAC,WAAgC;;;;;YACrD,kBAAkB;YAClB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC7D,kBAAkB;YAClB,IAAI,CAAC,EAAE;gBACH,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACG,UAAU,CAAC,IAAiB;;;;;YAC9B,wBAAwB;YACxB,MAAM,CAAC,GAAG,MAAM,OAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAE9C,OAAO,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC;KAAA;CACJ;AA7DD,gCA6DC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response error model declarations
|
|
3
|
+
*/
|
|
4
|
+
export interface IApiError {
|
|
5
|
+
status: number;
|
|
6
|
+
message: string | undefined;
|
|
7
|
+
details: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Implementation of response error model declarations
|
|
11
|
+
*/
|
|
12
|
+
export declare class ApiError implements IApiError {
|
|
13
|
+
status: number;
|
|
14
|
+
message: string | undefined;
|
|
15
|
+
details: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Error constructor
|
|
18
|
+
*
|
|
19
|
+
* @param {number} status error status number
|
|
20
|
+
* @param {string | undefined} message user friendly error message
|
|
21
|
+
* @param {string | undefined} details technical details (for logging)
|
|
22
|
+
*/
|
|
23
|
+
constructor(status?: number | undefined, message?: string | undefined, details?: string | undefined);
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of response error model declarations
|
|
6
|
+
*/
|
|
7
|
+
class ApiError {
|
|
8
|
+
/**
|
|
9
|
+
* Error constructor
|
|
10
|
+
*
|
|
11
|
+
* @param {number} status error status number
|
|
12
|
+
* @param {string | undefined} message user friendly error message
|
|
13
|
+
* @param {string | undefined} details technical details (for logging)
|
|
14
|
+
*/
|
|
15
|
+
constructor(status, message, details) {
|
|
16
|
+
this.status = status;
|
|
17
|
+
this.message = message ? message : undefined;
|
|
18
|
+
this.details = details ? details : undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ApiError = ApiError;
|
|
22
|
+
//# sourceMappingURL=api-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-error.js","sourceRoot":"","sources":["../../../core/_/api-error.ts"],"names":[],"mappings":";;;AAUA;;GAEG;AACH,MAAa,QAAQ;IAMjB;;;;;;OAMG;IACH,YAAY,MAA2B,EAAE,OAA4B,EAAE,OAA4B;QAC/F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAE,OAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;QACzD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAE,OAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,CAAC;CACJ;AAlBD,4BAkBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IApiError } from "./api-error";
|
|
2
|
+
/**
|
|
3
|
+
* Api response model declarations
|
|
4
|
+
*/
|
|
5
|
+
export interface IApiResponse<T> {
|
|
6
|
+
status: number;
|
|
7
|
+
result: T | undefined;
|
|
8
|
+
error: IApiError | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Implementation of api response model declarations
|
|
12
|
+
*/
|
|
13
|
+
export declare class ApiResponse<T> implements IApiResponse<T> {
|
|
14
|
+
status: number;
|
|
15
|
+
result: T | undefined;
|
|
16
|
+
error: IApiError | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* ApiResponse constructor
|
|
19
|
+
*
|
|
20
|
+
* @param {number} status response status
|
|
21
|
+
* @param {T | undefined} result response result as type T
|
|
22
|
+
* @param {IApiError | undefined} error response error
|
|
23
|
+
*/
|
|
24
|
+
constructor(status: number, result?: T | undefined, error?: IApiError | undefined);
|
|
25
|
+
}
|