• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Multivit4min / TS3-NodeJS-Library / 5461107410

pending completion
5461107410

push

github

Multivit4min
remove support for node v14 update deploy to use node 18

330 of 433 branches covered (76.21%)

Branch coverage included in aggregate %.

1150 of 1191 relevant lines covered (96.56%)

59.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.75
/src/node/ServerGroup.ts
1
import { Abstract } from "./Abstract"
11✔
2
import { TeamSpeak } from "../TeamSpeak"
3
import { ServerGroupEntry } from "../types/ResponseTypes"
4
import { TeamSpeakClient } from "./Client"
5
import { Permission } from "../util/Permission"
6

7
export class TeamSpeakServerGroup extends Abstract<ServerGroupEntry> {
11✔
8

9
  constructor(parent: TeamSpeak, list: ServerGroupEntry) {
10
    super(parent, list, "servergroup")
33✔
11
  }
12

13
  get sgid() {
14
    return super.getPropertyByName("sgid")
13✔
15
  }
16

17
  get name() {
18
    return super.getPropertyByName("name")
2✔
19
  }
20

21
  get type() {
22
    return super.getPropertyByName("type")
1✔
23
  }
24

25
  get iconid() {
26
    return super.getPropertyByName("iconid")
1✔
27
  }
28

29
  get savedb() {
30
    return super.getPropertyByName("savedb")
1✔
31
  }
32

33
  get sortid() {
34
    return super.getPropertyByName("sortid")
1✔
35
  }
36

37
  get namemode() {
38
    return super.getPropertyByName("namemode")
1✔
39
  }
40

41
  get nModifyp() {
42
    return super.getPropertyByName("nModifyp")
1✔
43
  }
44

45
  get nMemberAddp() {
46
    return super.getPropertyByName("nMemberAddp")
1✔
47
  }
48

49
  get nMemberRemovep() {
50
    return super.getPropertyByName("nMemberRemovep")
1✔
51
  }
52

53
  /**
54
   * Deletes the server group.
55
   * If force is set to 1, the server group will be deleted even if there are clients within.
56
   * @param force if set to 1 the servergroup will be deleted even when clients are in it
57
   */
58
  del(force?: boolean) {
59
    return super.getParent().serverGroupDel(this, force)
1✔
60
  }
61

62
  /**
63
   * Creates a copy of the server group specified with ssgid. If tsgid is set to 0, the server will create a new group.
64
   * To overwrite an existing group, simply set tsgid to the ID of a designated target group.
65
   * If a target group is set, the name parameter will be ignored.
66
   * @param tsgid the target group, 0 to create a new group
67
   * @param type type of the group (0 = Query Group | 1 = Normal Group)
68
   * @param name name of the group
69
   */
70
  copy(targetGroup: string|TeamSpeakServerGroup, type: number, name: string) {
71
    return super.getParent().serverGroupCopy(this, targetGroup, type, name)
1✔
72
  }
73

74
  /**
75
   * changes the name of the server group
76
   * @param name new name of the group
77
   */
78
  rename(name: string) {
79
    return super.getParent().serverGroupRename(this, name)
1✔
80
  }
81

82
  /**
83
   * returns a list of permissions assigned to the server group specified with sgid
84
   * @param permsid if the permsid option is set to true the output will contain the permission names
85
   */
86
  permList(permsid: boolean) {
87
    return super.getParent().serverGroupPermList(this, permsid)
3✔
88
  }
89

90
  /**
91
   * Adds a specified permissions to the server group.
92
   * A permission can be specified by permid or permsid.
93
   * @param perm the permission object to set
94
   */
95
  addPerm(perm: Permission.PermType) {
96
    return super.getParent().serverGroupAddPerm(this, perm)
1✔
97
  }
98

99
  /**
100
   * Adds a specified permissions to the server group.
101
   * A permission can be specified by permid or permsid.
102
   */
103
  createPerm() {
104
    return super.getParent().serverGroupAddPerm(this, undefined)
×
105
  }
106

107
  /**
108
   * rmoves a set of specified permissions from the server group.
109
   * A permission can be specified by permid or permsid.
110
   * @param perm the permid or permsid
111
   */
112
  delPerm(perm: string|number) {
113
    return super.getParent().serverGroupDelPerm(this, perm)
1✔
114
  }
115

116
  /**
117
   * Adds a client to the server group. Please note that a client cannot be added to default groups or template groups.
118
   * @param client the client database id which should be added to the Group
119
   */
120
  addClient(client: TeamSpeakClient.ClientType) {
121
    return super.getParent().serverGroupAddClient(client, this)
1✔
122
  }
123

124
  /**
125
   * removes a client specified with cldbid from the servergroup
126
   * @param client the client database id which should be removed from the group
127
   */
128
  delClient(client: TeamSpeakClient.ClientType) {
129
    return super.getParent().serverGroupDelClient(client, this)
1✔
130
  }
131

132
  /** returns the ids of all clients currently residing in the server group */
133
  clientList() {
134
    return super.getParent().serverGroupClientList(this)
1✔
135
  }
136

137
  /** returns a buffer with the icon of the servergroup */
138
  getIcon() {
139
    return this.getIconId().then(id => super.getParent().downloadIcon(id))
1✔
140
  }
141

142
  /** gets the icon id of the servergroup */
143
  getIconId() {
144
    return super.getParent().getIconId(this.permList(true))
2✔
145
  }
146

147
  /** retrieves the client id from a string or teamspeak client */
148
  static getId<T extends TeamSpeakServerGroup.GroupType>(group?: T): T extends undefined ? undefined : string
149
  static getId(group?: TeamSpeakServerGroup.GroupType): string|undefined {
150
    return group instanceof TeamSpeakServerGroup ? group.sgid : group
37✔
151
  }
152

153
  /** retrieves the clients from an array */
154
  static getMultipleIds(groups: TeamSpeakServerGroup.MultiGroupType) {
155
    const list = Array.isArray(groups) ? groups : [groups]
4!
156
    return list.map(c => TeamSpeakServerGroup.getId(c)) as string[]
8✔
157
  }
158

159
}
160

161
export namespace TeamSpeakServerGroup {
162
  export type GroupType = string|TeamSpeakServerGroup
163
  export type MultiGroupType = string[]|TeamSpeakServerGroup[]|GroupType
164
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc