polfan-server-js-client 0.1.99927 → 0.1.99929

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.
Files changed (34) hide show
  1. package/.idea/workspace.xml +59 -9
  2. package/build/index.js +31 -20
  3. package/build/index.js.map +1 -1
  4. package/build/types/AbstractChatClient.d.ts +6 -1
  5. package/build/types/Permissions.d.ts +8 -0
  6. package/build/types/WebApiChatClient.d.ts +2 -2
  7. package/build/types/WebSocketChatClient.d.ts +2 -2
  8. package/build/types/types/src/index.d.ts +8 -1
  9. package/build/types/types/src/schemes/BanObject.d.ts +11 -0
  10. package/build/types/types/src/schemes/LeaveReason.d.ts +6 -0
  11. package/build/types/types/src/schemes/commands/Ban.d.ts +8 -0
  12. package/build/types/types/src/schemes/commands/GetBans.d.ts +4 -0
  13. package/build/types/types/src/schemes/commands/Kick.d.ts +6 -0
  14. package/build/types/types/src/schemes/commands/Unban.d.ts +5 -0
  15. package/build/types/types/src/schemes/events/Bans.d.ts +6 -0
  16. package/build/types/types/src/schemes/events/RoomLeft.d.ts +2 -0
  17. package/build/types/types/src/schemes/events/SpaceLeft.d.ts +2 -0
  18. package/package.json +1 -1
  19. package/src/AbstractChatClient.ts +6 -1
  20. package/src/Permissions.ts +2 -0
  21. package/src/WebApiChatClient.ts +7 -11
  22. package/src/WebSocketChatClient.ts +7 -7
  23. package/src/state-tracker/PermissionsManager.ts +1 -1
  24. package/src/state-tracker/TopicHistoryWindow.ts +7 -1
  25. package/src/types/src/index.ts +14 -0
  26. package/src/types/src/schemes/BanObject.ts +12 -0
  27. package/src/types/src/schemes/LeaveReason.ts +7 -0
  28. package/src/types/src/schemes/commands/Ban.ts +9 -0
  29. package/src/types/src/schemes/commands/GetBans.ts +5 -0
  30. package/src/types/src/schemes/commands/Kick.ts +7 -0
  31. package/src/types/src/schemes/commands/Unban.ts +6 -0
  32. package/src/types/src/schemes/events/Bans.ts +7 -0
  33. package/src/types/src/schemes/events/RoomLeft.ts +3 -0
  34. 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 {
@@ -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?: string;
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?: string;
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
- export { Envelope, Message, MessageType, Role, Room, RoomFlag, RoomType, RoomMember, RoomSummary, Space, SpaceMember, Topic, FollowedTopic, User, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, 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, 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, };
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,6 @@
1
+ import { BanObject } from "./BanObject";
2
+ export interface LeaveReason {
3
+ type: 'Leave' | 'Ban' | 'Kick';
4
+ ban?: BanObject;
5
+ kick?: string;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ export interface Ban {
3
+ userId: string;
4
+ location: ChatLocation;
5
+ reason: string;
6
+ expiresAt?: string;
7
+ notify?: boolean;
8
+ }
@@ -0,0 +1,4 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ export interface GetBans {
3
+ location: ChatLocation;
4
+ }
@@ -0,0 +1,6 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ export interface Kick {
3
+ userId: string;
4
+ location: ChatLocation;
5
+ reason: string;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ export interface Unban {
3
+ userId: string;
4
+ location: ChatLocation;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ import { BanObject } from "../BanObject";
3
+ export interface Bans {
4
+ location: ChatLocation;
5
+ bans: BanObject[];
6
+ }
@@ -1,3 +1,5 @@
1
+ import { LeaveReason } from "../LeaveReason";
1
2
  export interface RoomLeft {
2
3
  id: string;
4
+ reason: LeaveReason;
3
5
  }
@@ -1,3 +1,5 @@
1
+ import { LeaveReason } from "../LeaveReason";
1
2
  export interface SpaceLeft {
2
3
  id: string;
4
+ reason: LeaveReason;
3
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.1.99927",
3
+ "version": "0.1.99929",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -82,7 +82,7 @@ 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
88
 
@@ -158,6 +158,7 @@ export type EventsMap = {
158
158
  NewEmoticon: NewEmoticon,
159
159
  EmoticonDeleted: EmoticonDeleted,
160
160
  Emoticons: Emoticons,
161
+ Bans: Bans,
161
162
  // Space events
162
163
  DiscoverableSpaces: DiscoverableSpaces,
163
164
  SpaceJoined: SpaceJoined,
@@ -212,6 +213,10 @@ export type CommandsMap = {
212
213
  CreateEmoticon: [CreateEmoticon, EventsMap['NewEmoticon']],
213
214
  DeleteEmoticon: [DeleteEmoticon, EventsMap['EmoticonDeleted']],
214
215
  GetEmoticons: [GetEmoticons, EventsMap['Emoticons']],
216
+ GetBans: [GetBans, EventsMap['Bans']],
217
+ Ban: [Ban, EventsMap['Ok']],
218
+ Unban: [Unban, EventsMap['Ok']],
219
+ Kick: [Kick, EventsMap['Ok']],
215
220
  // Space commands
216
221
  GetDiscoverableSpaces: [GetDiscoverableSpaces, EventsMap['DiscoverableSpaces']],
217
222
  JoinSpace: [JoinSpace, EventsMap['SpaceJoined']],
@@ -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)[] {
@@ -4,10 +4,10 @@ import {Envelope} from "./types/src";
4
4
 
5
5
  export interface WebApiChatClientOptions {
6
6
  url: string;
7
- token?: string;
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
- if (this.options.token) {
82
- headers.Authorization = `Bearer ${this.options.token}`;
83
- } else if (this.options.temporaryNick) {
84
- headers.Authorization = `Temp ${this.options.temporaryNick}`;
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(this.options.url, {
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?: string;
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 authString = this.options.token ? `token=${this.options.token}` : `nick=${this.options.temporaryNick}`;
44
- this.ws = new WebSocket(`${this.options.url}?${authString}`);
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
 
@@ -20,7 +20,7 @@ import {PromiseRegistry} from "./AsyncUtils";
20
20
  const getOvId = (
21
21
  location: ChatLocation,
22
22
  target?: PermissionOverwritesTarget,
23
- ) => [location.spaceId, location.roomId, location.topicId, target.type, target.userId, target.roleId].filter(Boolean).join('/');
23
+ ) => [location.spaceId, location.roomId, location.topicId, target?.type, target?.userId, target?.roleId].filter(Boolean).join('/');
24
24
 
25
25
  const getOvIdByObject
26
26
  = (overwrites: PermissionOverwrites | PermissionOverwritesUpdated): string => getOvId(overwrites.location, overwrites.target);
@@ -221,7 +221,13 @@ export class TopicHistoryWindow extends TraversableRemoteCollection<Message> {
221
221
  }
222
222
 
223
223
  private handleSession(ev: Session): void {
224
- this.resetToLatest();
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> {
@@ -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,7 @@
1
+ import {BanObject} from "./BanObject";
2
+
3
+ export interface LeaveReason {
4
+ type: 'Leave' | 'Ban' | 'Kick';
5
+ ban?: BanObject;
6
+ kick?: string;
7
+ }
@@ -0,0 +1,9 @@
1
+ import {ChatLocation} from "../ChatLocation";
2
+
3
+ export interface Ban {
4
+ userId: string;
5
+ location: ChatLocation;
6
+ reason: string;
7
+ expiresAt?: string;
8
+ notify?: boolean;
9
+ }
@@ -0,0 +1,5 @@
1
+ import {ChatLocation} from "../ChatLocation";
2
+
3
+ export interface GetBans {
4
+ location: ChatLocation;
5
+ }
@@ -0,0 +1,7 @@
1
+ import {ChatLocation} from "../ChatLocation";
2
+
3
+ export interface Kick {
4
+ userId: string;
5
+ location: ChatLocation;
6
+ reason: string;
7
+ }
@@ -0,0 +1,6 @@
1
+ import {ChatLocation} from "../ChatLocation";
2
+
3
+ export interface Unban {
4
+ userId: string;
5
+ location: ChatLocation;
6
+ }
@@ -0,0 +1,7 @@
1
+ import {ChatLocation} from "../ChatLocation";
2
+ import {BanObject} from "../BanObject";
3
+
4
+ export interface Bans {
5
+ location: ChatLocation;
6
+ bans: BanObject[];
7
+ }
@@ -1,3 +1,6 @@
1
+ import {LeaveReason} from "../LeaveReason";
2
+
1
3
  export interface RoomLeft {
2
4
  id: string;
5
+ reason: LeaveReason;
3
6
  }
@@ -1,3 +1,6 @@
1
+ import {LeaveReason} from "../LeaveReason";
2
+
1
3
  export interface SpaceLeft {
2
4
  id: string;
5
+ reason: LeaveReason;
3
6
  }