public TSSdkSession GetCurrentSession() { JObject json = JObject.Parse(RESTHelper.DoWebRequest(BASE_URL + DB + "/" + CURRENT_SESSION_DOC_ID, "GET", string.Empty)); json.Remove("_id"); json.Remove("_rev"); TSSdkSession sessionFromDB = TSSdkSession.FromJson(json.ToString()); return(sessionFromDB); }
/* * /session-create * POST https://{na,eu,ap}-api.teamspeaksdk.com/session-create * * Creates a voice session on the region associated with the api endpoint you are posting to. * * e.g. * Request body: * { * "CustomerLabel": "Raid #208052098", * "MaxUsers": "10", * "SDKVersion": "3.0.4" * } * * Response: * { * "CustomerLabel": "Raid #208052098", * "MaxUsers": 10, * "ApiKey": "******", * "SessionId": "na-64a6a6-e10b38-d8bb48-5be140-92cdf4", * "Password": "******", * "UDPPort": 13808, * "Region": "na", * "Hostname": "144.217.11.226", * "Message": "Created session." * } * * Error Response: * { * "Message": "Bad request - paramater not set." * } * * { * "Message": "Cannot have greater than 10 MaxUsers per voice server on a limited account." * } * * { * "Message": "No Instances available hosting that SDKVersion." * } * * { * "Message": "Failed to create voice session." * } */ private TSSdkSession SessionCreate() { string url = BASE_URL_EU + "/session-create"; string body = "{\"CustomerLabel\":\"" + CustomerLabel + "\",\"MaxUsers\":\"" + MaxUsers.ToString() + "\",\"SDKVersion\":\"" + SDKVersion + "\"}"; string response = RESTHelper.DoWebRequest(url, POST, body); if (response != null) { return(TSSdkSession.FromJson(response)); } return(null); }