@bwi-mentorspaces/application-utils-npm 0.0.5 → 0.0.7
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 -36
- package/chat/index.js +58 -58
- package/chat/stream/enum/index.d.ts +33 -27
- package/chat/stream/enum/index.js +41 -34
- package/chat/stream/enum/index.js.map +1 -1
- package/chat/stream/index.d.ts +9 -9
- package/chat/stream/index.js +17 -17
- package/chat/stream/models/_/channel.data.d.ts +19 -19
- package/chat/stream/models/_/channel.data.js +2 -2
- package/chat/stream/models/_/channel.member.d.ts +14 -14
- package/chat/stream/models/_/channel.member.js +11 -11
- package/chat/stream/models/_/channel.response.d.ts +8 -8
- package/chat/stream/models/_/channel.response.js +2 -2
- package/chat/stream/models/_/event.data.d.ts +16 -0
- package/chat/stream/models/_/event.data.js +4 -0
- package/chat/stream/models/_/event.data.js.map +1 -0
- package/chat/stream/models/_/message.response.d.ts +8 -8
- package/chat/stream/models/_/message.response.js +2 -2
- package/chat/stream/models/_/stream.config.d.ts +22 -22
- package/chat/stream/models/_/stream.config.js +2 -2
- package/chat/stream/models/_/user.response.d.ts +8 -8
- package/chat/stream/models/_/user.response.js +2 -2
- package/chat/stream/models/index.d.ts +9 -7
- package/chat/stream/models/index.js +5 -5
- package/chat/stream/models/index.js.map +1 -1
- package/chat/stream/stream.api.d.ts +63 -63
- package/chat/stream/stream.api.js +76 -76
- package/chat/stream/stream.auth.d.ts +70 -70
- package/chat/stream/stream.auth.js +80 -80
- package/chat/stream/stream.base.d.ts +56 -56
- package/chat/stream/stream.base.js +93 -93
- package/chat/stream/stream.channel.d.ts +132 -118
- package/chat/stream/stream.channel.js +306 -285
- package/chat/stream/stream.channel.js.map +1 -1
- package/chat/stream/stream.error.d.ts +19 -19
- package/chat/stream/stream.error.js +17 -17
- package/chat/stream/stream.member.d.ts +75 -75
- package/chat/stream/stream.member.js +175 -175
- package/chat/stream/stream.message.d.ts +59 -59
- package/chat/stream/stream.message.js +112 -112
- package/chat/stream/stream.user.d.ts +49 -49
- package/chat/stream/stream.user.js +90 -90
- package/core/_/api-error.d.ts +24 -24
- package/core/_/api-error.js +21 -21
- package/core/_/api-response.d.ts +25 -25
- package/core/_/api-response.js +21 -21
- package/core/_/cors-headers.d.ts +16 -16
- package/core/_/cors-headers.js +32 -32
- package/core/_/model.d.ts +39 -31
- package/core/_/model.js +2 -2
- package/core/_/service-request.d.ts +66 -66
- package/core/_/service-request.js +104 -104
- package/core/_/service-request.js.map +1 -1
- package/core/index.d.ts +10 -10
- package/core/index.js +11 -11
- package/deployment/_/serverless.d.ts +26 -26
- package/deployment/_/serverless.js +43 -43
- package/deployment/index.d.ts +2 -2
- package/deployment/index.js +5 -5
- package/endpoint-test-factory/_/test-factory.d.ts +45 -45
- package/endpoint-test-factory/_/test-factory.js +91 -91
- package/endpoint-test-factory/index.d.ts +2 -2
- package/endpoint-test-factory/index.js +5 -5
- package/enums/index.d.ts +92 -92
- package/enums/index.js +2 -2
- package/meet/index.d.ts +36 -36
- package/meet/index.js +58 -58
- package/meet/twilio/enum/index.d.ts +6 -6
- package/meet/twilio/enum/index.js +10 -10
- package/meet/twilio/index.d.ts +5 -5
- package/meet/twilio/index.js +11 -11
- package/meet/twilio/models/_/room.data.d.ts +6 -6
- package/meet/twilio/models/_/room.data.js +2 -2
- package/meet/twilio/models/_/twilio.config.d.ts +29 -29
- package/meet/twilio/models/_/twilio.config.js +2 -2
- package/meet/twilio/models/index.d.ts +3 -3
- package/meet/twilio/models/index.js +2 -2
- package/meet/twilio/twilio.api.d.ts +28 -28
- package/meet/twilio/twilio.api.js +45 -45
- package/meet/twilio/twilio.auth.d.ts +55 -55
- package/meet/twilio/twilio.auth.js +83 -83
- package/meet/twilio/twilio.base.d.ts +41 -41
- package/meet/twilio/twilio.base.js +53 -53
- package/meet/twilio/twilio.room.d.ts +46 -46
- package/meet/twilio/twilio.room.js +124 -124
- package/package.json +57 -57
- package/swagger/_/swagger.config.d.ts +21 -21
- package/swagger/_/swagger.config.js +2 -2
- package/swagger/_/swagger.d.ts +37 -37
- package/swagger/_/swagger.js +78 -78
- package/swagger/index.d.ts +3 -3
- package/swagger/index.js +5 -5
- package/types/index.d.ts +19 -19
- package/types/index.js +2 -2
- package/utils/_/encoder.d.ts +19 -19
- package/utils/_/encoder.js +27 -27
- package/utils/_/encryptor.d.ts +26 -26
- package/utils/_/encryptor.js +67 -67
- package/utils/_/hasher.d.ts +25 -25
- package/utils/_/hasher.js +63 -63
- package/utils/_/object-mapper.d.ts +12 -12
- package/utils/_/object-mapper.js +22 -22
- package/utils/_/string-formatter.d.ts +34 -34
- package/utils/_/string-formatter.js +49 -49
- package/utils/_/utc-date.d.ts +35 -35
- package/utils/_/utc-date.js +84 -84
- package/utils/index.d.ts +7 -7
- package/utils/index.js +15 -15
- package/validators/_/checker.d.ts +62 -62
- package/validators/_/checker.js +98 -98
- package/validators/_/regex.d.ts +98 -98
- package/validators/_/regex.js +142 -142
- package/validators/_/regex.js.map +1 -1
- package/validators/index.d.ts +3 -3
- package/validators/index.js +7 -7
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { Channel, StreamChat } from "stream-chat";
|
|
2
|
-
import { StreamAuth } from "./stream.auth";
|
|
3
|
-
/**
|
|
4
|
-
* BaseClient class
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class StreamBase {
|
|
7
|
-
private _server;
|
|
8
|
-
private _auth;
|
|
9
|
-
/**
|
|
10
|
-
* getter for stream chat instance
|
|
11
|
-
*
|
|
12
|
-
* @returns {StreamChat} stream chat instance
|
|
13
|
-
*/
|
|
14
|
-
get server(): StreamChat;
|
|
15
|
-
/**
|
|
16
|
-
* setter for stream chat instance
|
|
17
|
-
*
|
|
18
|
-
* @param {StreamChat} value stream chat instance
|
|
19
|
-
*/
|
|
20
|
-
set server(value: StreamChat);
|
|
21
|
-
/**
|
|
22
|
-
* getter for stream auth
|
|
23
|
-
*
|
|
24
|
-
* @returns {StreamAuth} stream auth instance
|
|
25
|
-
*/
|
|
26
|
-
get auth(): StreamAuth;
|
|
27
|
-
/**
|
|
28
|
-
* setter for stream auth instance
|
|
29
|
-
*
|
|
30
|
-
* @param {StreamAuth} value stream auth instance
|
|
31
|
-
*/
|
|
32
|
-
set auth(value: StreamAuth);
|
|
33
|
-
/**
|
|
34
|
-
* Get token for extended classes
|
|
35
|
-
*
|
|
36
|
-
* @param {string} userId user id
|
|
37
|
-
* @param {boolean} refresh refresh token
|
|
38
|
-
* @returns {string} returns the token value
|
|
39
|
-
*/
|
|
40
|
-
getToken(userId: string, refresh?: boolean): string;
|
|
41
|
-
/**
|
|
42
|
-
* Get channel instance by id
|
|
43
|
-
*
|
|
44
|
-
* @param {string} channelId channel id
|
|
45
|
-
* @returns {Channel} channel instance
|
|
46
|
-
*/
|
|
47
|
-
getChannelById(channelId: string): Promise<Channel[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Handles the exceptions generated by the StreamAPI *(check for token expiration)
|
|
50
|
-
*
|
|
51
|
-
* @param {number} httpError http error from Stream
|
|
52
|
-
* @param {number} httpCode http error code
|
|
53
|
-
* @returns {boolean} Will be return a string with a friendly message or a new token(depending of the case)
|
|
54
|
-
*/
|
|
55
|
-
static hasTokenExpired(httpError: number, httpCode: number): boolean;
|
|
56
|
-
}
|
|
1
|
+
import { Channel, StreamChat } from "stream-chat";
|
|
2
|
+
import { StreamAuth } from "./stream.auth";
|
|
3
|
+
/**
|
|
4
|
+
* BaseClient class
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class StreamBase {
|
|
7
|
+
private _server;
|
|
8
|
+
private _auth;
|
|
9
|
+
/**
|
|
10
|
+
* getter for stream chat instance
|
|
11
|
+
*
|
|
12
|
+
* @returns {StreamChat} stream chat instance
|
|
13
|
+
*/
|
|
14
|
+
get server(): StreamChat;
|
|
15
|
+
/**
|
|
16
|
+
* setter for stream chat instance
|
|
17
|
+
*
|
|
18
|
+
* @param {StreamChat} value stream chat instance
|
|
19
|
+
*/
|
|
20
|
+
set server(value: StreamChat);
|
|
21
|
+
/**
|
|
22
|
+
* getter for stream auth
|
|
23
|
+
*
|
|
24
|
+
* @returns {StreamAuth} stream auth instance
|
|
25
|
+
*/
|
|
26
|
+
get auth(): StreamAuth;
|
|
27
|
+
/**
|
|
28
|
+
* setter for stream auth instance
|
|
29
|
+
*
|
|
30
|
+
* @param {StreamAuth} value stream auth instance
|
|
31
|
+
*/
|
|
32
|
+
set auth(value: StreamAuth);
|
|
33
|
+
/**
|
|
34
|
+
* Get token for extended classes
|
|
35
|
+
*
|
|
36
|
+
* @param {string} userId user id
|
|
37
|
+
* @param {boolean} refresh refresh token
|
|
38
|
+
* @returns {string} returns the token value
|
|
39
|
+
*/
|
|
40
|
+
getToken(userId: string, refresh?: boolean): string;
|
|
41
|
+
/**
|
|
42
|
+
* Get channel instance by id
|
|
43
|
+
*
|
|
44
|
+
* @param {string} channelId channel id
|
|
45
|
+
* @returns {Channel} channel instance
|
|
46
|
+
*/
|
|
47
|
+
getChannelById(channelId: string): Promise<Channel[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Handles the exceptions generated by the StreamAPI *(check for token expiration)
|
|
50
|
+
*
|
|
51
|
+
* @param {number} httpError http error from Stream
|
|
52
|
+
* @param {number} httpCode http error code
|
|
53
|
+
* @returns {boolean} Will be return a string with a friendly message or a new token(depending of the case)
|
|
54
|
+
*/
|
|
55
|
+
static hasTokenExpired(httpError: number, httpCode: number): boolean;
|
|
56
|
+
}
|
|
@@ -1,94 +1,94 @@
|
|
|
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.StreamBase = void 0;
|
|
13
|
-
const enum_1 = require("./enum");
|
|
14
|
-
/**
|
|
15
|
-
* BaseClient class
|
|
16
|
-
*/
|
|
17
|
-
class StreamBase {
|
|
18
|
-
// getter / setter
|
|
19
|
-
/**
|
|
20
|
-
* getter for stream chat instance
|
|
21
|
-
*
|
|
22
|
-
* @returns {StreamChat} stream chat instance
|
|
23
|
-
*/
|
|
24
|
-
get server() {
|
|
25
|
-
return this._server;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* setter for stream chat instance
|
|
29
|
-
*
|
|
30
|
-
* @param {StreamChat} value stream chat instance
|
|
31
|
-
*/
|
|
32
|
-
set server(value) {
|
|
33
|
-
this._server = value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* getter for stream auth
|
|
37
|
-
*
|
|
38
|
-
* @returns {StreamAuth} stream auth instance
|
|
39
|
-
*/
|
|
40
|
-
get auth() {
|
|
41
|
-
return this._auth;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* setter for stream auth instance
|
|
45
|
-
*
|
|
46
|
-
* @param {StreamAuth} value stream auth instance
|
|
47
|
-
*/
|
|
48
|
-
set auth(value) {
|
|
49
|
-
this._auth = value;
|
|
50
|
-
}
|
|
51
|
-
// methods
|
|
52
|
-
/**
|
|
53
|
-
* Get token for extended classes
|
|
54
|
-
*
|
|
55
|
-
* @param {string} userId user id
|
|
56
|
-
* @param {boolean} refresh refresh token
|
|
57
|
-
* @returns {string} returns the token value
|
|
58
|
-
*/
|
|
59
|
-
getToken(userId, refresh) {
|
|
60
|
-
return this.auth.token(userId, refresh);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Get channel instance by id
|
|
64
|
-
*
|
|
65
|
-
* @param {string} channelId channel id
|
|
66
|
-
* @returns {Channel} channel instance
|
|
67
|
-
*/
|
|
68
|
-
getChannelById(channelId) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
//Create the filter
|
|
71
|
-
const filter = { type: enum_1.ChannelType.Team, id: { $eq: channelId } };
|
|
72
|
-
//return the result
|
|
73
|
-
return yield this._server.queryChannels(filter);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Handles the exceptions generated by the StreamAPI *(check for token expiration)
|
|
78
|
-
*
|
|
79
|
-
* @param {number} httpError http error from Stream
|
|
80
|
-
* @param {number} httpCode http error code
|
|
81
|
-
* @returns {boolean} Will be return a string with a friendly message or a new token(depending of the case)
|
|
82
|
-
*/
|
|
83
|
-
static hasTokenExpired(httpError, httpCode) {
|
|
84
|
-
//Check if the error belows an specific Authentication error code
|
|
85
|
-
if (httpError === 401 /* Unauthorized */ || httpError === 403 /* Forbidden */) {
|
|
86
|
-
//This is a token expired validation from API
|
|
87
|
-
if (httpCode == enum_1.ResponseCode.TokenExpired) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.StreamBase = StreamBase;
|
|
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.StreamBase = void 0;
|
|
13
|
+
const enum_1 = require("./enum");
|
|
14
|
+
/**
|
|
15
|
+
* BaseClient class
|
|
16
|
+
*/
|
|
17
|
+
class StreamBase {
|
|
18
|
+
// getter / setter
|
|
19
|
+
/**
|
|
20
|
+
* getter for stream chat instance
|
|
21
|
+
*
|
|
22
|
+
* @returns {StreamChat} stream chat instance
|
|
23
|
+
*/
|
|
24
|
+
get server() {
|
|
25
|
+
return this._server;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* setter for stream chat instance
|
|
29
|
+
*
|
|
30
|
+
* @param {StreamChat} value stream chat instance
|
|
31
|
+
*/
|
|
32
|
+
set server(value) {
|
|
33
|
+
this._server = value;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* getter for stream auth
|
|
37
|
+
*
|
|
38
|
+
* @returns {StreamAuth} stream auth instance
|
|
39
|
+
*/
|
|
40
|
+
get auth() {
|
|
41
|
+
return this._auth;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* setter for stream auth instance
|
|
45
|
+
*
|
|
46
|
+
* @param {StreamAuth} value stream auth instance
|
|
47
|
+
*/
|
|
48
|
+
set auth(value) {
|
|
49
|
+
this._auth = value;
|
|
50
|
+
}
|
|
51
|
+
// methods
|
|
52
|
+
/**
|
|
53
|
+
* Get token for extended classes
|
|
54
|
+
*
|
|
55
|
+
* @param {string} userId user id
|
|
56
|
+
* @param {boolean} refresh refresh token
|
|
57
|
+
* @returns {string} returns the token value
|
|
58
|
+
*/
|
|
59
|
+
getToken(userId, refresh) {
|
|
60
|
+
return this.auth.token(userId, refresh);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get channel instance by id
|
|
64
|
+
*
|
|
65
|
+
* @param {string} channelId channel id
|
|
66
|
+
* @returns {Channel} channel instance
|
|
67
|
+
*/
|
|
68
|
+
getChannelById(channelId) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
//Create the filter
|
|
71
|
+
const filter = { type: enum_1.ChannelType.Team, id: { $eq: channelId } };
|
|
72
|
+
//return the result
|
|
73
|
+
return yield this._server.queryChannels(filter);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Handles the exceptions generated by the StreamAPI *(check for token expiration)
|
|
78
|
+
*
|
|
79
|
+
* @param {number} httpError http error from Stream
|
|
80
|
+
* @param {number} httpCode http error code
|
|
81
|
+
* @returns {boolean} Will be return a string with a friendly message or a new token(depending of the case)
|
|
82
|
+
*/
|
|
83
|
+
static hasTokenExpired(httpError, httpCode) {
|
|
84
|
+
//Check if the error belows an specific Authentication error code
|
|
85
|
+
if (httpError === 401 /* Unauthorized */ || httpError === 403 /* Forbidden */) {
|
|
86
|
+
//This is a token expired validation from API
|
|
87
|
+
if (httpCode == enum_1.ResponseCode.TokenExpired) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.StreamBase = StreamBase;
|
|
94
94
|
//# sourceMappingURL=stream.base.js.map
|
|
@@ -1,118 +1,132 @@
|
|
|
1
|
-
import { ChannelAPIResponse, StreamChat, Channel, ChannelSort, UpdateChannelAPIResponse, ChannelFilters, ChannelOptions } from "stream-chat";
|
|
2
|
-
import { IChannelData } from "./models
|
|
3
|
-
import { StreamBase } from "./stream.base";
|
|
4
|
-
import { StreamAuth } from "./stream.auth";
|
|
5
|
-
/**
|
|
6
|
-
* Channel Api declarations
|
|
7
|
-
*/
|
|
8
|
-
interface IStreamChannel {
|
|
9
|
-
/**
|
|
10
|
-
* Create channel with optional data object
|
|
11
|
-
*/
|
|
12
|
-
create(data: IChannelData): Promise<ChannelAPIResponse>;
|
|
13
|
-
/**
|
|
14
|
-
* Check if exist a channel with specific members
|
|
15
|
-
*/
|
|
16
|
-
getByMembers(data: IChannelData): Promise<Channel[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Get channel by filter
|
|
19
|
-
*/
|
|
20
|
-
getChannel(filter: ChannelFilters): Promise<Channel[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Delete a specific channel from stream, this will be delete the data too.
|
|
23
|
-
*/
|
|
24
|
-
deleteChannel(channelId: string, isHard: boolean): Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Accept invited channel
|
|
27
|
-
*/
|
|
28
|
-
acceptInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
29
|
-
/**
|
|
30
|
-
* Reject invited channel
|
|
31
|
-
*/
|
|
32
|
-
rejectInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* Sync channel
|
|
35
|
-
*/
|
|
36
|
-
syncChannel(data: IChannelData): Promise<boolean>;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param {
|
|
67
|
-
* @returns {Promise<
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @param {
|
|
74
|
-
* @
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param {
|
|
90
|
-
* @
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* @
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* @
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
1
|
+
import { ChannelAPIResponse, StreamChat, Channel, ChannelSort, UpdateChannelAPIResponse, ChannelFilters, ChannelOptions, UserResponse, EventAPIResponse, DefaultGenerics } from "stream-chat";
|
|
2
|
+
import { IChannelData, IEventTypes, IEventTypesData } from "./models";
|
|
3
|
+
import { StreamBase } from "./stream.base";
|
|
4
|
+
import { StreamAuth } from "./stream.auth";
|
|
5
|
+
/**
|
|
6
|
+
* Channel Api declarations
|
|
7
|
+
*/
|
|
8
|
+
interface IStreamChannel {
|
|
9
|
+
/**
|
|
10
|
+
* Create channel with optional data object
|
|
11
|
+
*/
|
|
12
|
+
create(data: IChannelData): Promise<ChannelAPIResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Check if exist a channel with specific members
|
|
15
|
+
*/
|
|
16
|
+
getByMembers(data: IChannelData): Promise<Channel[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Get channel by filter
|
|
19
|
+
*/
|
|
20
|
+
getChannel(filter: ChannelFilters): Promise<Channel[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Delete a specific channel from stream, this will be delete the data too.
|
|
23
|
+
*/
|
|
24
|
+
deleteChannel(channelId: string, isHard: boolean): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Accept invited channel
|
|
27
|
+
*/
|
|
28
|
+
acceptInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Reject invited channel
|
|
31
|
+
*/
|
|
32
|
+
rejectInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Sync channel
|
|
35
|
+
*/
|
|
36
|
+
syncChannel(data: IChannelData): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Send event to channel
|
|
39
|
+
*/
|
|
40
|
+
sendChannelEvent<T extends IEventTypes>(channelId: string, eventType: T, user: UserResponse, customData?: IEventTypesData[T]): Promise<EventAPIResponse<DefaultGenerics>>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A class that provides methods to manage StreamAPI Channel
|
|
44
|
+
*/
|
|
45
|
+
export declare class StreamChannel extends StreamBase implements IStreamChannel {
|
|
46
|
+
/**
|
|
47
|
+
* Stream channel constructor
|
|
48
|
+
*
|
|
49
|
+
* @param {StreamAuth} auth Auth class
|
|
50
|
+
* @param {StreamChat} server Stream API server
|
|
51
|
+
*/
|
|
52
|
+
constructor(auth: StreamAuth, server: StreamChat);
|
|
53
|
+
/**
|
|
54
|
+
* Create channel
|
|
55
|
+
*
|
|
56
|
+
* @param {IChannelData} data channel data object
|
|
57
|
+
* @returns {ChannelAPIResponse} channel object response
|
|
58
|
+
*/
|
|
59
|
+
create(data: IChannelData): Promise<ChannelAPIResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Send event to channel
|
|
62
|
+
*
|
|
63
|
+
* @param {string} channelId the channel id
|
|
64
|
+
* @param {IEventTypes} eventType the event type
|
|
65
|
+
* @param {string} user user responsible for sent the event
|
|
66
|
+
* @param {IEventTypesData} customData the data to send with the event
|
|
67
|
+
* @returns {Promise<EventAPIResponse<DefaultGenerics>>} channel object response
|
|
68
|
+
*/
|
|
69
|
+
sendChannelEvent<T extends IEventTypes>(channelId: string, eventType: T, user: UserResponse, customData?: IEventTypesData[T]): Promise<EventAPIResponse<DefaultGenerics>>;
|
|
70
|
+
/**
|
|
71
|
+
* Add new members into a specific channel.
|
|
72
|
+
*
|
|
73
|
+
* @param {IChannelData} data channel data object
|
|
74
|
+
* @returns {Promise<boolean>} promise of the result to add members
|
|
75
|
+
*/
|
|
76
|
+
addMembers(data: IChannelData): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Check if exist a channel with specific members
|
|
79
|
+
*
|
|
80
|
+
* @param {IChannelData} data channel data object
|
|
81
|
+
* @returns {Promise<Channel[]>} channel response
|
|
82
|
+
*/
|
|
83
|
+
getByMembers(data: IChannelData): Promise<Channel[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Get channel by filter
|
|
86
|
+
*
|
|
87
|
+
* @param {ChannelFilters} filter filter parameters
|
|
88
|
+
* @param {ChannelSort} sort sort parameters
|
|
89
|
+
* @param {ChannelOptions} options options parameter
|
|
90
|
+
* @returns {Promise<Channel[]>} channel response
|
|
91
|
+
*/
|
|
92
|
+
getChannel(filter: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<Channel[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Allow to partial update some fields on stream channel
|
|
95
|
+
*
|
|
96
|
+
* @param {IChannelData} data channel data object
|
|
97
|
+
* @returns {Promise<UpdateChannelAPIResponse>} channel object response
|
|
98
|
+
*/
|
|
99
|
+
updateChannel(data: IChannelData): Promise<UpdateChannelAPIResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* This will be delete a specific channel from Stream
|
|
102
|
+
*
|
|
103
|
+
* @param {string} channelId channel id of the channel
|
|
104
|
+
* @param {boolean} isHard is Hard delete
|
|
105
|
+
* @returns {Promise<boolean>} promise of the result to delete channel
|
|
106
|
+
*/
|
|
107
|
+
deleteChannel(channelId: string, isHard?: boolean): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Accept invited channel
|
|
110
|
+
*
|
|
111
|
+
* @param {string} channelId channel id of the channel
|
|
112
|
+
* @param {string} userId user id from stream
|
|
113
|
+
* @returns {boolean} true / false
|
|
114
|
+
*/
|
|
115
|
+
acceptInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
116
|
+
/**
|
|
117
|
+
* Reject invited channel
|
|
118
|
+
*
|
|
119
|
+
* @param {string} channelId channel id of the channel
|
|
120
|
+
* @param {string} userId user id from stream
|
|
121
|
+
* @returns {boolean} true / false
|
|
122
|
+
*/
|
|
123
|
+
rejectInvite(channelId: string, userId: string): Promise<UpdateChannelAPIResponse>;
|
|
124
|
+
/**
|
|
125
|
+
* Sync a channel
|
|
126
|
+
*
|
|
127
|
+
* @param {IChannelData} data channel data
|
|
128
|
+
* @returns {Promise<boolean>} promise of the type boolean
|
|
129
|
+
*/
|
|
130
|
+
syncChannel(data: IChannelData): Promise<boolean>;
|
|
131
|
+
}
|
|
132
|
+
export {};
|