Files
2026-02-07 15:48:27 +08:00

275 lines
12 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 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.Fmu.V20191213
{
using Newtonsoft.Json;
using System.Threading.Tasks;
using TencentCloud.Common;
using TencentCloud.Common.Profile;
using TencentCloud.Fmu.V20191213.Models;
public class FmuClient : AbstractClient{
private const string endpoint = "fmu.tencentcloudapi.com";
private const string version = "2019-12-13";
/// <summary>
/// Client constructor.
/// </summary>
/// <param name="credential">Credentials.</param>
/// <param name="region">Region name, such as "ap-guangzhou".</param>
public FmuClient(Credential credential, string region)
: this(credential, region, new ClientProfile())
{
}
/// <summary>
/// Client Constructor.
/// </summary>
/// <param name="credential">Credentials.</param>
/// <param name="region">Region name, such as "ap-guangzhou".</param>
/// <param name="profile">Client profiles.</param>
public FmuClient(Credential credential, string region, ClientProfile profile)
: base(endpoint, version, credential, region, profile)
{
}
/// <summary>
/// 用户上传一张人脸图片,精准定位五官,实现美肤、亮肤、祛痘等美颜功能。
/// </summary>
/// <param name="req"><see cref="BeautifyPicRequest"/></param>
/// <returns><see cref="BeautifyPicResponse"/></returns>
public async Task<BeautifyPicResponse> BeautifyPic(BeautifyPicRequest req)
{
JsonResponseModel<BeautifyPicResponse> rsp = null;
try
{
var strResp = await this.InternalRequest(req, "BeautifyPic");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<BeautifyPicResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 用户上传一张人脸图片,精准定位五官,实现美肤、亮肤、祛痘等美颜功能。
/// </summary>
/// <param name="req"><see cref="BeautifyPicRequest"/></param>
/// <returns><see cref="BeautifyPicResponse"/></returns>
public BeautifyPicResponse BeautifyPicSync(BeautifyPicRequest req)
{
JsonResponseModel<BeautifyPicResponse> rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "BeautifyPic");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<BeautifyPicResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 在使用LUT素材的modelid实现试唇色前您需要先上传 LUT 格式的cube文件注册唇色ID。查看 [LUT文件的使用说明](https://cloud.tencent.com/document/product/1172/41701)。
///
/// 注:您也可以直接使用 [试唇色接口](https://cloud.tencent.com/document/product/1172/40706)通过输入RGBA模型数值的方式指定唇色更简单易用。
/// </summary>
/// <param name="req"><see cref="CreateModelRequest"/></param>
/// <returns><see cref="CreateModelResponse"/></returns>
public async Task<CreateModelResponse> CreateModel(CreateModelRequest req)
{
JsonResponseModel<CreateModelResponse> rsp = null;
try
{
var strResp = await this.InternalRequest(req, "CreateModel");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<CreateModelResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 在使用LUT素材的modelid实现试唇色前您需要先上传 LUT 格式的cube文件注册唇色ID。查看 [LUT文件的使用说明](https://cloud.tencent.com/document/product/1172/41701)。
///
/// 注:您也可以直接使用 [试唇色接口](https://cloud.tencent.com/document/product/1172/40706)通过输入RGBA模型数值的方式指定唇色更简单易用。
/// </summary>
/// <param name="req"><see cref="CreateModelRequest"/></param>
/// <returns><see cref="CreateModelResponse"/></returns>
public CreateModelResponse CreateModelSync(CreateModelRequest req)
{
JsonResponseModel<CreateModelResponse> rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "CreateModel");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<CreateModelResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 删除已注册的唇色素材。
/// </summary>
/// <param name="req"><see cref="DeleteModelRequest"/></param>
/// <returns><see cref="DeleteModelResponse"/></returns>
public async Task<DeleteModelResponse> DeleteModel(DeleteModelRequest req)
{
JsonResponseModel<DeleteModelResponse> rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DeleteModel");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<DeleteModelResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 删除已注册的唇色素材。
/// </summary>
/// <param name="req"><see cref="DeleteModelRequest"/></param>
/// <returns><see cref="DeleteModelResponse"/></returns>
public DeleteModelResponse DeleteModelSync(DeleteModelRequest req)
{
JsonResponseModel<DeleteModelResponse> rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DeleteModel");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<DeleteModelResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 查询已注册的唇色素材。
/// </summary>
/// <param name="req"><see cref="GetModelListRequest"/></param>
/// <returns><see cref="GetModelListResponse"/></returns>
public async Task<GetModelListResponse> GetModelList(GetModelListRequest req)
{
JsonResponseModel<GetModelListResponse> rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GetModelList");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<GetModelListResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 查询已注册的唇色素材。
/// </summary>
/// <param name="req"><see cref="GetModelListRequest"/></param>
/// <returns><see cref="GetModelListResponse"/></returns>
public GetModelListResponse GetModelListSync(GetModelListRequest req)
{
JsonResponseModel<GetModelListResponse> rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GetModelList");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<GetModelListResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 对图片中的人脸嘴唇进行着色最多支持同时对一张图中的3张人脸进行试唇色。
///
/// 您可以通过事先注册在腾讯云的唇色素材LUT文件改变图片中的人脸唇色也可以输入RGBA模型数值。
///
/// 为了更好的效果建议您使用事先注册在腾讯云的唇色素材LUT文件
///
/// >
/// - 公共参数中的签名方式请使用V3版本即配置SignatureMethod参数为TC3-HMAC-SHA256。
/// </summary>
/// <param name="req"><see cref="TryLipstickPicRequest"/></param>
/// <returns><see cref="TryLipstickPicResponse"/></returns>
public async Task<TryLipstickPicResponse> TryLipstickPic(TryLipstickPicRequest req)
{
JsonResponseModel<TryLipstickPicResponse> rsp = null;
try
{
var strResp = await this.InternalRequest(req, "TryLipstickPic");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<TryLipstickPicResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
/// <summary>
/// 对图片中的人脸嘴唇进行着色最多支持同时对一张图中的3张人脸进行试唇色。
///
/// 您可以通过事先注册在腾讯云的唇色素材LUT文件改变图片中的人脸唇色也可以输入RGBA模型数值。
///
/// 为了更好的效果建议您使用事先注册在腾讯云的唇色素材LUT文件
///
/// >
/// - 公共参数中的签名方式请使用V3版本即配置SignatureMethod参数为TC3-HMAC-SHA256。
/// </summary>
/// <param name="req"><see cref="TryLipstickPicRequest"/></param>
/// <returns><see cref="TryLipstickPicResponse"/></returns>
public TryLipstickPicResponse TryLipstickPicSync(TryLipstickPicRequest req)
{
JsonResponseModel<TryLipstickPicResponse> rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "TryLipstickPic");
rsp = JsonConvert.DeserializeObject<JsonResponseModel<TryLipstickPicResponse>>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
}
}