polfan-server-js-client 0.1.99928 → 0.1.99930
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/.idea/workspace.xml +35 -4
- package/build/index.js +30 -19
- package/build/index.js.map +1 -1
- package/build/types/AbstractChatClient.d.ts +7 -2
- package/build/types/Permissions.d.ts +8 -0
- package/build/types/WebApiChatClient.d.ts +2 -2
- package/build/types/WebSocketChatClient.d.ts +2 -2
- package/build/types/types/src/index.d.ts +8 -1
- package/build/types/types/src/schemes/BanObject.d.ts +11 -0
- package/build/types/types/src/schemes/LeaveReason.d.ts +9 -0
- package/build/types/types/src/schemes/commands/Ban.d.ts +8 -0
- package/build/types/types/src/schemes/commands/GetBans.d.ts +4 -0
- package/build/types/types/src/schemes/commands/Kick.d.ts +6 -0
- package/build/types/types/src/schemes/commands/Unban.d.ts +5 -0
- package/build/types/types/src/schemes/events/Bans.d.ts +6 -0
- package/build/types/types/src/schemes/events/Bye.d.ts +2 -1
- package/build/types/types/src/schemes/events/RoomLeft.d.ts +2 -0
- package/build/types/types/src/schemes/events/SpaceLeft.d.ts +2 -0
- package/package.json +1 -1
- package/src/AbstractChatClient.ts +8 -2
- package/src/Permissions.ts +2 -0
- package/src/WebApiChatClient.ts +7 -11
- package/src/WebSocketChatClient.ts +7 -7
- package/src/state-tracker/TopicHistoryWindow.ts +7 -1
- package/src/types/src/index.ts +14 -0
- package/src/types/src/schemes/BanObject.ts +12 -0
- package/src/types/src/schemes/LeaveReason.ts +10 -0
- package/src/types/src/schemes/commands/Ban.ts +9 -0
- package/src/types/src/schemes/commands/GetBans.ts +5 -0
- package/src/types/src/schemes/commands/Kick.ts +7 -0
- package/src/types/src/schemes/commands/Unban.ts +6 -0
- package/src/types/src/schemes/events/Bans.ts +7 -0
- package/src/types/src/schemes/events/Bye.ts +3 -1
- package/src/types/src/schemes/events/RoomLeft.ts +3 -0
- package/src/types/src/schemes/events/SpaceLeft.ts +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bye, GetSession, JoinSpace, Session, SpaceJoined, Error as ErrorType, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMemberUpdated, SpaceDeleted, SpaceMembers, SpaceRooms, NewRole, RoomDeleted, RoomJoined, RoomLeft, RoomMemberLeft, RoomMemberJoined, RoomMembers, NewRoom, NewTopic, TopicDeleted, NewMessage, GetPermissionOverwrites, GetComputedPermissions, LeaveSpace, CreateSpace, DeleteSpace, GetSpaceMembers, GetSpaceRooms, CreateRole, DeleteRole, AssignRole, DeassignRole, SetPermissionOverwrites, JoinRoom, LeaveRoom, CreateRoom, DeleteRoom, GetRoomMembers, CreateTopic, DeleteTopic, CreateMessage, Envelope, PermissionOverwrites, PermissionOverwritesUpdated, RoomMemberUpdated, UpdateRole, RoleUpdated, Ack, UserUpdated, UpdateRoom, RoomUpdated, UpdateSpace, SpaceUpdated, PermissionOverwriteTargets, GetPermissionOverwriteTargets, Owners, Ok, GetOwners, CreateOwner, RoleDeleted, FollowedTopicUpdated, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowTopic, UnfollowTopic, GetFollowedTopics, Messages, GetMessages, Topics, GetTopics, TopicUpdated, UpdateTopic, GetDiscoverableSpaces, DiscoverableSpaces, CreateEmoticon, DeleteEmoticon, GetEmoticons, Emoticons, EmoticonDeleted, NewEmoticon } from "./types/src/index";
|
|
1
|
+
import { Bye, GetSession, JoinSpace, Session, SpaceJoined, Error as ErrorType, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMemberUpdated, SpaceDeleted, SpaceMembers, SpaceRooms, NewRole, RoomDeleted, RoomJoined, RoomLeft, RoomMemberLeft, RoomMemberJoined, RoomMembers, NewRoom, NewTopic, TopicDeleted, NewMessage, GetPermissionOverwrites, GetComputedPermissions, LeaveSpace, CreateSpace, DeleteSpace, GetSpaceMembers, GetSpaceRooms, CreateRole, DeleteRole, AssignRole, DeassignRole, SetPermissionOverwrites, JoinRoom, LeaveRoom, CreateRoom, DeleteRoom, GetRoomMembers, CreateTopic, DeleteTopic, CreateMessage, Envelope, PermissionOverwrites, PermissionOverwritesUpdated, RoomMemberUpdated, UpdateRole, RoleUpdated, Ack, UserUpdated, UpdateRoom, RoomUpdated, UpdateSpace, SpaceUpdated, PermissionOverwriteTargets, GetPermissionOverwriteTargets, Owners, Ok, GetOwners, CreateOwner, RoleDeleted, FollowedTopicUpdated, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowTopic, UnfollowTopic, GetFollowedTopics, Messages, GetMessages, Topics, GetTopics, TopicUpdated, UpdateTopic, GetDiscoverableSpaces, DiscoverableSpaces, CreateEmoticon, DeleteEmoticon, GetEmoticons, Emoticons, EmoticonDeleted, NewEmoticon, Bans, GetBans, Ban, Unban, Kick } from "./types/src/index";
|
|
2
2
|
import { EventTarget } from "./EventTarget";
|
|
3
3
|
type ArrayOfPromiseResolvers = [(value: any) => void, (reason?: any) => void];
|
|
4
4
|
export declare abstract class AbstractChatClient extends EventTarget {
|
|
@@ -14,7 +14,7 @@ export declare abstract class AbstractChatClient extends EventTarget {
|
|
|
14
14
|
}
|
|
15
15
|
export type CommandResult<ResultT> = {
|
|
16
16
|
data?: ResultT;
|
|
17
|
-
error?:
|
|
17
|
+
error?: ErrorType;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Map of incoming events.
|
|
@@ -32,6 +32,7 @@ export type EventsMap = {
|
|
|
32
32
|
NewEmoticon: NewEmoticon;
|
|
33
33
|
EmoticonDeleted: EmoticonDeleted;
|
|
34
34
|
Emoticons: Emoticons;
|
|
35
|
+
Bans: Bans;
|
|
35
36
|
DiscoverableSpaces: DiscoverableSpaces;
|
|
36
37
|
SpaceJoined: SpaceJoined;
|
|
37
38
|
SpaceLeft: SpaceLeft;
|
|
@@ -81,6 +82,10 @@ export type CommandsMap = {
|
|
|
81
82
|
CreateEmoticon: [CreateEmoticon, EventsMap['NewEmoticon']];
|
|
82
83
|
DeleteEmoticon: [DeleteEmoticon, EventsMap['EmoticonDeleted']];
|
|
83
84
|
GetEmoticons: [GetEmoticons, EventsMap['Emoticons']];
|
|
85
|
+
GetBans: [GetBans, EventsMap['Bans']];
|
|
86
|
+
Ban: [Ban, EventsMap['Ok']];
|
|
87
|
+
Unban: [Unban, EventsMap['Ok']];
|
|
88
|
+
Kick: [Kick, EventsMap['Ok']];
|
|
84
89
|
GetDiscoverableSpaces: [GetDiscoverableSpaces, EventsMap['DiscoverableSpaces']];
|
|
85
90
|
JoinSpace: [JoinSpace, EventsMap['SpaceJoined']];
|
|
86
91
|
LeaveSpace: [LeaveSpace, EventsMap['SpaceLeft']];
|
|
@@ -70,6 +70,14 @@ export declare class Permissions {
|
|
|
70
70
|
value: number;
|
|
71
71
|
maxLayer: Layer;
|
|
72
72
|
};
|
|
73
|
+
ManageBan: {
|
|
74
|
+
value: number;
|
|
75
|
+
maxLayer: Layer;
|
|
76
|
+
};
|
|
77
|
+
Kick: {
|
|
78
|
+
value: number;
|
|
79
|
+
maxLayer: Layer;
|
|
80
|
+
};
|
|
73
81
|
};
|
|
74
82
|
static getNames(): (keyof typeof this.list)[];
|
|
75
83
|
static getByName(name: keyof typeof this.list): PermissionDefinition | undefined;
|
|
@@ -2,10 +2,10 @@ import { AbstractChatClient, CommandResult, CommandsMap } from "./AbstractChatCl
|
|
|
2
2
|
import { ObservableInterface } from "./EventTarget";
|
|
3
3
|
export interface WebApiChatClientOptions {
|
|
4
4
|
url: string;
|
|
5
|
-
token
|
|
6
|
-
temporaryNick?: string;
|
|
5
|
+
token: string;
|
|
7
6
|
attemptsToSend?: number;
|
|
8
7
|
attemptDelayMs?: number;
|
|
8
|
+
queryParams?: Record<string, string>;
|
|
9
9
|
}
|
|
10
10
|
declare enum WebApiChatClientEvent {
|
|
11
11
|
message = "message",
|
|
@@ -4,11 +4,11 @@ import { ChatStateTracker } from "./state-tracker/ChatStateTracker";
|
|
|
4
4
|
import { Envelope } from "./types/src";
|
|
5
5
|
export interface WebSocketClientOptions {
|
|
6
6
|
url: string;
|
|
7
|
-
token
|
|
8
|
-
temporaryNick?: string;
|
|
7
|
+
token: string;
|
|
9
8
|
connectingTimeoutMs?: number;
|
|
10
9
|
awaitQueueSendDelayMs?: number;
|
|
11
10
|
stateTracking?: boolean;
|
|
11
|
+
queryParams?: Record<string, string>;
|
|
12
12
|
}
|
|
13
13
|
declare enum WebSocketChatClientEvent {
|
|
14
14
|
connect = "connect",
|
|
@@ -100,4 +100,11 @@ import { DeleteEmoticon } from "./schemes/commands/DeleteEmoticon";
|
|
|
100
100
|
import { NewEmoticon } from "./schemes/events/NewEmoticon";
|
|
101
101
|
import { EmoticonDeleted } from "./schemes/events/EmoticonDeleted";
|
|
102
102
|
import { PermissionOverwritesTarget } from "./schemes/PermissionOverwritesTarget";
|
|
103
|
-
|
|
103
|
+
import { Ban } from "./schemes/commands/Ban";
|
|
104
|
+
import { Unban } from "./schemes/commands/Unban";
|
|
105
|
+
import { GetBans } from "./schemes/commands/GetBans";
|
|
106
|
+
import { BanObject } from "./schemes/BanObject";
|
|
107
|
+
import { Bans } from "./schemes/events/Bans";
|
|
108
|
+
import { Kick } from "./schemes/commands/Kick";
|
|
109
|
+
import { LeaveReason } from "./schemes/LeaveReason";
|
|
110
|
+
export { Envelope, Message, MessageType, Role, Room, RoomFlag, RoomType, RoomMember, RoomSummary, Space, SpaceMember, Topic, FollowedTopic, User, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, BanObject, LeaveReason, Bye, Error, Messages, NewMessage, NewRole, NewRoom, NewTopic, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowedTopicUpdated, ComputedPermissions, PermissionOverwrites, PermissionOverwritesUpdated, RoleDeleted, RoleUpdated, RoomDeleted, RoomUpdated, RoomJoined, RoomLeft, RoomMemberJoined, RoomMemberLeft, RoomMembers, RoomMemberUpdated, UserUpdated, Session, SpaceDeleted, SpaceUpdated, SpaceJoined, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMembers, SpaceMemberUpdated, SpaceRooms, TopicDeleted, TopicUpdated, PermissionOverwriteTargets, Owners, Ok, DiscoverableSpaces, Emoticons, EmoticonDeleted, NewEmoticon, Bans, AssignRole, GetMessages, CreateMessage, Ack, CreateRole, CreateRoom, CreateSpace, CreateTopic, FollowTopic, UnfollowTopic, GetFollowedTopics, DeassignRole, DeleteRole, DeleteRoom, DeleteSpace, DeleteTopic, SetPermissionOverwrites, GetPermissionOverwrites, GetComputedPermissions, GetRoomMembers, GetSession, GetSpaceMembers, GetSpaceRooms, JoinRoom, JoinSpace, LeaveRoom, LeaveSpace, UpdateRole, UpdateSpace, UpdateRoom, UpdateTopic, GetPermissionOverwriteTargets, CreateOwner, DeleteOwner, GetOwners, Topics, GetTopics, GetDiscoverableSpaces, GetEmoticons, CreateEmoticon, DeleteEmoticon, Ban, Unban, GetBans, Kick, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { User } from "./User";
|
|
2
|
+
import { ChatLocation } from "./ChatLocation";
|
|
3
|
+
export interface BanObject {
|
|
4
|
+
bannedUser: User;
|
|
5
|
+
banningUser?: User;
|
|
6
|
+
location: ChatLocation;
|
|
7
|
+
reason: string;
|
|
8
|
+
diagnosticId: string;
|
|
9
|
+
expiresAt?: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BanObject } from "./BanObject";
|
|
2
|
+
import { Error as ErrorObject } from "./events/Error";
|
|
3
|
+
export interface LeaveReason {
|
|
4
|
+
type: 'Leave' | 'Ban' | 'Kick' | 'Service' | 'Error';
|
|
5
|
+
ban?: BanObject;
|
|
6
|
+
kick?: string;
|
|
7
|
+
service?: string;
|
|
8
|
+
error?: ErrorObject;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -82,9 +82,10 @@ import {
|
|
|
82
82
|
GetEmoticons,
|
|
83
83
|
Emoticons,
|
|
84
84
|
EmoticonDeleted,
|
|
85
|
-
NewEmoticon,
|
|
85
|
+
NewEmoticon, Bans, GetBans, Ban, Unban, Kick,
|
|
86
86
|
} from "./types/src/index";
|
|
87
87
|
import {EventTarget} from "./EventTarget";
|
|
88
|
+
import {ErrorObject} from "css-minimizer-webpack-plugin";
|
|
88
89
|
|
|
89
90
|
type ArrayOfPromiseResolvers = [(value: any) => void, (reason?: any) => void];
|
|
90
91
|
|
|
@@ -139,7 +140,7 @@ export abstract class AbstractChatClient extends EventTarget {
|
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
export type CommandResult<ResultT> = {data?: ResultT, error?:
|
|
143
|
+
export type CommandResult<ResultT> = {data?: ResultT, error?: ErrorType};
|
|
143
144
|
|
|
144
145
|
/**
|
|
145
146
|
* Map of incoming events.
|
|
@@ -158,6 +159,7 @@ export type EventsMap = {
|
|
|
158
159
|
NewEmoticon: NewEmoticon,
|
|
159
160
|
EmoticonDeleted: EmoticonDeleted,
|
|
160
161
|
Emoticons: Emoticons,
|
|
162
|
+
Bans: Bans,
|
|
161
163
|
// Space events
|
|
162
164
|
DiscoverableSpaces: DiscoverableSpaces,
|
|
163
165
|
SpaceJoined: SpaceJoined,
|
|
@@ -212,6 +214,10 @@ export type CommandsMap = {
|
|
|
212
214
|
CreateEmoticon: [CreateEmoticon, EventsMap['NewEmoticon']],
|
|
213
215
|
DeleteEmoticon: [DeleteEmoticon, EventsMap['EmoticonDeleted']],
|
|
214
216
|
GetEmoticons: [GetEmoticons, EventsMap['Emoticons']],
|
|
217
|
+
GetBans: [GetBans, EventsMap['Bans']],
|
|
218
|
+
Ban: [Ban, EventsMap['Ok']],
|
|
219
|
+
Unban: [Unban, EventsMap['Ok']],
|
|
220
|
+
Kick: [Kick, EventsMap['Ok']],
|
|
215
221
|
// Space commands
|
|
216
222
|
GetDiscoverableSpaces: [GetDiscoverableSpaces, EventsMap['DiscoverableSpaces']],
|
|
217
223
|
JoinSpace: [JoinSpace, EventsMap['SpaceJoined']],
|
package/src/Permissions.ts
CHANGED
|
@@ -27,6 +27,8 @@ export class Permissions {
|
|
|
27
27
|
ManageSpaceRooms: {value: 1 << 12, maxLayer: Layer.Space},
|
|
28
28
|
CreateEmoticons: {value: 1 << 13, maxLayer: Layer.Space},
|
|
29
29
|
ManageEmoticon: {value: 1 << 14, maxLayer: Layer.Space},
|
|
30
|
+
ManageBan: {value: 1 << 15, maxLayer: Layer.Room},
|
|
31
|
+
Kick: {value: 1 << 16, maxLayer: Layer.Room},
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
public static getNames(): (keyof typeof this.list)[] {
|
package/src/WebApiChatClient.ts
CHANGED
|
@@ -4,10 +4,10 @@ import {Envelope} from "./types/src";
|
|
|
4
4
|
|
|
5
5
|
export interface WebApiChatClientOptions {
|
|
6
6
|
url: string;
|
|
7
|
-
token
|
|
8
|
-
temporaryNick?: string;
|
|
7
|
+
token: string;
|
|
9
8
|
attemptsToSend?: number;
|
|
10
9
|
attemptDelayMs?: number;
|
|
10
|
+
queryParams?: Record<string, string>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
enum WebApiChatClientEvent {
|
|
@@ -23,9 +23,6 @@ export class WebApiChatClient extends AbstractChatClient implements ObservableIn
|
|
|
23
23
|
|
|
24
24
|
public constructor(private readonly options: WebApiChatClientOptions) {
|
|
25
25
|
super();
|
|
26
|
-
if (!this.options.token && !this.options.temporaryNick) {
|
|
27
|
-
throw new Error('Token or temporary nick is required');
|
|
28
|
-
}
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
public async send<CommandType extends keyof CommandsMap>(commandType: CommandType, commandData: CommandsMap[CommandType][0]):
|
|
@@ -78,13 +75,12 @@ export class WebApiChatClient extends AbstractChatClient implements ObservableIn
|
|
|
78
75
|
Accept: 'application/json'
|
|
79
76
|
};
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
78
|
+
headers.Authorization = `Bearer ${this.options.token}`;
|
|
79
|
+
|
|
80
|
+
const params = new URLSearchParams(this.options.queryParams ?? {});
|
|
81
|
+
const url = `${this.options.url}${params ? '?' + params : ''}`;
|
|
86
82
|
|
|
87
|
-
fetch(
|
|
83
|
+
fetch(url, {
|
|
88
84
|
headers,
|
|
89
85
|
body: bodyJson,
|
|
90
86
|
method: 'POST',
|
|
@@ -5,11 +5,11 @@ import {Envelope} from "./types/src";
|
|
|
5
5
|
|
|
6
6
|
export interface WebSocketClientOptions {
|
|
7
7
|
url: string;
|
|
8
|
-
token
|
|
9
|
-
temporaryNick?: string;
|
|
8
|
+
token: string;
|
|
10
9
|
connectingTimeoutMs?: number;
|
|
11
10
|
awaitQueueSendDelayMs?: number;
|
|
12
11
|
stateTracking?: boolean;
|
|
12
|
+
queryParams?: Record<string, string>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
enum WebSocketChatClientEvent {
|
|
@@ -31,17 +31,16 @@ export class WebSocketChatClient extends AbstractChatClient implements Observabl
|
|
|
31
31
|
|
|
32
32
|
public constructor(private readonly options: WebSocketClientOptions) {
|
|
33
33
|
super();
|
|
34
|
-
if (!this.options.token && !this.options.temporaryNick) {
|
|
35
|
-
throw new Error('Token or temporary nick is required');
|
|
36
|
-
}
|
|
37
34
|
if (this.options.stateTracking ?? true) {
|
|
38
35
|
this.state = new ChatStateTracker(this);
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
public async connect(): Promise<void> {
|
|
43
|
-
const
|
|
44
|
-
|
|
40
|
+
const params = new URLSearchParams(this.options.queryParams ?? {});
|
|
41
|
+
params.set('token', this.options.token);
|
|
42
|
+
|
|
43
|
+
this.ws = new WebSocket(`${this.options.url}?${params}`);
|
|
45
44
|
this.ws.onclose = ev => this.onClose(ev);
|
|
46
45
|
this.ws.onmessage = ev => this.onMessage(ev);
|
|
47
46
|
this.connectingTimeoutId = setTimeout(
|
|
@@ -49,6 +48,7 @@ export class WebSocketChatClient extends AbstractChatClient implements Observabl
|
|
|
49
48
|
this.options.connectingTimeoutMs ?? 10000
|
|
50
49
|
);
|
|
51
50
|
this.authenticated = false;
|
|
51
|
+
|
|
52
52
|
return new Promise((...args) => this.authenticatedResolvers = args);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -221,7 +221,13 @@ export class TopicHistoryWindow extends TraversableRemoteCollection<Message> {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
private handleSession(ev: Session): void {
|
|
224
|
-
|
|
224
|
+
const rooms = ev.state.rooms;
|
|
225
|
+
|
|
226
|
+
if (rooms.find(room => room.id === this.roomId)) {
|
|
227
|
+
this.resetToLatest();
|
|
228
|
+
} else {
|
|
229
|
+
this.deleteAll();
|
|
230
|
+
}
|
|
225
231
|
}
|
|
226
232
|
|
|
227
233
|
protected async fetchItemsAfter(): Promise<Message[] | null> {
|
package/src/types/src/index.ts
CHANGED
|
@@ -100,6 +100,13 @@ import {DeleteEmoticon} from "./schemes/commands/DeleteEmoticon";
|
|
|
100
100
|
import {NewEmoticon} from "./schemes/events/NewEmoticon";
|
|
101
101
|
import {EmoticonDeleted} from "./schemes/events/EmoticonDeleted";
|
|
102
102
|
import {PermissionOverwritesTarget} from "./schemes/PermissionOverwritesTarget";
|
|
103
|
+
import {Ban} from "./schemes/commands/Ban";
|
|
104
|
+
import {Unban} from "./schemes/commands/Unban";
|
|
105
|
+
import {GetBans} from "./schemes/commands/GetBans";
|
|
106
|
+
import {BanObject} from "./schemes/BanObject";
|
|
107
|
+
import {Bans} from "./schemes/events/Bans";
|
|
108
|
+
import {Kick} from "./schemes/commands/Kick";
|
|
109
|
+
import {LeaveReason} from "./schemes/LeaveReason";
|
|
103
110
|
|
|
104
111
|
export {
|
|
105
112
|
// objects
|
|
@@ -124,6 +131,8 @@ export {
|
|
|
124
131
|
SpaceDiscoverable,
|
|
125
132
|
Emoticon,
|
|
126
133
|
PermissionOverwritesTarget,
|
|
134
|
+
BanObject,
|
|
135
|
+
LeaveReason,
|
|
127
136
|
// events
|
|
128
137
|
Bye,
|
|
129
138
|
Error,
|
|
@@ -169,6 +178,7 @@ export {
|
|
|
169
178
|
Emoticons,
|
|
170
179
|
EmoticonDeleted,
|
|
171
180
|
NewEmoticon,
|
|
181
|
+
Bans,
|
|
172
182
|
// commands
|
|
173
183
|
AssignRole,
|
|
174
184
|
GetMessages,
|
|
@@ -211,4 +221,8 @@ export {
|
|
|
211
221
|
GetEmoticons,
|
|
212
222
|
CreateEmoticon,
|
|
213
223
|
DeleteEmoticon,
|
|
224
|
+
Ban,
|
|
225
|
+
Unban,
|
|
226
|
+
GetBans,
|
|
227
|
+
Kick,
|
|
214
228
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {User} from "./User";
|
|
2
|
+
import {ChatLocation} from "./ChatLocation";
|
|
3
|
+
|
|
4
|
+
export interface BanObject {
|
|
5
|
+
bannedUser: User;
|
|
6
|
+
banningUser?: User;
|
|
7
|
+
location: ChatLocation;
|
|
8
|
+
reason: string;
|
|
9
|
+
diagnosticId: string;
|
|
10
|
+
expiresAt?: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {BanObject} from "./BanObject";
|
|
2
|
+
import {Error as ErrorObject} from "./events/Error"
|
|
3
|
+
|
|
4
|
+
export interface LeaveReason {
|
|
5
|
+
type: 'Leave' | 'Ban' | 'Kick' | 'Service' | 'Error';
|
|
6
|
+
ban?: BanObject;
|
|
7
|
+
kick?: string;
|
|
8
|
+
service?: string;
|
|
9
|
+
error?: ErrorObject;
|
|
10
|
+
}
|