Skip to content

TokensAdd (Privilege Key)

Samuel Grant edited this page Jun 23, 2020 · 5 revisions

Remarks

Creates a privilege key

Notes:

  1. Custom Fields (optional) can be attached to a privilege key. When the key is consumed the user will inherit these custom fields. You can search for a user using a custom field making this the way to link users to specific accounts on other applications

  2. This function only supports privilege keys that assign server groups. This is a limitation of the library and not Team Speak.

    Want this adjusted? Open a new issue

  3. The description should not be escaped as that will be handled by the function

Signature

Params

Name Type Description
sgid int64 ID of the server group that will be granted when a user consumes the token
description string Privilege key description, visible through the server query and TS Client
customFields map[string]string Key value pair for custom fields

**

Returns

Type Description
*status Query Response
*PrivilegeKey The token that was created
error

Example

qres, err := client.TokensAdd(sgid, "un escaped description", map[string]string{"key": "val"})
if err != nil || !qres.IsSuccess() {
  // Handle error or rejected server query 
}
  

Clone this wiki locally