Beispiel #1
0
        /*
         * /session-info
         * POST https://{na,eu,ap}-api.teamspeaksdk.com/session-info
         *
         * Gets the information for a voice session on the region associated with the api endpoint you are posting to.
         * For example, we need to post to the https://na-api.teamspeaksdk.com/session-info endpoint because this session starts with "na".
         *
         * e.g.
         * Request body:
         * {
         *  "SessionId": "na-406cae-d1017a-5d7076-7f83ec-134050"
         * }
         *
         * Response:
         * {
         *  "SessionId": "na-406cae-d1017a-5d7076-7f83ec-134050",
         *  "Region": "na",
         *  "Password": "******",
         *  "Hostname": "144.217.11.226",
         *  "UDPPort": "13195",
         *  "CustomerLabel": "demo session",
         *  "MaxUsers": "2",
         *  "VirtualServerClientsOnline": 0,
         *  "VirtualServerCreatedTimestamp": 1524077298,
         *  "VirtualServerMaxUsers": 2,
         * }
         */
        public TsSdkSessionInfo SessionInfo()
        {
            if (CurrentSession != null)
            {
                string url  = BASE_URL_EU + "/session-info";
                string body = "{\"SessionId\":\"" + CurrentSession.SessionId + "\"}";

                string response = RESTHelper.DoWebRequest(url, POST, body);

                if (response != null)
                {
                    return(TsSdkSessionInfo.FromJson(response));
                }
            }
            return(null);
        }
Beispiel #2
0
 public static string ToJson(this TsSdkSessionInfo self) => JsonConvert.SerializeObject(self, Converter.Settings);