/* * 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.Tbaas.V20180416 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Tbaas.V20180416.Models; public class TbaasClient : AbstractClient{ private const string endpoint = "tbaas.tencentcloudapi.com"; private const string version = "2018-04-16"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public TbaasClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public TbaasClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 申请用户证书 /// /// /// public async Task ApplyUserCert(ApplyUserCertRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ApplyUserCert"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 申请用户证书 /// /// /// public ApplyUserCertResponse ApplyUserCertSync(ApplyUserCertRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ApplyUserCert"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos根据块高查询区块信息 /// /// /// public async Task BlockByNumberHandler(BlockByNumberHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "BlockByNumberHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos根据块高查询区块信息 /// /// /// public BlockByNumberHandlerResponse BlockByNumberHandlerSync(BlockByNumberHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "BlockByNumberHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 动态部署合约 /// /// /// public async Task DeployDynamicContractHandler(DeployDynamicContractHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeployDynamicContractHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 动态部署合约 /// /// /// public DeployDynamicContractHandlerResponse DeployDynamicContractHandlerSync(DeployDynamicContractHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeployDynamicContractHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 下载用户证书 /// /// /// public async Task DownloadUserCert(DownloadUserCertRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DownloadUserCert"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 下载用户证书 /// /// /// public DownloadUserCertResponse DownloadUserCertSync(DownloadUserCertRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DownloadUserCert"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查看当前网络下的所有区块列表,分页展示 /// /// /// public async Task GetBlockList(GetBlockListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetBlockList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查看当前网络下的所有区块列表,分页展示 /// /// /// public GetBlockListResponse GetBlockListSync(GetBlockListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetBlockList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos分页查询当前群组下的区块列表 /// /// /// public async Task GetBlockListHandler(GetBlockListHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetBlockListHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos分页查询当前群组下的区块列表 /// /// /// public GetBlockListHandlerResponse GetBlockListHandlerSync(GetBlockListHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetBlockListHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取区块内的交易列表 /// /// /// public async Task GetBlockTransactionListForUser(GetBlockTransactionListForUserRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetBlockTransactionListForUser"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取区块内的交易列表 /// /// /// public GetBlockTransactionListForUserResponse GetBlockTransactionListForUserSync(GetBlockTransactionListForUserRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetBlockTransactionListForUser"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取区块链网络概要 /// /// /// public async Task GetClusterSummary(GetClusterSummaryRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetClusterSummary"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取区块链网络概要 /// /// /// public GetClusterSummaryResponse GetClusterSummarySync(GetClusterSummaryRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetClusterSummary"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Invoke异步调用结果查询 /// /// /// public async Task GetInvokeTx(GetInvokeTxRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetInvokeTx"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Invoke异步调用结果查询 /// /// /// public GetInvokeTxResponse GetInvokeTxSync(GetInvokeTxRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetInvokeTx"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取最新交易列表 /// /// /// public async Task GetLatesdTransactionList(GetLatesdTransactionListRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetLatesdTransactionList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取最新交易列表 /// /// /// public GetLatesdTransactionListResponse GetLatesdTransactionListSync(GetLatesdTransactionListRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetLatesdTransactionList"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos根据交易哈希查看交易详细信息 /// /// /// public async Task GetTransByHashHandler(GetTransByHashHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetTransByHashHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos根据交易哈希查看交易详细信息 /// /// /// public GetTransByHashHandlerResponse GetTransByHashHandlerSync(GetTransByHashHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetTransByHashHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos分页查询当前群组的交易信息列表 /// /// /// public async Task GetTransListHandler(GetTransListHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetTransListHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos分页查询当前群组的交易信息列表 /// /// /// public GetTransListHandlerResponse GetTransListHandlerSync(GetTransListHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetTransListHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取交易详情 /// /// /// public async Task GetTransactionDetailForUser(GetTransactionDetailForUserRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "GetTransactionDetailForUser"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 获取交易详情 /// /// /// public GetTransactionDetailForUserResponse GetTransactionDetailForUserSync(GetTransactionDetailForUserRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "GetTransactionDetailForUser"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 新增交易 /// /// /// public async Task Invoke(InvokeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "Invoke"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 新增交易 /// /// /// public InvokeResponse InvokeSync(InvokeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "Invoke"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询交易 /// /// /// public async Task Query(QueryRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "Query"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 查询交易 /// /// /// public QueryResponse QuerySync(QueryRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "Query"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos发送交易 /// /// /// public async Task SendTransactionHandler(SendTransactionHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "SendTransactionHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// Bcos发送交易 /// /// /// public SendTransactionHandlerResponse SendTransactionHandlerSync(SendTransactionHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "SendTransactionHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// trustsql服务统一接口 /// /// /// public async Task SrvInvoke(SrvInvokeRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "SrvInvoke"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// trustsql服务统一接口 /// /// /// public SrvInvokeResponse SrvInvokeSync(SrvInvokeRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "SrvInvoke"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 根据动态部署的合约发送交易 /// /// /// public async Task TransByDynamicContractHandler(TransByDynamicContractHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "TransByDynamicContractHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 根据动态部署的合约发送交易 /// /// /// public TransByDynamicContractHandlerResponse TransByDynamicContractHandlerSync(TransByDynamicContractHandlerRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "TransByDynamicContractHandler"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }