/* * 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.Drm.V20181115 { using Newtonsoft.Json; using System.Threading.Tasks; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Drm.V20181115.Models; public class DrmClient : AbstractClient{ private const string endpoint = "drm.tencentcloudapi.com"; private const string version = "2018-11-15"; /// /// Client constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". public DrmClient(Credential credential, string region) : this(credential, region, new ClientProfile()) { } /// /// Client Constructor. /// /// Credentials. /// Region name, such as "ap-guangzhou". /// Client profiles. public DrmClient(Credential credential, string region, ClientProfile profile) : base(endpoint, version, credential, region, profile) { } /// /// 本接口用来设置fairplay方案所需的私钥、私钥密钥、ask等信息。 /// 如需使用fairplay方案,请务必先设置私钥。 /// /// /// public async Task AddFairPlayPem(AddFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "AddFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来设置fairplay方案所需的私钥、私钥密钥、ask等信息。 /// 如需使用fairplay方案,请务必先设置私钥。 /// /// /// public AddFairPlayPemResponse AddFairPlayPemSync(AddFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "AddFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用来设置加密的密钥。注意,同一个content id,只能设置一次! /// /// /// public async Task CreateEncryptKeys(CreateEncryptKeysRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateEncryptKeys"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用来设置加密的密钥。注意,同一个content id,只能设置一次! /// /// /// public CreateEncryptKeysResponse CreateEncryptKeysSync(CreateEncryptKeysRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateEncryptKeys"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来生成DRM方案对应的播放许可证,开发者需提供DRM方案类型、内容类型参数,后台将生成许可证后返回许可证数据 /// 开发者需要转发终端设备发出的许可证请求信息。 /// /// /// public async Task CreateLicense(CreateLicenseRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "CreateLicense"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来生成DRM方案对应的播放许可证,开发者需提供DRM方案类型、内容类型参数,后台将生成许可证后返回许可证数据 /// 开发者需要转发终端设备发出的许可证请求信息。 /// /// /// public CreateLicenseResponse CreateLicenseSync(CreateLicenseRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "CreateLicense"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来删除fairplay方案的私钥、ask等信息 /// 注:高风险操作,删除后,您将无法使用腾讯云DRM提供的fairplay服务。 /// 由于缓存,删除操作需要约半小时生效 /// /// /// public async Task DeleteFairPlayPem(DeleteFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DeleteFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来删除fairplay方案的私钥、ask等信息 /// 注:高风险操作,删除后,您将无法使用腾讯云DRM提供的fairplay服务。 /// 由于缓存,删除操作需要约半小时生效 /// /// /// public DeleteFairPlayPemResponse DeleteFairPlayPemSync(DeleteFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来查询指定DRM类型、ContentType的所有加密密钥 /// /// /// public async Task DescribeAllKeys(DescribeAllKeysRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeAllKeys"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来查询指定DRM类型、ContentType的所有加密密钥 /// /// /// public DescribeAllKeysResponse DescribeAllKeysSync(DescribeAllKeysRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeAllKeys"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用来查询设置的FairPlay私钥校验信息。可用该接口校验设置的私钥与本身的私钥是否一致。 /// /// /// public async Task DescribeFairPlayPem(DescribeFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 该接口用来查询设置的FairPlay私钥校验信息。可用该接口校验设置的私钥与本身的私钥是否一致。 /// /// /// public DescribeFairPlayPemResponse DescribeFairPlayPemSync(DescribeFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 开发者需要指定使用的DRM类型、和需要加密的Track类型,后台返回加密使用的密钥 /// 如果加密使用的ContentID没有关联的密钥信息,后台会自动生成新的密钥返回 /// /// /// public async Task DescribeKeys(DescribeKeysRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "DescribeKeys"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 开发者需要指定使用的DRM类型、和需要加密的Track类型,后台返回加密使用的密钥 /// 如果加密使用的ContentID没有关联的密钥信息,后台会自动生成新的密钥返回 /// /// /// public DescribeKeysResponse DescribeKeysSync(DescribeKeysRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "DescribeKeys"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来设置fairplay方案所需的私钥、私钥密钥、ask等信息。 /// 如需使用fairplay方案,请务必先设置私钥。 /// /// /// public async Task ModifyFairPlayPem(ModifyFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "ModifyFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 本接口用来设置fairplay方案所需的私钥、私钥密钥、ask等信息。 /// 如需使用fairplay方案,请务必先设置私钥。 /// /// /// public ModifyFairPlayPemResponse ModifyFairPlayPemSync(ModifyFairPlayPemRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "ModifyFairPlayPem"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 开发者调用该接口,启动一次内容文件的DRM加密工作流 /// /// /// public async Task StartEncryption(StartEncryptionRequest req) { JsonResponseModel rsp = null; try { var strResp = await this.InternalRequest(req, "StartEncryption"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } /// /// 开发者调用该接口,启动一次内容文件的DRM加密工作流 /// /// /// public StartEncryptionResponse StartEncryptionSync(StartEncryptionRequest req) { JsonResponseModel rsp = null; try { var strResp = this.InternalRequestSync(req, "StartEncryption"); rsp = JsonConvert.DeserializeObject>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; } } }