typings are now bundled within the package (#37725)

This commit is contained in:
David Kartnaller
2019-08-19 19:10:42 +02:00
committed by Sheetal Nandi
parent 63dccaf6c4
commit 2d6e3c5ee4
15 changed files with 6 additions and 2136 deletions

View File

@@ -3600,6 +3600,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/trim-newlines",
"asOfVersion": "3.0.0"
},
{
"libraryName": "ts3-nodejs-library",
"typingsPackageName": "ts3-nodejs-library",
"sourceRepoURL": "https://github.com/Multivit4min/TS3-NodeJS-Library",
"asOfVersion": "2.0.0"
},
{
"libraryName": "TsMonad",
"typingsPackageName": "tsmonad",

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +0,0 @@
// Type definitions for ts3-nodejs-library 1.13
// Project: https://github.com/Multivit4min/TS3-NodeJS-Library
// Definitions by: Pascal Sthamer <https://github.com/P4sca1>
// David Kartnaller <https://github.com/Multivit4min>
// Mattis Krämer <https://github.com/Mattzi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
import TeamSpeak3 = require('./TeamSpeak3');
export = TeamSpeak3;

View File

@@ -1,66 +0,0 @@
import TeamSpeak3 = require('../TeamSpeak3');
import { EventEmitter } from 'events';
declare class Abstract extends EventEmitter {
constructor(parent: TeamSpeak3, props: any, namespace: string);
/**
* retrieves the namespace of this class
* @returns the current namespace
*/
getNameSpace(): string;
/**
* returns JSONifyable data
*/
toJSON(): void;
/**
* retrieves a single property value by the given name
* @param - the name from where the value should be retrieved
*/
getPropertyByName(name: string): void;
/**
* translates a TeamSpeak property key to a JavaScript conform name
* @param - the name which will get converted
* @returns returns the JavaScript conform name
* @example
* // given that the abstract is extending a TeamSpeakClient
* client.translatePropName("client_nickname") //returns "nickname"
* client.translatePropName("client_is_talker") //returns "isTalker"
* client.translatePropName("client_channel_group_id") //returns "channelGroupId"
*/
translatePropName(name: string): string;
/**
* Safely unsubscribes to all Events
*/
destruct(): void;
/**
* Returns the data from the last List Command
*/
getCache(): any;
/**
* Sets the Data from the Last List Command
*/
updateCache(): void;
/**
* Copies the the new values and keys from src to dst and returns the changes to dst
* @param - the object to copy the src object onto
* @param - the object with the new values
* @returns the updated values from src to dst
*/
objectCopy(dst: any, src: any): any;
/**
* Returns the Parent Class
* @returns the teamspeak instance
*/
getParent(): TeamSpeak3;
}
export = Abstract;

View File

@@ -1,106 +0,0 @@
import Abstract = require('./Abstract');
import TeamSpeak3 = require('../TeamSpeak3');
/**
* the response of the channellist command for a single channel
*/
interface ChannelListResponse {
id: number;
}
declare class TeamSpeakChannel extends Abstract {
constructor(parent: TeamSpeak3, list: ChannelListResponse);
cid: number;
pid: number;
order: number;
name: string;
topic?: number;
flagDefault: 0 | 1;
flagPassword: 0 | 1;
flagPermanent: 0 | 1;
flagSemiPermanent: 0 | 1;
codec: number;
codecQuality: number;
neededTalkPower: number;
iconId: number;
secondsEmpty: number;
totalClientsFamily: number;
maxclients: number;
maxfamilyclients: number;
totalClients: number;
neededSubscribePower: number;
/**
* Returns the ID of the Channel
* @returns the Channels ID
*/
getID(): number;
/**
* Displays detailed configuration information about a channel including ID, topic, description, etc.
*/
getInfo(): Promise<any>;
/**
* Moves a channel to a new parent channel with the ID cpid.
* If order is specified, the channel will be sorted right under the channel with the specified ID.
* If order is set to 0, the channel will be sorted right below the new parent.
* @param - Channel Parent ID
* @param - Channel Sort Order. Defaults to 0.
*/
move(cpid: number, order?: number): Promise<any>;
/**
* Deletes an existing channel by ID. If force is set to 1, the channel will be deleted even if there are clients within.
* The clients will be kicked to the default channel with an appropriate reason message.
* @param - If set to 1 the Channel will be deleted even when Clients are in it
*/
del(force: number): Promise<any>;
/**
* Changes a channels configuration using given properties.
* Note that this command accepts multiple properties which means that you're able to change all settings of the channel specified with cid at once.
* @param - The Properties of the Channel which should get changed
*/
edit(properties: any): Promise<any>;
/**
* Displays a list of permissions defined for a channel.
* @param - Whether the Perm SID should be displayed aswell. Defaults to false.
*/
permList(permsid?: boolean): Promise<any[]>;
/**
* Adds a set of specified permissions to a channel. Multiple permissions can be added by providing the two parameters of each permission.
* A permission can be specified by permid or permsid.
* @param - The permid or permsid
* @param - The Value which should be set
*/
setPerm(perm: string | number, value: number): Promise<any>;
/**
* Removes a set of specified permissions from a channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
* @param - The permid or permsid
*/
delPerm(perm: string | number): Promise<any>;
/**
* Gets a List of Clients in the current Channel
* @param - The Filter Object
*/
getClients(filter: any): Promise<any>;
/**
* Returns a Buffer with the Icon of the Channel
* @returns a Promise with the binary data of the Channel Icon
*/
getIcon(): Promise<any>;
/**
* Gets the Icon Name of the Channel
*/
getIconName(): Promise<any>;
}
export = TeamSpeakChannel;

View File

@@ -1,97 +0,0 @@
import Abstract = require('./Abstract');
import TeamSpeak3 = require('../TeamSpeak3');
/**
* the response of the channelgrouplist command for a single channelgroup
*/
interface ChannelGroupListResponse {
cgid: number;
}
declare class TeamSpeakChannelGroup extends Abstract {
constructor(parent: TeamSpeak3, list: ChannelGroupListResponse);
cgid: number;
name: string;
type: string;
iconid: string;
savedb: string;
sortid: string;
namemode: string;
nModifyp: string;
nMemberAddp: string;
nMemberRemovep: string;
/**
* Deletes the channel group. If force is set to 1, the channel group will be deleted even if there are clients within.
* @param - If set to 1 the Channel Group will be deleted even when Clients are in it. Defaults to 0.
*/
del(force?: number): Promise<any>;
/**
* Creates a copy of the channel group. If tcgid is set to 0, the server will create a new group.
* To overwrite an existing group, simply set tcgid to the ID of a designated target group.
* If a target group is set, the name parameter will be ignored.
* @param - The Target Group, 0 to create a new Group. Defaults to 0.
* @param - The Type of the Group (0 = Template Group | 1 = Normal Group)
* @param - Name of the Group. Defaults to false.
*/
copy(tcgid?: number, type?: number, name?: string | boolean): Promise<any>;
/**
* Changes the name of the channel group
* @param - Name of the Group
*/
rename(name: string): Promise<any>;
/**
* Displays a list of permissions assigned to the channel group specified with cgid.
* @param - If the permsid option is set to true the output will contain the permission names. Defaults to false.
*/
permList(permsid?: boolean): Promise<any[]>;
/**
* Adds a specified permissions to the channel group. A permission can be specified by permid or permsid.
* @param - The permid or permsid
* @param - Value of the Permission
* @param - Whether the skip flag should be set. Defaults to 0.
* @param - Whether the negate flag should be set. DEfaults to 0.
*/
addPerm(
perm: string | number,
value: number,
skip?: number,
negate?: number
): Promise<any>;
/**
* Removes a set of specified permissions from the channel group. A permission can be specified by permid or permsid.
* @param - The permid or permsid
*/
delPerm(perm: string | number): Promise<any>;
/**
* Sets the channel group of a client
* @param - The Channel in which the Client should be assigned the Group
* @param - The Client Database ID which should be added to the Group
*/
setClient(cid: number, cldbid: number): Promise<any>;
/**
* Displays the IDs of all clients currently residing in the channel group.
* @param - The Channel ID
*/
clientList(cid?: number): Promise<any>;
/**
* Returns a Buffer with the Icon of the Channel Group
* @returns a Promise with the binary data of the ChannelGroup Icon
*/
getIcon(): Promise<any>;
/**
* Gets the Icon Name of the Channel Group
*/
getIconName(): Promise<any>;
}
export = TeamSpeakChannelGroup;

View File

@@ -1,230 +0,0 @@
import Abstract = require('./Abstract');
import TeamSpeak3 = require('../TeamSpeak3');
/**
* the response of the clientlist command for a single client
*/
interface ClientListResponse {
clid: number;
client_database_id: number;
client_type: number;
client_unique_identifier: string;
}
declare enum ClientType {
CLIENT = 0,
QUERY = 1
}
declare class TeamSpeakClient extends Abstract {
constructor(parent: TeamSpeak3, list: ClientListResponse);
cid: number;
cfid: number;
ctid: number;
reasonid: number;
clid: number;
uniqueIdentifier: string;
nickname: string;
inputMuted: 0 | 1;
outputMuted: 0 | 1;
outputonlyMuted: 0 | 1;
inputHardware: number;
outputHardware: number;
isRecording: 0 | 1;
databaseId: number;
channelGroupId: number;
servergroups: number[];
away: 0 | 1;
type: ClientType;
talkPower: number;
talkRequest: number;
isTalker: 0 | 1;
isPrioritySpeaker: 0 | 1;
unreadMessages: string;
neededServerqueryViewPower: string;
iconId: number;
isChannelCommander: 0 | 1;
channelGroupInheritedChannelId: number;
badges?: string;
myteamspeakId?: string;
/**
* Returns the Database ID of the Client
* @returns the Clients Database ID
*/
getDBID(): number;
/**
* Returns the Client ID
* @returns the Client ID
*/
getID(): number;
/**
* Returns the Client Unique ID
* @returns the Client UniqueID
*/
getUID(): string;
/**
* Evaluates if the Client is a Query Client or a normal Client
* @returns true when the Client is a Server Query Client
*/
isQuery(): boolean;
/**
* Retrieves a displayable Client Link for the TeamSpeak Chat
* @return the TeamSpeak Client URL as Link
*/
getURL(): string;
/**
* Returns General Info of the Client, requires the Client to be online
* @returns a Promise with the Client Information
*/
getInfo(): Promise<any>;
/**
* Returns the Clients Database Info
* @returns the Client Database Info
*/
getDBInfo(): Promise<any>;
/**
* Displays a list of custom properties for the client
*/
customInfo(): Promise<any>;
/**
* Removes a custom property from the client
* This requires TeamSpeak Server Version 3.2.0 or newer.
* @param - The Key which should be deleted
*/
customDelete(ident: string): Promise<any>;
/**
* Creates or updates a custom property for the client.
* Ident and value can be any value, and are the key value pair of the custom property.
* This requires TeamSpeak Server Version 3.2.0 or newer.
* @param - The Key which should be set
* @param - The Value which should be set
*/
customSet(ident: string, value: string): Promise<any>;
/**
* Kicks the Client from the Server
* @param - The Message the Client should receive when getting kicked
*/
kickFromServer(msg: string): Promise<any>;
/**
* Kicks the Client from their currently joined Channel
* @param - The Message the Client should receive when getting kicked (max 40 Chars)
*/
kickFromChannel(msg: string): Promise<any>;
/**
* Adds a new ban rule on the selected virtual server. All parameters are optional but at least one of the following must be set: ip, name, or uid.
* @param - IP Regex
* @param - Name Regex
* @param - UID Regex
* @param - Bantime in Seconds, if left empty it will result in a permaban
* @param- Ban Reason
*/
banAdd(
ip?: string,
name?: string,
uid?: string,
time?: number,
banreason?: string
): Promise<any>;
/**
* creates a new ban with the clients uid
* @param - reason message
* @param - the time in seconds a client should be banned, leave empty if it should result in a permanent ban
*/
ban(banreason?: string, time?: number): Promise<any>;
/**
* Moves the Client to a different Channel
* @param - Channel ID in which the Client should get moved
* @param - The Channel Password
*/
move(cid: number, cpw?: string): Promise<any>;
/**
* Adds the client to the server group specified with sgid. Please note that a client cannot be added to default groups or template groups.
* @param - The Server Group ID which the Client should be added to
*/
serverGroupAdd(sgid: number): Promise<any>;
/**
* Removes the client from the server group specified with sgid.
* @param - The Server Group ID which the Client should be removed from
*/
serverGroupDel(sgid: number): Promise<any>;
/**
* Pokes the Client with a certain message
* @param - The message the Client should receive
*/
poke(msg: string): Promise<any>;
/**
* Sends a textmessage to the Client
* @param - The message the Client should receive
*/
message(msg: string): Promise<any>;
/**
* Displays a list of permissions defined for a client
* @param - If the permsid option is set to true the output will contain the permission names. Defaults to false.
*/
permList(permsid?: boolean): Promise<any>;
/**
* Adds a set of specified permissions to a client. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.
* @param - The permid or permsid
* @param - Value of the Permission
* @param - Whether the skip flag should be set. Defaults to 0.
* @param - Whether the negate flag should be set. Defaults to 0.
*/
addPerm(
perm: string | number,
value: number,
skip?: number,
negate?: number
): Promise<any>;
/**
* Removes a set of specified permissions from a client. Multiple permissions can be removed at once. A permission can be specified by permid or permsid
* @param - The permid or permsid
*/
delPerm(perm: string | number): Promise<any>;
/**
* Returns a Buffer with the Avatar of the User
* @returns a Promise with the binary data of the avatar
*/
getAvatar(): Promise<any>;
/**
* Returns a Buffer with the Icon of the Client
* @returns a Promise with the binary data of the Client Icon
*/
getIcon(): Promise<any>;
/**
* Gets the Avatar Name of the Client
*/
getAvatarName(): Promise<string>;
/**
* Gets the Icon Name of the Client
*/
getIconName(): Promise<any>;
}
export = TeamSpeakClient;

View File

@@ -1,53 +0,0 @@
import Abstract = require('./Abstract');
import TeamSpeak3 = require('../TeamSpeak3');
/**
* the response of the serverlist command for a single virtual server
*/
interface ServerListResponse {
virtualserver_id: number;
}
declare class TeamSpeakServer extends Abstract {
constructor(parent: TeamSpeak3, list: ServerListResponse);
id: number;
port: number;
status: string;
clientsonline: number;
queryclientsonline: number;
maxclients: number;
uptime: number;
name: string;
autostart: number;
uniqueIdentifier: string;
/**
* Selects the Virtual Server
* @param - Set Nickname when selecting a server
*/
use(client_nickname?: string): Promise<any>;
/**
* Gets basic Infos about the Server
*/
getInfo(): Promise<any>;
/**
* Deletes the Server.
*/
del(): Promise<any>;
/**
* Starts the virtual server. Depending on your permissions, you're able to start either your own virtual server only or all virtual servers in the server instance.
*/
start(): Promise<any>;
/**
* Stops the virtual server. Depending on your permissions, you're able to stop either your own virtual server only or all virtual servers in the server instance.
* @param - Specifies a text message that is sent to the clients before the client disconnects (requires TeamSpeak Server 3.2.0 or newer).
*/
stop(msg?: string): Promise<any>;
}
export = TeamSpeakServer;

View File

@@ -1,106 +0,0 @@
import Abstract = require('./Abstract');
import TeamSpeak3 = require('../TeamSpeak3');
/**
* the response of the servergrouplist command for a single servergroup
*/
interface ServerGroupListResponse {
sgid: number;
}
declare class TeamSpeakServerGroup extends Abstract {
constructor(parent: TeamSpeak3, list: ServerGroupListResponse);
sgid: number;
name: string;
type: string;
iconid: string;
savedb: string;
sortid: string;
namemode: string;
nModifyp: string;
nMemberAddp: string;
nMemberRemovep: string;
/**
* Returns the Server Group ID
*/
getSGID(): number;
/**
* Deletes the server group. If force is set to 1, the server group will be deleted even if there are clients within.
* @param - If set to 1 the ServerGroup will be deleted even when Clients are in it
*/
del(force: number): Promise<any>;
/**
* Creates a copy of the server group specified with ssgid. If tsgid is set to 0, the server will create a new group.
* To overwrite an existing group, simply set tsgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored.
* @param - The Target Group, 0 to create a new Group. Defaults to 0.
* @param - The Type of the Group (0 = Query Group | 1 = Normal Group)
* @param - Name of the Group. Defaults to false.
*/
copy(tsgid?: number, type?: number, name?: string | boolean): Promise<any>;
/**
* Changes the name of the server group
* @param - Name of the Group
*/
rename(name: string): Promise<any>;
/**
* Displays a list of permissions assigned to the server group specified with sgid.
* @param - If the permsid option is set to true the output will contain the permission names. Defaults to false.
*/
permList(permsid?: boolean): Promise<any>;
/**
* Adds a specified permissions to the server group. A permission can be specified by permid or permsid.
* @param - The permid or permsid
* @param - Value of the Permission
* @param - Whether the skip flag should be set Defaults to 0.
* @param - Whether the negate flag should be set. Defaults to 0.
*/
addPerm(
perm: string | number,
value: number,
skip?: number,
negate?: number
): Promise<any>;
/**
* Removes a set of specified permissions from the server group. A permission can be specified by permid or permsid.
* @param - The permid or permsid
*/
delPerm(perm: string | number): Promise<any>;
/**
* Adds a client to the server group. Please note that a client cannot be added to default groups or template groups.
* @param - The Client Database ID which should be added to the Group
*/
addClient(cldbid: number): Promise<any>;
/**
* Removes a client specified with cldbid from the server group.
* @param - The Client Database ID which should be removed from the Group
*/
delClient(cldbid: number): Promise<any>;
/**
* Displays the IDs of all clients currently residing in the server group.
*/
clientList(): Promise<any>;
/**
* Returns a Buffer with the Icon of the Server Group
* @returns promise with the binary data of the ServerGroup Icon
*/
getIcon(): Promise<any>;
/**
* Gets the Icon Name of the Server Group
*/
getIconName(): Promise<any>;
}
export = TeamSpeakServerGroup;

View File

@@ -1,101 +0,0 @@
declare class Command {
constructor();
/**
* Initializes the Respone with default values
*/
reset(): this;
/**
* Sets the main command to send
* @param - Sets the command which will be sent to the TeamSpeak Query
*/
setCommand(cmd: string): this;
/**
* Sets the TeamSpeak Key Value Pairs
* @param - Sets the Object with the key value pairs which should get sent to the TeamSpeak Query
*/
setOptions(opts: any): this;
/**
* Sets the TeamSpeak Key Value Pairs
* @param - Sets the Object with the key value pairs which should get sent to the TeamSpeak Query
*/
setMultiOptions(opts: []): this;
/**
* Checks wether there are options used with this command
*/
hasOptions(): boolean;
/**
* Checks wether there are options used with this command
*/
hasMultiOptions(): boolean;
/**
* Set TeamSpeak Flags
* @param - Sets the Flags which should get sent to the TeamSpeak Query
*/
setFlags(flags: any): this;
/**
* Checks wether there are flags used with this command
*/
hasFlags(): boolean;
/**
* Set the Line which has been received from the TeamSpeak Query
* @param - The Line which has been received from the TeamSpeak Query
*/
setResponse(line: string): this;
/**
* Set the error line which has been received from the TeamSpeak Query
* @param - The error Line which has been received from the TeamSpeak Query
*/
setError(error: string): this;
/**
* Get the Parsed Error Object which has been received from the TeamSpeak Query
* @returns the Parsed Error Object
*/
getError(): any;
/**
* Checks if a error has been received
* @returns true when a error has been received
*/
hasError(): boolean;
/**
* Get the Parsed Response Object which has been received from the TeamSpeak Query
* @returns the Parsed Response Object
*/
getResponse(): any;
/**
* Parses a Query Response
* @param - The Line which has been received
* @returns the parsed Data
*/
static parse(data: string): any;
/**
* Checks if a error has been received
* @version 1.0
* @returns the parsed String which is readable by the TeamSpeak Query
*/
build(): string;
/**
* Parses a value to the type which the key represents
* @param - The Key which should get looked up
* @param - The value which should get parsed
* @returns the parsed Data
*/
static parseValue(k: string, v: any): any;
}
export = Command;

View File

@@ -1,20 +0,0 @@
declare class FileTransfer {
constructor(host: string, port?: number, timeout?: number);
/**
* Starts the download of a File
* @param - The Filetransfer Key
* @param- The Data Length
* @returns a buffer with the binary data
*/
download(ftkey: string, size: number): Promise<Buffer>;
/**
* Starts the upload of a File
* @param - the Filetransfer Key
* @param - the data to send
*/
upload(ftkey: string, data: string | Buffer): Promise<void>;
}
export = FileTransfer;

View File

@@ -1,50 +0,0 @@
import { EventEmitter } from 'events';
import { ConnectionParams } from '../TeamSpeak3';
declare class TS3Query extends EventEmitter {
constructor(config: ConnectionParams);
/**
* Handles any TeamSpeak Query Response Line
* @param - error line from teamspeak
*/
handleLine(line: string): void;
/**
* Handles the error line which finnishes a command
* @param - error line from teamspeak
*/
handleQueryError(line: string): void;
/**
* Handles an event which has been received from the TeamSpeak Server
* @param - event line from TeamSpeak
*/
handleQueryEvent(line: string): void;
/**
* Emits an Error which the given arguments
* @param - arguments which gets passed to the error event
*/
handleError(...args: any[]): void;
/**
* Sends keepalive to the TeamSpeak Server so the connection will not be closed
*/
keepAlive(): void;
/**
* Whether Double Events should be handled or not
* @param - Parameter enables or disables the Double Event Handling. Defaults to true.
*/
handleDoubleEvents(b?: boolean): void;
/**
* Sends a command to the TeamSpeak Server.
* @param - parameters which should get executed
* @returns - a Promise object which returns the Information about the Query executed
*/
execute(...args: any[]): Promise<any>;
}
export = TS3Query;

View File

@@ -1,14 +0,0 @@
import TeamSpeak3 = require('ts3-nodejs-library');
const ts3 = new TeamSpeak3({
username: 'serveradmin',
password: 'password',
nickname: 'My TS3 Bot'
});
async function main() {
const me = await ts3.whoami();
// Add other tests here.
}
main();

View File

@@ -1,33 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"ts3-nodejs-library-tests.ts",
"index.d.ts",
"TeamSpeak3.d.ts",
"property/Abstract.d.ts",
"property/Channel.d.ts",
"property/ChannelGroup.d.ts",
"property/Client.d.ts",
"property/Server.d.ts",
"property/ServerGroup.d.ts",
"transport/Command.d.ts",
"transport/FileTransfer.d.ts",
"transport/TS3Query.d.ts"
]
}

View File

@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }