/* * Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ namespace TencentCloud.Gs.V20191118 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Gs.V20191118.Models; public class GsClient : AbstractClient{ private const string endpoint = "gs.tencentcloudapi.com"; private const string version = "2019-11-18"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public GsClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public GsClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 创建会话 /// /// /// public async Task CreateSession(CreateSessionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateSession"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建会话 /// /// /// public CreateSessionResponse CreateSessionSync(CreateSessionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateSession"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询空闲机器数量 /// /// /// public async Task DescribeWorkers(DescribeWorkersRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeWorkers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询空闲机器数量 /// /// /// public DescribeWorkersResponse DescribeWorkersSync(DescribeWorkersRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeWorkers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取机器信息 /// /// /// public async Task DescribeWorkersInfo(DescribeWorkersInfoRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeWorkersInfo"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取机器信息 /// /// /// public DescribeWorkersInfoResponse DescribeWorkersInfoSync(DescribeWorkersInfoRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeWorkersInfo"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 进入排队锁定机器 /// /// /// public async Task EnterQueue(EnterQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "EnterQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 进入排队锁定机器 /// /// /// public EnterQueueResponse EnterQueueSync(EnterQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "EnterQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改机器信息 /// /// /// public async Task ModifyWorkers(ModifyWorkersRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ModifyWorkers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改机器信息 /// /// /// public ModifyWorkersResponse ModifyWorkersSync(ModifyWorkersRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ModifyWorkers"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 退出排队 /// /// /// public async Task QuitQueue(QuitQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "QuitQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 退出排队 /// /// /// public QuitQueueResponse QuitQueueSync(QuitQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "QuitQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 强制退出游戏 /// /// /// public async Task StopGame(StopGameRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "StopGame"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 强制退出游戏 /// /// /// public StopGameResponse StopGameSync(StopGameRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "StopGame"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 尝试锁定机器 /// /// /// public async Task TrylockWorker(TrylockWorkerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "TrylockWorker"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 尝试锁定机器 /// /// /// public TrylockWorkerResponse TrylockWorkerSync(TrylockWorkerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "TrylockWorker"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }