/* * 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.Cmq.V20190304 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Cmq.V20190304.Models; public class CmqClient : AbstractClient{ private const string endpoint = "cmq.tencentcloudapi.com"; private const string version = "2019-03-04"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public CmqClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public CmqClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 清除queue中的所有消息 /// /// /// public async Task ClearQueue(ClearQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ClearQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 清除queue中的所有消息 /// /// /// public ClearQueueResponse ClearQueueSync(ClearQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ClearQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 清空订阅者消息标签 /// /// /// public async Task ClearSubscriptionFilterTags(ClearSubscriptionFilterTagsRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ClearSubscriptionFilterTags"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 清空订阅者消息标签 /// /// /// public ClearSubscriptionFilterTagsResponse ClearSubscriptionFilterTagsSync(ClearSubscriptionFilterTagsRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ClearSubscriptionFilterTags"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建队列接口 /// /// /// public async Task CreateQueue(CreateQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建队列接口 /// /// /// public CreateQueueResponse CreateQueueSync(CreateQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建订阅接口 /// /// /// public async Task CreateSubscribe(CreateSubscribeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateSubscribe"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建订阅接口 /// /// /// public CreateSubscribeResponse CreateSubscribeSync(CreateSubscribeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateSubscribe"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建主题 /// /// /// public async Task CreateTopic(CreateTopicRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateTopic"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 创建主题 /// /// /// public CreateTopicResponse CreateTopicSync(CreateTopicRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateTopic"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// DeleteQueue /// /// /// public async Task DeleteQueue(DeleteQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// DeleteQueue /// /// /// public DeleteQueueResponse DeleteQueueSync(DeleteQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除订阅 /// /// /// public async Task DeleteSubscribe(DeleteSubscribeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteSubscribe"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除订阅 /// /// /// public DeleteSubscribeResponse DeleteSubscribeSync(DeleteSubscribeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteSubscribe"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除主题 /// /// /// public async Task DeleteTopic(DeleteTopicRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteTopic"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 删除主题 /// /// /// public DeleteTopicResponse DeleteTopicSync(DeleteTopicRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteTopic"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 枚举死信队列源队列 /// /// /// public async Task DescribeDeadLetterSourceQueues(DescribeDeadLetterSourceQueuesRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeDeadLetterSourceQueues"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 枚举死信队列源队列 /// /// /// public DescribeDeadLetterSourceQueuesResponse DescribeDeadLetterSourceQueuesSync(DescribeDeadLetterSourceQueuesRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeDeadLetterSourceQueues"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 枚举队列 /// /// /// public async Task DescribeQueueDetail(DescribeQueueDetailRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeQueueDetail"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 枚举队列 /// /// /// public DescribeQueueDetailResponse DescribeQueueDetailSync(DescribeQueueDetailRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeQueueDetail"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询订阅详情 /// /// /// public async Task DescribeSubscriptionDetail(DescribeSubscriptionDetailRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeSubscriptionDetail"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询订阅详情 /// /// /// public DescribeSubscriptionDetailResponse DescribeSubscriptionDetailSync(DescribeSubscriptionDetailRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeSubscriptionDetail"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询主题详情 /// /// /// public async Task DescribeTopicDetail(DescribeTopicDetailRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeTopicDetail"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询主题详情 /// /// /// public DescribeTopicDetailResponse DescribeTopicDetailSync(DescribeTopicDetailRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeTopicDetail"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改队列属性 /// /// /// public async Task ModifyQueueAttribute(ModifyQueueAttributeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ModifyQueueAttribute"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改队列属性 /// /// /// public ModifyQueueAttributeResponse ModifyQueueAttributeSync(ModifyQueueAttributeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ModifyQueueAttribute"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改订阅属性 /// /// /// public async Task ModifySubscriptionAttribute(ModifySubscriptionAttributeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ModifySubscriptionAttribute"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改订阅属性 /// /// /// public ModifySubscriptionAttributeResponse ModifySubscriptionAttributeSync(ModifySubscriptionAttributeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ModifySubscriptionAttribute"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改主题属性 /// /// /// public async Task ModifyTopicAttribute(ModifyTopicAttributeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ModifyTopicAttribute"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 修改主题属性 /// /// /// public ModifyTopicAttributeResponse ModifyTopicAttributeSync(ModifyTopicAttributeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ModifyTopicAttribute"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 回溯队列 /// /// /// public async Task RewindQueue(RewindQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "RewindQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 回溯队列 /// /// /// public RewindQueueResponse RewindQueueSync(RewindQueueRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "RewindQueue"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 解绑死信队列 /// /// /// public async Task UnbindDeadLetter(UnbindDeadLetterRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "UnbindDeadLetter"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 解绑死信队列 /// /// /// public UnbindDeadLetterResponse UnbindDeadLetterSync(UnbindDeadLetterRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "UnbindDeadLetter"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }