-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.ts
More file actions
59 lines (50 loc) · 1.59 KB
/
admin.ts
File metadata and controls
59 lines (50 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import {
Admin,
MessageBuilder,
AttributeBuilder,
CreateCommand,
DestroyCommand,
MemberAppendCommand,
MemberRemoveCommand,
} from "../../api/admin";
import {Attributes} from "../../model/models";
import {CommonServiceImpl} from "../common/common";
import {AttributeBuilderImpl} from "./buildAttribute";
import {AdminMessageBuilderImpl} from "./buildMessage";
import {CreateCommandImpl} from "./cmdCreate";
import {DestroyCommandImpl} from "./cmdDestroy";
import {MemberAppendCommandImpl} from "./cmdMemberAppend";
import {MemberRemoveCommandImpl} from "./cmdMemberRemove";
function concat(first: string, ...others): string[] {
const all: string[] = [];
all.push(first);
if (others && others.length > 0) {
for (const s of others) {
all.push(s);
}
}
return all;
}
class AdminImpl extends CommonServiceImpl implements Admin {
public say(text: string, remark?: string): MessageBuilder {
return new AdminMessageBuilderImpl(this, text, remark);
}
public setAttributes(attributes: Attributes, overwrite?: boolean): AttributeBuilder {
return new AttributeBuilderImpl(this, attributes, overwrite);
}
public removeMembers(first: string, ...others): MemberRemoveCommand {
return new MemberRemoveCommandImpl(this, concat(first, others));
}
public appendMembers(first: string, ...others): MemberAppendCommand {
return new MemberAppendCommandImpl(this, concat(first, others));
}
public create(): CreateCommand {
return new CreateCommandImpl(this);
}
public destroy(): DestroyCommand {
return new DestroyCommandImpl(this);
}
}
export {
AdminImpl,
};