support unbind device

This commit is contained in:
sdk-team
2024-01-17 03:24:31 +00:00
parent 26ec339ba4
commit 220fbacfa2
16 changed files with 319 additions and 1 deletions

View File

@@ -159,6 +159,42 @@ AvatarClient::ClientStartOutcomeCallable AvatarClient::clientStartCallable(const
return task->get_future();
}
AvatarClient::ClientUnbindDeviceOutcome AvatarClient::clientUnbindDevice(const ClientUnbindDeviceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ClientUnbindDeviceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ClientUnbindDeviceOutcome(ClientUnbindDeviceResult(outcome.result()));
else
return ClientUnbindDeviceOutcome(outcome.error());
}
void AvatarClient::clientUnbindDeviceAsync(const ClientUnbindDeviceRequest& request, const ClientUnbindDeviceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, clientUnbindDevice(request), context);
};
asyncExecute(new Runnable(fn));
}
AvatarClient::ClientUnbindDeviceOutcomeCallable AvatarClient::clientUnbindDeviceCallable(const ClientUnbindDeviceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ClientUnbindDeviceOutcome()>>(
[this, request]()
{
return this->clientUnbindDevice(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
AvatarClient::CloseTimedResetOperateOutcome AvatarClient::closeTimedResetOperate(const CloseTimedResetOperateRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,45 @@
/*
* Copyright 2009-2017 Alibaba Cloud 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.
*/
#include <alibabacloud/avatar/model/ClientUnbindDeviceRequest.h>
using AlibabaCloud::Avatar::Model::ClientUnbindDeviceRequest;
ClientUnbindDeviceRequest::ClientUnbindDeviceRequest()
: RpcServiceRequest("avatar", "2022-01-30", "ClientUnbindDevice") {
setMethod(HttpRequest::Method::Post);
}
ClientUnbindDeviceRequest::~ClientUnbindDeviceRequest() {}
long ClientUnbindDeviceRequest::getTenantId() const {
return tenantId_;
}
void ClientUnbindDeviceRequest::setTenantId(long tenantId) {
tenantId_ = tenantId;
setParameter(std::string("TenantId"), std::to_string(tenantId));
}
std::string ClientUnbindDeviceRequest::getDeviceId() const {
return deviceId_;
}
void ClientUnbindDeviceRequest::setDeviceId(const std::string &deviceId) {
deviceId_ = deviceId;
setParameter(std::string("DeviceId"), deviceId);
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2009-2017 Alibaba Cloud 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.
*/
#include <alibabacloud/avatar/model/ClientUnbindDeviceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Avatar;
using namespace AlibabaCloud::Avatar::Model;
ClientUnbindDeviceResult::ClientUnbindDeviceResult() :
ServiceResult()
{}
ClientUnbindDeviceResult::ClientUnbindDeviceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ClientUnbindDeviceResult::~ClientUnbindDeviceResult()
{}
void ClientUnbindDeviceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string ClientUnbindDeviceResult::getMessage()const
{
return message_;
}
std::string ClientUnbindDeviceResult::getCode()const
{
return code_;
}
bool ClientUnbindDeviceResult::getSuccess()const
{
return success_;
}

View File

@@ -34,6 +34,15 @@ void SubmitAudioTo2DAvatarVideoTaskRequest::setApp(const SubmitAudioTo2DAvatarVi
setParameter(std::string("App") + ".AppId", app.appId);
}
SubmitAudioTo2DAvatarVideoTaskRequest::AudioInfo SubmitAudioTo2DAvatarVideoTaskRequest::getAudioInfo() const {
return audioInfo_;
}
void SubmitAudioTo2DAvatarVideoTaskRequest::setAudioInfo(const SubmitAudioTo2DAvatarVideoTaskRequest::AudioInfo &audioInfo) {
audioInfo_ = audioInfo;
setParameter(std::string("AudioInfo") + ".SampleRate", std::to_string(audioInfo.sampleRate));
}
SubmitAudioTo2DAvatarVideoTaskRequest::AvatarInfo SubmitAudioTo2DAvatarVideoTaskRequest::getAvatarInfo() const {
return avatarInfo_;
}

View File

@@ -34,6 +34,15 @@ void SubmitAudioTo3DAvatarVideoTaskRequest::setApp(const SubmitAudioTo3DAvatarVi
setParameter(std::string("App") + ".AppId", app.appId);
}
SubmitAudioTo3DAvatarVideoTaskRequest::AudioInfo SubmitAudioTo3DAvatarVideoTaskRequest::getAudioInfo() const {
return audioInfo_;
}
void SubmitAudioTo3DAvatarVideoTaskRequest::setAudioInfo(const SubmitAudioTo3DAvatarVideoTaskRequest::AudioInfo &audioInfo) {
audioInfo_ = audioInfo;
setParameter(std::string("AudioInfo") + ".SampleRate", std::to_string(audioInfo.sampleRate));
}
SubmitAudioTo3DAvatarVideoTaskRequest::AvatarInfo SubmitAudioTo3DAvatarVideoTaskRequest::getAvatarInfo() const {
return avatarInfo_;
}

View File

@@ -44,6 +44,7 @@ void SubmitTextTo2DAvatarVideoTaskRequest::setAudioInfo(const SubmitTextTo2DAvat
setParameter(std::string("AudioInfo") + ".Volume", std::to_string(audioInfo.volume));
setParameter(std::string("AudioInfo") + ".SpeechRate", std::to_string(audioInfo.speechRate));
setParameter(std::string("AudioInfo") + ".PitchRate", std::to_string(audioInfo.pitchRate));
setParameter(std::string("AudioInfo") + ".SampleRate", std::to_string(audioInfo.sampleRate));
}
SubmitTextTo2DAvatarVideoTaskRequest::AvatarInfo SubmitTextTo2DAvatarVideoTaskRequest::getAvatarInfo() const {
@@ -87,6 +88,11 @@ void SubmitTextTo2DAvatarVideoTaskRequest::setVideoInfo(const SubmitTextTo2DAvat
setParameter(std::string("VideoInfo") + ".BackgroundImageUrl", videoInfo.backgroundImageUrl);
setParameter(std::string("VideoInfo") + ".IsSubtitles", videoInfo.isSubtitles ? "true" : "false");
setParameter(std::string("VideoInfo") + ".SubtitleEmbedded", videoInfo.subtitleEmbedded ? "true" : "false");
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Color", videoInfo.subtitleStyle.color);
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Size", std::to_string(videoInfo.subtitleStyle.size));
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Name", videoInfo.subtitleStyle.name);
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Y", std::to_string(videoInfo.subtitleStyle.y));
setParameter(std::string("VideoInfo") + ".SubtitleStyle.OutlineColor", videoInfo.subtitleStyle.outlineColor);
setParameter(std::string("VideoInfo") + ".Resolution", std::to_string(videoInfo.resolution));
setParameter(std::string("VideoInfo") + ".AlphaFormat", std::to_string(videoInfo.alphaFormat));
}

View File

@@ -44,6 +44,7 @@ void SubmitTextTo3DAvatarVideoTaskRequest::setAudioInfo(const SubmitTextTo3DAvat
setParameter(std::string("AudioInfo") + ".Volume", std::to_string(audioInfo.volume));
setParameter(std::string("AudioInfo") + ".SpeechRate", std::to_string(audioInfo.speechRate));
setParameter(std::string("AudioInfo") + ".PitchRate", std::to_string(audioInfo.pitchRate));
setParameter(std::string("AudioInfo") + ".SampleRate", std::to_string(audioInfo.sampleRate));
}
SubmitTextTo3DAvatarVideoTaskRequest::AvatarInfo SubmitTextTo3DAvatarVideoTaskRequest::getAvatarInfo() const {
@@ -86,6 +87,11 @@ void SubmitTextTo3DAvatarVideoTaskRequest::setVideoInfo(const SubmitTextTo3DAvat
setParameter(std::string("VideoInfo") + ".BackgroundImageUrl", videoInfo.backgroundImageUrl);
setParameter(std::string("VideoInfo") + ".IsSubtitles", videoInfo.isSubtitles ? "true" : "false");
setParameter(std::string("VideoInfo") + ".SubtitleEmbedded", videoInfo.subtitleEmbedded ? "true" : "false");
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Color", videoInfo.subtitleStyle.color);
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Size", std::to_string(videoInfo.subtitleStyle.size));
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Name", videoInfo.subtitleStyle.name);
setParameter(std::string("VideoInfo") + ".SubtitleStyle.Y", std::to_string(videoInfo.subtitleStyle.y));
setParameter(std::string("VideoInfo") + ".SubtitleStyle.OutlineColor", videoInfo.subtitleStyle.outlineColor);
setParameter(std::string("VideoInfo") + ".Resolution", std::to_string(videoInfo.resolution));
setParameter(std::string("VideoInfo") + ".AlphaFormat", std::to_string(videoInfo.alphaFormat));
}